aboutsummaryrefslogtreecommitdiff
path: root/parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'parser.py')
-rwxr-xr-xparser.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/parser.py b/parser.py
index 96cf1f7..ad2e87f 100755
--- a/parser.py
+++ b/parser.py
@@ -34,6 +34,8 @@ tokens = ['LPAREN',
'ATOM',
'COMMENT',
'ASSIGN',
+ 'EQUALS',
+ 'NEQUALS',
'COMMA',
'DOT',
'STRING',
@@ -42,6 +44,8 @@ tokens = ['LPAREN',
] + list(reserved.values())
t_ASSIGN = '='
+t_EQUALS = '=='
+t_NEQUALS = '\!='
t_LPAREN = '\('
t_RPAREN = '\)'
t_LBRACKET = '\['
@@ -115,6 +119,11 @@ def p_statement_assign(t):
'statement : expression ASSIGN statement'
t[0] = nodes.Assignment(t[1], t[3], t.lineno(1))
+def p_statement_equals(t):
+ '''statement : statement EQUALS statement
+ | statement NEQUALS statement'''
+ t[0] = nodes.Comparison(t[1], t[2], t[3], t.lineno(1))
+
def p_statement_func_call(t):
'statement : expression LPAREN args RPAREN'
t[0] = nodes.FunctionCall(t[1], t[3], t.lineno(1))