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

Removing $_ variable - you can simply use "0".

parent e52a1d93
Branches
No related merge requests found
...@@ -5,13 +5,11 @@ ...@@ -5,13 +5,11 @@
namespace Wccl { namespace Wccl {
ApplyOperator::ApplyOperator( ApplyOperator::ApplyOperator(
const VariableAccessor<Position>& cur_iter_pos,
const VariableAccessor<Match>& matches, const VariableAccessor<Match>& matches,
const boost::shared_ptr<const MatchOperator>& match_op, const boost::shared_ptr<const MatchOperator>& match_op,
const boost::shared_ptr<const std::vector<boost::shared_ptr<MatchAction> > >& actions, const boost::shared_ptr<const std::vector<boost::shared_ptr<MatchAction> > >& actions,
const boost::shared_ptr<const std::vector<boost::shared_ptr<Function<Bool> > > >& conditions) const boost::shared_ptr<const std::vector<boost::shared_ptr<Function<Bool> > > >& conditions)
: _cur_iter_pos(cur_iter_pos), : _matches(matches),
_matches(matches),
_match_op(match_op), _match_op(match_op),
_actions(actions), _actions(actions),
_conditions(conditions) _conditions(conditions)
...@@ -22,9 +20,9 @@ ApplyOperator::ApplyOperator( ...@@ -22,9 +20,9 @@ ApplyOperator::ApplyOperator(
void ApplyOperator::execute(const ActionExecContext &context) const void ApplyOperator::execute(const ActionExecContext &context) const
{ {
boost::shared_ptr<Position> iter_pos = context.variables()->get_fast(_cur_iter_pos); boost::shared_ptr<Position> iter_pos(new Position(0));
boost::shared_ptr<MatchVector> matches = boost::shared_ptr<MatchVector> matches =
boost::dynamic_pointer_cast<MatchVector>(context.variables()->get_fast(_matches)); boost::dynamic_pointer_cast<MatchVector>(context.variables()->get_fast(_matches));
while(context.sentence_context().is_current_inside()) { while(context.sentence_context().is_current_inside()) {
// Set initial values of $_ and $m:_M variables for this iteration and launch the match: // Set initial values of $_ and $m:_M variables for this iteration and launch the match:
iter_pos->set_value(0); iter_pos->set_value(0);
......
...@@ -17,14 +17,12 @@ class ApplyOperator : public Expression ...@@ -17,14 +17,12 @@ class ApplyOperator : public Expression
public: public:
typedef LogicalPredicate::BoolFunctionPtrVector BoolFunctionPtrVector; typedef LogicalPredicate::BoolFunctionPtrVector BoolFunctionPtrVector;
/** /**
* @param cur_iter_pos Accessor to the "$_" variable
* @param matches Accessor to the "$m:_M" variable * @param matches Accessor to the "$m:_M" variable
* @param match_op "match" operator for apply * @param match_op "match" operator for apply
* @param actions "actions" section of apply, should not be empty * @param actions "actions" section of apply, should not be empty
* @param conditions "cond" section of apply, empty by default * @param conditions "cond" section of apply, empty by default
*/ */
ApplyOperator( ApplyOperator(
const VariableAccessor<Position>& cur_iter_pos,
const VariableAccessor<Match>& matches, const VariableAccessor<Match>& matches,
const boost::shared_ptr<const MatchOperator>& match_op, const boost::shared_ptr<const MatchOperator>& match_op,
const boost::shared_ptr<const std::vector<boost::shared_ptr<MatchAction> > >& actions, const boost::shared_ptr<const std::vector<boost::shared_ptr<MatchAction> > >& actions,
...@@ -60,7 +58,6 @@ protected: ...@@ -60,7 +58,6 @@ protected:
virtual void execute(const ActionExecContext &context) const; virtual void execute(const ActionExecContext &context) const;
private: private:
const VariableAccessor<Position> _cur_iter_pos;
const VariableAccessor<Match> _matches; const VariableAccessor<Match> _matches;
const boost::shared_ptr<const MatchOperator> _match_op; const boost::shared_ptr<const MatchOperator> _match_op;
const boost::shared_ptr<const std::vector<boost::shared_ptr<MatchAction> > > _actions; const boost::shared_ptr<const std::vector<boost::shared_ptr<MatchAction> > > _actions;
......
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