public virtual string ToString([Nullable] IList <string> ruleNames, [Nullable] 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.RuleIndex; 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()); }
// recog null unless ParserRuleContext, in which case we use subclass toString(...) public virtual string ToString(IRecognizer recog, [Nullable] 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 int Depth() { int n = 0; Antlr4.Runtime.RuleContext p = this; while (p != null) { p = p.parent; n++; } return(n); }
internal bool GetPropertyInContext(string name, Antlr4.Runtime.RuleContext scope, out Member property) { property = GetProperty(name); if (!property.isPrivate) { return(true); } var parent = (Engine.Parser.GetDefinitionBlock(scope)).LexicalEnvironment; var canAccess = false; while (parent != null) { if (parent.Context == property.definitionBlock) { canAccess = true; } parent = parent.Parent; } return(canAccess); }
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; }
internal static void AddError(Node node, string message, Antlr4.Runtime.RuleContext context, MessageCode code = MessageCode.SyntaxErrorInParser) { AddError(node, message, ParseTreeUtils.GetFirstToken(context), RuleStackBuilder.GetRuleStack(context), code); }