/// <inheritdoc/> public override object VisitOptionDefinition([NotNull] LGFileParser.OptionDefinitionContext context) { var originalText = context.OPTION().GetText(); var result = string.Empty; if (!string.IsNullOrWhiteSpace(originalText)) { var matchResult = OptionRegex.Match(originalText); if (matchResult.Success && matchResult.Groups.Count == 2) { result = matchResult.Groups[1].Value?.Trim(); } } if (!string.IsNullOrWhiteSpace(result)) { _templates.Options.Add(result); } return(null); }
/// <summary> /// Exit a parse tree produced by <see cref="LGFileParser.optionDefinition"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitOptionDefinition([NotNull] LGFileParser.OptionDefinitionContext context) { }
/// <summary> /// Visit a parse tree produced by <see cref="LGFileParser.optionDefinition"/>. /// <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 VisitOptionDefinition([NotNull] LGFileParser.OptionDefinitionContext context) { return(VisitChildren(context)); }