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 void AddFirst(CSymbol s, int j) { for (; j < this.m_rhs.Count; ++j) { CSymbol rh = (CSymbol)this.m_rhs[j]; s.AddFollow(rh.m_first); if (!rh.IsNullable()) { break; } } }
public static void BuildIncludes(Transition t) { t.m_Follow = new SymbolSet(t.m_ps.m_sgen); foreach (Production prod in t.m_A.m_prods) { for (int i = prod.m_rhs.Count - 1; i >= 0; --i) { CSymbol rh = (CSymbol)prod.m_rhs[i]; if (rh.m_symtype == CSymbol.SymType.nonterminal) { ((Transition)(i <= 0 ? t.m_ps : new Path(t.m_ps, prod.Prefix(i)).Top).m_transitions[(object)rh.yytext]).m_includes[(object)t] = (object)true; } if (!rh.IsNullable()) { break; } } } }