All pastes #414684 Raw Edit

Anonymous

public text v1 · immutable
#414684 ·published 2007-03-29 05:26 UTC
rendered paste body
            //Compile an embedded boo template

             //Parse template            
            TemplateParser parser = new TemplateParser(stringReader);
            Node node = parser.Parse();
            //Construct compiler
            
            //Setup visitors
            Dictionary<int, Visitor> visitors = new Dictionary<int, Visitor>();

            //Text visitors
            visitors[(int)TemplateConstants.TEXTCHARS] = new Visitors.TextCharsVisitor();

            //Indents
            Visitors.IndentVisitor indentVisitor = new Visitors.IndentVisitor();
            visitors[(int)TemplateConstants.STARTINDENT] = indentVisitor;
            visitors[(int)TemplateConstants.ENDINDENT] = indentVisitor;
            
            //start text block and end text block
            visitors[(int)TemplateConstants.STARTTEXTBLOCK] = new Visitors.StartTextBlockVisitor(indentVisitor);
            visitors[(int)TemplateConstants.ENDTEXTBLOCK] = new Visitors.EndTextBlockVisitor();


            //Compile
            Compiler c = new Compiler();
            string results = c.Compile(node,visitors);