]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
fixed a bug which allowed some statements to end in tokens other than semicolons...
authorWolfgang Bumiller <blub@speed.at>
Thu, 10 Jan 2013 14:23:04 +0000 (15:23 +0100)
committerWolfgang Bumiller <blub@speed.at>
Thu, 10 Jan 2013 14:23:04 +0000 (15:23 +0100)
parser.c

index b15280b8d993ee9f33441463a700762f1ed460fb..9912f564d8f6ee638b2caf515e85963b336e87c0 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1957,7 +1957,7 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma
             goto onerr;
         }
         if (parser->tok == ';' ||
-            (!parens && parser->tok == ']'))
+            (!parens && (parser->tok == ']' || parser->tok == ')')))
         {
             break;
         }
@@ -1996,8 +1996,13 @@ static ast_expression* parse_expression(parser_t *parser, bool stopatcomma, bool
     ast_expression *e = parse_expression_leave(parser, stopatcomma, false, with_labels);
     if (!e)
         return NULL;
+    if (parser->tok != ';') {
+        parseerror(parser, "semicolon expected after expression");
+        ast_unref(e);
+        return NULL;
+    }
     if (!parser_next(parser)) {
-        ast_delete(e);
+        ast_unref(e);
         return NULL;
     }
     return e;