Example #1
0
        public Template(string code, PythonEngine engine)
        {
            m_engine = engine;
            Parser par = new Parser(code, m_engine);

            m_template = par.Parse();
        }
Example #2
0
 internal override void PushItem(CompiledTemplate tpl)
 {
     if (m_separ != null)
     {
         m_separ.PushItem(tpl);
     }
     else
     {
         m_body.PushItem(tpl);
     }
 }
Example #3
0
        private void ParseInterior(string end)
        {
            string cmd = ReadInterior(end).Trim();
            int    idx = cmd.IndexOf(' ');
            string type, pars = "";

            if (idx >= 0)
            {
                type = cmd.Substring(0, idx).Trim();
                pars = cmd.Substring(idx + 1).Trim();
            }
            else
            {
                type = cmd.Trim();
            }
            if (type == "end")
            {
                if (m_stackCommands.Pop() != pars)
                {
                    ParseError("end mitchmatch");
                }
                m_stack.Pop();
            }
            else
            {
                if (m_itemTypes.ContainsKey(type))
                {
                    CompiledTemplate tpl = m_itemTypes[type](pars, m_engine);
                    m_stack.Peek().PushItem(tpl);
                    m_stack.Push(tpl);
                    m_stackCommands.Push(type);
                }
                else
                {
                    m_stack.Peek().Command(type, pars);
                }
            }
        }
Example #4
0
 internal virtual void PushItem(CompiledTemplate tpl)
 {
 }
Example #5
0
 internal override void PushItem(CompiledTemplate tpl)
 {
     m_items.Add(tpl);
 }