Short-circuiting Boolean "and" and "or" operators.

This commit is contained in:
Stephen Dolan committed 2012-09-04 20:38:59 +01:00
1 parent c5ab3b2336
commit 6e6ea50763
5 files changed
+62 -5

No files matched your search

+12
View File
@@ -34,9 +34,13 @@
%token ELSE "else"
%token ELSE_IF "elif"
%token END "end"
%token AND "and"
%token OR "or"
%right "//"
%nonassoc '=' SETPIPE
%nonassoc EQ
%left OR
%left AND
%left '+'
@@ -99,6 +103,14 @@ Exp '=' Exp {
$$ = gen_assign(assign);
} |
Exp "or" Exp {
$$ = gen_or($1, $3);
} |
Exp "and" Exp {
$$ = gen_and($1, $3);
} |
Exp "//" Exp {
$$ = gen_definedor($1, $3);
} |