private dynamic ResolveTerm(ProfaneParser.TermContext termContext) { if (termContext.number() != null) { return(termContext.number().GetText()); } else if (termContext.ID() != null) { return(termContext.ID().GetText()); } else if (termContext.STRING() != null) { Regex regex = new Regex("/\\$\\{([^\\}]+)\\}/g"); var contextText = termContext.GetText(); var replacedString = regex.Replace(contextText, "$1"); return(replacedString); } else { return(default(dynamic)); } }
/// <summary> /// Exit a parse tree produced by <see cref="ProfaneParser.term"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitTerm([NotNull] ProfaneParser.TermContext context) { }