public override AstNode VisitValue(ALangParser.ValueContext context) { AstNode visitValue; if (context.ID() != null) { visitValue = new IdentfierNode(context) { Symbol = context.ID().GetText() } } ; else if (context.INTEGERS() != null) { var node = new IntNode(context); node.Value = Int32.Parse(context.INTEGERS().GetText()); visitValue = node; } else if (context.PIN() != null) { var node = new PinNode(context); node.Value = Int32.Parse(context.PIN().GetText().TrimStart('P')); visitValue = node; } else if (context.TIME() != null) { var node = new TimeNode(context); node.Value = Time.TimeFromString(context.TIME().GetText()); visitValue = node; } else if (context.functioncall() != null) { visitValue = context.functioncall().Accept(this); } else { visitValue = null; } return(visitValue); }
/// <summary> /// Exit a parse tree produced by <see cref="ALangParser.value"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitValue([NotNull] ALangParser.ValueContext context) { }
/// <summary> /// Visit a parse tree produced by <see cref="ALangParser.value"/>. /// <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 VisitValue([NotNull] ALangParser.ValueContext context) { return(VisitChildren(context)); }