Java Code Examples for org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable#hasEmitters()

The following examples show how to use org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable#hasEmitters() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSyntacticSequencer.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
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();
}
 
Example 2
Source File: AbstractSyntacticSequencer.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
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();
}