protected virtual Handle Action(GrammarAST node, ILexerAction lexerAction) { ATNState left = NewState(node); ATNState right = NewState(node); bool isCtxDependent = false; int lexerActionIndex = GetLexerActionIndex(lexerAction); ActionTransition a = new ActionTransition(right, currentRule.index, lexerActionIndex, isCtxDependent); left.AddTransition(a); node.atnState = left; Handle h = new Handle(left, right); return h; }
public override Handle LexerAltCommands(Handle alt, Handle cmds) { Handle h = new Handle(alt.left, cmds.right); Epsilon(alt.right, cmds.left); return h; }
public override Handle Rule(GrammarAST ruleAST, string name, Handle blk) { ruleCommands.Clear(); return base.Rule(ruleAST, name, blk); }
public virtual Handle LexerAltCommands([NotNull] Handle alt, [NotNull] Handle cmds) { throw new InvalidOperationException("This element is not allowed in parsers."); }
public virtual Handle ListLabel([NotNull] Handle t) { return(t); }
public virtual Handle RuleRef([NotNull] GrammarAST node) { Handle h = _RuleRef(node); return(h); }
public virtual Handle Rule([NotNull] GrammarAST ruleAST, [NotNull] string name, [NotNull] Handle blk) { Rule r = g.GetRule(name); RuleStartState start = atn.ruleToStartState[r.index]; Epsilon(start, blk.left); RuleStopState stop = atn.ruleToStopState[r.index]; Epsilon(blk.right, stop); Handle h = new Handle(start, stop); //ATNPrinter ser = new ATNPrinter(g, h.left); //System.Console.WriteLine(ruleAST.ToStringTree() + ":\n" + ser.AsString()); ruleAST.atnState = start; return(h); }