20 if (!(*
this < other) && !(other < *
this))
return true;
25 if (!(*
this < other) && !(other < *
this))
return false;
46 if(
typeid(*
this) !=
typeid(other))
return false;
57 catch (std::bad_alloc& ba){
58 std::cerr <<
"bad_alloc caught in Terminal::Clone new Clone(*this): " << ba.what() << std::endl;
70 std::vector<Idx>::const_iterator it;
89 if(
typeid(*
this) !=
typeid(other))
return true;
97 std::vector<Idx>::const_iterator it1, it2;
100 if(*it1 < *it2)
return true;
101 if(*it2 < *it1)
return false;
114 catch (std::bad_alloc& ba){
115 std::cerr <<
"bad_alloc caught in Nonterminal::Clone new Clone(*this): " << ba.what() << std::endl;
127 if (lhs.size() < rhs.size())
return true;
128 if (rhs.size() < lhs.size())
return false;
130 GrammarSymbolVector::const_iterator it1, it2;
132 for(it1 = lhs.begin(); it1 != lhs.end(); it1++){
133 if(**it1 < **it2)
return true;
134 if(**it2 < **it1)
return false;
164 GrammarSymbolWordSet::const_iterator setit;
165 GrammarSymbolVector::const_iterator gsit1, gsit2;
169 for(setit =
set.begin(); setit !=
set.end(); setit++){
172 if(setit->size() == word.size()){
177 gsit2 = word.begin();
178 for(gsit1 = setit->begin(); gsit1 != setit->end(); gsit1++){
181 if(**gsit1 != **gsit2){
204 GrammarSymbolVector::const_iterator it;
205 for(it =
mRhs.begin(); it <
mRhs.end(); it++){
212 if (
mLhs < other.
Lhs())
return true;
213 if (other.
Lhs() <
mLhs)
return false;
260 std::stringstream errstr;
261 errstr <<
"Grammar symbol mismatch: Lefthand-side nonterminal " << gp.
Lhs().
Str() <<
" does not exist in grammar." <<std::endl;
262 throw Exception(
"Grammar::InsGrammarProduction", errstr.str(), 1001);
266 GrammarSymbolVector::const_iterator gsit;
267 for(gsit = gp.
Rhs().begin(); gsit != gp.
Rhs().end(); gsit ++){
273 std::stringstream errstr;
274 errstr <<
"Grammar symbol mismatch: Righthand-side nonterminal " << nt->
Str() <<
" does not exist in grammar." <<std::endl;
275 throw Exception(
"Grammar::InsGrammarProduction", errstr.str(), 1001);
282 std::stringstream errstr;
283 errstr <<
"Grammar symbol mismatch: Righthand-side terminal " << t->
Str() <<
" does not exist in grammar." <<std::endl;
284 throw Exception(
"Grammar::InsGrammarProduction", errstr.str(), 1001);
293 std::set<GrammarProduction>::const_iterator gpit;
294 for(gpit = gp.begin(); gpit != gp.end(); gpit++){
325 std::set<Terminal>::const_iterator it;
329 else s+=
", " + it->Str();
336 std::set<Nonterminal>::const_iterator it;
340 else s+=
", " + it->Str();
351 std::set<GrammarProduction>::const_iterator it;
354 s+=
"\n " + it->Str();