This commit is contained in:
Dale Weiler 2013-07-31 15:56:56 +00:00
parent fa5ad1212e
commit 1538e69f93
2 changed files with 9 additions and 10 deletions

5
fold.c
View file

@ -42,7 +42,6 @@
#define isvector(X) (((ast_expression*)(X))->vtype == TYPE_VECTOR)
#define isstring(X) (((ast_expression*)(X))->vtype == TYPE_STRING)
#define isfloats(X,Y) (isfloat (X) && isfloat (Y))
#define isvectors(X,Y) (isvector (X) && isvector(Y))
/*
* Implementation of basic vector math for vec3_t, for trivial constant
@ -547,8 +546,8 @@ ast_expression *fold_op(fold_t *fold, const oper_info *info, ast_expression **op
}
switch(info->id) {
case opid2('-', 'P'): return fold_op_neg (fold, a);
case opid2('!', 'P'): return fold_op_not (fold, a);
case opid2('-','P'): return fold_op_neg (fold, a);
case opid2('!','P'): return fold_op_not (fold, a);
case opid1('+'): return fold_op_add (fold, a, b);
case opid1('-'): return fold_op_sub (fold, a, b);
case opid1('*'): return fold_op_mul (fold, a, b);

14
lexer.h
View file

@ -185,10 +185,10 @@ static const oper_info c_operators[] = {
{ "++", 1, opid3('+','+','P'), ASSOC_RIGHT, 16, OP_PREFIX, false},
{ "--", 1, opid3('-','-','P'), ASSOC_RIGHT, 16, OP_PREFIX, false},
{ "**", 2, opid2('*', '*'), ASSOC_RIGHT, 15, 0, true},
{ "**", 2, opid2('*','*'), ASSOC_RIGHT, 15, 0, true},
{ "!", 1, opid2('!', 'P'), ASSOC_RIGHT, 14, OP_PREFIX, true},
{ "~", 1, opid2('~', 'P'), ASSOC_RIGHT, 14, OP_PREFIX, true},
{ "!", 1, opid2('!','P'), ASSOC_RIGHT, 14, OP_PREFIX, true},
{ "~", 1, opid2('~','P'), ASSOC_RIGHT, 14, OP_PREFIX, true},
{ "+", 1, opid2('+','P'), ASSOC_RIGHT, 14, OP_PREFIX, false},
{ "-", 1, opid2('-','P'), ASSOC_RIGHT, 14, OP_PREFIX, true},
/* { "&", 1, opid2('&','P'), ASSOC_RIGHT, 14, OP_PREFIX, false}, */
@ -212,7 +212,7 @@ static const oper_info c_operators[] = {
{ "==", 2, opid2('=','='), ASSOC_LEFT, 9, 0, true},
{ "!=", 2, opid2('!','='), ASSOC_LEFT, 9, 0, true},
{ "&", 2, opid1('&'), ASSOC_LEFT, 8, 0, false},
{ "&", 2, opid1('&'), ASSOC_LEFT, 8, 0, true},
{ "^", 2, opid1('^'), ASSOC_LEFT, 7, 0, true},
@ -252,9 +252,9 @@ static const oper_info fte_operators[] = {
{ "(", 0, opid1('('), ASSOC_LEFT, 15, 0, false}, /* function call */
{ "[", 2, opid1('['), ASSOC_LEFT, 15, 0, false}, /* array subscript */
{ "!", 1, opid2('!', 'P'), ASSOC_RIGHT, 14, OP_PREFIX, false},
{ "!", 1, opid2('!','P'), ASSOC_RIGHT, 14, OP_PREFIX, true},
{ "+", 1, opid2('+','P'), ASSOC_RIGHT, 14, OP_PREFIX, false},
{ "-", 1, opid2('-','P'), ASSOC_RIGHT, 14, OP_PREFIX, false},
{ "-", 1, opid2('-','P'), ASSOC_RIGHT, 14, OP_PREFIX, true},
{ "++", 1, opid3('+','+','P'), ASSOC_RIGHT, 14, OP_PREFIX, false},
{ "--", 1, opid3('-','-','P'), ASSOC_RIGHT, 14, OP_PREFIX, false},
@ -304,7 +304,7 @@ static const oper_info qcc_operators[] = {
{ "(", 0, opid1('('), ASSOC_LEFT, 15, 0, false}, /* function call */
{ "[", 2, opid1('['), ASSOC_LEFT, 15, 0, false}, /* array subscript */
{ "!", 1, opid2('!', 'P'), ASSOC_RIGHT, 14, OP_PREFIX, true},
{ "!", 1, opid2('!','P'), ASSOC_RIGHT, 14, OP_PREFIX, true},
{ "+", 1, opid2('+','P'), ASSOC_RIGHT, 14, OP_PREFIX, false},
{ "-", 1, opid2('-','P'), ASSOC_RIGHT, 14, OP_PREFIX, true},