mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-04-22 18:02:18 +00:00
Fixing operator precedence of suffices
This commit is contained in:
parent
448d4ebd75
commit
5867167a70
3 changed files with 9 additions and 6 deletions
10
lexer.h
10
lexer.h
|
@ -139,9 +139,8 @@ typedef struct {
|
|||
static const oper_info c_operators[] = {
|
||||
{ "(", 0, opid1('('), ASSOC_LEFT, 99, OP_PREFIX}, /* paren expression - non function call */
|
||||
|
||||
{ "++", 1, opid3('S','+','+'), ASSOC_LEFT, 16, OP_SUFFIX},
|
||||
{ "--", 1, opid3('S','-','-'), ASSOC_LEFT, 16, OP_SUFFIX},
|
||||
|
||||
{ "++", 1, opid3('S','+','+'), ASSOC_LEFT, 15, OP_SUFFIX},
|
||||
{ "--", 1, opid3('S','-','-'), ASSOC_LEFT, 15, OP_SUFFIX},
|
||||
{ ".", 2, opid1('.'), ASSOC_LEFT, 15, 0 },
|
||||
{ "(", 0, opid1('('), ASSOC_LEFT, 15, 0 }, /* function call */
|
||||
{ "[", 2, opid1('['), ASSOC_LEFT, 15, 0 }, /* array subscript */
|
||||
|
@ -204,9 +203,8 @@ static const size_t c_operator_count = (sizeof(c_operators) / sizeof(c_operators
|
|||
static const oper_info fte_operators[] = {
|
||||
{ "(", 0, opid1('('), ASSOC_LEFT, 99, OP_PREFIX}, /* paren expression - non function call */
|
||||
|
||||
{ "++", 1, opid3('S','+','+'), ASSOC_LEFT, 16, OP_SUFFIX},
|
||||
{ "--", 1, opid3('S','-','-'), ASSOC_LEFT, 16, OP_SUFFIX},
|
||||
|
||||
{ "++", 1, opid3('S','+','+'), ASSOC_LEFT, 15, OP_SUFFIX},
|
||||
{ "--", 1, opid3('S','-','-'), ASSOC_LEFT, 15, OP_SUFFIX},
|
||||
{ ".", 2, opid1('.'), ASSOC_LEFT, 15, 0 },
|
||||
{ "(", 0, opid1('('), ASSOC_LEFT, 15, 0 }, /* function call */
|
||||
{ "[", 2, opid1('['), ASSOC_LEFT, 15, 0 }, /* array subscript */
|
||||
|
|
|
@ -35,4 +35,8 @@ void main() {
|
|||
// check if minus translates
|
||||
print(ftos(a--), "\n");
|
||||
print(ftos(--a), "\n");
|
||||
|
||||
// postfix on members
|
||||
print(ftos(e.mem--), " = ");
|
||||
print(ftos(e.mem+1), "\n");
|
||||
}
|
||||
|
|
|
@ -11,3 +11,4 @@ M: 6 = 6
|
|||
M: 11 = 11
|
||||
M: 4
|
||||
M: 2
|
||||
M: 12 = 12
|
||||
|
|
Loading…
Reference in a new issue