use of org.eclipse.xtext.grammaranalysis.IPDAState in project xtext-core by eclipse.
the class AbstractPDAProvider method getPDA.
/**
* @since 2.0
*/
@Override
public IPDAState getPDA(CTX context) {
PDAContext<CTX> ctx = createContext(context);
ctx.start = createState(IPDAState.PDAStateType.START, null);
ctx.stop = createState(IPDAState.PDAStateType.STOP, null);
Set<Pair<Boolean, INFAState<?, ?>>> visited = Sets.newHashSet();
ctx.start.followers = Sets.newHashSet();
for (INFAState<?, ?> state : getStartFollowers(context)) {
boolean targetCanReturn = !canEnterRuleCall(state);
boolean targetReturning = !state.getOutgoingAfterReturn().isEmpty() && targetCanReturn;
RuleCallStackElement stack = new RuleCallStackElement(null, null);
IPDAState s = createState(ctx, stack, state, null, targetReturning, targetCanReturn, visited);
if (s != null)
ctx.start.followers.add(s);
}
return ctx.start;
}