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_LEAF_NODE_HPP
7 #define BOOST_LEXER_LEAF_NODE_HPP
9 #include "../../consts.hpp" // null_token
11 #include "../../size_t.hpp"
19 class leaf_node : public node
22 leaf_node (const std::size_t token_, const bool greedy_) :
23 node (token_ == null_token),
25 _set_greedy (!greedy_),
30 _firstpos.push_back (this);
31 _lastpos.push_back (this);
39 virtual void append_followpos (const node_vector &followpos_)
41 for (node_vector::const_iterator iter_ = followpos_.begin (),
42 end_ = followpos_.end (); iter_ != end_; ++iter_)
44 _followpos.push_back (*iter_);
48 virtual type what_type () const
53 virtual bool traverse (const_node_stack &/*node_stack_*/,
54 bool_stack &/*perform_op_stack_*/) const
59 virtual std::size_t token () const
64 virtual void greedy (const bool greedy_)
73 virtual bool greedy () const
78 virtual const node_vector &followpos () const
83 virtual node_vector &followpos ()
92 node_vector _followpos;
94 virtual void copy_node (node_ptr_vector &node_ptr_vector_,
95 node_stack &new_node_stack_, bool_stack &/*perform_op_stack_*/,
96 bool &/*down_*/) const
98 node_ptr_vector_->push_back (static_cast<leaf_node *>(0));
99 node_ptr_vector_->back () = new leaf_node (_token, _greedy);
100 new_node_stack_.push (node_ptr_vector_->back ());
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