aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.c81
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h1
-rw-r--r--LuaSL/src/LuaSL_lemon_yaccer.y32
3 files changed, 76 insertions, 38 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.c b/LuaSL/src/LuaSL_LSL_tree.c
index c5a9405..dc0a4c7 100644
--- a/LuaSL/src/LuaSL_LSL_tree.c
+++ b/LuaSL/src/LuaSL_LSL_tree.c
@@ -41,26 +41,26 @@ LSL_Token LSL_Tokens[] =
41 {LSL_LESS_THAN, ST_COMPARISON, "<", LSL_RIGHT2LEFT, NULL, NULL, evaluateOperationToken}, 41 {LSL_LESS_THAN, ST_COMPARISON, "<", LSL_RIGHT2LEFT, NULL, NULL, evaluateOperationToken},
42 {LSL_RIGHT_SHIFT, ST_BITWISE, ">>", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 42 {LSL_RIGHT_SHIFT, ST_BITWISE, ">>", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
43 {LSL_LEFT_SHIFT, ST_BITWISE, "<<", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 43 {LSL_LEFT_SHIFT, ST_BITWISE, "<<", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
44// {LSL_CONCATENATE, ST_ADD, "+", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 44 {LSL_CONCATENATE, ST_ADD, "+", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
45 {LSL_ADD, ST_ADD, "+", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 45 {LSL_ADD, ST_ADD, "+", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
46 {LSL_SUBTRACT, ST_SUBTRACT, "-", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 46 {LSL_SUBTRACT, ST_SUBTRACT, "-", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
47// {LSL_CROSS_PRODUCT, ST_NONE, "%", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 47 {LSL_CROSS_PRODUCT, ST_NONE, "%", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
48// {LSL_DOT_PRODUCT, ST_NONE, "*", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 48 {LSL_DOT_PRODUCT, ST_NONE, "*", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
49 {LSL_MULTIPLY, ST_MULTIPLY, "*", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 49 {LSL_MULTIPLY, ST_MULTIPLY, "*", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
50 {LSL_MODULO, ST_MODULO, "%", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 50 {LSL_MODULO, ST_MODULO, "%", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
51 {LSL_DIVIDE, ST_MULTIPLY, "/", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 51 {LSL_DIVIDE, ST_MULTIPLY, "/", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
52 {LSL_NEGATION, ST_NEGATE, "-", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken}, 52 {LSL_NEGATION, ST_NEGATE, "-", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken},
53 {LSL_BOOL_NOT, ST_BOOL_NOT, "!", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken}, 53 {LSL_BOOL_NOT, ST_BOOL_NOT, "!", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken},
54 {LSL_BIT_NOT, ST_BIT_NOT, "~", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken}, 54 {LSL_BIT_NOT, ST_BIT_NOT, "~", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken},
55// {LSL_TYPECAST_CLOSE, ST_NONE, ")", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken}, 55 {LSL_TYPECAST_CLOSE, ST_NONE, ")", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateNoToken},
56// {LSL_TYPECAST_OPEN, ST_NONE, "(", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken}, 56 {LSL_TYPECAST_OPEN, ST_NONE, "(", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken},
57 {LSL_ANGLE_CLOSE, ST_NONE, ">", LSL_LEFT2RIGHT | LSL_CREATION, NULL, NULL, evaluateOperationToken}, 57 {LSL_ANGLE_CLOSE, ST_NONE, ">", LSL_LEFT2RIGHT | LSL_CREATION, NULL, NULL, evaluateNoToken},
58 {LSL_ANGLE_OPEN, ST_NONE, "<", LSL_LEFT2RIGHT | LSL_CREATION, NULL, NULL, evaluateOperationToken}, 58 {LSL_ANGLE_OPEN, ST_NONE, "<", LSL_LEFT2RIGHT | LSL_CREATION, NULL, NULL, evaluateOperationToken},
59 {LSL_BRACKET_CLOSE, ST_NONE, "]", LSL_INNER2OUTER | LSL_CREATION, NULL, NULL, evaluateOperationToken}, 59 {LSL_BRACKET_CLOSE, ST_NONE, "]", LSL_INNER2OUTER | LSL_CREATION, NULL, NULL, evaluateNoToken},
60 {LSL_BRACKET_OPEN, ST_NONE, "[", LSL_INNER2OUTER | LSL_CREATION, NULL, NULL, evaluateOperationToken}, 60 {LSL_BRACKET_OPEN, ST_NONE, "[", LSL_INNER2OUTER | LSL_CREATION, NULL, NULL, evaluateOperationToken},
61 {LSL_PARENTHESIS_CLOSE, ST_NONE, ")", LSL_INNER2OUTER, NULL, NULL, evaluateNoToken}, 61 {LSL_PARENTHESIS_CLOSE, ST_NONE, ")", LSL_INNER2OUTER, NULL, NULL, evaluateNoToken},
62 {LSL_PARENTHESIS_OPEN, ST_NONE, "(", LSL_INNER2OUTER, outputParenthesisToken, NULL, eveluateParenthesisToken}, 62 {LSL_PARENTHESIS_OPEN, ST_NONE, "(", LSL_INNER2OUTER, outputParenthesisToken, NULL, eveluateParenthesisToken},
63// {LSL_ASSIGNMENT_CONCATENATE, ST_CONCATENATION "+=", LSL_RIGHT2LEFT | LSL_ASSIGNMENT, NULL, NULL, evaluateOperationToken}, 63 {LSL_ASSIGNMENT_CONCATENATE,ST_CONCATENATION, "+=", LSL_RIGHT2LEFT | LSL_ASSIGNMENT, NULL, NULL, evaluateOperationToken},
64 {LSL_ASSIGNMENT_ADD, ST_CONCATENATION, "+=", LSL_RIGHT2LEFT | LSL_ASSIGNMENT, NULL, NULL, evaluateOperationToken}, 64 {LSL_ASSIGNMENT_ADD, ST_CONCATENATION, "+=", LSL_RIGHT2LEFT | LSL_ASSIGNMENT, NULL, NULL, evaluateOperationToken},
65 {LSL_ASSIGNMENT_SUBTRACT, ST_ASSIGNMENT, "-=", LSL_RIGHT2LEFT | LSL_ASSIGNMENT, NULL, NULL, evaluateOperationToken}, 65 {LSL_ASSIGNMENT_SUBTRACT, ST_ASSIGNMENT, "-=", LSL_RIGHT2LEFT | LSL_ASSIGNMENT, NULL, NULL, evaluateOperationToken},
66 {LSL_ASSIGNMENT_MULTIPLY, ST_ASSIGNMENT, "*=", LSL_RIGHT2LEFT | LSL_ASSIGNMENT, NULL, NULL, evaluateOperationToken}, 66 {LSL_ASSIGNMENT_MULTIPLY, ST_ASSIGNMENT, "*=", LSL_RIGHT2LEFT | LSL_ASSIGNMENT, NULL, NULL, evaluateOperationToken},
@@ -68,9 +68,9 @@ LSL_Token LSL_Tokens[] =
68 {LSL_ASSIGNMENT_DIVIDE, ST_ASSIGNMENT, "/=", LSL_RIGHT2LEFT | LSL_ASSIGNMENT, NULL, NULL, evaluateOperationToken}, 68 {LSL_ASSIGNMENT_DIVIDE, ST_ASSIGNMENT, "/=", LSL_RIGHT2LEFT | LSL_ASSIGNMENT, NULL, NULL, evaluateOperationToken},
69 {LSL_ASSIGNMENT_PLAIN, ST_CONCATENATION, "=", LSL_RIGHT2LEFT | LSL_ASSIGNMENT, NULL, NULL, evaluateOperationToken}, 69 {LSL_ASSIGNMENT_PLAIN, ST_CONCATENATION, "=", LSL_RIGHT2LEFT | LSL_ASSIGNMENT, NULL, NULL, evaluateOperationToken},
70 {LSL_DOT, ST_NONE, ".", LSL_RIGHT2LEFT, NULL, NULL, evaluateOperationToken}, 70 {LSL_DOT, ST_NONE, ".", LSL_RIGHT2LEFT, NULL, NULL, evaluateOperationToken},
71// {LSL_DECREMENT_POST, ST_NONE, "--", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken}, 71 {LSL_DECREMENT_POST, ST_NONE, "--", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken},
72 {LSL_DECREMENT_PRE, ST_NONE, "--", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken}, 72 {LSL_DECREMENT_PRE, ST_NONE, "--", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken},
73// {LSL_INCREMENT_POST, ST_NONE, "++", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken}, 73 {LSL_INCREMENT_POST, ST_NONE, "++", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken},
74 {LSL_INCREMENT_PRE, ST_NONE, "++", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken}, 74 {LSL_INCREMENT_PRE, ST_NONE, "++", LSL_RIGHT2LEFT | LSL_UNARY, NULL, NULL, evaluateOperationToken},
75 {LSL_COMMA, ST_NONE, ",", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken}, 75 {LSL_COMMA, ST_NONE, ",", LSL_LEFT2RIGHT, NULL, NULL, evaluateOperationToken},
76 76
@@ -79,11 +79,11 @@ LSL_Token LSL_Tokens[] =
79 // Types. 79 // Types.
80 {LSL_FLOAT, ST_NONE, "float", LSL_NONE, outputFloatToken, NULL, evaluateFloatToken}, 80 {LSL_FLOAT, ST_NONE, "float", LSL_NONE, outputFloatToken, NULL, evaluateFloatToken},
81 {LSL_INTEGER, ST_NONE, "integer", LSL_NONE, outputIntegerToken, NULL, evaluateIntegerToken}, 81 {LSL_INTEGER, ST_NONE, "integer", LSL_NONE, outputIntegerToken, NULL, evaluateIntegerToken},
82// {LSL_KEY, ST_NONE, "key", LSL_NONE, NULL, NULL, NULL}, 82 {LSL_KEY, ST_NONE, "key", LSL_NONE, NULL, NULL, NULL},
83// {LSL_LIST, ST_NONE, "list", LSL_NONE, NULL, NULL, NULL}, 83 {LSL_LIST, ST_NONE, "list", LSL_NONE, NULL, NULL, NULL},
84// {LSL_ROTATION, ST_NONE, "rotation", LSL_NONE, NULL, NULL, NULL}, 84 {LSL_ROTATION, ST_NONE, "rotation", LSL_NONE, NULL, NULL, NULL},
85// {LSL_STRING, ST_NONE, "string", LSL_NONE, NULL, NULL, NULL}, 85 {LSL_STRING, ST_NONE, "string", LSL_NONE, NULL, NULL, NULL},
86// {LSL_VECTOR, ST_NONE, "vector", LSL_NONE, NULL, NULL, NULL}, 86 {LSL_VECTOR, ST_NONE, "vector", LSL_NONE, NULL, NULL, NULL},
87 87
88 // Types names. 88 // Types names.
89 {LSL_TYPE_FLOAT, ST_NONE, "float", LSL_NONE, NULL, NULL, NULL}, 89 {LSL_TYPE_FLOAT, ST_NONE, "float", LSL_NONE, NULL, NULL, NULL},
@@ -101,7 +101,7 @@ LSL_Token LSL_Tokens[] =
101 101
102 {LSL_DO, ST_NONE, "do", LSL_NONE, NULL, NULL, NULL}, 102 {LSL_DO, ST_NONE, "do", LSL_NONE, NULL, NULL, NULL},
103 {LSL_FOR, ST_NONE, "for", LSL_NONE, NULL, NULL, NULL}, 103 {LSL_FOR, ST_NONE, "for", LSL_NONE, NULL, NULL, NULL},
104// {LSL_ELSE_IF, ST_NONE, "else if", LSL_NONE, NULL, NULL, NULL}, 104 {LSL_ELSE_IF, ST_NONE, "else if", LSL_NONE, NULL, NULL, NULL},
105 {LSL_ELSE, ST_NONE, "else", LSL_NONE, NULL, NULL, NULL}, 105 {LSL_ELSE, ST_NONE, "else", LSL_NONE, NULL, NULL, NULL},
106 {LSL_IF, ST_NONE, "if", LSL_NONE, NULL, NULL, NULL}, 106 {LSL_IF, ST_NONE, "if", LSL_NONE, NULL, NULL, NULL},
107 {LSL_JUMP, ST_NONE, "jump", LSL_NONE, NULL, NULL, NULL}, 107 {LSL_JUMP, ST_NONE, "jump", LSL_NONE, NULL, NULL, NULL},
@@ -112,9 +112,9 @@ LSL_Token LSL_Tokens[] =
112 112
113 {LSL_BLOCK_CLOSE, ST_NONE, "}", LSL_NONE, NULL, NULL, NULL}, 113 {LSL_BLOCK_CLOSE, ST_NONE, "}", LSL_NONE, NULL, NULL, NULL},
114 {LSL_BLOCK_OPEN, ST_NONE, "{", LSL_NONE, NULL, NULL, NULL}, 114 {LSL_BLOCK_OPEN, ST_NONE, "{", LSL_NONE, NULL, NULL, NULL},
115// {LSL_PARAMETER, ST_NONE, "parameter", LSL_NONE, NULL, NULL, NULL}, 115 {LSL_PARAMETER, ST_NONE, "parameter", LSL_NONE, NULL, NULL, NULL},
116// {LSL_FUNCTION, ST_NONE, "function", LSL_NONE, NULL, NULL, NULL}, 116 {LSL_FUNCTION, ST_NONE, "function", LSL_NONE, NULL, NULL, NULL},
117// {LSL_STATE, ST_NONE, "state", LSL_NONE, NULL, NULL, NULL}, 117 {LSL_STATE, ST_NONE, "state", LSL_NONE, NULL, NULL, NULL},
118 {LSL_SCRIPT, ST_NONE, "", LSL_NONE, NULL, NULL, NULL}, 118 {LSL_SCRIPT, ST_NONE, "", LSL_NONE, NULL, NULL, NULL},
119 119
120 {LSL_UNKNOWN, ST_NONE, "unknown", LSL_NONE, NULL, NULL, NULL}, 120 {LSL_UNKNOWN, ST_NONE, "unknown", LSL_NONE, NULL, NULL, NULL},
@@ -260,7 +260,7 @@ LSL_Leaf *addOperation(LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right)
260 if (LSL_MULTIPLY == lval->token->type) 260 if (LSL_MULTIPLY == lval->token->type)
261 { 261 {
262 lval->basicType = OT_float; 262 lval->basicType = OT_float;
263// lval->token = tokens[LSL_DOT_PRODUCT - lowestToken]; 263 lval->token = tokens[LSL_DOT_PRODUCT - lowestToken];
264 } 264 }
265 else 265 else
266 lval->basicType = OT_vector; 266 lval->basicType = OT_vector;
@@ -311,6 +311,29 @@ LSL_Leaf *addStatement(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *expr)
311 return lval; 311 return lval;
312} 312}
313 313
314LSL_Leaf *addTypecast(LSL_Leaf *lval, LSL_Leaf *type, LSL_Leaf *rval)
315{
316 LSL_Parenthesis *parens = malloc(sizeof(LSL_Parenthesis));
317
318 if (parens)
319 {
320 parens->left = lval;
321 parens->expression = type;
322 parens->right = rval;
323 if (lval)
324 {
325 lval->value.parenthesis = parens;
326 lval->basicType = type->basicType;
327 lval->token = tokens[LSL_TYPECAST_OPEN - lowestToken];
328 }
329 if (rval)
330 {
331 rval->token = tokens[LSL_TYPECAST_CLOSE - lowestToken];
332 }
333 }
334 return lval;
335}
336
314static LSL_Leaf *evaluateLeaf(LSL_Leaf *leaf, LSL_Leaf *left, LSL_Leaf *right) 337static LSL_Leaf *evaluateLeaf(LSL_Leaf *leaf, LSL_Leaf *left, LSL_Leaf *right)
315{ 338{
316 LSL_Leaf *result = NULL; 339 LSL_Leaf *result = NULL;
@@ -479,9 +502,9 @@ static LSL_Leaf *evaluateOperationToken(LSL_Leaf *content, LSL_Leaf *left, LSL_L
479 { 502 {
480 case LSL_COMMA : 503 case LSL_COMMA :
481 case LSL_INCREMENT_PRE : 504 case LSL_INCREMENT_PRE :
482// case LSL_INCREMENT_POST : 505 case LSL_INCREMENT_POST :
483 case LSL_DECREMENT_PRE : 506 case LSL_DECREMENT_PRE :
484// case LSL_DECREMENT_POST : 507 case LSL_DECREMENT_POST :
485 case LSL_ASSIGNMENT_PLAIN : 508 case LSL_ASSIGNMENT_PLAIN :
486 case LSL_ASSIGNMENT_DIVIDE : 509 case LSL_ASSIGNMENT_DIVIDE :
487 case LSL_ASSIGNMENT_MULTIPLY : 510 case LSL_ASSIGNMENT_MULTIPLY :
@@ -491,9 +514,9 @@ static LSL_Leaf *evaluateOperationToken(LSL_Leaf *content, LSL_Leaf *left, LSL_L
491 case LSL_BRACKET_CLOSE : 514 case LSL_BRACKET_CLOSE :
492 case LSL_ANGLE_OPEN : 515 case LSL_ANGLE_OPEN :
493 case LSL_ANGLE_CLOSE : 516 case LSL_ANGLE_CLOSE :
494// case LSL_TYPECAST_OPEN : 517 case LSL_TYPECAST_OPEN :
495// case LSL_TYPECAST_CLOSE : 518 case LSL_TYPECAST_CLOSE :
496// case LSL_DOT_PRODUCT : 519 case LSL_DOT_PRODUCT :
497 break; 520 break;
498 case LSL_NEGATION : result->value.floatValue = 0 - fright; break; 521 case LSL_NEGATION : result->value.floatValue = 0 - fright; break;
499 case LSL_DIVIDE : result->value.floatValue = fleft / fright; break; 522 case LSL_DIVIDE : result->value.floatValue = fleft / fright; break;
@@ -519,9 +542,9 @@ static LSL_Leaf *evaluateOperationToken(LSL_Leaf *content, LSL_Leaf *left, LSL_L
519 { 542 {
520 case LSL_COMMA : 543 case LSL_COMMA :
521 case LSL_INCREMENT_PRE : 544 case LSL_INCREMENT_PRE :
522// case LSL_INCREMENT_POST : 545 case LSL_INCREMENT_POST :
523 case LSL_DECREMENT_PRE : 546 case LSL_DECREMENT_PRE :
524// case LSL_DECREMENT_POST : 547 case LSL_DECREMENT_POST :
525 case LSL_DOT : 548 case LSL_DOT :
526 case LSL_ASSIGNMENT_PLAIN : 549 case LSL_ASSIGNMENT_PLAIN :
527 case LSL_ASSIGNMENT_DIVIDE : 550 case LSL_ASSIGNMENT_DIVIDE :
@@ -533,8 +556,8 @@ static LSL_Leaf *evaluateOperationToken(LSL_Leaf *content, LSL_Leaf *left, LSL_L
533 case LSL_BRACKET_CLOSE : 556 case LSL_BRACKET_CLOSE :
534 case LSL_ANGLE_OPEN : 557 case LSL_ANGLE_OPEN :
535 case LSL_ANGLE_CLOSE : 558 case LSL_ANGLE_CLOSE :
536// case LSL_TYPECAST_OPEN : 559 case LSL_TYPECAST_OPEN :
537// case LSL_TYPECAST_CLOSE : 560 case LSL_TYPECAST_CLOSE :
538 break; 561 break;
539 case LSL_BIT_NOT : result->value.integerValue = ~ right->value.integerValue; break; 562 case LSL_BIT_NOT : result->value.integerValue = ~ right->value.integerValue; break;
540 case LSL_BOOL_NOT : result->value.integerValue = ! right->value.integerValue; break; 563 case LSL_BOOL_NOT : result->value.integerValue = ! right->value.integerValue; break;
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h
index 9a71c17..e56e94c 100644
--- a/LuaSL/src/LuaSL_LSL_tree.h
+++ b/LuaSL/src/LuaSL_LSL_tree.h
@@ -289,6 +289,7 @@ LSL_Leaf *addExpression(LSL_Leaf *exp);
289LSL_Leaf *addOperation(LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right); 289LSL_Leaf *addOperation(LSL_Leaf *left, LSL_Leaf *lval, LSL_Leaf *right);
290LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr, LSL_Leaf *rval); 290LSL_Leaf *addParenthesis(LSL_Leaf *lval, LSL_Leaf *expr, LSL_Leaf *rval);
291LSL_Leaf *addStatement(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *expr); 291LSL_Leaf *addStatement(LSL_Leaf *lval, LSL_Type type, LSL_Leaf *expr);
292LSL_Leaf *addTypecast(LSL_Leaf *lval, LSL_Leaf *expr, LSL_Leaf *rval);
292 293
293void *ParseAlloc(void *(*mallocProc)(size_t)); 294void *ParseAlloc(void *(*mallocProc)(size_t));
294void ParseTrace(FILE *TraceFILE, char *zTracePrompt); 295void ParseTrace(FILE *TraceFILE, char *zTracePrompt);
diff --git a/LuaSL/src/LuaSL_lemon_yaccer.y b/LuaSL/src/LuaSL_lemon_yaccer.y
index 5cffb73..9d08fa9 100644
--- a/LuaSL/src/LuaSL_lemon_yaccer.y
+++ b/LuaSL/src/LuaSL_lemon_yaccer.y
@@ -36,10 +36,10 @@ expr(A) ::= expr(B) LSL_LESS_THAN(C) expr(D). { A = addOperation(B, C, D); }
36expr(A) ::= expr(B) LSL_RIGHT_SHIFT(C) expr(D). { A = addOperation(B, C, D); } 36expr(A) ::= expr(B) LSL_RIGHT_SHIFT(C) expr(D). { A = addOperation(B, C, D); }
37expr(A) ::= expr(B) LSL_LEFT_SHIFT(C) expr(D). { A = addOperation(B, C, D); } 37expr(A) ::= expr(B) LSL_LEFT_SHIFT(C) expr(D). { A = addOperation(B, C, D); }
38 38
39%left LSL_SUBTRACT LSL_ADD. 39%left LSL_SUBTRACT LSL_ADD LSL_CONCATENATE.
40expr(A) ::= expr(B) LSL_ADD(C) expr(D). { A = addOperation(B, C, D); } 40expr(A) ::= expr(B) LSL_ADD(C) expr(D). { A = addOperation(B, C, D); }
41expr(A) ::= expr(B) LSL_SUBTRACT(C) expr(D). { A = addOperation(B, C, D); } 41expr(A) ::= expr(B) LSL_SUBTRACT(C) expr(D). { A = addOperation(B, C, D); }
42%left LSL_DIVIDE LSL_MODULO LSL_MULTIPLY. 42%left LSL_DIVIDE LSL_MODULO LSL_MULTIPLY LSL_DOT_PRODUCT LSL_CROSS_PRODUCT.
43expr(A) ::= expr(B) LSL_MULTIPLY(C) expr(D). { A = addOperation(B, C, D); } 43expr(A) ::= expr(B) LSL_MULTIPLY(C) expr(D). { A = addOperation(B, C, D); }
44expr(A) ::= expr(B) LSL_MODULO(C) expr(D). { A = addOperation(B, C, D); } 44expr(A) ::= expr(B) LSL_MODULO(C) expr(D). { A = addOperation(B, C, D); }
45expr(A) ::= expr(B) LSL_DIVIDE(C) expr(D). { A = addOperation(B, C, D); } 45expr(A) ::= expr(B) LSL_DIVIDE(C) expr(D). { A = addOperation(B, C, D); }
@@ -49,29 +49,40 @@ expr(A) ::= LSL_BIT_NOT(B) expr(C). { A = addOperation(NULL, B, C); }
49expr(A) ::= LSL_BOOL_NOT(B) expr(C). { A = addOperation(NULL, B, C); } 49expr(A) ::= LSL_BOOL_NOT(B) expr(C). { A = addOperation(NULL, B, C); }
50expr(A) ::= LSL_SUBTRACT(B) expr(C). [LSL_NEGATION] { A = addOperation(NULL, B, C); } 50expr(A) ::= LSL_SUBTRACT(B) expr(C). [LSL_NEGATION] { A = addOperation(NULL, B, C); }
51 51
52%right LSL_TYPECAST_OPEN LSL_TYPECAST_CLOSE.
53%nonassoc LSL_TYPE_FLOAT LSL_TYPE_INTEGER LSL_TYPE_KEY LSL_TYPE_LIST LSL_TYPE_ROTATION LSL_TYPE_STRING LSL_TYPE_VECTOR.
52%left LSL_ANGLE_OPEN LSL_ANGLE_CLOSE. 54%left LSL_ANGLE_OPEN LSL_ANGLE_CLOSE.
53%nonassoc LSL_BRACKET_OPEN LSL_BRACKET_CLOSE. 55%nonassoc LSL_BRACKET_OPEN LSL_BRACKET_CLOSE.
54%nonassoc LSL_PARENTHESIS_OPEN LSL_PARENTHESIS_CLOSE LSL_EXPRESSION. 56%nonassoc LSL_PARENTHESIS_OPEN LSL_PARENTHESIS_CLOSE LSL_EXPRESSION.
55expr(A) ::= LSL_PARENTHESIS_OPEN(B) expr(C) LSL_PARENTHESIS_CLOSE(D). { A = addParenthesis(B, C, D); } 57expr(A) ::= LSL_PARENTHESIS_OPEN(B) expr(C) LSL_PARENTHESIS_CLOSE(D). { A = addParenthesis(B, C, D); }
56 58
57%right LSL_ASSIGNMENT_ADD LSL_ASSIGNMENT_SUBTRACT LSL_ASSIGNMENT_MULTIPLY LSL_ASSIGNMENT_MODULO LSL_ASSIGNMENT_DIVIDE LSL_ASSIGNMENT_PLAIN. 59expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_FLOAT(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
60expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_INTEGER(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
61expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_KEY(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
62expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_LIST(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
63expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_ROTATION(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
64expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_STRING(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
65expr(A) ::= LSL_PARENTHESIS_OPEN(B) LSL_TYPE_VECTOR(C) LSL_PARENTHESIS_CLOSE(D). { A = addTypecast(B, C, D); }
66
67%right LSL_ASSIGNMENT_CONCATENATE LSL_ASSIGNMENT_ADD LSL_ASSIGNMENT_SUBTRACT LSL_ASSIGNMENT_MULTIPLY LSL_ASSIGNMENT_MODULO LSL_ASSIGNMENT_DIVIDE LSL_ASSIGNMENT_PLAIN.
58%right LSL_DOT. 68%right LSL_DOT.
59%right LSL_DECREMENT_PRE LSL_INCREMENT_PRE. 69%right LSL_DECREMENT_PRE LSL_INCREMENT_PRE LSL_DECREMENT_POST LSL_INCREMENT_POST.
60%nonassoc LSL_COMMA. 70%nonassoc LSL_COMMA.
61 71
62%nonassoc LSL_FLOAT. 72%nonassoc LSL_FLOAT.
63expr(A) ::= LSL_FLOAT(B). { B->basicType = OT_float; A = B; } 73expr(A) ::= LSL_FLOAT(B). { B->basicType = OT_float; A = B; }
64%nonassoc LSL_INTEGER. 74%nonassoc LSL_INTEGER.
65expr(A) ::= LSL_INTEGER(B). { B->basicType = OT_integer; A = B; } 75expr(A) ::= LSL_INTEGER(B). { B->basicType = OT_integer; A = B; }
76%nonassoc LSL_KEY.
77%nonassoc LSL_LIST.
78%nonassoc LSL_ROTATION.
79%nonassoc LSL_STRING.
80%nonassoc LSL_VECTOR.
66 81
67%nonassoc LSL_TYPE_FLOAT LSL_TYPE_INTEGER LSL_TYPE_KEY LSL_TYPE_LIST LSL_TYPE_ROTATION LSL_TYPE_STRING LSL_TYPE_VECTOR. 82%nonassoc LSL_DO LSL_FOR LSL_ELSE LSL_ELSE_IF LSL_IF LSL_JUMP LSL_RETURN LSL_STATE_CHANGE LSL_WHILE.
68
69%nonassoc LSL_DO LSL_FOR LSL_ELSE LSL_IF LSL_JUMP LSL_RETURN LSL_STATE_CHANGE LSL_WHILE.
70 83
71%nonassoc LSL_LABEL. 84%nonassoc LSL_LABEL.
72 85
73%nonassoc LSL_BLOCK_OPEN LSL_BLOCK_CLOSE.
74
75%nonassoc LSL_STATEMENT. 86%nonassoc LSL_STATEMENT.
76statement(A) ::= expr(B) LSL_STATEMENT(D). { A = addStatement(D, LSL_EXPRESSION, B); } 87statement(A) ::= expr(B) LSL_STATEMENT(D). { A = addStatement(D, LSL_EXPRESSION, B); }
77 88
@@ -79,6 +90,9 @@ statement(A) ::= expr(B) LSL_STATEMENT(D). { A = addStatement(D, LSL_EXPRESS
79script ::= script statement(A). { A->left = param->ast; param->ast = A; } 90script ::= script statement(A). { A->left = param->ast; param->ast = A; }
80script ::= statement(A). { A->left = param->ast; param->ast = A; } 91script ::= statement(A). { A->left = param->ast; param->ast = A; }
81 92
93%nonassoc LSL_BLOCK_OPEN LSL_BLOCK_CLOSE.
94%nonassoc LSL_PARAMETER LSL_FUNCTION LSL_STATE.
95
82%nonassoc LSL_SPACE LSL_COMMENT LSL_COMMENT_LINE LSL_UNKNOWN. 96%nonassoc LSL_SPACE LSL_COMMENT LSL_COMMENT_LINE LSL_UNKNOWN.
83 97
84 98