From: Jamie McCracken Date: Mon, 24 May 2010 18:51:59 +0000 (-0400) Subject: Genie: Fix assertion failure on large rollback in parser X-Git-Tag: 0.9.1~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7d524d32a8fd3a77207766bc7dd5031ec3cdc21;p=thirdparty%2Fvala.git Genie: Fix assertion failure on large rollback in parser --- diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala index a1305ea3d..18bf14601 100644 --- a/vala/valagenieparser.vala +++ b/vala/valagenieparser.vala @@ -200,7 +200,15 @@ public class Vala.Genie.Parser : CodeVisitor { void rollback (SourceLocation location) { while (tokens[index].begin.pos != location.pos) { - prev (); + index = (index - 1 + BUFFER_SIZE) % BUFFER_SIZE; + size++; + if (size > BUFFER_SIZE) { + scanner.seek (location); + size = 0; + index = 0; + + next (); + } } } @@ -1012,6 +1020,11 @@ public class Vala.Genie.Parser : CodeVisitor { do { if (!first) { // array of arrays: new T[][42] + + if (size_specified) { + throw new ParseError.SYNTAX (get_error ("size of inner arrays must not be specified in array creation expression")); + } + etype = new ArrayType (etype, size_specifier_list.size, etype.source_reference); } else { first = false; diff --git a/vala/valageniescanner.vala b/vala/valageniescanner.vala index aacc3edfa..5c2bb6d52 100644 --- a/vala/valageniescanner.vala +++ b/vala/valageniescanner.vala @@ -103,6 +103,15 @@ public class Vala.Genie.Scanner { bool is_ident_char (char c) { return (c.isalnum () || c == '_'); } + + public void seek (SourceLocation location) { + current = location.pos; + line = location.line; + column = location.column; + + conditional_stack = null; + state_stack = null; + } TokenType get_identifier_or_keyword (char* begin, int len) { switch (len) {