Example #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);
        }
Example #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);
        }
Example #3
0
        public static void BuildParseTable(Transition t)
        {
            YyParser     symbols       = t.m_ps.m_sgen.m_symbols;
            ParsingInfo  parsingInfo   = t.ParsingInfo;
            ParserReduce parserReduce1 = (ParserReduce)null;

            foreach (ParserReduce parserReduce2 in (IEnumerable)t.m_reduce.Values)
            {
                if ((!t.m_ps.m_sgen.m_lalrParser ? (parserReduce2.m_prod.m_lhs.m_follow.Contains(t.m_A) ? 1 : 0) : (parserReduce2.m_lookAhead.Contains(t.m_A) ? 1 : 0)) != 0)
                {
                    if (parserReduce1 != null)
                    {
                        symbols.erh.Error(new CSToolsException(12, string.Format("reduce/reduce conflict {0} vs {1}", (object)parserReduce1.m_prod.m_pno, (object)parserReduce2.m_prod.m_pno) + string.Format(" state {0} on {1}", (object)t.m_ps.m_state, (object)t.m_A.yytext)));
                    }
                    parserReduce1 = parserReduce2;
                }
            }
            if (t.m_next != null && t.m_A != symbols.EOFSymbol)
            {
                if (parserReduce1 == null)
                {
                    parsingInfo.m_parsetable[(object)t.m_ps.m_state] = (object)t.m_next;
                }
                else
                {
                    switch (t.m_A.ShiftPrecedence(parserReduce1.m_prod, t.m_ps))
                    {
                    case Precedence.PrecType.left:
                        parsingInfo.m_parsetable[(object)t.m_ps.m_state] = (object)t.m_next;
                        break;

                    case Precedence.PrecType.right:
                        parsingInfo.m_parsetable[(object)t.m_ps.m_state] = (object)parserReduce1;
                        break;
                    }
                }
            }
            else
            {
                if (parserReduce1 == null)
                {
                    return;
                }
                parsingInfo.m_parsetable[(object)t.m_ps.m_state] = (object)parserReduce1;
            }
        }
Example #4
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);
        }
Example #5
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);
        }
Example #6
0
		public LSLSyntax
			(YyParser syms,ErrorHandler erh):base(syms,new LSLTokens(erh)) {}
Example #7
0
		public LSLSyntax
			(YyParser syms):base(syms,new LSLTokens()) {}
/// <exclude/>
public syntax(YyParser syms,ErrorHandler erh):base(syms,new Exam(erh)) {}
/// <exclude/>
public syntax(YyParser syms):base(syms,new Exam()) {}
Example #10
0
 public Parser(YyParser syms, Lexer lexer)
 {
     this.m_lexer       = lexer;
     this.m_symbols     = syms;
     this.m_symbols.erh = this.m_lexer.tokens.erh;
 }
 /// <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;
 }
Example #13
0
public PCParser
(YyParser syms,ErrorHandler erh):base(syms,new PCLexer(erh)) {}
Example #14
0
public PCParser
(YyParser syms):base(syms,new PCLexer()) {}
Example #15
0
		public Parser(YyParser syms,Lexer lexer) 
		{
			m_lexer = lexer;
			m_symbols = syms;
			m_symbols.erh = m_lexer.tokens.erh;
		}
Example #16
0
		public Sfactory(YyParser syms,string cls_name,SCreator cr) 
		{
			syms.types[cls_name] = cr;
		}
Example #17
0
 public Sfactory(YyParser syms, string cls_name, SCreator cr)
 {
     syms.types[(object)cls_name] = (object)cr;
 }