Lexer/RegExs now work on a very basic level. Regular expressions have not been fully implemented, but the structure is there. It creates trivial regexs that only accept a specified sequence, no actual regular expression power.
This commit is contained in:
@@ -6,6 +6,7 @@ RegExState::RegExState(RegExState* inInnerState) {
|
||||
|
||||
RegExState::RegExState(char inCharacter) {
|
||||
character = inCharacter;
|
||||
inner = NULL;
|
||||
}
|
||||
|
||||
RegExState::~RegExState() {
|
||||
@@ -33,4 +34,13 @@ bool RegExState::isGoal() {
|
||||
return inner == NULL && nextStates.size() == 0;
|
||||
}
|
||||
|
||||
std::string RegExState::toString() {
|
||||
std::string string = "";
|
||||
string += character;
|
||||
for (std::vector<RegExState*>::size_type i = 0; i < nextStates.size(); i++)
|
||||
string += "->" + nextStates[i]->toString() + " EC ";
|
||||
//std::cout << "inner = " << inner << " nextStates size = " << nextStates.size() <<std::endl;
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user