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/spirit/home/classic/symbols/impl/tst.ipp> 12 #include <boost/utility/addressof.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 = data_ 21 + sizeof(data_)/sizeof(char_type); // Yes, this is an intencional bug ;) 22 main()23int main() 24 { 25 typedef BOOST_SPIRIT_CLASSIC_NS::scanner<> scanner; 26 typedef BOOST_SPIRIT_CLASSIC_NS::impl::tst<void *, char_type> symbols; 27 28 symbols symbols_; 29 30 symbols_.add(begin, end - 1, (void*) boost::addressof(symbols_)); 31 32 // The symbol table parser should not choke on input containing the null 33 // character. 34 symbols_.find(scanner(begin, end)); 35 } 36