Skip to content
Snippets Groups Projects
Commit ccb85ebf authored by Adam Wardynski's avatar Adam Wardynski
Browse files

Adding relative position to grammar as infix +-

parent 15781243
Branches
No related merge requests found
......@@ -538,11 +538,16 @@ symset_condition
position_operator
[const Corpus2::Tagset& tagset, Variables& vars]
returns [boost::shared_ptr<Function<Position> > ret]
: ret = position_var_val [vars]
| ret = position_relpos [tagset, vars]
:
( ret = position_var_val [vars]
| ret = position_condition [tagset, vars]
//
| LPAREN ret = position_operator [tagset, vars] RPAREN
)
( // if there is SIGNED_INT after the position, it is actually a relative position
i: SIGNED_INT {
ret.reset(new RelativePosition(ret, token_ref_to_int(i)));
}
)?
;
// ----------------------------------------------------------------------------
......@@ -554,21 +559,6 @@ position_var_val
| ret = position_variable [vars]
;
// ----------------------------------------------------------------------------
// Realtive position operator.
// TODO 2+2, actually relative gets position is possible only as relpos(...,...)
position_relpos
[const Corpus2::Tagset& tagset, Variables& vars]
returns [boost::shared_ptr<Function<Position> > ret]
{
int n = 0;
boost::shared_ptr<Function<Position> > pos;
}
: "relpos" LPAREN pos = position_operator [tagset, vars] COMMA n = number RPAREN {
ret.reset(new RelativePosition(pos, n));
}
;
// ----------------------------------------------------------------------------
// Condition of the position value
// if (Bool, Position, Position)
......
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