public NonLocalAttrRef(StructDecl ctx, string ruleName, string name, int ruleIndex) : base(ctx) { this.name = name; this.ruleName = ruleName; this.ruleIndex = ruleIndex; }
public SetNonLocalAttr(StructDecl ctx, string ruleName, string name, int ruleIndex, IList<ActionChunk> rhsChunks) : base(ctx, name, rhsChunks) { this.ruleName = ruleName; this.ruleIndex = ruleIndex; }
public Action(OutputModelFactory factory, StructDecl ctx, string action) : base(factory, null) { ActionAST ast = new ActionAST(new CommonToken(ANTLRParser.ACTION, action)); RuleFunction rf = factory.GetCurrentRuleFunction(); if (rf != null) { // we can translate ast.resolver = rf.rule; chunks = ActionTranslator.TranslateActionChunk(factory, rf, action, ast); } else { chunks = new List<ActionChunk>(); chunks.Add(new ActionText(ctx, action)); } }
public RulePropertyRef_text(StructDecl ctx, string label) : base(ctx, label) { }
public LabelRef(StructDecl ctx, string name) : base(ctx) { this.name = name; }
public ActionText(StructDecl ctx, string text) : base(ctx) { this.text = text; }
public Action(OutputModelFactory factory, StructDecl ctx, Template actionST) : base(factory, null) { chunks = new List<ActionChunk>(); chunks.Add(new ActionTemplate(ctx, actionST)); }
public RuleFunction(OutputModelFactory factory, Rule r) : base(factory) { this.name = r.name; this.rule = r; if (r.modifiers != null && r.modifiers.Count > 0) { this.modifiers = new List<string>(); foreach (GrammarAST t in r.modifiers) modifiers.Add(t.Text); } modifiers = Utils.NodesToStrings(r.modifiers); index = r.index; int lfIndex = name.IndexOf(ATNSimulator.RuleVariantDelimiter); if (lfIndex >= 0) { variantOf = name.Substring(0, lfIndex); } if (r.name.Equals(r.GetBaseContext())) { ruleCtx = new StructDecl(factory, r); AddContextGetters(factory, r.g.contextASTs[r.name]); if (r.args != null) { ICollection<Attribute> decls = r.args.attributes.Values; if (decls.Count > 0) { args = new List<AttributeDecl>(); ruleCtx.AddDecls(decls); foreach (Attribute a in decls) { args.Add(new AttributeDecl(factory, a)); } ruleCtx.ctorAttrs = args; } } if (r.retvals != null) { ruleCtx.AddDecls(r.retvals.attributes.Values); } if (r.locals != null) { ruleCtx.AddDecls(r.locals.attributes.Values); } } else { if (r.args != null || r.retvals != null || r.locals != null) { throw new System.NotSupportedException("customized fields are not yet supported for customized context objects"); } } ruleLabels = r.GetElementLabelNames(); tokenLabels = r.GetTokenRefs(); if (r.exceptions != null) { exceptions = new List<ExceptionClause>(); foreach (GrammarAST e in r.exceptions) { ActionAST catchArg = (ActionAST)e.GetChild(0); ActionAST catchAction = (ActionAST)e.GetChild(1); exceptions.Add(new ExceptionClause(factory, catchArg, catchAction)); } } startState = factory.GetGrammar().atn.ruleToStartState[r.index]; }
public QRetValueRef(StructDecl ctx, string dict, string name) : base(ctx, name) { this.dict = dict; }
public ArgRef(StructDecl ctx, string name) : base(ctx, name) { }
public ListLabelRef(StructDecl ctx, string name) : base(ctx, name) { }
public TokenRef(StructDecl ctx, string name) : base(ctx) { this.name = name; }
public SetAttr(StructDecl ctx, string name, IList<ActionChunk> rhsChunks) : base(ctx) { this.name = name; this.rhsChunks = rhsChunks; }
public RetValueRef(StructDecl ctx, string name) : base(ctx) { this.name = name; }
public TokenPropertyRef_int(StructDecl ctx, string label) : base(ctx, label) { }
public TokenPropertyRef(StructDecl ctx, string label) : base(ctx) { this.label = label; }
public ActionTemplate(StructDecl ctx, Template st) : base(ctx) { this.st = st; }
public ThisRulePropertyRef_start(StructDecl ctx, string label) : base(ctx, label) { }
public ActionChunk(StructDecl ctx) { this.ctx = ctx; }