2 // Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #ifndef BOOST_LEXER_ITERATION_NODE_HPP
7 #define BOOST_LEXER_ITERATION_NODE_HPP
17 class iteration_node : public node
20 iteration_node (node *next_, const bool greedy_) :
25 node_vector::iterator iter_;
26 node_vector::iterator end_;
28 _next->append_firstpos (_firstpos);
29 _next->append_lastpos (_lastpos);
31 for (iter_ = _lastpos.begin (), end_ = _lastpos.end ();
32 iter_ != end_; ++iter_)
34 (*iter_)->append_followpos (_firstpos);
37 for (iter_ = _firstpos.begin (), end_ = _firstpos.end ();
38 iter_ != end_; ++iter_)
40 (*iter_)->greedy (greedy_);
44 virtual ~iteration_node ()
48 virtual type what_type () const
53 virtual bool traverse (const_node_stack &node_stack_,
54 bool_stack &perform_op_stack_) const
56 perform_op_stack_.push (true);
57 node_stack_.push (_next);
62 // Not owner of this pointer...
66 virtual void copy_node (node_ptr_vector &node_ptr_vector_,
67 node_stack &new_node_stack_, bool_stack &perform_op_stack_,
70 if (perform_op_stack_.top ())
72 node *ptr_ = new_node_stack_.top ();
74 node_ptr_vector_->push_back (static_cast<iteration_node *>(0));
75 node_ptr_vector_->back () = new iteration_node (ptr_, _greedy);
76 new_node_stack_.top () = node_ptr_vector_->back ();
83 perform_op_stack_.pop ();
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams