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:
@@ -13,7 +13,7 @@ class Lexer {
|
||||
Lexer();
|
||||
Lexer(std::string inputString);
|
||||
~Lexer();
|
||||
void addRegexString(std::string regExString);
|
||||
void addRegEx(std::string regExString);
|
||||
void setInput(std::string inputString);
|
||||
Symbol* next();
|
||||
private:
|
||||
|
||||
@@ -32,7 +32,7 @@ class Parser {
|
||||
std::string stateSetToString();
|
||||
void addToTable(State* fromState, Symbol* tranSymbol, ParseAction* action);
|
||||
ParseAction* getTable(int state, Symbol* token);
|
||||
NodeTree* parseInput(Lexer* lexer);
|
||||
NodeTree* parseInput(std::string inputString);
|
||||
|
||||
std::string grammerToString();
|
||||
std::string grammerToDOT();
|
||||
@@ -41,6 +41,7 @@ class Parser {
|
||||
|
||||
private:
|
||||
StringReader reader;
|
||||
Lexer lexer;
|
||||
std::map<std::string, Symbol*> symbols;
|
||||
std::vector<ParseRule*> loadedGrammer;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ class RegEx {
|
||||
|
||||
int longMatch(std::string stringToMatch);
|
||||
std::string getPattern();
|
||||
std::string toString();
|
||||
private:
|
||||
std::string pattern;
|
||||
RegExState* begin;
|
||||
|
||||
@@ -18,6 +18,7 @@ class RegExState {
|
||||
bool characterIs(char inCharacter);
|
||||
std::vector<RegExState*>* advance(char advanceCharacter);
|
||||
bool isGoal();
|
||||
std::string toString();
|
||||
|
||||
private:
|
||||
std::vector<RegExState*> nextStates;
|
||||
|
||||
Reference in New Issue
Block a user