Example #1
0
        public new static object Serialise(object o, Serialiser s)
        {
            ParserAction parserAction = (ParserAction)o;

            if (s.Encode)
            {
                CSymbol.Serialise((object)parserAction, s);
                s.Serialise((object)parserAction.m_sym);
                s.Serialise((object)parserAction.m_len);
                return((object)null);
            }
            CSymbol.Serialise((object)parserAction, s);
            parserAction.m_sym = (CSymbol)s.Deserialise();
            parserAction.m_len = (int)s.Deserialise();
            return((object)parserAction);
        }
Example #2
0
 public void ReduceStates()
 {
     for (ProdItemList prodItemList = this.m_items; prodItemList.m_pi != null; prodItemList = prodItemList.m_next)
     {
         ProdItem pi = prodItemList.m_pi;
         if (pi.Next() == null)
         {
             Production prod = pi.m_prod;
             if (prod.m_pno != 0)
             {
                 int          count = prod.m_rhs.Count;
                 CSymbol      rh;
                 ParserReduce parserReduce;
                 if (count > 0 && (rh = (CSymbol)prod.m_rhs[count - 1]) != null && rh.IsAction())
                 {
                     ParserAction action = (ParserAction)rh;
                     action.m_len = count;
                     parserReduce = new ParserReduce(action, count - 1, prod);
                 }
                 else
                 {
                     this.m_sgen.m_lexer.yytext = "%" + prod.m_lhs.yytext;
                     this.m_sgen.m_prod         = prod;
                     ParserSimpleAction parserSimpleAction = new ParserSimpleAction(this.m_sgen);
                     parserSimpleAction.m_sym = prod.m_lhs;
                     parserSimpleAction.m_len = count;
                     parserReduce             = new ParserReduce((ParserAction)parserSimpleAction, count, prod);
                 }
                 foreach (CSymbol key in (IEnumerable)pi.m_prod.m_lhs.m_follow.Keys)
                 {
                     this.GetTransition(key).m_reduce[(object)prod] = (object)parserReduce;
                 }
             }
         }
     }
 }
Example #3
0
		public ParserReduce(ParserAction action,int depth,Production prod) : base(action) {m_depth=depth; m_prod = prod; }
Example #4
0
		public ParserShift(ParserAction action,ParseState next) : base(action) { m_next=next; }
Example #5
0
		public ParserEntry(ParserAction action) { m_action=action; }
Example #6
0
		public ParserEntry() { m_action = null; }
Example #7
0
 public ParserReduce(ParserAction action, int depth, Production prod)
     : base(action)
 {
     this.m_depth = depth;
     this.m_prod  = prod;
 }