main.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/metaparse/repeated.hpp>
  6. #include <boost/metaparse/sequence.hpp>
  7. #include <boost/metaparse/lit_c.hpp>
  8. #include <boost/metaparse/debug_parsing_error.hpp>
  9. #include <boost/metaparse/build_parser.hpp>
  10. #include <boost/metaparse/string.hpp>
  11. #include <boost/mpl/apply.hpp>
  12. using boost::metaparse::sequence;
  13. using boost::metaparse::lit_c;
  14. using boost::metaparse::repeated;
  15. using boost::metaparse::build_parser;
  16. using boost::metaparse::debug_parsing_error;
  17. using boost::mpl::apply;
  18. /*
  19. * The grammar
  20. *
  21. * s ::= a*b
  22. */
  23. typedef sequence<repeated<lit_c<'a'> >, lit_c<'b'> > s;
  24. typedef build_parser<s> test_parser;
  25. #if BOOST_METAPARSE_STD < 2011
  26. typedef boost::metaparse::string<'a','a','a','c'> invalid_input;
  27. #else
  28. typedef BOOST_METAPARSE_STRING("aaac") invalid_input;
  29. #endif
  30. debug_parsing_error<test_parser, invalid_input> debug;
  31. int main()
  32. {
  33. // This causes an error
  34. // apply<test_parser, invalid_input>::type();
  35. }