Working on #48 : Refactored FunctionParser.py

This commit is contained in:
2021-03-11 18:00:50 +01:00
parent f32e14669a
commit 19908b97a6
4 changed files with 22 additions and 46 deletions
+2 -6
View File
@@ -148,16 +148,12 @@ class LogicalOperatorParser(BaseExpressionParser):
parser_input.tokens[start: parsed.end + 1],
node)
else:
return self.parse_names(context, parser_input, error_sink)
return self.parse_tokens(context, parser_input, error_sink)
@staticmethod
def stop_condition(token, parser_input):
def parse_tokens_stop_condition(self, token, parser_input):
return token.type == TokenKind.IDENTIFIER and token.value in ("and", "or") or \
token.value == "not" and parser_input.the_token_after(True).value != "in"
def parse_names(self, context, parser_input, error_sink):
return self.inner_parse_names(context, parser_input, error_sink, self.stop_condition)
def compile_conjunctions(self, context, conjunctions, who):
"""
Transform a list of conjunctions (AND and OR) into one or multiple CompiledExpr