public bool Visit(SubroutineBlock node)
        {
            foreach (var nodeDeclPart in node.DeclParts)
            {
                nodeDeclPart.Accept(this);
            }

            node.CompoundStatement.Accept(this);

            return(true);
        }
Exemplo n.º 2
0
//        public AstPrinterNode Visit(InitVarDecl node)
//        {
//            var printer = new AstPrinterNode(node.ToString());
//            printer.AddChild(node.Ident.Accept(this));
//            printer.AddChild(node.IdentType.Accept(this));
//            printer.AddChild(node.Expression.Accept(this));
//            return printer;
//        }

//        public AstPrinterNode Visit(ProcFuncDeclsPart node)
//        {
//            var printer = new AstPrinterNode(node.ToString());
//            foreach (var ident in node.Decls)
//            {
//                printer.AddChild(ident.Accept(this));
//            }
//
//            return printer;
//        }

//        public AstPrinterNode Visit(ProcDecl node)
//        {
//            var printer = new AstPrinterNode(node.ToString());
//            printer.AddChild(node.ProcHeader.Accept(this));
//            printer.AddChild(node.Block.Accept(this));
//            return printer;
//        }
//
//        public AstPrinterNode Visit(ProcHeader node)
//        {
//            var printer = new AstPrinterNode(node.ToString());
//            printer.AddChild(node.Name.Accept(this));
//            foreach (var param in node.ParamList)
//            {
//                printer.AddChild(param.Accept(this));
//            }
//
//            return printer;
//        }
//
//        public AstPrinterNode Visit(FuncDecl node)
//        {
//            var printer = new AstPrinterNode(node.ToString());
//            printer.AddChild(node.FuncHeader.Accept(this));
//            printer.AddChild(node.Block.Accept(this));
//            return printer;
//        }
//
//        public AstPrinterNode Visit(FuncHeader node)
//        {
//            var printer = new AstPrinterNode(node.ToString());
//            printer.AddChild(node.Name.Accept(this));
//            foreach (var param in node.ParamList)
//            {
//                printer.AddChild(param.Accept(this));
//            }
//
//            printer.AddChild(node.ReturnType.Accept(this));
//            return printer;
//        }

        public AstPrinterNode Visit(SubroutineBlock node)
        {
            var printer = new AstPrinterNode(node.ToString());

            foreach (var declPart in node.DeclParts)
            {
                printer.AddChild(declPart.Accept(this));
            }

            printer.AddChild(node.CompoundStatement.Accept(this));
            return(printer);
        }