Create expression2 precendence level (relation operators)

This commit is contained in:
Bartłomiej Pluta
2019-07-10 22:39:22 +02:00
parent 4018bcddc7
commit 3058293b7e
5 changed files with 17 additions and 4 deletions

View File

@@ -8,10 +8,12 @@ from smnp.token.type import TokenType
class Expression(Valuable):
pass
ExpressionParser = Parser.leftAssociativeOperatorParser(TermParser, [TokenType.PLUS, TokenType.MINUS], TermParser,
lambda left, op, right: Expression.withValue(BinaryOperator.withValues(left, op, right)))
Expression2Parser = Parser.leftAssociativeOperatorParser(ExpressionParser, [TokenType.RELATION], ExpressionParser,
lambda left, op, right: Expression.withValue(BinaryOperator.withValues(left, op, right)))
#
# class ExpressionNode(Node):
# def __init__(self, pos):