Search in sources :

Example 1 with ISynNavigable

use of org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable 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();
}
Also used : ISynAbsorberState(org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynAbsorberState) ISynNavigable(org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable) ISynState(org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynState)

Example 2 with ISynNavigable

use of org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable 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();
}
Also used : ISynAbsorberState(org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynAbsorberState) ISynNavigable(org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable) ISynState(org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynState)

Aggregations

ISynAbsorberState (org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynAbsorberState)2 ISynNavigable (org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable)2 ISynState (org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynState)2