public ParseState(SymbolsGen syms, CSymbol acc) { this.m_sgen = syms; this.m_state = syms.state++; this.m_accessingSymbol = acc; this.m_items = new ProdItemList(); }
public ParserSimpleAction(SymbolsGen yyp) : base(yyp) { yyp.actions.Add((object)this); this.m_symtype = CSymbol.SymType.simpleaction; yyp.SimpleAction(this); }
public SymbolSet FirstOfRest(SymbolsGen syms) { if (this.follow != null) { return(this.follow); } this.follow = new SymbolSet(syms); bool flag = false; int count = this.m_prod.m_rhs.Count; for (int index = this.m_pos + 1; index < count; ++index) { CSymbol rh = (CSymbol)this.m_prod.m_rhs[index]; foreach (CSymbol key in (IEnumerable)rh.m_first.Keys) { this.follow.CheckIn(key); } if (!rh.IsNullable()) { flag = true; break; } } if (!flag) { this.follow.Add(this.m_prod.m_lhs.m_follow); } this.follow = this.follow.Resolve(); return(this.follow); }
public Digraph(SymbolsGen s,Relation r,Func f1,Func f2,AddToFunc d) { sg=s; R=r; F1=f1; F2=f2; DF2=d; N = new int[sg.m_trans]; for (int j=0;j<sg.m_trans;j++) N[j]=0; }
public Production(SymbolsGen syms) { this.m_lhs = (CSymbol)null; this.m_prec = 0; this.m_pno = syms.pno++; this.m_actionsOnly = true; syms.prods.Add((object)this); }
public CSymbol(SymbolsGen yyp) : base(yyp.m_lexer) { this.m_parser = yyp; this.m_symtype = CSymbol.SymType.unknown; this.m_prec = (Precedence)null; this.m_prod = (Production)null; this.m_refSymbol = (CSymbol)null; this.m_first = new SymbolSet(yyp); this.m_follow = new SymbolSet(yyp); }
public static void BuildDR(Transition t) { SymbolsGen sgen = t.m_ps.m_sgen; t.m_DR = new SymbolSet(sgen); if (t.m_next == null) { return; } foreach (Transition transition in (IEnumerable)t.m_next.m_next.m_transitions.Values) { if (transition.m_next != null && (transition.m_A.m_symtype == CSymbol.SymType.terminal || transition.m_A.m_symtype == CSymbol.SymType.eofsymbol)) { t.m_DR.AddIn(transition.m_A); } } }
public void BuildLookback(Transition a) { SymbolsGen sgen = a.m_ps.m_sgen; if (this.m_lookAhead != null) { return; } this.m_lookAhead = new SymbolSet(sgen); foreach (ParseState q in (IEnumerable)sgen.m_symbols.m_states.Values) { Transition transition = (Transition)q.m_transitions[(object)this.m_prod.m_lhs.yytext]; if (transition != null) { Path path = new Path(q, this.m_prod.Prefix(this.m_prod.m_rhs.Count)); if (path.valid && path.Top == a.m_ps) { transition.m_lookbackOf[(object)this] = (object)true; } } } }
public ParserAction(SymbolsGen yyp) : base(yyp) {}
public ParserOldAction(SymbolsGen yyp) : base(yyp) { m_action = yyp.action_num++; yyp.actions.Add(this); m_sym = null; m_symtype = CSymbol.SymType.oldaction; yyp.OldAction(this); }
public SymbolType(SymbolsGen yyp,string name,bool defined) { Lexer yyl = yyp.m_lexer; int p = name.IndexOf("+"); int num = 0; if (p>0) { num = int.Parse(name.Substring(p+1)); if (num> yyp.LastSymbol) yyp.LastSymbol = num; name = name.Substring(0,p); } yyl.yytext = name; CSymbol s = new CSymbol(yyp); if (num>0) s.m_yynum = num; s = s.Resolve(); if (defined) s.m_defined = true; m_name = name; m_next=yyp.stypes; yyp.stypes=this; }
public EOF(SymbolsGen yyp):base(yyp) { yytext = "EOF"; m_yynum = 2; m_symtype = SymType.eofsymbol; }
public SymbolSet FirstOfRest(SymbolsGen syms) { if (follow!=null) return follow; follow = new SymbolSet(syms); bool broke=false; int n = m_prod.m_rhs.Count; for (int j=m_pos+1;j<n;j++) { CSymbol s = (CSymbol)m_prod.m_rhs[j]; foreach (CSymbol a in s.m_first.Keys) follow.CheckIn(a); if (!s.IsNullable()) { broke = true; break; } } if (!broke) follow.Add(m_prod.m_lhs.m_follow); follow = follow.Resolve(); return follow; }
public SymbolType(SymbolsGen yyp,string name) : this(yyp,name,false) {}
public Production(SymbolsGen syms) { m_lhs=null; m_prec=0; m_pno=syms.pno++; m_actionsOnly = true; syms.prods.Add(this); }
public Production(SymbolsGen syms,CSymbol lhs) { m_lhs=lhs; m_prec=0; m_pno=syms.pno++; m_actionsOnly=true; syms.prods.Add(this); lhs.m_prods.Add(this); }
public SymbolSet(SymbolsGen syms) { this.m_symbols = syms; }
public Literal(SymbolsGen yyp) : base(yyp) { m_symtype=SymType.terminal; }
public ParseState(SymbolsGen syms,CSymbol acc) { m_sgen = syms; m_state=syms.state++; m_accessingSymbol=acc; m_items = new ProdItemList(); }
public ParserSimpleAction(SymbolsGen yyp) : base(yyp) { yyp.actions.Add(this); m_symtype = CSymbol.SymType.simpleaction; yyp.SimpleAction(this); }
public void ClassInit(SymbolsGen yyp) { this.Special = new CSymbol(yyp); this.Special.yytext = "S'"; this.EOFSymbol = new EOF(yyp).Resolve(); }
public SymbolType(SymbolsGen yyp,string name,bool defined) { Lexer yyl = yyp.m_lexer; yyl.yytext = name; CSymbol s = (new CSymbol(yyp)).Resolve(); m_name = name; m_next=yyp.stypes; yyp.stypes=this; if (defined) s.m_defined = true; }
public void ClassInit(SymbolsGen yyp) { EmptySequence = new CSymbol(yyp); EmptySequence.yytext="e"; Special = new CSymbol(yyp); Special.yytext="S'"; EOFSymbol = new EOF(yyp).Resolve(); }
public void ClassInit(SymbolsGen yyp) { Special = new CSymbol(yyp); Special.yytext="S'"; EOFSymbol = new EOF(yyp).Resolve(); }
public CSymbol(SymbolsGen yyp) : base(yyp.m_lexer) { m_parser = yyp; m_symtype = SymType.unknown; m_prec = null; m_prod = null; m_refSymbol = null; m_first = new SymbolSet(yyp); m_follow = new SymbolSet(yyp); }
Hashtable m_set = new Hashtable(); // CSymbol -> bool public SymbolSet(SymbolsGen syms) { m_symbols = syms; }
public ParserAction(SymbolsGen yyp) : base(yyp) { }