Working on #48 : Updating ExpressionParser.py

This commit is contained in:
2021-03-11 11:50:23 +01:00
parent aa42bcb2ec
commit 8f51893f53
4 changed files with 23 additions and 7 deletions
+4 -2
View File
@@ -185,7 +185,8 @@ class LogicalOperatorParser(BaseExprParser):
def parse_not(self, context, parser_input, error_sink):
token = parser_input.token
start = parser_input.pos
if token.type == TokenKind.IDENTIFIER and token.value == "not":
if (token.type == TokenKind.IDENTIFIER and token.value == "not" and
parser_input.the_token_after(True).value != "in"):
parser_input.next_token()
parsed = self.parse_not(context, parser_input, error_sink)
node = parsed.node if isinstance(parsed, ParenthesisNode) else parsed
@@ -201,7 +202,8 @@ class LogicalOperatorParser(BaseExprParser):
def stop():
return token.type == TokenKind.EOF or \
paren_count == 0 and token.type == TokenKind.RPAR or \
token.type == TokenKind.IDENTIFIER and token.value in ("and", "or", "not")
token.type == TokenKind.IDENTIFIER and token.value in ("and", "or") or \
token.value == "not" and parser_input.the_token_after(True).value != "in"
token = parser_input.token
if token.type == TokenKind.EOF: