public override void EnterOption([NotNull] ANTLRv4Parser.OptionContext context) { string optionName = context.identifier()?.GetText(); if (optionName == "superClass") { SuperClass = context.optionValue()?.GetText(); } }
public override void EnterOption([NotNull] ANTLRv4Parser.OptionContext context) { if (context.ChildCount < 3) { return; } if (context.GetChild(0) == null) { return; } if (context.GetChild(0).GetText() != "tokenVocab") { return; } string dep_grammar = context.GetChild(2).GetText(); string file = _pd.Item.FullPath; string dir = System.IO.Path.GetDirectoryName(file); string dep = dir + System.IO.Path.DirectorySeparatorChar + dep_grammar + ".g4"; dep = Workspaces.Util.GetProperFilePathCapitalization(dep); if (dep == null) { return; } _pd.Imports.Add(dep); if (!AntlrGrammarDetails._dependent_grammars.ContainsKey(dep)) { AntlrGrammarDetails._dependent_grammars.Add(dep); } bool found = false; foreach (string f in AntlrGrammarDetails._dependent_grammars[dep]) { if (f == file) { found = true; break; } } if (!found) { AntlrGrammarDetails._dependent_grammars.Add(dep, file); } saw_tokenVocab_option = true; }
/// <summary> /// Exit a parse tree produced by <see cref="ANTLRv4Parser.option"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitOption([NotNull] ANTLRv4Parser.OptionContext context) { }
/// <summary> /// Visit a parse tree produced by <see cref="ANTLRv4Parser.option"/>. /// <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 VisitOption([NotNull] ANTLRv4Parser.OptionContext context) { return(VisitChildren(context)); }