diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-03-16 21:27:38 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-03-16 21:27:38 +0100 |
commit | 74350b52fee9f576a1cc71d99cfd4ebdf5a73e0f (patch) | |
tree | fbcc823f28f31b3671af3a1e01a109abae0dbb92 /lexer.h | |
parent | 9502989aec80e8f75cf14e7dd7d1d85333090866 (diff) |
Fixed lexer
Diffstat (limited to 'lexer.h')
-rw-r--r-- | lexer.h | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -18,23 +18,23 @@ class Lexer // Graph size_t states{}; // start, ... - std::unordered_map<size_t, std::vector<std::pair<size_t, char>>> transitions; //transitions: state -> {state,character}, ...; empty transition is marked by \0 - std::vector<std::string> m_state_types; + std::unordered_map<size_t, std::vector<std::pair<size_t, char>>> transitions; // transitions: state -> {state,character}, ...; empty transition is marked by \0 + std::unordered_map<size_t, std::string> m_state_types; // only necessary for 2nd level symbol names size_t m_startState; - size_t m_endState; // Graph manipulation - size_t newState(std::string state_type = ""); + size_t newState(); + bool isEndState(size_t state); void addTransition(size_t state0, size_t state1, char c); void removeTransition(size_t state0, size_t state1, char c); std::vector<std::pair<size_t, char>> getSuccessorsViaEmpty(size_t state); std::vector<std::pair<size_t, char>> getSuccessors(size_t state); // Build up automaton, recursively - void addPath(size_t state0, size_t state1, std::string s, std::string type); - void addPathOrTransition(size_t state0, size_t state1, std::string symbol, std::string type); - void addRule(const std::vector<std::string>& list, size_t list_index_from, size_t list_index_to, size_t state0, size_t state1, const std::string& rule_symbol, std::string type); + void addPath(size_t state0, size_t state1, std::string s); + void addPathOrTransition(size_t state0, size_t state1, std::string symbol); + void addRule(const std::vector<std::string>& list, size_t list_index_from, size_t list_index_to, size_t state0, size_t state1, const std::string& rule_symbol); Token getToken(const std::string& s, Location& location); void skipWhitespace(const std::string& s, Location& location); |