コード例 #1
0
 /// <summary>
 /// Initializes the function invocation
 /// </summary>
 public FunctionInvocationNode(Z80AsmParser.FunctionInvocationContext context, Z80AsmVisitor visitor)
     : base(context)
 {
     FunctionName = context.IDENTIFIER()?.GetText()?.ToLower();
     if (FunctionName != null)
     {
         visitor.AddFunction(context);
     }
     ArgumentExpressions = context.expr().Select(expr => (ExpressionNode)visitor.VisitExpr(expr)).ToList();
 }
コード例 #2
0
        /// <summary>
        /// Visit a parse tree produced by <see cref="Z80AsmParser.functionInvocation"/>.
        /// <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 override object VisitFunctionInvocation(Z80AsmParser.FunctionInvocationContext context)
        {
            var funcName = context.IDENTIFIER()?.GetText()?.ToLower();

            if (funcName != null)
            {
                AddFunction(context);
            }
            var args = context.expr().Select(expr => (ExpressionNode)VisitExpr(expr)).ToList();

            return(new FunctionInvocationNode(funcName, args));
        }