Null rules work in RNGLR now, but there seems to be a bug where somehow some states/rules get no lookahead.

This commit is contained in:
Nathan Braswell
2013-08-02 15:21:42 -04:00
parent 49d149bc1f
commit d5b33efb22
5 changed files with 54 additions and 14 deletions

View File

@@ -23,9 +23,9 @@ void Lexer::addRegEx(std::string regExString) {
}
Symbol* Lexer::next() {
std::cout << "Current at is \"" << input.substr(currentPosition,input.length()-1) << "\" currentPos is " << currentPosition <<std::endl;
std::cout << "Current at is \"" << input.substr(currentPosition,input.length()-1) << "\" currentPos is " << currentPosition << " out of " << input.length() <<std::endl;
//If we're at the end, return an eof
if (currentPosition == input.length()-1)
if (currentPosition >= input.length()-1)
return new Symbol("$EOF$", true);
int longestMatch = -1;
RegEx* longestRegEx = NULL;
@@ -44,7 +44,7 @@ Symbol* Lexer::next() {
return new Symbol(longestRegEx->getPattern(), true);
} else {
std::cout << "Found no applicable regex" << std::endl;
std::cout << "Remaining is " << input.substr(currentPosition,input.length()-1) << std::endl;
return new Symbol("$NO_APPLICABLE_REGEX$", true);
std::cout << "Remaining is ||" << input.substr(currentPosition,input.length()-1) << "||" << std::endl;
return NULL;
}
}