added rule for branches
This commit is contained in:
parent
b8c9bfb4e7
commit
98c60aef16
|
@ -56,7 +56,7 @@
|
||||||
%token FunExtsupport
|
%token FunExtsupport
|
||||||
|
|
||||||
%%
|
%%
|
||||||
program: statement;
|
program: statementlist;
|
||||||
|
|
||||||
|
|
||||||
expr: ValFloat
|
expr: ValFloat
|
||||||
|
@ -65,9 +65,23 @@ expr: ValFloat
|
||||||
| ValStr
|
| ValStr
|
||||||
| Ident;
|
| Ident;
|
||||||
|
|
||||||
|
statementlist: statementlist statement
|
||||||
|
| ;
|
||||||
|
|
||||||
statement: assign
|
statement: assign
|
||||||
| decl
|
| 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
|
identlist: Ident ',' identlist
|
||||||
| Ident
|
| Ident
|
||||||
|
|
Loading…
Reference in New Issue