Tools.Parser.Pop C# (CSharp) Method

Pop() private method

private Pop ( ParseStackEntry &elt, int depth, SYMBOL ns ) : void
elt ParseStackEntry
depth int
ns SYMBOL
return void
        internal void Pop(ref ParseStackEntry elt, int depth, SYMBOL ns)
        {
            for (;m_stack.Count>0 && depth>0;depth--)
            {
                elt = (ParseStackEntry)m_stack.Pop();
                if (m_symbols.m_concrete) // building the concrete syntax tree
                    ns.kids.Push(elt.m_value); // else will be garbage collected
            }
            if (depth!=0)
                m_symbols.erh.Error(new CSToolsException(14,m_lexer,"Pop failed"));
        }

Usage Example

Beispiel #1
0
        public override void Pass(ref ParseStackEntry top)
        {
            Parser yyps = top.yyps;
            SYMBOL ns   = this.m_action.Action(yyps);

            yyps.m_ungot = top.m_value;
            if (yyps.m_debug)
            {
                Console.WriteLine("about to pop {0} count is {1}", (object)this.m_depth, (object)yyps.m_stack.Count);
            }
            yyps.Pop(ref top, this.m_depth, ns);
            if (ns.pos == 0)
            {
                ns.pos = top.m_value.pos;
            }
            top.m_value = ns;
        }