Ejemplo n.º 1
0
        public virtual bool Pass(YyParser syms, int snum, out ParserEntry entry)
        {
            ParsingInfo parsingInfo = (ParsingInfo)syms.symbolInfo[(object)this.yynum];

            if (parsingInfo == null)
            {
                string s = string.Format("No parsinginfo for symbol {0} {1}", (object)this.yyname, (object)this.yynum);
                syms.erh.Error((CSToolsException) new CSToolsFatalException(9, this.yylx, this.yyname, s));
            }
            bool flag = parsingInfo.m_parsetable.Contains((object)snum);

            entry = !flag ? (ParserEntry)null : (ParserEntry)parsingInfo.m_parsetable[(object)snum];
            return(flag);
        }
Ejemplo n.º 2
0
        public virtual bool Pass(YyParser syms, int snum, out ParserEntry entry)
        {
            ParsingInfo pi = (ParsingInfo)syms.symbolInfo[yynum];

            if (pi == null)
            {
                string s = string.Format("No parsinginfo for symbol {0} {1}", yyname, yynum);
                syms.erh.Error(new CSToolsFatalException(9, yylx, yyname, s));
            }
            bool r = pi.m_parsetable.Contains(snum);

            entry = r ? ((ParserEntry)pi.m_parsetable[snum]) : null;
            return(r);
        }
Ejemplo n.º 3
0
        private void PrintTransition(ParsingInfo pi)
        {
            ParserEntry parserEntry = (ParserEntry)pi.m_parsetable[(object)this.m_state];

            if (parserEntry == null)
            {
                return;
            }
            Console.Write("        {0}  {1}  ", (object)pi.m_name, (object)parserEntry.str);
            if (parserEntry.m_action != null)
            {
                parserEntry.m_action.Print();
            }
            Console.WriteLine();
        }
Ejemplo n.º 4
0
        public override bool Pass(Symbols syms, int snum, out ParserEntry entry)
        {
            if (!yyname().Equals("TOKEN"))             // derived classes' parsetable do not depend on yytext
            {
                return(base.Pass(syms, snum, out entry));
            }
            //Console.WriteLine("Retrieving Parsetable for literal {0}",m_str);
            ParsingInfo pi = (ParsingInfo)syms.literalInfo[m_str];

            if (pi == null)
            {
                syms.erh.Error(new CSToolsException(10, yylx, m_str, String.Format("Parser does not recognise literal <{0}>", m_str)));
            }
            bool r = pi.m_parsetable.Contains(snum);

            entry = r?((ParserEntry)pi.m_parsetable[snum]):null;
            return(r);
        }
Ejemplo n.º 5
0
        public new static object Serialise(object o, Serialiser s)
        {
            if (s == null)
            {
                return((object)new ParserReduce());
            }
            ParserReduce parserReduce = (ParserReduce)o;

            if (s.Encode)
            {
                ParserEntry.Serialise((object)parserReduce, s);
                s.Serialise((object)parserReduce.m_depth);
                s.Serialise((object)parserReduce.m_prod);
                return((object)null);
            }
            ParserEntry.Serialise((object)parserReduce, s);
            parserReduce.m_depth = (int)s.Deserialise();
            parserReduce.m_prod  = (Production)s.Deserialise();
            return((object)parserReduce);
        }
Ejemplo n.º 6
0
        public override bool Pass(YyParser syms, int snum, out ParserEntry entry)
        {
            if (yynum == 1)
            {
                Literal lit = (Literal)syms.literals[yytext];
                if (lit != null)
                {
                    num = (int)lit.m_yynum;
                }
            }
            ParsingInfo pi = (ParsingInfo)syms.symbolInfo[yynum];

            if (pi == null)
            {
                string s = string.Format("Parser does not recognise literal {0}", yytext);
                syms.erh.Error(new CSToolsFatalException(9, yylx, yyname, s));
            }
            bool r = pi.m_parsetable.Contains(snum);

            entry = r ? ((ParserEntry)pi.m_parsetable[snum]) : null;
            return(r);
        }
Ejemplo n.º 7
0
        public override bool Pass(YyParser syms, int snum, out ParserEntry entry)
        {
            if (this.yynum == 1)
            {
                Literal literal = (Literal)syms.literals[(object)this.yytext];
                if (literal != null)
                {
                    this.num = literal.m_yynum;
                }
            }
            ParsingInfo parsingInfo = (ParsingInfo)syms.symbolInfo[(object)this.yynum];

            if (parsingInfo == null)
            {
                string s = string.Format("Parser does not recognise literal {0}", (object)this.yytext);
                syms.erh.Error((CSToolsException) new CSToolsFatalException(9, this.yylx, this.yyname, s));
            }
            bool flag = parsingInfo.m_parsetable.Contains((object)snum);

            entry = !flag ? (ParserEntry)null : (ParserEntry)parsingInfo.m_parsetable[(object)snum];
            return(flag);
        }
 /// <exclude/>
 public override bool Pass(YyParser syms,int snum,out ParserEntry entry)
 {
     if (yynum==1)
     {
         Literal lit = (Literal)syms.literals[yytext];
         if (lit!=null)
             num = (int)lit.m_yynum;
     }
     ParsingInfo pi = (ParsingInfo)syms.symbolInfo[yynum];
     if (pi==null)
     {
         string s = string.Format("Parser does not recognise literal {0}",yytext);
         syms.erh.Error(new CSToolsFatalException(9,yylx,yyname,s));
     }
     bool r = pi.m_parsetable.Contains(snum);
     entry = r?((ParserEntry)pi.m_parsetable[snum]):null;
     return r;
 }
 /// <exclude/>
 public virtual bool Pass(YyParser syms,int snum,out ParserEntry entry)
 {
     ParsingInfo pi = (ParsingInfo)syms.symbolInfo[yynum];
     if (pi==null)
     {
         string s = string.Format("No parsinginfo for symbol {0} {1}",yyname,yynum);
         syms.erh.Error(new CSToolsFatalException(9,yylx,yyname,s));
     }
     bool r = pi.m_parsetable.Contains(snum);
     entry = r?((ParserEntry)pi.m_parsetable[snum]):null;
     return r;
 }
Ejemplo n.º 10
0
		public override bool Pass(Symbols syms,int snum, out ParserEntry entry)
		{
			if (!yyname().Equals("TOKEN")) // derived classes' parsetable do not depend on yytext
				return base.Pass(syms,snum,out entry);
			//Console.WriteLine("Retrieving Parsetable for literal {0}",m_str);
			ParsingInfo pi = (ParsingInfo)syms.literalInfo[m_str];
			if (pi==null)
				syms.erh.Error(new CSToolsException(10,yylx,m_str,String.Format("Parser does not recognise literal <{0}>",m_str)));
			bool r = pi.m_parsetable.Contains(snum);
			entry = r?((ParserEntry)pi.m_parsetable[snum]):null;
			return r;
		}