public void Main(string[] args)
        {
            Start:
            Console.Write("> ");
            var data = Console.ReadLine();

            var lexer = new TemplateLexer(data);
            do
            {
                var token = lexer.Next();
                Console.WriteLine("{0} ({1}, {2}): {3}", token.TokenKind.ToString(), token.Line, token.Col
                    , token.Data);
                if (token.TokenKind == TokenKind.EOF)
                    break;
            } while (true);

            goto Start;
        }
 public TemplateParser(TemplateLexer lexer)
 {
     this.lexer = lexer;
     this.elements = new List<Element>();
 }
        /// <summary>
        /// load template from string
        /// </summary>
        /// <param name="name">name of template</param>
        /// <param name="data">string containg code for template</param>
        /// <returns></returns>
        public static Template FromString(string name, string data)
        {
            TemplateLexer lexer = new TemplateLexer(data);
            TemplateParser parser = new TemplateParser(lexer);
            List<Element> elems = parser.Parse();

            TagParser tagParser = new TagParser(elems);
            elems = tagParser.CreateHierarchy();

            return new Template(name, elems);
        }