RNGLR Recognizer now works for grammers without null rules.

This commit is contained in:
Nathan Braswell
2013-08-02 02:47:01 -04:00
parent 9887555dd5
commit 49d149bc1f
8 changed files with 96 additions and 1 deletions

View File

@@ -71,6 +71,19 @@ void Table::add(int stateNum, Symbol* tranSymbol, ParseAction* action) {
}
}
void Table::remove(int stateNum, Symbol* tranSymbol) {
//find out what index this symbol is on
int symbolIndex = -1;
for (std::vector<Symbol*>::size_type i = 0; i < symbolIndexVec.size(); i++) {
if ( *(symbolIndexVec[i]) == *tranSymbol ) {
//Has been found
symbolIndex = i;
break;
}
}
(*(table[stateNum]))[symbolIndex] = NULL;
}
std::vector<ParseAction*>* Table::get(int state, Symbol* token) {
int symbolIndex = -1;
for (std::vector<Symbol*>::size_type i = 0; i < symbolIndexVec.size(); i++) {