All pastes #414648 Raw Edit

Stuff

public text v1 · immutable
#414648 ·published 2007-03-29 04:28 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<string, Visitor>();

            //Text visitors
            visitors[TemplateConstants.TEXT] = new Visitors.TextVisitor();

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


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