X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=lexer.h;h=24ac39a63f7f574d1e9a8a7dfc1f8236cc51612a;hp=9724a7b90d97c386e1de013a97e08d654e05d280;hb=c3f4b7153b3815daf271829148f40d545a6140ef;hpb=3593a1b6b89ff690b8e89a31707468aad014b7b1 diff --git a/lexer.h b/lexer.h index 9724a7b..24ac39a 100644 --- a/lexer.h +++ b/lexer.h @@ -87,7 +87,11 @@ enum { TOKEN_WHITE, TOKEN_EOL, - TOKEN_EOF, + /* if we add additional tokens before this, the exposed API + * should not be broken anyway, but EOF/ERROR/... should + * still be at the bottom + */ + TOKEN_EOF = 1024, /* We use '< TOKEN_ERROR', so TOKEN_FATAL must come after it and any * other error related tokens as well @@ -166,18 +170,21 @@ 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, 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 */ + { "++", 1, opid3('S','+','+'), ASSOC_LEFT, 17, OP_SUFFIX}, + { "--", 1, opid3('S','-','-'), ASSOC_LEFT, 17, OP_SUFFIX}, + { ".", 2, opid1('.'), ASSOC_LEFT, 17, 0 }, + { "(", 0, opid1('('), ASSOC_LEFT, 17, 0 }, /* function call */ + { "[", 2, opid1('['), ASSOC_LEFT, 17, 0 }, /* array subscript */ + + { "++", 1, opid3('+','+','P'), ASSOC_RIGHT, 16, OP_PREFIX }, + { "--", 1, opid3('-','-','P'), ASSOC_RIGHT, 16, OP_PREFIX }, + + { "**", 2, opid2('*', '*'), ASSOC_RIGHT, 15, 0 }, { "!", 1, opid2('!', 'P'), ASSOC_RIGHT, 14, OP_PREFIX }, { "~", 1, opid2('~', 'P'), ASSOC_RIGHT, 14, OP_PREFIX }, { "+", 1, opid2('+','P'), ASSOC_RIGHT, 14, OP_PREFIX }, { "-", 1, opid2('-','P'), ASSOC_RIGHT, 14, OP_PREFIX }, - { "++", 1, opid3('+','+','P'), ASSOC_RIGHT, 14, OP_PREFIX }, - { "--", 1, opid3('-','-','P'), ASSOC_RIGHT, 14, OP_PREFIX }, /* { "&", 1, opid2('&','P'), ASSOC_RIGHT, 14, OP_PREFIX }, */ { "*", 2, opid1('*'), ASSOC_LEFT, 13, 0 },