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 ();
+ }
}
}
/* valascanner.vala
*
- * Copyright (C) 2008-2009 Jürg Billeter
+ * Copyright (C) 2008-2010 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
column = 1;
}
+ public void seek (SourceLocation location) {
+ current = location.pos;
+ line = location.line;
+ column = location.column;
+
+ conditional_stack = null;
+ state_stack = null;
+ }
+
bool in_template () {
return (state_stack.length > 0 && state_stack[state_stack.length - 1] == State.TEMPLATE);
}