mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
lex: Added test harness for lexer
This commit is contained in:
parent
f9d7c97410
commit
0b9f25bfe0
4 changed files with 27 additions and 2 deletions
|
@ -60,6 +60,6 @@ set (CPACK_SOURCE_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION})
|
|||
set (CPACK_SOURCE_IGNORE_FILES "CMakeCache" "CMakeFiles" "CPackConfig" "CPackSourceConfig"
|
||||
"_CPack_Packages" "cmake_install" "install_manifest" "Makefile$"
|
||||
"test" "package-config" "src/timew$" "src/libtimew.a"
|
||||
"src/commands/libcommands.a"
|
||||
"src/commands/libcommands.a" "src/lex"
|
||||
"/\\\\.gitignore" "/\\\\.git/" "swp$")
|
||||
include (CPack)
|
||||
|
|
4
src/.gitignore
vendored
4
src/.gitignore
vendored
|
@ -1,6 +1,8 @@
|
|||
timew
|
||||
gr
|
||||
lex
|
||||
*.a
|
||||
CMakeFiles
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
lr0
|
||||
sax
|
||||
|
|
|
@ -41,10 +41,13 @@ set (libshared_SRCS libshared/src/Args.cpp libshared/src/Args.h
|
|||
add_library (timew STATIC ${timew_SRCS})
|
||||
add_library (libshared STATIC ${libshared_SRCS})
|
||||
add_executable (timew_executable timew.cpp)
|
||||
add_executable (lex_executable lex.cpp)
|
||||
|
||||
target_link_libraries (timew_executable timew libshared commands timew libshared ${TIMEW_LIBRARIES})
|
||||
target_link_libraries (lex_executable timew libshared libshared ${TIMEW_LIBRARIES})
|
||||
|
||||
set_property (TARGET timew_executable PROPERTY OUTPUT_NAME "timew")
|
||||
set_property (TARGET lex_executable PROPERTY OUTPUT_NAME "lex")
|
||||
|
||||
install (TARGETS timew_executable DESTINATION bin)
|
||||
|
||||
|
|
20
src/lex.cpp
Normal file
20
src/lex.cpp
Normal file
|
@ -0,0 +1,20 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <iostream>
|
||||
#include <Lexer.h>
|
||||
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
for (auto i = 1; i < argc; i++)
|
||||
{
|
||||
std::cout << "argument '" << argv[i] << "'\n";
|
||||
|
||||
Lexer l (argv[i]);
|
||||
std::string token;
|
||||
Lexer::Type type;
|
||||
while (l.token (token, type))
|
||||
std::cout << " token '" << token << "' " << Lexer::typeToString (type) << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
Loading…
Add table
Add a link
Reference in a new issue