Merge branch 'parser-devel' into 43-add-parser-rule-for-operators
This commit is contained in:
commit
4d7dcc4c73
|
@ -15,6 +15,8 @@
|
||||||
%%
|
%%
|
||||||
"\n" yyLineNumber++;
|
"\n" yyLineNumber++;
|
||||||
|
|
||||||
|
#.* ;
|
||||||
|
|
||||||
":" {DEBUG("\"%s\" tokenized with \':\'", yytext); return(':');};
|
":" {DEBUG("\"%s\" tokenized with \':\'", yytext); return(':');};
|
||||||
"=" {DEBUG("\"%s\" tokenized with \'=\'", yytext); return('=');};
|
"=" {DEBUG("\"%s\" tokenized with \'=\'", yytext); return('=');};
|
||||||
"+" {DEBUG("\"%s\" tokenized with \'+\'", yytext); return('+');};
|
"+" {DEBUG("\"%s\" tokenized with \'+\'", yytext); return('+');};
|
||||||
|
@ -24,7 +26,6 @@
|
||||||
"," {DEBUG("\"%s\" tokenized with \',\'", yytext); return(',');};
|
"," {DEBUG("\"%s\" tokenized with \',\'", yytext); return(',');};
|
||||||
";" {DEBUG("\"%s\" tokenized with \';\'", yytext); return(';');};
|
";" {DEBUG("\"%s\" tokenized with \';\'", yytext); return(';');};
|
||||||
"." {DEBUG("\"%s\" tokenized with \'.\'", yytext); return('.');};
|
"." {DEBUG("\"%s\" tokenized with \'.\'", yytext); return('.');};
|
||||||
"#" {DEBUG("\"%s\" tokenized with \'#\'", yytext); return('#');};
|
|
||||||
|
|
||||||
"(" {DEBUG("\"%s\" tokenized with \'(\'", yytext); return('(');};
|
"(" {DEBUG("\"%s\" tokenized with \'(\'", yytext); return('(');};
|
||||||
")" {DEBUG("\"%s\" tokenized with \')\'", yytext); return(')');};
|
")" {DEBUG("\"%s\" tokenized with \')\'", yytext); return(')');};
|
||||||
|
|
|
@ -63,8 +63,8 @@
|
||||||
%left OpBitand OpBitor OpBitxor OpBitnot
|
%left OpBitand OpBitor OpBitxor OpBitnot
|
||||||
|
|
||||||
%%
|
%%
|
||||||
program: assign
|
program: statement;
|
||||||
| definition;
|
|
||||||
|
|
||||||
expr: ValFloat
|
expr: ValFloat
|
||||||
| ValInt
|
| ValInt
|
||||||
|
@ -73,7 +73,9 @@ expr: ValFloat
|
||||||
| Ident
|
| Ident
|
||||||
| operation;
|
| operation;
|
||||||
|
|
||||||
assign: Ident '=' expr { DEBUG("Assignment"); };
|
statement: assign
|
||||||
|
| decl
|
||||||
|
| definition;
|
||||||
|
|
||||||
identlist: Ident ',' identlist
|
identlist: Ident ',' identlist
|
||||||
| Ident
|
| Ident
|
||||||
|
@ -83,6 +85,8 @@ decl: type ':' identlist { DEBUG("Declaration"); };
|
||||||
|
|
||||||
definition: decl '=' expr { DEBUG("Definition"); };
|
definition: decl '=' expr { DEBUG("Definition"); };
|
||||||
|
|
||||||
|
assign: Ident '=' expr { DEBUG("Assignment"); };
|
||||||
|
|
||||||
sign: KeySigned
|
sign: KeySigned
|
||||||
| KeyUnsigned
|
| KeyUnsigned
|
||||||
| ;
|
| ;
|
||||||
|
@ -121,7 +125,6 @@ opbit: expr OpBitand expr
|
||||||
| expr OpBitor expr
|
| expr OpBitor expr
|
||||||
| expr OpBitxor expr
|
| expr OpBitxor expr
|
||||||
| OpBitnot expr %prec OpBitand;
|
| OpBitnot expr %prec OpBitand;
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
int yyerror(char *s) {
|
int yyerror(char *s) {
|
||||||
|
|
Loading…
Reference in New Issue