aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.c19
-rw-r--r--LuaSL/src/LuaSL_lemon_yaccer.y13
2 files changed, 17 insertions, 15 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.c b/LuaSL/src/LuaSL_LSL_tree.c
index 8eed579..3cf880c 100644
--- a/LuaSL/src/LuaSL_LSL_tree.c
+++ b/LuaSL/src/LuaSL_LSL_tree.c
@@ -22,20 +22,21 @@ LSL_Token LSL_Tokens[] =
22 // Operators, in order of precedence, low to high 22 // Operators, in order of precedence, low to high
23 // Left to right, unless oterwise stated. 23 // Left to right, unless oterwise stated.
24 // According to http://wiki.secondlife.com/wiki/Category:LSL_Operators 24 // According to http://wiki.secondlife.com/wiki/Category:LSL_Operators
25 {LSL_BOOL_AND, "&&", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 25 {LSL_BOOL_AND, "&&", LSL_RIGHT2LEFT, NULL, NULL, evaluateOperationToken},
26// QUIRK - Seems to be some disagreement about BOOL_AND/BOOL_OR precedence. Either they are equal, or OR is higher. 26// QUIRK - Seems to be some disagreement about BOOL_AND/BOOL_OR precedence. Either they are equal, or OR is higher.
27// QUIRK - No boolean short circuiting. 27// QUIRK - No boolean short circuiting.
28 {LSL_BOOL_OR, "||", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 28// QUIRK - Booleans and conditionals are executed right to left. Or maybe not, depending on who you believe.
29 {LSL_BOOL_OR, "||", LSL_RIGHT2LEFT, NULL, NULL, evaluateOperationToken},
29 {LSL_BIT_OR, "|", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 30 {LSL_BIT_OR, "|", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
30 {LSL_BIT_XOR, "^", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 31 {LSL_BIT_XOR, "^", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
31 {LSL_BIT_AND, "&", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 32 {LSL_BIT_AND, "&", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
32// QUIRK - Conditionals are executed right to left. Or left to right, depending on who you ask. lol 33// QUIRK - Booleans and conditionals are executed right to left. Or maybe not, depending on who you believe.
33 {LSL_NOT_EQUAL, "!=", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 34 {LSL_NOT_EQUAL, "!=", LSL_RIGHT2LEFT, NULL, NULL, evaluateOperationToken},
34 {LSL_EQUAL, "==", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 35 {LSL_EQUAL, "==", LSL_RIGHT2LEFT, NULL, NULL, evaluateOperationToken},
35 {LSL_GREATER_EQUAL, ">=", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 36 {LSL_GREATER_EQUAL, ">=", LSL_RIGHT2LEFT, NULL, NULL, evaluateOperationToken},
36 {LSL_LESS_EQUAL, "<=", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 37 {LSL_LESS_EQUAL, "<=", LSL_RIGHT2LEFT, NULL, NULL, evaluateOperationToken},
37 {LSL_GREATER_THAN, ">", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 38 {LSL_GREATER_THAN, ">", LSL_RIGHT2LEFT, NULL, NULL, evaluateOperationToken},
38 {LSL_LESS_THAN, "<", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 39 {LSL_LESS_THAN, "<", LSL_RIGHT2LEFT, NULL, NULL, evaluateOperationToken},
39 {LSL_RIGHT_SHIFT, ">>", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 40 {LSL_RIGHT_SHIFT, ">>", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
40 {LSL_LEFT_SHIFT, "<<", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 41 {LSL_LEFT_SHIFT, "<<", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
41// {LSL_CONCATENATE, "+", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 42// {LSL_CONCATENATE, "+", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y
index 731a52d..bd0aa52 100644
--- a/LuaSL/src/LuaSL_lemon_yaccer.y
+++ b/LuaSL/src/LuaSL_lemon_yaccer.y
@@ -13,10 +13,9 @@
13 13
14program ::= script LSL_SCRIPT(A). { A->left = param->ast; param->ast = A; } // Lemon does not like the start symbol to be on the RHS, so give it a dummy one. 14program ::= script LSL_SCRIPT(A). { A->left = param->ast; param->ast = A; } // Lemon does not like the start symbol to be on the RHS, so give it a dummy one.
15 15
16 16%right LSL_BOOL_AND.
17%left LSL_BOOL_AND.
18expr(A) ::= expr(B) LSL_BOOL_AND(C) expr(D). { A = addOperation(B, C, D); } 17expr(A) ::= expr(B) LSL_BOOL_AND(C) expr(D). { A = addOperation(B, C, D); }
19%left LSL_BOOL_OR. 18%right LSL_BOOL_OR.
20expr(A) ::= expr(B) LSL_BOOL_OR(C) expr(D). { A = addOperation(B, C, D); } 19expr(A) ::= expr(B) LSL_BOOL_OR(C) expr(D). { A = addOperation(B, C, D); }
21 20
22%left LSL_BIT_AND LSL_BIT_XOR LSL_BIT_OR. 21%left LSL_BIT_AND LSL_BIT_XOR LSL_BIT_OR.
@@ -24,10 +23,10 @@ expr(A) ::= expr(B) LSL_BIT_OR(C) expr(D). { A = addOperation(B, C, D); }
24expr(A) ::= expr(B) LSL_BIT_XOR(C) expr(D). { A = addOperation(B, C, D); } 23expr(A) ::= expr(B) LSL_BIT_XOR(C) expr(D). { A = addOperation(B, C, D); }
25expr(A) ::= expr(B) LSL_BIT_AND(C) expr(D). { A = addOperation(B, C, D); } 24expr(A) ::= expr(B) LSL_BIT_AND(C) expr(D). { A = addOperation(B, C, D); }
26 25
27%left LSL_EQUAL LSL_NOT_EQUAL. 26%right LSL_EQUAL LSL_NOT_EQUAL.
28expr(A) ::= expr(B) LSL_NOT_EQUAL(C) expr(D). { A = addOperation(B, C, D); } 27expr(A) ::= expr(B) LSL_NOT_EQUAL(C) expr(D). { A = addOperation(B, C, D); }
29expr(A) ::= expr(B) LSL_EQUAL(C) expr(D). { A = addOperation(B, C, D); } 28expr(A) ::= expr(B) LSL_EQUAL(C) expr(D). { A = addOperation(B, C, D); }
30%left LSL_LESS_THAN LSL_GREATER_THAN LSL_LESS_EQUAL LSL_GREATER_EQUAL. 29%right LSL_LESS_THAN LSL_GREATER_THAN LSL_LESS_EQUAL LSL_GREATER_EQUAL.
31expr(A) ::= expr(B) LSL_GREATER_EQUAL(C) expr(D). { A = addOperation(B, C, D); } 30expr(A) ::= expr(B) LSL_GREATER_EQUAL(C) expr(D). { A = addOperation(B, C, D); }
32expr(A) ::= expr(B) LSL_LESS_EQUAL(C) expr(D). { A = addOperation(B, C, D); } 31expr(A) ::= expr(B) LSL_LESS_EQUAL(C) expr(D). { A = addOperation(B, C, D); }
33expr(A) ::= expr(B) LSL_GREATER_THAN(C) expr(D). { A = addOperation(B, C, D); } 32expr(A) ::= expr(B) LSL_GREATER_THAN(C) expr(D). { A = addOperation(B, C, D); }
@@ -75,10 +74,12 @@ expr(A) ::= LSL_INTEGER(B). { A = B; }
75%nonassoc LSL_STATEMENT. 74%nonassoc LSL_STATEMENT.
76statement(A) ::= expr(B) LSL_STATEMENT(D). { A = addStatement(D, LSL_EXPRESSION, B); } 75statement(A) ::= expr(B) LSL_STATEMENT(D). { A = addStatement(D, LSL_EXPRESSION, B); }
77 76
78%nonassoc LSL_SPACE LSL_COMMENT LSL_COMMENT_LINE LSL_IDENTIFIER LSL_SCRIPT LSL_UNKNOWN. 77%nonassoc LSL_IDENTIFIER LSL_SCRIPT.
79script ::= script statement(A). { A->left = param->ast; param->ast = A; } 78script ::= script statement(A). { A->left = param->ast; param->ast = A; }
80script ::= statement(A). { A->left = param->ast; param->ast = A; } 79script ::= statement(A). { A->left = param->ast; param->ast = A; }
81 80
81%nonassoc LSL_SPACE LSL_COMMENT LSL_COMMENT_LINE LSL_UNKNOWN.
82
82 83
83%parse_accept {printf("Parsing complete.\n");} 84%parse_accept {printf("Parsing complete.\n");}
84 85