public AstPrinterNode Visit(TypeDecl node) { var printer = new AstPrinterNode(node.ToString()); printer.AddChild(node.Ident.Accept(this)); printer.AddChild(node.IdentType.Accept(this)); return(printer); }
static string Convert(string input) { var tokens = input.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); int index = 0; TypeDecl decl = null; string name = null; Assert.IsTrue(TypeDecl.ParseType(tokens, ref index, out decl, out name)); Assert.AreEqual(tokens.Length, index); if (name == null) { return(decl.ToString()); } else { return(name + " : " + decl.ToString()); } }