// recog null unless ParserRuleContext, in which case we use subclass toString(...) public virtual string ToString(IRecognizer recog, Antlr4.Runtime.RuleContext stop) { string[] ruleNames = recog != null ? recog.RuleNames : null; IList <string> ruleNamesList = ruleNames != null?Arrays.AsList(ruleNames) : null; return(ToString(ruleNamesList, stop)); }
public virtual string ToString(IList <string> ruleNames, Antlr4.Runtime.RuleContext stop) { StringBuilder buf = new StringBuilder(); Antlr4.Runtime.RuleContext p = this; buf.Append("["); while (p != null && p != stop) { if (ruleNames == null) { if (!p.IsEmpty()) { buf.Append(p.invokingState); } } else { int ruleIndex = p.GetRuleIndex(); string ruleName = ruleIndex >= 0 && ruleIndex < ruleNames.Count ? ruleNames[ruleIndex ] : ruleIndex.ToString(); buf.Append(ruleName); } if (p.parent != null && (ruleNames != null || !p.parent.IsEmpty())) { buf.Append(" "); } p = p.parent; } buf.Append("]"); return(buf.ToString()); }
public override bool Sempred(Antlr4.Runtime.RuleContext _localctx, int ruleIndex, int actionIndex) { switch (ruleIndex) { case 1: return(expression_sempred((ExpressionContext)_localctx, actionIndex)); } return(true); }
public virtual int Depth() { int n = 0; Antlr4.Runtime.RuleContext p = this; while (p != null) { p = p.parent; n++; } return(n); }
public static Antlr4.Runtime.RuleContext GetChildContext(Antlr4.Runtime.RuleContext parent, int invokingState) { return(new Antlr4.Runtime.RuleContext(parent, invokingState)); }
public RuleContext(Antlr4.Runtime.RuleContext parent, int invokingState) { this.parent = parent; //if ( parent!=null ) System.out.println("invoke "+stateNumber+" from "+parent); this.invokingState = invokingState; }
public override bool Precpred(RuleContext localctx, int precedence) { return(precedence >= _precedenceStack[_precedenceStack.Count - 1]); }
public virtual void Action(RuleContext _localctx, int ruleIndex, int actionIndex) { }
public virtual bool Precpred(RuleContext localctx, int precedence) { return(true); }
// subclass needs to override these if there are sempreds or actions // that the ATN interp needs to execute public virtual bool Sempred(RuleContext _localctx, int ruleIndex, int actionIndex) { return(true); }
public virtual string GetText(RuleContext ctx) { return(GetText(ctx.SourceInterval)); }
public RecognitionException(Lexer lexer, ICharStream input) { this.recognizer = lexer; this.input = input; this.ctx = null; }