public void RhSide(Production p) { CSymbol s; ParserOldAction a = null; // last old action seen while (m_tok != null) { if (m_tok.Matches(";")) { break; } if (m_tok.Matches("|")) { break; } if (m_tok.Matches(":")) { Advance(); p.m_alias[m_tok.yytext] = p.m_rhs.Count; Advance(); } else if (m_tok is PrecReference) { if (p.m_rhs.Count == 0) { erh.Error(new CSToolsException(21, "%prec cannot be at the start of a right hand side")); } PrecReference pr = (PrecReference)m_tok; CSymbol r = (CSymbol)p.m_rhs[p.m_rhs.Count - 1]; r.m_prec = pr.precref.m_prec; Advance(); } else { s = (CSymbol)m_tok; if (s.m_symtype == CSymbol.SymType.oldaction) { if (a != null) { Error(42, s.pos, "adjacent actions"); } a = (ParserOldAction)s; if (a.m_action < 0) { // an OldAction that has been converted to a SimpleAction: discard it s = a.m_sym; // add the SimpleAction instead s.m_symtype = CSymbol.SymType.simpleaction; ParserSimpleAction sa = (ParserSimpleAction)s; } else // add it to the Actions function { m_actions += String.Format("\ncase {0} : {1} break;", a.m_action, a.m_initialisation); } a = null; } else if (s.m_symtype != CSymbol.SymType.simpleaction) { s = ((CSymbol)m_tok).Resolve(); } p.AddToRhs(s); Advance(); } } Precedence.Check(p); }