コード例 #1
0
        public override int VisitFunctionDefinition(MINICParser.FunctionDefinitionContext context)
        {
            int    serial = ms_serialCounter++;
            string s      = "FunctionDefinition_" + serial;

            outFile.WriteLine("\"{0}\"->\"{1}\";", m_labels.Peek(), s);

            m_labels.Push(s);

            base.VisitChildren(context);

            m_labels.Pop();
            return(0);
        }
コード例 #2
0
        public override int VisitFunctionDefinition(MINICParser.FunctionDefinitionContext context)
        {
            ASTComposite           m_parent = m_parents.Peek();
            CASTFunctionDefinition newnode  = new CASTFunctionDefinition(context.GetText(), m_parents.Peek(), 3);

            m_parent.AddChild(newnode, m_parentContext.Peek());
            m_parents.Push(newnode);
            this.VisitTerminalInContext(context, context.IDENTIFIER().Symbol, m_parentContext,
                                        contextType.CT_FUNCTIONDEFINITION_IDENTIFIER);
            if (context.fargs() != null)
            {
                this.VisitElementInContext(context.fargs(), m_parentContext, contextType.CT_FUNCTIONDEFINITION_FARGS);
            }
            this.VisitElementInContext(context.compoundStatement(), m_parentContext, contextType.CT_FUNCTIONDEFINITION_BODY);
            m_parents.Pop();
            return(0);
        }