Added support for various binary operations (>=, <=, /= etc). Also bitwise operators | and & are now allowed

This commit is contained in:
jpekkila
2019-10-18 01:52:14 +03:00
parent 26bbfa089d
commit 7c79a98cdc
2 changed files with 6 additions and 7 deletions

View File

@@ -19,7 +19,7 @@ int yyget_lineno();
%token SCALAR VECTOR MATRIX SCALARFIELD SCALARARRAY
%token VOID INT INT3 COMPLEX
%token IF ELSE FOR WHILE ELIF
%token LEQU LAND LOR LLEQU
%token LEQU LAND LOR LLEQU BINARY_OP
%token KERNEL DEVICE PREPROCESSED
%token INPLACE_INC INPLACE_DEC INPLACE_ADD INPLACE_SUB
@@ -190,6 +190,7 @@ binary_operator: '+'
| LLEQU { $$ = astnode_create(NODE_UNKNOWN, NULL, NULL); astnode_set_buffer(yytext, $$); }
| INPLACE_ADD { $$ = astnode_create(NODE_UNKNOWN, NULL, NULL); astnode_set_buffer(yytext, $$); }
| INPLACE_SUB { $$ = astnode_create(NODE_UNKNOWN, NULL, NULL); astnode_set_buffer(yytext, $$); }
| BINARY_OP { $$ = astnode_create(NODE_UNKNOWN, NULL, NULL); astnode_set_buffer(yytext, $$); }
;
unary_operator: '-' /* C-style casts are disallowed, would otherwise be defined here */ { $$ = astnode_create(NODE_UNKNOWN, NULL, NULL); $$->infix = yytext[0]; }