use of org.eclipse.xtext.parser.packrat.consumers.IRootConsumerListener in project xtext-core by eclipse.
the class AbstractPackratParser method parse.
protected final IParseResult parse(INonTerminalConsumer consumer) {
if (activeMarker != null)
throw new IllegalStateException("cannot parse now. Active marker is already assigned.");
IMarker rootMarker = mark();
IRootConsumerListener listener = new RootConsumerListener();
try {
consumer.consumeAsRoot(listener);
IParseResult result = getParseResultFactory().createParseResult(activeMarker, input);
rootMarker.commit();
if (activeMarker != null)
throw new IllegalStateException("cannot finish parse: active marker is still present.");
return result;
} catch (Exception e) {
throw new WrappedException(e);
}
}
Aggregations