diff --git a/CMakeLists.txt b/CMakeLists.txt index 51abf19048f243cae8f4ec4e17e15b1f1d145963..7069f0e878e8e29efad8be95fefd40b5d0d35924 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,8 +58,5 @@ if(MSVC OR BORLAND) endif(MSVC OR BORLAND) add_subdirectory(libwccl) -add_subdirectory(wcclparser) -add_subdirectory(wcclrun) -add_subdirectory(wcclrules) -add_subdirectory(wccl-features) +add_subdirectory(wccl-apps) add_subdirectory(tests) diff --git a/wccl-apps/CMakeLists.txt b/wccl-apps/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8b95da6852fbd08e959ee63d8a9e98eae8fb9d5 --- /dev/null +++ b/wccl-apps/CMakeLists.txt @@ -0,0 +1,34 @@ +PROJECT( wccl-features ) + +find_package(Libedit) +if (Libedit_FOUND) + message(STATUS "Building with libedit") + add_definitions( -DHAVE_LIBEDIT ) + set(LIBS ${LIBS} ${Libedit_LIBRARIES}) +endif (Libedit_FOUND) + +find_package(LibXML++ REQUIRED) +include_directories(${LibXML++_INCLUDE_DIRS}) +link_directories(${LibXML++_LIBRARY_DIRS}) +set(LIBS ${LIBS} ${LibXML++_LIBRARIES}) + +include_directories(${CMAKE_SOURCE_DIR}) +include_directories(${Boost_INCLUDE_DIR}) +link_directories(${Boost_LIBRARY_DIRS}) + +add_executable(wccl-features wccl-features.cpp) +target_link_libraries (wccl-features wccl ${Boost_LIBRARIES} antlr ${LIBS}) +add_executable(wccl-run wccl-run.cpp stdopts.cpp) +target_link_libraries (wccl-run wccl ${Boost_LIBRARIES} antlr ${LIBS}) +add_executable(wccl-rules wccl-rules.cpp) +target_link_libraries (wccl-rules wccl ${Boost_LIBRARIES} antlr ${LIBS}) +add_executable(wccl-parser wccl-parser.cpp) +target_link_libraries (wccl-parser wccl ${Boost_LIBRARIES} antlr ${LIBS}) +add_executable(wccl-match wccl-match.cpp) +target_link_libraries (wccl-match wccl ${Boost_LIBRARIES} antlr ${LIBS}) + +if(UNIX) + install(TARGETS wccl-features wccl-run wccl-rules wccl-parser wccl-match + RUNTIME DESTINATION bin + ) +endif(UNIX) diff --git a/wccl-apps/stdopts.cpp b/wccl-apps/stdopts.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/wccl-apps/stdopts.h b/wccl-apps/stdopts.h new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/wccl-features/main.cpp b/wccl-apps/wccl-features.cpp similarity index 100% rename from wccl-features/main.cpp rename to wccl-apps/wccl-features.cpp diff --git a/wccl-apps/wccl-match.cpp b/wccl-apps/wccl-match.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6924dcd5d620910d7e96f1f8572d1a33f090102b --- /dev/null +++ b/wccl-apps/wccl-match.cpp @@ -0,0 +1,201 @@ +#include <cstdlib> +#include <fstream> +#include <iomanip> + +#include <libwccl/values/strset.h> +#include <libwccl/parser/Parser.h> +#include <libwccl/ops/rulesequence.h> +#include <libcorpus2/tagsetmanager.h> +#include <libcorpus2/util/tokentimer.h> + +#include <boost/bind.hpp> +#include <boost/algorithm/string.hpp> +#include <boost/make_shared.hpp> +#include <boost/filesystem.hpp> +#include <boost/program_options.hpp> +#include <libcorpus2/io/reader.h> +#include <libcorpus2/io/writer.h> + +namespace { + bool quiet = false; + bool progress = false; + + struct options { + bool first; + bool until_done; + int until_done_iterations; + }; +} + +class MatchRunner +{ +public: + MatchRunner(const Corpus2::Tagset& tagset) + : tagset_(tagset), parser_(tagset_) + { + } + + bool load_more_rules(const std::string &filename); + + bool load_operator_string(const std::string &op_string); + + void apply_rules(boost::shared_ptr<Corpus2::TokenReader> reader, + boost::shared_ptr<Corpus2::TokenWriter> writer); + + bool empty() { + return rules_.empty(); + } + +private: + const Corpus2::Tagset& tagset_; + Wccl::Parser parser_; + std::vector<std::string> rule_names_; + std::vector<boost::shared_ptr<Wccl::ApplyOperator> > rules_; +}; + +bool MatchRunner::load_more_rules(const std::string& filename) +{ + boost::shared_ptr<Wccl::ApplyOperator> retOp; + try { + std::ifstream is(filename.c_str()); + if (!is.good()) { + throw Wccl::FileNotFound(filename, "", __FUNCTION__); + } + retOp = parser_.parseMatchRule(is); + if (retOp) { + boost::filesystem::path p(filename); + rule_names_.push_back(p.stem()); + rules_.push_back(retOp); + return true; + } else { + std::cerr << "Problem while parsing -- " + << "parser returned NULL!" << std::endl; + } + } catch (PwrNlp::PwrNlpError& e) { + std::cerr << e.scope() << " Error: " << e.info() << std::endl; + } + return false; +} + +void MatchRunner::apply_rules(boost::shared_ptr<Corpus2::TokenReader> reader, + boost::shared_ptr<Corpus2::TokenWriter> writer) +{ + Corpus2::TokenTimer& timer = Corpus2::global_timer(); + while (boost::shared_ptr<Corpus2::Chunk> c = reader->get_next_chunk()) { + foreach (boost::shared_ptr<Corpus2::Sentence>& s, c->sentences()) { + boost::shared_ptr<Corpus2::AnnotatedSentence> as; + as = Corpus2::AnnotatedSentence::wrap_sentence(s); + + foreach (const boost::shared_ptr<Wccl::ApplyOperator>& r, rules_) { + //r->execute(); + } + + timer.count_sentence(*as); + if (progress) { + timer.check_slice(); + } + writer->write_sentence(*as); + } + //writer->write_chunk(*c); + } + if (progress) { + timer.stats(); + } +} + +int main(int argc, char** argv) +{ + std::string tagset_load = "kipi"; + std::string input_format; + std::string output_format; + options opts; + opts.first = false; + opts.until_done = false; + opts.until_done_iterations = 1000; + std::vector<std::string> corpora_files, ccl_files, files; + bool corpus_stdin = true; + using boost::program_options::value; + + std::string readers = boost::algorithm::join(Corpus2::TokenReader::available_reader_types_help(), " "); + std::string readers_help = "Input format, any of: " + readers + "\n"; + std::string writers = boost::algorithm::join(Corpus2::TokenWriter::available_writer_types_help(), " "); + std::string writers_help = "Output format, any of: " + writers + "\n";; + + boost::program_options::options_description desc("Allowed options"); + desc.add_options() + ("tagset,t", value(&tagset_load), + "Tagset to use\n") + ("corpus,c", value(&corpora_files), + "Corpus file to load (XCES), do not load from stdin\n") + ("ccl-file,C", value(&ccl_files), + "CCL rule files\n") + ("files,f", value(&files), + "Files to load, looking at the extension to determine type\n") + ("input-format,i", value(&input_format)->default_value("xces"), + readers_help.c_str()) + ("output-format,o", value(&output_format)->default_value("xces"), + writers_help.c_str()) + ("progress,p", value(&progress)->zero_tokens(), + "Show progress info") + ("quiet,q", value(&quiet)->zero_tokens(), + "Suppress messages\n") + ("until-done,u", value(&opts.until_done)->zero_tokens(), + "Until-done mode\n") + ("until-done-iterations", value(&opts.until_done_iterations), + "Until-done iteration limit\n") + ("first-sentence-only,1", value(&opts.first)->zero_tokens(), + "Only process first sentence\n") + ("help,h", "Show help") + ; + boost::program_options::variables_map vm; + boost::program_options::positional_options_description p; + p.add("files", -1); + + try { + boost::program_options::store( + boost::program_options::command_line_parser(argc, argv) + .options(desc).positional(p).run(), vm); + } catch (boost::program_options::error& e) { + std::cerr << e.what() << std::endl; + return 2; + } + boost::program_options::notify(vm); + + if (vm.count("help")) { + std::cerr << "Usage " << argv[0] << " [OPTIONS] FILES\n" + << "Files ending with .xml are treated as corpora, otherwise \n" + << "as CCL files. Use - to read corpus from stdin (as with -I)"; + std::cout << desc << "\n"; + return 1; + } + + foreach (const std::string& f, files) { + if (boost::algorithm::ends_with(f, ".xml")) { + corpora_files.push_back(f); + } else { + ccl_files.push_back(f); + } + } + + try { + const Corpus2::Tagset& tagset = Corpus2::get_named_tagset(tagset_load); + MatchRunner runner(tagset); + foreach (const std::string& file, ccl_files) { + runner.load_more_rules(file); + } + if (!runner.empty()) { + Corpus2::TokenTimer& timer = Corpus2::global_timer(); + timer.register_signal_handler(); + boost::shared_ptr<Corpus2::TokenWriter> writer; + writer.reset(Corpus2::TokenWriter::create(output_format, std::cout, tagset)); + boost::shared_ptr<Corpus2::TokenReader> reader; + reader = Corpus2::TokenReader::create_path_reader(input_format, tagset, ccl_files[0]); + runner.apply_rules(reader, writer); + } + } catch (PwrNlp::PwrNlpError& e) { + std::cerr << e.info() << std::endl; + return 2; + } + + return 0; +} diff --git a/wcclparser/main.cpp b/wccl-apps/wccl-parser.cpp similarity index 100% rename from wcclparser/main.cpp rename to wccl-apps/wccl-parser.cpp diff --git a/wcclrules/main.cpp b/wccl-apps/wccl-rules.cpp similarity index 100% rename from wcclrules/main.cpp rename to wccl-apps/wccl-rules.cpp diff --git a/wcclrun/main.cpp b/wccl-apps/wccl-run.cpp similarity index 100% rename from wcclrun/main.cpp rename to wccl-apps/wccl-run.cpp diff --git a/wccl-features/CMakeLists.txt b/wccl-features/CMakeLists.txt deleted file mode 100644 index 0cd2499dfc43c535f23becd9aa2bf7c17f972cb8..0000000000000000000000000000000000000000 --- a/wccl-features/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -PROJECT( wccl-features ) - -find_package(Libedit) -if (Libedit_FOUND) - message(STATUS "Building with libedit") - add_definitions( -DHAVE_LIBEDIT ) - set(LIBS ${LIBS} ${Libedit_LIBRARIES}) -endif (Libedit_FOUND) - -find_package(LibXML++ REQUIRED) -include_directories(${LibXML++_INCLUDE_DIRS}) -link_directories(${LibXML++_LIBRARY_DIRS}) -set(LIBS ${LIBS} ${LibXML++_LIBRARIES}) - -include_directories( ${CMAKE_SOURCE_DIR} ) - -add_definitions(-DLIBWCCL_WCCLRUN_DATA_DIR="${PROJECT_SOURCE_DIR}/") - -add_executable(wccl-features - main.cpp -) -target_link_libraries (wccl-features wccl ${Boost_LIBRARIES} antlr ${LIBS}) - -include_directories(${Boost_INCLUDE_DIR}) -link_directories(${Boost_LIBRARY_DIRS}) - -if(UNIX) - install(TARGETS wccl-features - RUNTIME DESTINATION bin - ) -endif(UNIX) diff --git a/wcclparser/CMakeLists.txt b/wcclparser/CMakeLists.txt deleted file mode 100644 index c0efaf5b6b897ec7bffe6474e7db4e5e67e005de..0000000000000000000000000000000000000000 --- a/wcclparser/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -PROJECT( parser ) - -find_package(Libedit) -if (Libedit_FOUND) - message(STATUS "Building with libedit") - add_definitions( -DHAVE_LIBEDIT ) - set(LIBS ${LIBS} ${Libedit_LIBRARIES}) -endif (Libedit_FOUND) - -find_package(LibXML++ REQUIRED) -include_directories(${LibXML++_INCLUDE_DIRS}) -link_directories(${LibXML++_LIBRARY_DIRS}) -set(LIBS ${LIBS} ${LibXML++_LIBRARIES}) - -include_directories( ${CMAKE_SOURCE_DIR} ) - -add_definitions(-DLIBWCCL_WCCLPARSER_DATA_DIR="${PROJECT_SOURCE_DIR}/") - -add_executable(wcclparser - main.cpp -) -target_link_libraries (wcclparser wccl ${Boost_LIBRARIES} antlr ${LIBS}) - -# String operator -add_executable(parser-strop - strop_main.cpp -) -target_link_libraries (parser-strop wccl ${Boost_LIBRARIES} antlr) - -# Bool operator -add_executable(parser-boolop - bool_main.cpp -) -target_link_libraries (parser-boolop wccl ${Boost_LIBRARIES} antlr) - -# Tagset operator -add_executable(parser-tagop - tagset_main.cpp -) -target_link_libraries (parser-tagop wccl ${Boost_LIBRARIES} antlr) - -include_directories(${Boost_INCLUDE_DIR}) -link_directories(${Boost_LIBRARY_DIRS}) - -#add_custom_target(test tests) -#add_custom_target(test-verbose ./tests --log_level=message) - -if(UNIX) - install(TARGETS wcclparser - RUNTIME DESTINATION bin - ) -endif(UNIX) diff --git a/wcclparser/bool_main.cpp b/wcclparser/bool_main.cpp deleted file mode 100644 index 86bb5b7cbc7e2684df3feec49765aab38b963bc1..0000000000000000000000000000000000000000 --- a/wcclparser/bool_main.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include <cstdlib> -#include <libwccl/values/bool.h> -#include <libwccl/ops/operator.h> -#include <libwccl/parser/Parser.h> - -#include <antlr/NoViableAltException.hpp> -#include <antlr/MismatchedTokenException.hpp> -#include <antlr/TokenStreamRecognitionException.hpp> - -// ---------------------------------------------------------------------------- - -/** - * @desc It's simple command line tester for testing predicates - */ - -int main() -{ - std::string str_in; - Corpus2::Tagset tagset; - Wccl::Parser parser(tagset); - - boost::shared_ptr<const Wccl::Value> retVal; - boost::shared_ptr<Wccl::FunctionalOperator> retOp; - boost::shared_ptr<Corpus2::Sentence> sentence = boost::make_shared<Corpus2::Sentence>(); - Wccl::SentenceContext sc(sentence); - - Corpus2::Token* the_token = new Corpus2::Token("ZZ", PwrNlp::Whitespace::ManySpaces); - Corpus2::Tag t1(Corpus2::mask_t(0)); - Corpus2::Lexeme l1("aaa", t1); - the_token->add_lexeme(l1); - sentence->append(the_token); - - if (system("clear")) { - // - } - - std::cerr << "Simple command line tester for testing bool operators" - << std::endl; - - while (1) { - std::cerr << "Enter a bool operator expression: "; - - getline(std::cin, str_in); - - if (str_in == "clear" || str_in == "cls") { - if (system("clear")) { - // - } - } - else if (str_in == "exit" || str_in == "quit") { - break; - } - else { - try { - retOp = parser.parseBoolOperator(str_in); - - if (retOp) { - retVal = retOp->base_apply(sc); - - if(retVal) { - std::cerr << "Parsed expression: " << retVal->to_raw_string() - << std::endl; - } - else { - std::cerr << "Problem while parsing -- Bool is NULL!" << std::endl; - } - } - else { - std::cerr << "Problem while parsing -- " - << "Function<Wccl::Bool> is NULL!" << std::endl; - } - } - catch (antlr::MismatchedTokenException &e) { - std::cerr << e.getFileLineColumnString() - << " " << e.getMessage() << std::endl; - } catch(antlr::NoViableAltException &e) { - std::cerr << e.getFileLineColumnString() - << " " << e.getMessage() << std::endl; - } catch(antlr::TokenStreamRecognitionException &e) { - std::cerr << e.getLine() << ":" << e.getColumn() - << " " << e.getMessage() << std::endl; - } catch (Wccl::InvalidVariableName &e) { - std::cerr << "Wccl::InvalidVariableName" << std::endl; - } catch (Wccl::VariableTypeMismatch &e) { - std::cerr << "Wccl::VariableTypeMismatch" << std::endl; - } catch (Wccl::InvalidArgument &e) { - std::cerr << "Wccl::InvalidArgument " << e.info() << std::endl; - } catch (Wccl::WcclError &e) { - std::cerr << "Generic WcclError: " << e.info() << std::endl; - } - catch (...) { - std::cerr << "[N] Syntax error!" << std::endl; - } - } - } - - return 0; -} - diff --git a/wcclparser/strop_main.cpp b/wcclparser/strop_main.cpp deleted file mode 100644 index 632829b851ccf82641263e96e18a0d7d3ebce116..0000000000000000000000000000000000000000 --- a/wcclparser/strop_main.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include <cstdlib> -#include <libwccl/values/strset.h> -#include <libwccl/ops/operator.h> -#include <libwccl/parser/Parser.h> - -#include <antlr/NoViableAltException.hpp> -#include <antlr/MismatchedTokenException.hpp> -#include <antlr/TokenStreamRecognitionException.hpp> - -// ---------------------------------------------------------------------------- - -/** - * @desc It's simple command line tester for testing string operators - */ - -int main() -{ - std::string str_in; - Corpus2::Tagset tagset; - Wccl::Parser parser(tagset); - - boost::shared_ptr<const Wccl::Value> retVal; - boost::shared_ptr<Wccl::FunctionalOperator> retOp; - boost::shared_ptr<Corpus2::Sentence> sentence = boost::make_shared<Corpus2::Sentence>(); - Wccl::SentenceContext sc(sentence); - - Corpus2::Token* the_token = new Corpus2::Token("ZZ", PwrNlp::Whitespace::ManySpaces); - Corpus2::Tag t1(Corpus2::mask_t(0)); - Corpus2::Lexeme l1("aaa", t1); - the_token->add_lexeme(l1); - sentence->append(the_token); - - if (system("clear")) { - // - } - - std::cerr << "Simple command line tester for testing string operators" - << std::endl; - - while (1) { - std::cerr << "Enter a string operator expression: "; - - getline(std::cin, str_in); - - if (str_in == "clear" || str_in == "cls") { - if (system("clear")) { - // - } - } - else if (str_in == "exit" || str_in == "quit") { - break; - } - else { - try { - retOp = parser.parseStringOperator(str_in); - - if (retOp.get()) { - retVal = retOp->base_apply(sc); - - if (retVal) { - std::cerr << "Parsed expression: " << retVal->to_raw_string() - << std::endl; - } - else { - std::cerr << "Problem while parsing -- StrSet is NULL!" << std::endl; - } - } - else { - std::cerr << "Problem while parsing -- " - << "Function<Wccl::StrSet> is NULL!" << std::endl; - } - } - catch (antlr::MismatchedTokenException &e) { - std::cerr << e.getFileLineColumnString() - << " " << e.getMessage() << std::endl; - } catch(antlr::NoViableAltException &e) { - std::cerr << e.getFileLineColumnString() - << " " << e.getMessage() << std::endl; - } catch(antlr::TokenStreamRecognitionException &e) { - std::cerr << e.getLine() << ":" << e.getColumn() - << " " << e.getMessage() << std::endl; - } catch (Wccl::InvalidVariableName &e) { - std::cerr << "Wccl::InvalidVariableName" << std::endl; - } catch (Wccl::VariableTypeMismatch &e) { - std::cerr << "Wccl::VariableTypeMismatch" << std::endl; - } catch (...) { - std::cerr << "[N] Syntax error!" << std::endl; - } - } - } - - return 0; -} - diff --git a/wcclparser/tagset_main.cpp b/wcclparser/tagset_main.cpp deleted file mode 100644 index 76e18a5bb71f5af646841c9ddeb67f8aeef18487..0000000000000000000000000000000000000000 --- a/wcclparser/tagset_main.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include <cstdlib> -#include <libwccl/values/tset.h> -#include <libwccl/ops/operator.h> -#include <libwccl/parser/Parser.h> - -#include <antlr/NoViableAltException.hpp> -#include <antlr/MismatchedTokenException.hpp> -#include <antlr/TokenStreamRecognitionException.hpp> - -#include <libcorpus2/tagsetmanager.h> - -// ---------------------------------------------------------------------------- - -/** - * @desc It's simple command line tester for testing tagset operators - */ - -int main() -{ - std::string str_in; - const Corpus2::Tagset& tagset = Corpus2::get_named_tagset("kipi"); - Wccl::Parser parser(tagset); - - boost::shared_ptr<const Wccl::Value> retVal; - boost::shared_ptr<Wccl::FunctionalOperator> retOp; - boost::shared_ptr<Corpus2::Sentence> sentence = boost::make_shared<Corpus2::Sentence>(); - Wccl::SentenceContext sc(sentence); - - Corpus2::Token* the_token = new Corpus2::Token("ZZ", PwrNlp::Whitespace::ManySpaces); - Corpus2::Tag t1(Corpus2::mask_t(0)); - Corpus2::Lexeme l1("aaa", t1); - the_token->add_lexeme(l1); - sentence->append(the_token); - - if (system("clear")) { - // - } - - std::cerr << "Simple command line tester for testing bool operators" - << std::endl; - - while (1) { - std::cerr << "Enter a bool operator expression: "; - - getline(std::cin, str_in); - - if (str_in == "clear" || str_in == "cls") { - if (system("clear")) { - // - } - } - else if (str_in == "exit" || str_in == "quit") { - break; - } - else { - try { - retOp = parser.parseSymSetOperator(str_in); - - if (retOp.get()) { - retVal = retOp->base_apply(sc); - - if (retVal) { - std::cerr << "Parsed expression: " << retVal->to_raw_string() - << std::endl; - } - else { - std::cerr << "Problem while parsing -- TSet is NULL!" << std::endl; - } - } - else { - std::cerr << "Problem while parsing -- " - << "Function<Wccl::TSet> is NULL!" << std::endl; - } - } - catch (antlr::MismatchedTokenException &e) { - std::cerr << e.getFileLineColumnString() - << " " << e.getMessage() << std::endl; - } catch(antlr::NoViableAltException &e) { - std::cerr << e.getFileLineColumnString() - << " " << e.getMessage() << std::endl; - } catch(antlr::TokenStreamRecognitionException &e) { - std::cerr << e.getLine() << ":" << e.getColumn() - << " " << e.getMessage() << std::endl; - } catch (Wccl::InvalidVariableName &e) { - std::cerr << "Wccl::InvalidVariableName" << std::endl; - } catch (Wccl::VariableTypeMismatch &e) { - std::cerr << "Wccl::VariableTypeMismatch" << std::endl; - } catch (...) { - std::cerr << "[N] Syntax error!" << std::endl; - } - } - } - - return 0; -} - diff --git a/wcclparser/val_main.cpp b/wcclparser/val_main.cpp deleted file mode 100644 index 82d3d058021c67cf6648399d8cdfaa787113f4ef..0000000000000000000000000000000000000000 --- a/wcclparser/val_main.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include <cstdlib> - -#include <libwccl/values/strset.h> -#include <libwccl/parser/Parser.h> - -// ---------------------------------------------------------------------------- - -/** - * @desc It's simple command line tester for testing predicates - */ - -int main() -{ - std::string str_in; - Corpus2::Tagset tagset; - Parser parser(tagset); - - boost::shared_ptr<Wccl::Bool> retValue; - boost::shared_ptr<Wccl::Function<Wccl::Bool> > retOp; - boost::shared_ptr<Corpus2::Sentence> sentence; - Wccl::SentenceContext sc(sentence); - - while (1) { - std::cerr << "Enter a string predicates expression: "; - - getline(std::cin, str_in); - - if (str_in == "clear" || str_in == "cls") { - if (system("clear")) { - // - } - } - else if (str_in == "exit" || str_in == "quit") { - break; - } - else { - try { - retOp = parser.parsePredicate(str_in); - - if (retOp.get()) { - std::cerr - << "Parsed expression: " - << (retValue = retOp->apply(sc))->to_raw_string() - << std::endl; - } - else { - std::cerr << "Problem while parsing -- haven't got Function<Wccl::StrSet> object in boost::shared_ptr!" << std::endl; - } - } - catch (antlr::MismatchedTokenException &e) { - std::cerr << "Mismatch token exception!" << std::endl; - } - /* - catch (antlr::TokenStreamRecognitionException &e) { - std::cerr << "[2] Syntax error!" << std::endl; - } - */ - catch (...) { - std::cerr << "[N] Syntax error!" << std::endl; - } - } - } - - return 0; -} - diff --git a/wcclrules/CMakeLists.txt b/wcclrules/CMakeLists.txt deleted file mode 100644 index ab54ea158dd5ab444437215de73c7807fec3f770..0000000000000000000000000000000000000000 --- a/wcclrules/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -PROJECT( wcclrules ) - -find_package(LibXML++ REQUIRED) -include_directories(${LibXML++_INCLUDE_DIRS}) -link_directories(${LibXML++_LIBRARY_DIRS}) -set(LIBS ${LIBS} ${LibXML++_LIBRARIES}) - -find_package(Loki REQUIRED QUIET) -set(LIBS ${LIBS} loki) - -include_directories( ${CMAKE_SOURCE_DIR} ) - -add_definitions(-DLIBWCCL_WCCLRUN_DATA_DIR="${PROJECT_SOURCE_DIR}/") - -add_executable(wcclrules - main.cpp -) -target_link_libraries (wcclrules wccl ${Boost_LIBRARIES} antlr ${LIBS}) - -include_directories(${Boost_INCLUDE_DIR}) -link_directories(${Boost_LIBRARY_DIRS}) - -if(UNIX) - install(TARGETS wcclrules - RUNTIME DESTINATION bin - ) -endif(UNIX) diff --git a/wcclrun/CMakeLists.txt b/wcclrun/CMakeLists.txt deleted file mode 100644 index 6d321bb66f148ad024455531421dca46b92869c7..0000000000000000000000000000000000000000 --- a/wcclrun/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -PROJECT( wcclrun ) - -find_package(Libedit) -if (Libedit_FOUND) - message(STATUS "Building with libedit") - add_definitions( -DHAVE_LIBEDIT ) - set(LIBS ${LIBS} ${Libedit_LIBRARIES}) -endif (Libedit_FOUND) - -find_package(LibXML++ REQUIRED) -include_directories(${LibXML++_INCLUDE_DIRS}) -link_directories(${LibXML++_LIBRARY_DIRS}) -set(LIBS ${LIBS} ${LibXML++_LIBRARIES}) - -include_directories( ${CMAKE_SOURCE_DIR} ) - -add_definitions(-DLIBWCCL_WCCLRUN_DATA_DIR="${PROJECT_SOURCE_DIR}/") - -add_executable(wcclrun - main.cpp -) -target_link_libraries (wcclrun wccl ${Boost_LIBRARIES} antlr ${LIBS}) - -include_directories(${Boost_INCLUDE_DIR}) -link_directories(${Boost_LIBRARY_DIRS}) - -if(UNIX) - install(TARGETS wcclrun - RUNTIME DESTINATION bin - ) -endif(UNIX)