mirror of
https://github.com/PaddiM8/kalker.git
synced 2025-03-01 06:41:15 +01:00
Renamed symbol_table::contains_func to contains_fn.
This commit is contained in:
parent
0786398d52
commit
b3e07b710e
@ -255,7 +255,7 @@ fn parse_identifier(context: &mut Context) -> Result<Expr, CalcError> {
|
|||||||
// Eg. sqrt64
|
// Eg. sqrt64
|
||||||
if match_token(context, TokenKind::Literal) {
|
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 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());
|
let parameter = Expr::Literal(advance(context).value.clone());
|
||||||
return Ok(Expr::FnCall(identifier.value, vec![parameter]));
|
return Ok(Expr::FnCall(identifier.value, vec![parameter]));
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ impl SymbolTable {
|
|||||||
prelude::CONSTANTS.contains_key(identifier) || self.hashmap.contains_key(identifier)
|
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)
|
||||||
|| prelude::UNARY_FUNCS.contains_key(identifier)
|
|| prelude::UNARY_FUNCS.contains_key(identifier)
|
||||||
|| self.hashmap.contains_key(&format!("{}()", identifier))
|
|| self.hashmap.contains_key(&format!("{}()", identifier))
|
||||||
|
Loading…
Reference in New Issue
Block a user