Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:47:49

0001 // end_node.hpp
0002 // Copyright (c) 2007-2009 Ben Hanson (http://www.benhanson.net/)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file licence_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 #ifndef BOOST_SPIRIT_SUPPORT_DETAIL_LEXER_PARSER_TREE_END_NODE_HPP
0007 #define BOOST_SPIRIT_SUPPORT_DETAIL_LEXER_PARSER_TREE_END_NODE_HPP
0008 
0009 #include "node.hpp"
0010 #include "../../size_t.hpp"
0011 
0012 namespace boost
0013 {
0014 namespace lexer
0015 {
0016 namespace detail
0017 {
0018 class end_node : public node
0019 {
0020 public:
0021     end_node (const std::size_t id_, const std::size_t unique_id_,
0022         const std::size_t lexer_state_) :
0023         node (false),
0024         _id (id_),
0025         _unique_id (unique_id_),
0026         _lexer_state (lexer_state_)
0027     {
0028         node::_firstpos.push_back (this);
0029         node::_lastpos.push_back (this);
0030     }
0031 
0032     virtual ~end_node ()
0033     {
0034     }
0035 
0036     virtual type what_type () const
0037     {
0038         return END;
0039     }
0040 
0041     virtual bool traverse (const_node_stack &/*node_stack_*/,
0042         bool_stack &/*perform_op_stack_*/) const
0043     {
0044         return false;
0045     }
0046 
0047     virtual const node_vector &followpos () const
0048     {
0049         // _followpos is always empty..!
0050         return _followpos;
0051     }
0052 
0053     virtual bool end_state () const
0054     {
0055         return true;
0056     }
0057 
0058     virtual std::size_t id () const
0059     {
0060         return _id;
0061     }
0062 
0063     virtual std::size_t unique_id () const
0064     {
0065         return _unique_id;
0066     }
0067 
0068     virtual std::size_t lexer_state () const
0069     {
0070         return _lexer_state;
0071     }
0072 
0073 private:
0074     std::size_t _id;
0075     std::size_t _unique_id;
0076     std::size_t _lexer_state;
0077     node_vector _followpos;
0078 
0079     virtual void copy_node (node_ptr_vector &/*node_ptr_vector_*/,
0080         node_stack &/*new_node_stack_*/, bool_stack &/*perform_op_stack_*/,
0081         bool &/*down_*/) const
0082     {
0083         // Nothing to do, as end_nodes are not copied.
0084     }
0085 };
0086 }
0087 }
0088 }
0089 
0090 #endif