Skip to content

Commit

Permalink
Handle (a=b) || (a=c) as foo_stmt
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlei committed Oct 13, 2014
1 parent e44b5c1 commit ef3446d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions smop/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def p_stmt(p):
| switch_stmt
| try_catch
| while_stmt
| foo_stmt
| unwind
"""
# END_STMT is intentionally left out
Expand Down Expand Up @@ -172,6 +173,16 @@ def p_global_stmt(p):
for ident in p[0]:
ident.props="G" # G=global

def p_foo_stmt(p):
"foo_stmt : expr OROR expr SEMI"
expr1 = p[1][1][0]
expr2 = p[3][1][0]
ident = expr1.ret
args1 = expr1.args
args2 = expr2.args
p[0] = node.let(ret=ident,
args=node.expr("or",node.expr_list([args1,args2])))

def p_persistent_stmt(p):
#"""persistent_stmt : PERSISTENT global_list SEMI
"""persistent_stmt : PERSISTENT expr SEMI
Expand Down

0 comments on commit ef3446d

Please sign in to comment.