char_strings_test.cpp 900 B

1234567891011121314151617181920212223242526272829303132
  1. /*=============================================================================
  2. Copyright (c) 2004 Joao Abecasis
  3. http://spirit.sourceforge.net/
  4. Use, modification and distribution is subject to the Boost Software
  5. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. http://www.boost.org/LICENSE_1_0.txt)
  7. =============================================================================*/
  8. #include <boost/spirit/include/classic_primitives.hpp>
  9. #include <boost/spirit/include/classic_rule.hpp>
  10. #include <string>
  11. int main()
  12. {
  13. using BOOST_SPIRIT_CLASSIC_NS::rule;
  14. using BOOST_SPIRIT_CLASSIC_NS::str_p;
  15. using BOOST_SPIRIT_CLASSIC_NS::ch_p;
  16. using std::string;
  17. string str = "abcd";
  18. rule<> strings = str_p("abcd");
  19. strings = str_p('a');
  20. strings = str_p(str.begin(), str.end());
  21. rule<> chars = ch_p('a');
  22. chars = ch_p("b");
  23. }