示例#1
0
 public virtual IntervalSet Look(ATNState s, ATNState stopState, RuleContext ctx)
 {
     IntervalSet r = new IntervalSet();
     bool seeThruPreds = true;
     PredictionContext lookContext = ctx != null ? PredictionContext.FromRuleContext(s.atn, ctx) : null;
     Look_(s, stopState, lookContext, r, new HashSet<ATNConfig>(), new BitSet(), seeThruPreds, true);
     return r;
 }
示例#2
0
        public static PredictionContext FromRuleContext(ATN atn, RuleContext outerContext)
        {
            if (outerContext == null)
            {
                outerContext = ParserRuleContext.EMPTY;
            }
            if (outerContext.Parent == null || outerContext == ParserRuleContext.EMPTY)
            {
                return(PredictionContext.EMPTY);
            }
            PredictionContext parent     = PredictionContext.FromRuleContext(atn, outerContext.Parent);
            ATNState          state      = atn.states[outerContext.invokingState];
            RuleTransition    transition = (RuleTransition)state.Transition(0);

            return(parent.GetChild(transition.followState.stateNumber));
        }