aboutsummaryrefslogtreecommitdiff
path: root/parser.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2013-01-25 21:59:53 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2013-01-25 21:59:53 +0200
commitf5835d85e2ae098aacb3f585bc63bea5c9e7884f (patch)
treeaf8f33dc7219702373e1bfe2447528b46ad1a75e /parser.py
parentb2df86d5ccf49ccc1b4489a4a0ab47175d007df9 (diff)
downloadmeson-f5835d85e2ae098aacb3f585bc63bea5c9e7884f.zip
meson-f5835d85e2ae098aacb3f585bc63bea5c9e7884f.tar.gz
meson-f5835d85e2ae098aacb3f585bc63bea5c9e7884f.tar.bz2
Added comparison.
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))