Search in sources :

Example 1 with ISynEmitterState

use of org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynEmitterState in project xtext-core by eclipse.

the class SyntacticSequencerPDAProviderNavigatorTest method newStack.

protected RuleCallStack newStack(ISynTransition start, String... ruleCalls) {
    RuleCallStack result = new RuleCallStack();
    for (String name : ruleCalls) {
        ISynEmitterState emitter = findEmitter(start, name, Sets.<ISynFollowerOwner>newHashSet());
        result.push((RuleCall) emitter.getGrammarElement());
    }
    return result;
}
Also used : RuleCallStack(org.eclipse.xtext.serializer.sequencer.RuleCallStack) ISynEmitterState(org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynEmitterState)

Example 2 with ISynEmitterState

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

Aggregations

ISynEmitterState (org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynEmitterState)2 INode (org.eclipse.xtext.nodemodel.INode)1 ISynState (org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynState)1 RuleCallStack (org.eclipse.xtext.serializer.sequencer.RuleCallStack)1