public override AstNode VisitIdentifier(StannumParser.IdentifierContext context) { var raw = context.GetText().Replace(" ", "").Replace("\t", ""); if (raw.Substring(0, 1) == "@") { raw = raw.Substring(1); } var first = raw.Substring(0, 1); var rest = raw.Substring(1).Replace("_", "").ToLower(); return(new Identifier(first + rest)); }
/// <summary> /// Visit a parse tree produced by <see cref="StannumParser.identifier"/>. /// <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 VisitIdentifier([NotNull] StannumParser.IdentifierContext context) { return(VisitChildren(context)); }