• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //  Hannibal: partial C++ grammar to parse C++ type information
2 //  Copyright (c) 2005-2006 Danny Havenith
3 //
4 //  Boost.Wave: A Standard compliant C++ preprocessor
5 //  Copyright (c) 2001-2009 Hartmut Kaiser
6 //
7 //  http://www.boost.org/
8 //
9 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
10 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 
12 #if !defined(BOOST_HANNIBAL_TRANSLATION_UNIT_SKIPPER_H_INCLUDED)
13 #define BOOST_HANNIBAL_TRANSLATION_UNIT_SKIPPER_H_INCLUDED
14 
15 #include <boost/spirit/include/classic_core.hpp>
16 #include <boost/spirit/include/classic_confix.hpp>
17 
18 #include <boost/wave/wave_config.hpp>
19 #include <boost/wave/token_ids.hpp>
20 #include <boost/wave/util/pattern_parser.hpp>
21 
22 ///////////////////////////////////////////////////////////////////////////////
23 struct translation_unit_skipper
24 :   public boost::spirit::classic::grammar<translation_unit_skipper>
25 {
26     template <typename ScannerT>
27     struct definition
28     {
definitiontranslation_unit_skipper::definition29         definition(translation_unit_skipper const& /*self*/)
30         {
31             using namespace boost::spirit::classic;
32             using namespace boost::wave;
33             using boost::wave::util::pattern_p;
34 
35             skip
36                 =   pattern_p(WhiteSpaceTokenType, TokenTypeMask)
37                 |   pattern_p(EOLTokenType, TokenTypeMask)
38                 |   pattern_p(EOFTokenType, TokenTypeMask)
39                 |   comment_p(pattern_p(PPTokenType, TokenTypeMask),
40                               pattern_p(EOLTokenType, TokenTypeMask))
41                 ;
42         }
43 
44         boost::spirit::classic::rule<ScannerT> skip;
45 
46         boost::spirit::classic::rule<ScannerT> const&
starttranslation_unit_skipper::definition47         start() const { return skip; }
48     };
49 };
50 
51 #endif // BOOST_HANNIBAL_TRANSLATION_UNIT_SKIPPER_H_INCLUDED
52