diff options
-rw-r--r-- | minicc.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -37,17 +37,22 @@ BNF Reverse(BNF bnf){ std::vector<std::string> Lex(std::string s, std::string Top, BNF bnf) { + std::vector<std::string> result; + std::string token; + BNF ReverseBNF{ Reverse(bnf)}; - size_t pos{0}; + std::string Whitespace{"\t \n\r"}; - while (pos < s.size()) { + for (size_t pos{0}; pos < s.size(); pos++) { char c{s[pos]}; + if (token.empty() and Whitespace.find(c) != std::string::npos) + continue; // skip whitespace between tokens + auto Path = GetPath(std::string{1, c}, ReverseBNF, Top); - pos++; } - return {}; + return result; } ProgramNode Compile(std::vector<std::string> Tokens, std::string Top, BNF bnf, Terminals terminals) |