]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - lexer.c
Reorganizing expression parsing to allow prefix-operators like unary minus
[xonotic/gmqcc.git] / lexer.c
diff --git a/lexer.c b/lexer.c
index ef4464ea0cd672a9803f281e7492b08cbee1d3f9..6fc32b7c1456835bc059be907bba45468f6f980f 100644 (file)
--- a/lexer.c
+++ b/lexer.c
@@ -498,7 +498,11 @@ int lex_do(lex_file *lex)
                case ']':
 
                case '#':
-
+               if (!lex_tokench(lex, ch) ||
+                   !lex_endtoken(lex))
+               {
+                   return (lex->tok->ttype = TOKEN_FATAL);
+               }
                        return (lex->tok->ttype = ch);
                default:
                        break;
@@ -524,6 +528,11 @@ int lex_do(lex_file *lex)
                        case '~':
                        case ',':
                    case '.':
+                   if (!lex_tokench(lex, ch) ||
+                       !lex_endtoken(lex))
+                   {
+                       return (lex->tok->ttype = TOKEN_FATAL);
+                   }
                                return (lex->tok->ttype = ch);
                        default:
                                break;