Newer
Older
#include <libwccl/parser/Parser.h>
/**
* @desc Parser constructor. Default tagset is NULL
*/
Parser::Parser(const Corpus2::Tagset& t) : tagset(t)
{
}
/**
*
*/
Parser::~Parser()
{
//
}
// ----------------------------------------------------------------------------
/**
* @desc Parse string operator writed in std::string. Converts writed operator
* to istream and calling parseStringOperator with istream
* @arg str writed operator
* @retrun boost::shared_ptr<Wccl::StrSet>
boost::shared_ptr<ANTLRParserResult<Wccl::StrSet> > Parser::parseStringOperator(
const std::string& str) const
{
std::stringstream ss (std::stringstream::in | std::stringstream::out);
ss << str;
return this->parseStringOperator(ss);
* @desc Parse string operator. Runs parse_string_operator rule
* in the parser grammar.
* @arg istr input stream with writed operator
* @return boost::shared_ptr<Wccl::Function<Wccl::StrSet> > to created operator
boost::shared_ptr<ANTLRParserResult<Wccl::StrSet> > Parser::parseStringOperator(
std::istream& istr) const
Paweł Kędzia
committed
return parser.parse_string_operator(this->tagset);
// ----------------------------------------------------------------------------
/**
* @desc Parse predicates writed in std::string. Converts writed predicates
* to istream and calling parsePredicate with istream
* @arg str writed predicate(s)
* @return boost::shared_ptr<Wccl::Function<Wccl::Bool> > to created predicate
*/
boost::shared_ptr<ANTLRParserResult<Wccl::Bool> > Parser::parsePredicate(
const std::string& str) const
{
std::stringstream ss (std::stringstream::in | std::stringstream::out);
ss << str;
return this->parsePredicate(ss);
}
/**
* @desc Parse predicate. Runs parse_predicates rule in the parser grammar.
* @arg istr input stream with writed predicate
* @return boost::shared_ptr<Wccl::Function<Wccl::Bool> > to created predicate
*/
boost::shared_ptr<ANTLRParserResult<Wccl::Bool> > Parser::parsePredicate(
std::istream& istr) const
{
ANTLRLexer lexer(istr);
ANTLRParser parser(lexer);
Paweł Kędzia
committed
return parser.parse_predicates(this->tagset);
// ----------------------------------------------------------------------------
* @desc Parse sym set operator writed in std::string. Converts writed operator
* to istream and calling parseSymSetOperator with istream
* @arg str writed operator
* @retrun boost::shared_ptr<Wccl::Function<Wccl::TSet> >
boost::shared_ptr<ANTLRParserResult<Wccl::TSet> > Parser::parseSymSetOperator(
const std::string& str) const
{
std::stringstream ss (std::stringstream::in | std::stringstream::out);
ss << str;
return this->parseSymSetOperator(ss);
* @desc Parse sym set operator. Runs parse_sym_set_operator rule
* in the parser grammar.
* @arg istr input stream with writed operator
* @return boost::shared_ptr<Wccl::Function<Wccl::TSet> > to created operator
boost::shared_ptr<ANTLRParserResult<Wccl::TSet> > Parser::parseSymSetOperator(
std::istream& istr) const
Paweł Kędzia
committed
return parser.parse_sym_set_operator(this->tagset);