public Forest<R> parse(Token.Stream<T> input) throws IOException, Failed {
GSS gss = new GSS();
Token.Location loc = input.getLocation();
- GSS.Phase current = gss.new Phase(null, input.next(), loc);
+ GSS.Phase current = gss.new Phase(null, input.next(1), loc);
current.newNode(null, null, pt.start, true);
+ int count = 1;
for(;;) {
loc = input.getLocation();
- GSS.Phase next = gss.new Phase(current, input.next(), loc);
+ GSS.Phase next = gss.new Phase(current, input.next(count), loc);
current.reduce();
Forest forest = current.token==null ? null : shiftedToken((T)current.token, loc);
current.shift(next, forest);
- if (current.isDone()) return (Forest<R>)current.finalResult;
+ count = next.hash.size();
current.checkFailure();
+ if (current.isDone()) return (Forest<R>)current.finalResult;
current = next;
}
}