Modifed set creation to use a State object. Set creation works

This commit is contained in:
Nathan Braswell
2013-05-26 22:12:47 -04:00
parent 858daa30ee
commit 315dc55409
7 changed files with 185 additions and 56 deletions

View File

@@ -19,6 +19,10 @@ const bool ParseRule::operator==(const ParseRule &other) {
return( leftHandle == other.leftHandle && rightSide == other.rightSide && pointerIndex == other.pointerIndex );
}
const bool ParseRule::operator!=(const ParseRule &other) {
return !(this->operator==(other));
}
ParseRule* ParseRule::clone() {
return( new ParseRule(leftHandle, pointerIndex, rightSide) );
}
@@ -39,8 +43,24 @@ std::vector<Symbol*> ParseRule::getRightSide() {
return rightSide;
}
Symbol* ParseRule::getAtNextIndex() {
if (pointerIndex >= rightSide.size())
return NULL;
return rightSide[pointerIndex];
}
Symbol* ParseRule::getAtIndex() {
if (pointerIndex < 1)
return NULL;
return rightSide[pointerIndex-1];
}
int ParseRule::getRightSize() {
return rightSide.size();
}
int ParseRule::getIndex() {
return pointerIndex;
return pointerIndex-1;
}
bool ParseRule::advancePointer() {