X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=lexer.c;h=3f1aa76c0f5c312273a1d17a8c33fe06996e8627;hb=64c230d2222e53e754c8d8636fc6cb2c6eda7e0c;hp=5c98d31caedbcf1f95fba984d871686558cc0f5d;hpb=d581fdc048df3714446f10ec37866a26c5e9ed7a;p=xonotic%2Fgmqcc.git diff --git a/lexer.c b/lexer.c index 5c98d31..3f1aa76 100644 --- a/lexer.c +++ b/lexer.c @@ -464,7 +464,7 @@ int lex_do(lex_file *lex) case '[': case ']': - case ',': + case '#': return (lex->tok->ttype = ch); default: @@ -489,12 +489,22 @@ int lex_do(lex_file *lex) case '|': case '^': case '~': + case ',': return ch; default: break; } } + if (ch == ',') { + if (!lex_tokench(lex, ch) || + !lex_endtoken(lex)) + { + return (lex->tok->ttype = TOKEN_FATAL); + } + return (lex->tok->ttype = TOKEN_OPERATOR); + } + if (ch == '+' || ch == '-' || /* ++, --, +=, -= and -> as well! */ ch == '>' || ch == '<' || /* <<, >>, <=, >= */ ch == '=' || /* == */ @@ -577,10 +587,11 @@ int lex_do(lex_file *lex) } else if (!strcmp(v, "vector")) { lex->tok->ttype = TOKEN_TYPENAME; lex->tok->constval.t = TYPE_VECTOR; - } else if (!strcmp(v, "for") || - !strcmp(v, "while") || - !strcmp(v, "do") || - !strcmp(v, "var") || + } else if (!strcmp(v, "for") || + !strcmp(v, "while") || + !strcmp(v, "do") || + !strcmp(v, "var") || + !strcmp(v, "return") || !strcmp(v, "const")) lex->tok->ttype = TOKEN_KEYWORD;