Skip to content
Snippets Groups Projects
Commit 97bff541 authored by Bartosz Broda's avatar Bartosz Broda
Browse files

add antrl dependencies in tester

parent 44625c67
Branches
No related merge requests found
...@@ -25,13 +25,15 @@ include_directories(${LibXML++_INCLUDE_DIRS}) ...@@ -25,13 +25,15 @@ include_directories(${LibXML++_INCLUDE_DIRS})
link_directories(${LibXML++_LIBRARY_DIRS}) link_directories(${LibXML++_LIBRARY_DIRS})
set(LIBS ${LIBS} ${LibXML++_LIBRARIES}) set(LIBS ${LIBS} ${LibXML++_LIBRARIES})
set(LIBS ${LIBS} corpus2 wccl)
add_library(corpus2_mwereader SHARED mwereader.cpp mwe.cpp mweparser.cpp) add_library(corpus2_mwereader SHARED mwereader.cpp mwe.cpp mweparser.cpp)
target_link_libraries(corpus2_mwereader corpus2) target_link_libraries(corpus2_mwereader ${LIBS})
add_executable(mwertest mwertest.cpp mweparser.cpp) add_executable(mwertest mwertest.cpp mweparser.cpp)
target_link_libraries(mwertest corpus2_mwereader ${LIBS}) target_link_libraries(mwertest corpus2_mwereader ${LIBS} antlr)
set_target_properties(corpus2_mwereader PROPERTIES set_target_properties(corpus2_mwereader PROPERTIES
VERSION "${libmwereader_major}.${libmwereader_minor}" VERSION "${libmwereader_major}.${libmwereader_minor}"
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <libpwrutils/foreach.h> #include <libpwrutils/foreach.h>
#include <libcorpus2/tagsetmanager.h> #include <libcorpus2/tagsetmanager.h>
#include <libxml++/libxml++.h> #include <libxml++/libxml++.h>
#include <libxml2/libxml/parser.h> #include <libxml2/libxml/parser.h>
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
...@@ -11,7 +12,7 @@ ...@@ -11,7 +12,7 @@
namespace Corpus2 { namespace Corpus2 {
MWEBuilder::MWEBuilder(const Tagset& tagset) MWEBuilder::MWEBuilder(const Tagset& tagset)
: tagset_(tagset) : tagset_(tagset), parser_(tagset)
{ {
} }
...@@ -21,6 +22,16 @@ namespace Corpus2 { ...@@ -21,6 +22,16 @@ namespace Corpus2 {
{ {
} }
MWEParser::~MWEParser()
{
// TODO: something to do?
}
void MWEParser::create_mwe()
{
}
std::string MWEParser::get_attribute(const AttributeList& attributes, std::string MWEParser::get_attribute(const AttributeList& attributes,
const std::string &name) const const std::string &name) const
{ {
...@@ -96,9 +107,7 @@ namespace Corpus2 { ...@@ -96,9 +107,7 @@ namespace Corpus2 {
state_ = MWEGROUP; state_ = MWEGROUP;
} else if(state_ == MWE && name == "MWE"){ } else if(state_ == MWE && name == "MWE"){
state_ = INSTANCES; state_ = INSTANCES;
// TODO: tworzenie jednostki create_mwe();
print_current_mwe(true);
} else if(state_ == VAR && name == "var"){ } else if(state_ == VAR && name == "var"){
state_ = MWE; state_ = MWE;
variables_[var_name_] = finish_get_text(); variables_[var_name_] = finish_get_text();
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include <libcorpus2/io/sax.h> #include <libcorpus2/io/sax.h>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#include <libwccl/parser/Parser.h>
#include "mwe.h" #include "mwe.h"
namespace Corpus2 { namespace Corpus2 {
...@@ -13,23 +15,29 @@ class MWEBuilder ...@@ -13,23 +15,29 @@ class MWEBuilder
{ {
public: public:
MWEBuilder(const Tagset& tagset); MWEBuilder(const Tagset& tagset);
typedef boost::unordered_map<std::string, std::string> value_type;
private: private:
typedef boost::unordered_map<std::string, std::string> value_type;
const Tagset& tagset_; const Tagset& tagset_;
/// str -> ptr to ccl operator /// str -> ptr to ccl operator
value_type main_conditions_; value_type main_conditions_;
/// str -> ptr to ccl operator /// str -> ptr to ccl operator
value_type head_conditions_; value_type head_conditions_;
Wccl::Parser parser_;
}; };
class MWEParser : public BasicSaxParser class MWEParser : public BasicSaxParser
{ {
public: public:
MWEParser(MWEIndex &index); MWEParser(MWEIndex &index);
~MWEParser();
protected: protected:
void create_mwe();
typedef std::map<std::string, std::string> str_map; typedef std::map<std::string, std::string> str_map;
void on_start_element(const Glib::ustring &name, void on_start_element(const Glib::ustring &name,
const AttributeList& attributes); const AttributeList& attributes);
......
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