• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2004 Joao Abecasis
3     http://spirit.sourceforge.net/
4 
5     Use, modification and distribution is subject to the Boost Software
6     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7     http://www.boost.org/LICENSE_1_0.txt)
8 =============================================================================*/
9 
10 #include <boost/spirit/include/classic_scanner.hpp>
11 #include <boost/utility/addressof.hpp>
12 #include "symbols.hpp"
13 
14 typedef char char_type;
15 typedef char const* iterator;
16 
17 char_type data_[] = "whatever";
18 
19 iterator begin = data_;
20 iterator end =
21     data_ +
22     sizeof(data_) / sizeof(char_type); // Yes, this is an intentional bug ;)
23 
main()24 int main()
25 {
26     typedef BOOST_SPIRIT_CLASSIC_NS::scanner<> scanner;
27     typedef quickbook::tst<void*, char_type> symbols;
28 
29     symbols symbols_;
30 
31     symbols_.add(begin, end - 1, (void*)boost::addressof(symbols_));
32 
33     // The symbol table parser should not choke on input containing the null
34     // character.
35     symbols_.find(scanner(begin, end));
36 }
37