From fcfb65f93327ca19321c10efb8ad6f53d9e58cb9 Mon Sep 17 00:00:00 2001 From: rk <rk@wojtek-desktop.(none)> Date: Mon, 8 Nov 2010 13:48:16 +0100 Subject: [PATCH] Added parser. --- CMakeLists.txt | 1 - libwccl/CMakeLists.txt | 18 +++++++++++++++--- libwccl/main.cpp | 4 ---- tests/CMakeLists.txt | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) delete mode 100644 libwccl/main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index c3c0b82..6e134b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,4 +50,3 @@ find_package(Boost 1.41 REQUIRED COMPONENTS program_options filesystem regex) add_subdirectory(libwccl) add_subdirectory(tests) - diff --git a/libwccl/CMakeLists.txt b/libwccl/CMakeLists.txt index 00ed846..e96ecc2 100644 --- a/libwccl/CMakeLists.txt +++ b/libwccl/CMakeLists.txt @@ -15,12 +15,13 @@ set(LIBS ${LIBS} ${Boost_LIBRARIES}) SET(libwccl_STAT_SRC exception.cpp - main.cpp ops/and.cpp ops/or.cpp ops/logicalpredicate.cpp - ops/nor.cpp + ops/nor.cpp ops/predicate.cpp + parser/Parser.cpp + parser/ParserException.cpp sentencecontext.cpp values/bool.cpp values/position.cpp @@ -31,10 +32,21 @@ SET(libwccl_STAT_SRC variables.cpp ) +SET(libwccl_STAT_SRC ${libwccl_STAT_SRC} + parser/ANTLRLexer.cpp + parser/ANTLRParser.cpp +) + +ADD_CUSTOM_COMMAND( + OUTPUT parser/ANTLRLexer.cpp parser/ANTLRLexer.hpp parser/ANTLRParser.cpp parser/ANTLRParser.hpp parser/ANTLRExprTokenTypes.hpp parser/ANTLRExprTokenTypes.txt + COMMAND runantlr -o parser parser/grammar.g + DEPENDS parser/grammar.g + COMMENT "-- Generating parser/ANTLRLexer.cpp parser/ANTLRLexer.hpp parser/ANTLRExprTokenTypes.hpp parser/ANTLRExprTokenTypes.txt parser/ANTLRParser.cpp parser/ANTLRParser.hpp") + file(GLOB_RECURSE INCS "*.h") add_library(wccl SHARED ${libwccl_STAT_SRC} ${INCS}) -target_link_libraries ( wccl ${LIBS} ) +target_link_libraries ( wccl ${LIBS}) set_target_properties(wccl PROPERTIES VERSION "${ver_major}.${ver_minor}" diff --git a/libwccl/main.cpp b/libwccl/main.cpp deleted file mode 100644 index 1f8701d..0000000 --- a/libwccl/main.cpp +++ /dev/null @@ -1,4 +0,0 @@ - -namespace Wccl { - -} /* end ns Wccl */ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 167604e..065b15f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,7 +14,7 @@ add_executable(tests variables.cpp ) -target_link_libraries ( tests wccl ${Boost_LIBRARIES}) +target_link_libraries ( tests wccl ${Boost_LIBRARIES} antlr) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIRS}) -- GitLab