mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-27 14:12:36 +00:00
-std=fteqcc gets its own operator list
This commit is contained in:
parent
e25e83b14c
commit
3f805fdde9
2 changed files with 50 additions and 0 deletions
47
lexer.h
47
lexer.h
|
@ -201,6 +201,53 @@ static const oper_info c_operators[] = {
|
|||
};
|
||||
static const size_t c_operator_count = (sizeof(c_operators) / sizeof(c_operators[0]));
|
||||
|
||||
static const oper_info fte_operators[] = {
|
||||
{ "(", 0, opid1('('), ASSOC_LEFT, 99, OP_PREFIX}, /* paren expression - non function call */
|
||||
|
||||
{ ".", 2, opid1('.'), ASSOC_LEFT, 15, 0 },
|
||||
{ "(", 0, opid1('('), ASSOC_LEFT, 15, 0 }, /* function call */
|
||||
{ "[", 2, opid1('['), ASSOC_LEFT, 15, 0 }, /* array subscript */
|
||||
|
||||
{ "!", 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 },
|
||||
|
||||
{ "*", 2, opid1('*'), ASSOC_LEFT, 13, 0 },
|
||||
{ "/", 2, opid1('/'), ASSOC_LEFT, 13, 0 },
|
||||
{ "&", 2, opid1('&'), ASSOC_LEFT, 13, 0 },
|
||||
{ "|", 2, opid1('|'), ASSOC_LEFT, 13, 0 },
|
||||
|
||||
{ "+", 2, opid1('+'), ASSOC_LEFT, 12, 0 },
|
||||
{ "-", 2, opid1('-'), ASSOC_LEFT, 12, 0 },
|
||||
|
||||
{ "<", 2, opid1('<'), ASSOC_LEFT, 10, 0 },
|
||||
{ ">", 2, opid1('>'), ASSOC_LEFT, 10, 0 },
|
||||
{ "<=", 2, opid2('<','='), ASSOC_LEFT, 10, 0 },
|
||||
{ ">=", 2, opid2('>','='), ASSOC_LEFT, 10, 0 },
|
||||
{ "==", 2, opid2('=','='), ASSOC_LEFT, 10, 0 },
|
||||
{ "!=", 2, opid2('!','='), ASSOC_LEFT, 10, 0 },
|
||||
|
||||
{ "=", 2, opid1('='), ASSOC_RIGHT, 8, 0 },
|
||||
{ "+=", 2, opid2('+','='), ASSOC_RIGHT, 8, 0 },
|
||||
{ "-=", 2, opid2('-','='), ASSOC_RIGHT, 8, 0 },
|
||||
{ "*=", 2, opid2('*','='), ASSOC_RIGHT, 8, 0 },
|
||||
{ "/=", 2, opid2('/','='), ASSOC_RIGHT, 8, 0 },
|
||||
{ "%=", 2, opid2('%','='), ASSOC_RIGHT, 8, 0 },
|
||||
{ "&=", 2, opid2('&','='), ASSOC_RIGHT, 8, 0 },
|
||||
{ "|=", 2, opid2('|','='), ASSOC_RIGHT, 8, 0 },
|
||||
|
||||
{ "&&", 2, opid2('&','&'), ASSOC_LEFT, 5, 0 },
|
||||
{ "||", 2, opid2('|','|'), ASSOC_LEFT, 5, 0 },
|
||||
|
||||
{ ",", 2, opid1(','), ASSOC_LEFT, 2, 0 },
|
||||
|
||||
{ "?", 3, opid2('?',':'), ASSOC_RIGHT, 1, 0 },
|
||||
{ ":", 3, opid2(':','?'), ASSOC_RIGHT, 1, 0 }
|
||||
};
|
||||
static const size_t fte_operator_count = (sizeof(fte_operators) / sizeof(fte_operators[0]));
|
||||
|
||||
static const oper_info qcc_operators[] = {
|
||||
{ "(", 0, opid1('('), ASSOC_LEFT, 99, OP_PREFIX}, /* paren expression - non function call */
|
||||
|
||||
|
|
3
main.c
3
main.c
|
@ -458,6 +458,9 @@ int main(int argc, char **argv) {
|
|||
if (opts_standard == COMPILER_GMQCC) {
|
||||
operators = c_operators;
|
||||
operator_count = c_operator_count;
|
||||
} else if (opts_standard == COMPILER_FTEQCC) {
|
||||
operators = fte_operators;
|
||||
operator_count = fte_operator_count;
|
||||
} else {
|
||||
operators = qcc_operators;
|
||||
operator_count = qcc_operator_count;
|
||||
|
|
Loading…
Reference in a new issue