Merge pull request #51 from Servostar/36-add-parser-rule-for-if
36 add parser rule for if
This commit is contained in:
commit
07b3198c06
|
@ -63,7 +63,7 @@
|
|||
%left OpBitand OpBitor OpBitxor OpBitnot
|
||||
|
||||
%%
|
||||
program: statement;
|
||||
program: statementlist;
|
||||
|
||||
|
||||
expr: ValFloat
|
||||
|
@ -73,9 +73,23 @@ expr: ValFloat
|
|||
| Ident
|
||||
| operation;
|
||||
|
||||
statementlist: statementlist statement
|
||||
| ;
|
||||
|
||||
statement: assign
|
||||
| decl
|
||||
| definition;
|
||||
| definition
|
||||
| branch;
|
||||
|
||||
branchif: KeyIf expr '{' statementlist '}' { DEBUG("if"); };
|
||||
branchelse: KeyElse '{' statementlist '}' { DEBUG("if-else"); };
|
||||
branchelseif: KeyElse KeyIf expr '{' statementlist '}' { DEBUG("else-if"); };
|
||||
|
||||
branchelseifs: branchelseifs branchelseif
|
||||
| ;
|
||||
|
||||
branch: branchif branchelseifs
|
||||
| branchif branchelseifs branchelse;
|
||||
|
||||
identlist: Ident ',' identlist
|
||||
| Ident
|
||||
|
|
Loading…
Reference in New Issue