Skip to content
Snippets Groups Projects
Commit 1b5f1c37 authored by ilor's avatar ilor
Browse files

wccl-apps refactoring: move to commond dir, harmonize names to wccl-SOMETHING

parent b1b976c6
Branches
No related merge requests found
......@@ -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)
......@@ -12,20 +12,21 @@ 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(${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)
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})
if(UNIX)
install(TARGETS wccl-features
install(TARGETS wccl-features wccl-run wccl-rules wccl-parser
RUNTIME DESTINATION bin
)
endif(UNIX)
File moved
File moved
File moved
File moved
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)
#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;
}
#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;
}
#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;
}
#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;
}
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)
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)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment