diff options
Diffstat (limited to 'LuaSL/src/LuaSL_yaccer.y')
-rw-r--r-- | LuaSL/src/LuaSL_yaccer.y | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/LuaSL/src/LuaSL_yaccer.y b/LuaSL/src/LuaSL_yaccer.y index a3bf1a3..75cfd78 100644 --- a/LuaSL/src/LuaSL_yaccer.y +++ b/LuaSL/src/LuaSL_yaccer.y | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | %token <integerValue> LSL_INTEGER | 12 | %token <integerValue> LSL_INTEGER |
13 | 13 | ||
14 | %nonassoc LSL_STATEMENT | ||
14 | %left LSL_BOOL_AND | 15 | %left LSL_BOOL_AND |
15 | %left LSL_BOOL_OR | 16 | %left LSL_BOOL_OR |
16 | %left LSL_BIT_AND LSL_BIT_XOR LSL_BIT_OR | 17 | %left LSL_BIT_AND LSL_BIT_XOR LSL_BIT_OR |
@@ -25,10 +26,17 @@ | |||
25 | 26 | ||
26 | %type <expressionValue> expr | 27 | %type <expressionValue> expr |
27 | 28 | ||
29 | %type <statementValue> statement | ||
30 | |||
28 | %% | 31 | %% |
29 | 32 | ||
30 | input : | 33 | input : |
31 | expr { ((LuaSL_yyparseParam*)data)->ast = addOperation(LSL_EXPRESSION, $1, $1); } | 34 | expr { ((LuaSL_yyparseParam*)data)->ast = addOperation(LSL_EXPRESSION, $1, $1); } |
35 | | statement { ((LuaSL_yyparseParam*)data)->ast = addStatement($1, ((LuaSL_yyparseParam*)data)->ast); } | ||
36 | ; | ||
37 | |||
38 | statement : | ||
39 | expr LSL_STATEMENT { $$ = createStatement(LSL_EXPRESSION, $1); } | ||
32 | ; | 40 | ; |
33 | 41 | ||
34 | expr : | 42 | expr : |
@@ -54,7 +62,7 @@ expr : | |||
54 | | LSL_BIT_NOT expr { $$ = addOperation( LSL_BIT_NOT, NULL, $2 ); } | 62 | | LSL_BIT_NOT expr { $$ = addOperation( LSL_BIT_NOT, NULL, $2 ); } |
55 | | LSL_BOOL_NOT expr { $$ = addOperation( LSL_BOOL_NOT, NULL, $2 ); } | 63 | | LSL_BOOL_NOT expr { $$ = addOperation( LSL_BOOL_NOT, NULL, $2 ); } |
56 | | LSL_SUBTRACT expr { $$ = addOperation( LSL_NEGATION, NULL, $2 ); } %prec LSL_NEGATION | 64 | | LSL_SUBTRACT expr { $$ = addOperation( LSL_NEGATION, NULL, $2 ); } %prec LSL_NEGATION |
57 | | LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE { $$ = $2; } | 65 | | LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE { $$ = addParenthesis($2); } |
58 | ; | 66 | ; |
59 | 67 | ||
60 | %% | 68 | %% |