aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_yaccer.y
diff options
context:
space:
mode:
Diffstat (limited to 'LuaSL/src/LuaSL_yaccer.y')
-rw-r--r--LuaSL/src/LuaSL_yaccer.y50
1 files changed, 37 insertions, 13 deletions
diff --git a/LuaSL/src/LuaSL_yaccer.y b/LuaSL/src/LuaSL_yaccer.y
index 5d01f46..fd5a461 100644
--- a/LuaSL/src/LuaSL_yaccer.y
+++ b/LuaSL/src/LuaSL_yaccer.y
@@ -9,28 +9,52 @@
9 9
10%define api.pure 10%define api.pure
11 11
12%left '+' LSL_ADD 12%token <integerValue> LSL_INTEGER
13%left '*' LSL_MULTIPLY
14 13
15%token LSL_ADD 14%left LSL_BOOL_AND
16%token LSL_MULTIPLY 15%left LSL_BOOL_OR
17%token LSL_PARENTHESIS_OPEN LSL_PARENTHESIS_CLOSE 16%left LSL_BIT_AND LSL_BIT_XOR LSL_BIT_OR
17%left LSL_EQUAL LSL_NOT_EQUAL
18%left LSL_LESS_THAN LSL_GREATER_THAN LSL_LESS_EQUAL LSL_GREATER_EQUAL
19%left LSL_LEFT_SHIFT LSL_RIGHT_SHIFT
20%left LSL_SUBTRACT LSL_ADD
21%left LSL_DIVIDE LSL_MODULO LSL_MULTIPLY
22%right LSL_BIT_NOT LSL_BOOL_NOT LSL_NEGATION
18 23
19%token <integerValue> LSL_INTEGER 24%token LSL_PARENTHESIS_OPEN LSL_PARENTHESIS_CLOSE
20 25
21%type <expressionValue> expr 26%type <expressionValue> expr
22 27
23%% 28%%
24 29
25input: 30input :
26 expr { ((LuaSL_yyparseParam*)data)->expression = $1; } 31 expr { ((LuaSL_yyparseParam*)data)->expression = $1; }
27 ; 32;
28 33
29expr: 34expr :
30 LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE { $$ = $2; } 35 LSL_INTEGER { $$ = addInteger($1); }
31 | expr LSL_MULTIPLY expr { $$ = addOperation( LSL_MULTIPLY, $1, $3 ); } 36 | expr LSL_BOOL_AND expr { $$ = addOperation( LSL_BOOL_AND, $1, $3 ); }
37 | expr LSL_BOOL_OR expr { $$ = addOperation( LSL_BOOL_OR, $1, $3 ); }
38 | expr LSL_BIT_OR expr { $$ = addOperation( LSL_BIT_OR, $1, $3 ); }
39 | expr LSL_BIT_XOR expr { $$ = addOperation( LSL_BIT_XOR, $1, $3 ); }
40 | expr LSL_BIT_AND expr { $$ = addOperation( LSL_BIT_AND, $1, $3 ); }
41 | expr LSL_NOT_EQUAL expr { $$ = addOperation( LSL_NOT_EQUAL, $1, $3 ); }
42 | expr LSL_EQUAL expr { $$ = addOperation( LSL_EQUAL, $1, $3 ); }
43 | expr LSL_GREATER_EQUAL expr { $$ = addOperation( LSL_GREATER_EQUAL, $1, $3 ); }
44 | expr LSL_LESS_EQUAL expr { $$ = addOperation( LSL_LESS_EQUAL, $1, $3 ); }
45 | expr LSL_GREATER_THAN expr { $$ = addOperation( LSL_GREATER_THAN, $1, $3 ); }
46 | expr LSL_LESS_THAN expr { $$ = addOperation( LSL_LESS_THAN, $1, $3 ); }
47 | expr LSL_RIGHT_SHIFT expr { $$ = addOperation( LSL_RIGHT_SHIFT, $1, $3 ); }
48 | expr LSL_LEFT_SHIFT expr { $$ = addOperation( LSL_LEFT_SHIFT, $1, $3 ); }
32 | expr LSL_ADD expr { $$ = addOperation( LSL_ADD, $1, $3 ); } 49 | expr LSL_ADD expr { $$ = addOperation( LSL_ADD, $1, $3 ); }
33 | LSL_INTEGER { $$ = addInteger($1); } 50 | expr LSL_SUBTRACT expr { $$ = addOperation( LSL_SUBTRACT, $1, $3 ); }
51 | expr LSL_MULTIPLY expr { $$ = addOperation( LSL_MULTIPLY, $1, $3 ); }
52 | expr LSL_MODULO expr { $$ = addOperation( LSL_MODULO, $1, $3 ); }
53 | expr LSL_DIVIDE expr { $$ = addOperation( LSL_DIVIDE, $1, $3 ); }
54 | LSL_BIT_NOT expr { $$ = addOperation( LSL_BIT_NOT, NULL, $2 ); }
55 | LSL_BOOL_NOT expr { $$ = addOperation( LSL_BOOL_NOT, NULL, $2 ); }
56 | LSL_SUBTRACT expr { $$ = addOperation( LSL_NEGATION, NULL, $2 ); } %prec LSL_NEGATION
57 | LSL_PARENTHESIS_OPEN expr LSL_PARENTHESIS_CLOSE { $$ = $2; }
34; 58;
35 59
36%% 60%%