public override ItemSequence VisitLexerRuleSpec([NotNull] ANTLRv4Parser.LexerRuleSpecContext context) { var displayName = context.FRAGMENT()?.GetText() + " " + context.TOKEN_REF(); var comments = context.DOC_COMMENT().Select(x => x.GetText()).Select(CreateComment).Select(x => Create($"{context.TOKEN_REF().GetText()} Comment", DiagramOf(x))); return(comments.Concat(SequenceOf(displayName, Transform(context.lexerRuleBlock().lexerAltList())))); }
public override void EnterLexerRuleSpec([NotNull] ANTLRv4Parser.LexerRuleSpecContext context) { Rules.Add(context); ITerminalNode token_ref = context.TOKEN_REF(); LHS.Add(token_ref); current_nonterminal = token_ref; RHS[current_nonterminal] = new List <ITerminalNode>(); }
public override void EnterLexerRuleSpec([NotNull] ANTLRv4Parser.LexerRuleSpecContext context) { int i; for (i = 0; i < context.ChildCount; ++i) { if (!(context.GetChild(i) is TerminalNodeImpl)) { continue; } TerminalNodeImpl c = context.GetChild(i) as TerminalNodeImpl; if (c.Symbol.Type == ANTLRv4Lexer.TOKEN_REF) { break; } } if (i == context.ChildCount) { return; } TerminalNodeImpl token_ref = context.GetChild(i) as TerminalNodeImpl; string id = token_ref.GetText(); ISymbol sym = new TerminalSymbol(id, token_ref.Symbol); _pd.RootScope.define(ref sym); CombinedScopeSymbol s = (CombinedScopeSymbol)sym; _pd.Attributes[context] = new List <CombinedScopeSymbol>() { s }; _pd.Attributes[context.GetChild(i)] = new List <CombinedScopeSymbol>() { s }; }
/// <summary> /// Exit a parse tree produced by <see cref="ANTLRv4Parser.lexerRuleSpec"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitLexerRuleSpec([NotNull] ANTLRv4Parser.LexerRuleSpecContext context) { }
/// <summary> /// Visit a parse tree produced by <see cref="ANTLRv4Parser.lexerRuleSpec"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public virtual Result VisitLexerRuleSpec([NotNull] ANTLRv4Parser.LexerRuleSpecContext context) { return(VisitChildren(context)); }
public override void ExitLexerRuleSpec([NotNull] ANTLRv4Parser.LexerRuleSpecContext context) { _lexer = false; }
public override void EnterLexerRuleSpec([NotNull] ANTLRv4Parser.LexerRuleSpecContext context) { _lexer = true; }