[vala] Genie: Fix assertion failure on large rollback in parser
- From: Jamie McCracken <jamiemcc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Genie: Fix assertion failure on large rollback in parser
- Date: Mon, 24 May 2010 19:27:04 +0000 (UTC)
commit e7d524d32a8fd3a77207766bc7dd5031ec3cdc21
Author: Jamie McCracken <jamie.mccrack gmail com>
Date: Mon May 24 14:51:59 2010 -0400
Genie: Fix assertion failure on large rollback in parser
vala/valagenieparser.vala | 15 ++++++++++++++-
vala/valageniescanner.vala | 9 +++++++++
2 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index a1305ea..18bf146 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 aacc3ed..5c2bb6d 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) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]