Skip to content
Snippets Groups Projects
Commit fa0d5168 authored by Paweł Kędzia's avatar Paweł Kędzia
Browse files

Changed nor operator name to not. Added tagset to position rules.

parent 4bb3555a
Branches
No related merge requests found
......@@ -21,7 +21,7 @@ public:
* @returns Name of the function: "not"
*/
std::string raw_name() const {
return "not";
return "nor";
}
protected :
......
......@@ -342,14 +342,14 @@ position_variable
// realtive position
relpos
[Wccl::Variables& vars]
[const Corpus2::Tagset& tagset, Wccl::Variables& vars]
returns [boost::shared_ptr<Wccl::Function<Wccl::Position> > ret]
{
boost::shared_ptr<Wccl::Function<Wccl::Position> > pos;
}
: "relpos"
LPAREN
pos = op_position [vars] ("+" | "-") ofst: UNSIGNED_INT
pos = op_position [tagset, vars] ("+" | "-") ofst: UNSIGNED_INT
RPAREN {
ret.reset(new Wccl::RelativePosition(
pos,
......@@ -479,7 +479,7 @@ setvar_body_pos
}
: ret_acc = position_variable_acc [vars]
COMMA
ret_op = op_position [vars] {
ret_op = op_position [tagset, vars] {
op.reset(new Wccl::VarSetter<Wccl::Position>(*ret_acc.get(), ret_op));
}
;
......@@ -584,17 +584,18 @@ condit_sym
position_operators
[const Corpus2::Tagset& tagset, Wccl::Variables& vars]
returns [boost::shared_ptr<Wccl::Function<Wccl::Position> > ret]
: ret = op_position [vars]
: ret = op_position [tagset, vars]
;
// Implementations of symbol set operators:
// ----------------------------------------------------------------------------
op_position
[Wccl::Variables& vars]
[const Corpus2::Tagset& tagset, Wccl::Variables& vars]
returns [boost::shared_ptr<Wccl::Function<Wccl::Position> > op]
: op = position_variable [vars]
| op = position_value
| op = relpos [vars]
| op = relpos [tagset, vars]
// | op = condit_position [tagset, vars]
;
// ----------------------------------------------------------------------------
......@@ -621,7 +622,7 @@ op_orth
{
boost::shared_ptr<Wccl::Function<Wccl::Position> > pos;
}
: "orth" LBRACKET pos = op_position [vars] RBRACKET {
: "orth" LBRACKET pos = op_position [tagset, vars] RBRACKET {
ret.reset(new Wccl::GetOrth(pos));
}
;
......@@ -783,7 +784,7 @@ lpred_nor
std::vector<boost::shared_ptr<Wccl::Function<Wccl::Bool> > >
> ret_v;
}
: "nor" LPAREN ret_v = logical_predicates_comma_sep [tagset, vars] RPAREN {
: "not" LPAREN ret_v = logical_predicates_comma_sep [tagset, vars] RPAREN {
op.reset(new Wccl::Nor(ret_v));
}
;
......@@ -953,6 +954,39 @@ condit_bool
}
;
// ----------------------------------------------------------------------------
// if (Bool, Position, Position)
// ? Position ? Bool : 0
/* Not implemented yet
*/
/*
condit_position
[const Corpus2::Tagset& tagset, Wccl::Variables& vars]
returns [boost::shared_ptr<Wccl::Function<Wccl::Position> > op]
{
boost::shared_ptr<Wccl::Function<Wccl::Bool> > test;
boost::shared_ptr<Wccl::Function<Wccl::Bool> > p_true, p_false;
}
: "if" LPAREN test = logical_predicates [tagset, vars] COMMA
p_true = position_operators [tagset, vars]
(COMMA p_false = position_operators [tagset, vars])?
RPAREN {
if (p_false) {
op.reset(new Wccl::Conditional<Wccl::Position>(test, p_true, p_false));
}
else {
op.reset(new Wccl::Conditional<Wccl::Position>(test, p_true));
}
}
| Q_MARK
p_true = position_operators [tagset, vars]
Q_MARK
test = logical_predicates [tagset, vars] {
op.reset(new Wccl::Conditional<Wccl::Position>(test, p_true));
}
;
*/
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// ANTLR LEXER
......
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