use of org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynState in project xtext-core by eclipse.
the class AbstractSyntacticSequencer method acceptNodes.
protected void acceptNodes(ISynNavigable fromState, INode fromNode, INode toNode) {
RuleCallStack stack = contexts.peek().stack.clone();
List<INode> nodes = collectNodes(fromNode, toNode);
if (nodes != null) {
for (INode next : nodes) {
List<ISynState> path = fromState.getShortestPathTo((AbstractElement) next.getGrammarElement(), stack);
if (path != null) {
if (path.get(path.size() - 1) instanceof ISynEmitterState)
fromState = (ISynEmitterState) path.get(path.size() - 1);
else
return;
acceptNode(next);
}
}
}
}
use of org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynState in project xtext-core by eclipse.
the class AbstractSyntacticSequencer method navigateToEmitter.
protected ISynFollowerOwner navigateToEmitter(ISynFollowerOwner fromState, INode fromNode, AbstractElement toEle, INode toNode, RuleCallStack stack) {
if (fromState instanceof ISynAbsorberState)
return fromState;
if (fromState instanceof ISynNavigable) {
ISynNavigable fromEmitter = (ISynNavigable) fromState;
if (!fromEmitter.hasEmitters())
return fromEmitter.getTarget();
List<ISynState> pathAndElement = fromEmitter.getShortestPathTo(toEle, stack);
if (pathAndElement == null) {
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createUnexpectedEmitterDiagnostic(fromEmitter, toEle, stack));
return null;
}
List<ISynState> path = pathAndElement.subList(0, pathAndElement.size() - 1);
accept(fromNode, path, stack);
return pathAndElement.get(pathAndElement.size() - 1);
}
throw new IllegalStateException();
}
use of org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynState in project xtext-core by eclipse.
the class AbstractSyntacticSequencer method navigateToAbsorber.
protected ISynAbsorberState navigateToAbsorber(ISynFollowerOwner fromState, INode fromNode, INode toNode, RuleCallStack stack) {
if (fromState instanceof ISynAbsorberState)
return (ISynAbsorberState) fromState;
if (fromState instanceof ISynNavigable) {
ISynNavigable fromEmitter = (ISynNavigable) fromState;
// RCStack back = stack.clone();
if (fromEmitter.hasEmitters()) {
List<ISynState> path = fromEmitter.getShortestStackpruningPathToAbsorber(stack);
accept(fromNode, path, stack);
}
return fromEmitter.getTarget();
}
throw new IllegalStateException();
}
Aggregations