Skip to content

Commit

Permalink
Added error case to detect and notify missing IF clause -- fixes BYTE…
Browse files Browse the repository at this point in the history
…MAN-247
  • Loading branch information
adinn committed Jul 8, 2013
1 parent 49b5b8c commit a29ec9d
Show file tree
Hide file tree
Showing 4 changed files with 1,004 additions and 959 deletions.
5 changes: 5 additions & 0 deletions agent/grammar/cup/ECAGrammar.cup
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -392,12 +392,17 @@ ca_error
ca_error_in_condition ca_error_in_condition
::= IF:i error {: error("invalid condition", ileft, iright); :} ::= IF:i error {: error("invalid condition", ileft, iright); :}
DO actions:a {: RESULT = node(ParseNode.BIND, ileft, iright, null, null, a); :} DO actions:a {: RESULT = node(ParseNode.BIND, ileft, iright, null, null, a); :}
| DO actions:a {: error("missing IF clause", aleft, aright);
RESULT = node(ParseNode.BIND, aleft, aright, null, null, a); :}
; ;


ca_error_in_action ca_error_in_action
::= IF condition:c ::= IF condition:c
DO:d error {: error("invalid action", dleft, dright); DO:d error {: error("invalid action", dleft, dright);
RESULT = node(ParseNode.BIND, cleft, cright, null, c, null); :} RESULT = node(ParseNode.BIND, cleft, cright, null, c, null); :}
| DO:d error {: error("invalid action", dleft, dright);
error("missing IF clause", dleft, dright);
RESULT = node(ParseNode.BIND, dleft, dright, null, null, null); :}
; ;


// event specifications -- for now events are just a list of bindings // event specifications -- for now events are just a list of bindings
Expand Down
Loading

0 comments on commit a29ec9d

Please sign in to comment.