Files
taskwarrior-2.x/src/lex.cpp
Paul Beckingham 745aad0d27 Lexer
- Renamed Lexer2 to Lexer, it looks good enough to assume control.
2015-02-22 18:23:03 -05:00

31 lines
813 B
C++

////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <Lexer.h>
#include <Context.h>
Context context;
int main (int argc, char** argv)
{
for (auto i = 1; i < argc; i++)
{
std::cout << "input '" << argv[i] << "'\n";
// Low-level tokens.
Lexer lexer (argv[i]);
std::string token;
Lexer::Type type;
while (lexer.token (token, type))
std::cout << " token '" << token << "' " << Lexer::typeToString (type) << "\n";
/*
// High-level tokens.
auto all = Lexer::tokens (argv[i]);
for (auto token : Lexer::tokens (argv[i]))
std::cout << " token '" << token.first << "' " << Lexer::typeToString (token.second) << "\n";
*/
}
}
////////////////////////////////////////////////////////////////////////////////