Renamed symbol_table::contains_func to contains_fn.

This commit is contained in:
PaddiM8 2020-06-11 21:47:14 +02:00
parent 0786398d52
commit b3e07b710e
2 changed files with 2 additions and 2 deletions

View File

@ -255,7 +255,7 @@ fn parse_identifier(context: &mut Context) -> Result<Expr, CalcError> {
// Eg. sqrt64
if match_token(context, TokenKind::Literal) {
// If there is a function with this name, parse it as a function, with the next token as the argument.
if context.symbol_table.contains_func(&identifier.value) {
if context.symbol_table.contains_fn(&identifier.value) {
let parameter = Expr::Literal(advance(context).value.clone());
return Ok(Expr::FnCall(identifier.value, vec![parameter]));
}

View File

@ -32,7 +32,7 @@ impl SymbolTable {
prelude::CONSTANTS.contains_key(identifier) || self.hashmap.contains_key(identifier)
}
pub fn contains_func(&self, identifier: &str) -> bool {
pub fn contains_fn(&self, identifier: &str) -> bool {
prelude::UNARY_FUNCS.contains_key(identifier)
|| prelude::UNARY_FUNCS.contains_key(identifier)
|| self.hashmap.contains_key(&format!("{}()", identifier))