├── doc ├── .gitignore ├── images │ ├── folds.png │ ├── foldl_diag1.png │ ├── foldl_diag2.png │ ├── foldr_diag1.png │ ├── repeated_diag0.png │ ├── repeated_diag1.png │ ├── repeated_diag2.png │ ├── repeated_diag3.png │ ├── tutorial_diag0.png │ ├── tutorial_diag1.png │ ├── tutorial_diag2.png │ ├── tutorial_diag3.png │ ├── tutorial_diag4.png │ ├── tutorial_diag5.png │ ├── tutorial_diag6.png │ ├── tutorial_diag7.png │ ├── tutorial_diag8.png │ ├── tutorial_diag9.png │ ├── tutorial_diag10.png │ ├── tutorial_diag11.png │ ├── foldl_reject_incomplete_diag1.png │ ├── foldl_start_with_parser_diag1.png │ ├── foldr_reject_incomplete_diag1.png │ ├── foldr_start_with_parser_diag1.png │ ├── generate.sh │ ├── repeated_reject_incomplete_diag1.png │ └── foldl_reject_incomplete_start_with_parser_diag1.png ├── before_3.qbk ├── getting_started_14.qbk ├── getting_started_1.qbk ├── getting_started_31.qbk ├── getting_started_36.qbk ├── getting_started_3.qbk ├── getting_started_6.qbk ├── getting_started_9.qbk ├── getting_started_33.qbk ├── getting_started_8.qbk ├── tag.qbk ├── getting_started_30.qbk ├── getting_started_0.qbk ├── getting_started_21.qbk ├── getting_started_18.qbk ├── getting_started_32.qbk ├── getting_started_35.qbk ├── getting_started_16.qbk ├── getting_started_19.qbk ├── getting_started_20.qbk ├── getting_started_23.qbk ├── getting_started_27.qbk ├── getting_started_4.qbk ├── getting_started_25.qbk ├── getting_started_28.qbk ├── getting_started_22.qbk ├── getting_started_7.qbk ├── parser_combinator.qbk ├── getting_started_5.qbk ├── getting_started_13.qbk ├── getting_started_2.qbk ├── getting_started_10.qbk ├── getting_started_17.qbk ├── before_3_1.qbk ├── before_3_2.qbk ├── getting_started_15.qbk ├── string_tag.qbk ├── getting_started_39.qbk ├── getting_started_26.qbk ├── accept_tag.qbk ├── fail_tag.qbk ├── getting_started_29.qbk ├── getting_started_12.qbk ├── source_position_tag.qbk ├── start.qbk ├── before_3_3.qbk ├── getting_started_38.qbk ├── README ├── getting_started_34.qbk ├── digit_expected.qbk ├── expected_to_fail.qbk ├── letter_expected.qbk ├── end_of_input_expected.qbk ├── whitespace_expected.qbk ├── getting_started_37.qbk ├── unexpected_character.qbk ├── before_4.qbk ├── getting_started_24.qbk ├── unexpected_end_of_input.qbk ├── getting_started_11.qbk ├── none_of_the_expected_cases_found.qbk ├── predicate.qbk ├── metaprogramming_value.qbk ├── literal_expected.qbk ├── BOOST_METAPARSE_VERSION.qbk ├── parsing_error_message.qbk ├── getting_started_40.qbk ├── boxed_value.qbk ├── before_4_1.qbk ├── nullary_metafunction.qbk └── index_out_of_range.qbk ├── example ├── parsing_error │ ├── .gitignore │ ├── Jamfile.v2 │ └── README ├── binary_number │ ├── README │ └── Jamfile.v2 ├── rational │ ├── Jamfile.v2 │ └── README ├── regexp │ ├── Jamfile.v2 │ └── README ├── calculator │ ├── README │ └── Jamfile.v2 ├── meta_lambda │ ├── Jamfile.v2 │ └── README ├── constexpr_parser │ ├── Jamfile.v2 │ └── README ├── minimal_rational │ ├── Jamfile.v2 │ └── README ├── calculator_with_parens │ ├── Jamfile.v2 │ └── README ├── compile_to_native_code │ ├── Jamfile.v2 │ └── README ├── meta_metaparse │ ├── README │ └── Jamfile.v2 ├── calculator_with_parens_and_unary_ops │ ├── Jamfile.v2 │ └── README ├── grammar_calculator │ ├── README │ └── Jamfile.v2 ├── getting_started │ ├── 1.hpp │ ├── README │ ├── 1_1.hpp │ ├── 5_1.hpp │ ├── 6_1.hpp │ ├── 7_1.hpp │ ├── 1_2.hpp │ ├── 2.hpp │ ├── 8_2.hpp │ ├── 11_2.hpp │ ├── 1_2_1.hpp │ ├── 1_2_2.hpp │ ├── 11_1.hpp │ ├── 3_2.hpp │ ├── 5_2_1.hpp │ ├── 3.hpp │ ├── 4_2.hpp │ ├── 3_1.hpp │ ├── 4.hpp │ ├── 3_3.hpp │ ├── 5_2.hpp │ ├── 5_2_4.hpp │ ├── 6_2.hpp │ ├── 4_1.hpp │ ├── 8.hpp │ ├── 11_3_2.hpp │ └── 6.hpp ├── meta_hs │ ├── README │ ├── Jamfile.v2 │ ├── double_number.hpp │ ├── lazy.hpp │ ├── main_handcrafted.cpp │ └── main_in_haskell.cpp └── Jamfile.v2 ├── index.html ├── test ├── build_parser.cpp ├── change_error_message.cpp ├── repeated.cpp ├── repeated1.cpp ├── one_char.cpp ├── repeated_reject_incomplete.cpp ├── all_headers.cpp ├── repeated_reject_incomplete1.cpp ├── one_char_except_c.cpp ├── one_char_except.cpp ├── version.cpp ├── test_case.hpp ├── empty_string.cpp ├── returns.cpp ├── string_tag.cpp ├── foldr.cpp ├── foldl.cpp ├── foldr1.cpp ├── foldl1.cpp ├── string_iterator_tag.cpp ├── is_char_c.cpp ├── back_inserter.cpp ├── front_inserter.cpp ├── define_error.cpp ├── foldr_reject_incomplete.cpp ├── foldl_reject_incomplete.cpp ├── foldl_reject_incomplete1.cpp ├── foldr_reject_incomplete1.cpp ├── is_digit.cpp └── has_type.cpp ├── meta └── libraries.json ├── include └── boost │ └── metaparse │ ├── version.hpp │ ├── if_.hpp │ ├── limit_one_of_size.hpp │ ├── limit_string_size.hpp │ ├── fail.hpp │ ├── int_.hpp │ ├── digit.hpp │ ├── empty.hpp │ ├── foldl.hpp │ ├── foldr.hpp │ ├── limit_sequence_size.hpp │ ├── lit.hpp │ ├── range.hpp │ ├── token.hpp │ ├── accept.hpp │ ├── always.hpp │ ├── except.hpp │ ├── foldl1.hpp │ ├── foldr1.hpp │ ├── grammar.hpp │ ├── letter.hpp │ ├── nth_of.hpp │ ├── one_of.hpp │ ├── reject.hpp │ ├── spaces.hpp │ ├── start.hpp │ ├── iterate.hpp │ ├── keyword.hpp │ ├── last_of.hpp │ ├── lit_c.hpp │ ├── range_c.hpp │ ├── return_.hpp │ ├── space.hpp │ ├── alphanum.hpp │ ├── always_c.hpp │ ├── first_of.hpp │ ├── get_col.hpp │ ├── is_error.hpp │ ├── nth_of_c.hpp │ ├── one_of_c.hpp │ ├── optional.hpp │ ├── repeated.hpp │ ├── sequence.hpp │ ├── v1 │ ├── impl │ │ ├── no_char.hpp │ │ ├── void_.hpp │ │ ├── has_type.hpp │ │ ├── one_char_except_not_used.hpp │ │ ├── returns.hpp │ │ ├── string_iterator_tag.hpp │ │ ├── assert_string_length.hpp │ │ ├── back_inserter.hpp │ │ ├── front_inserter.hpp │ │ └── is_char_c.hpp │ ├── fwd │ │ ├── reject.hpp │ │ ├── build_parser.hpp │ │ ├── accept.hpp │ │ ├── source_position.hpp │ │ ├── get_col.hpp │ │ ├── get_line.hpp │ │ ├── get_result.hpp │ │ ├── get_message.hpp │ │ ├── get_position.hpp │ │ ├── get_prev_char.hpp │ │ ├── get_remaining.hpp │ │ ├── next_char.hpp │ │ └── next_line.hpp │ ├── string_tag.hpp │ ├── lit.hpp │ ├── spaces.hpp │ ├── iterate.hpp │ ├── always_c.hpp │ ├── alphanum.hpp │ ├── swap.hpp │ ├── error │ │ ├── digit_expected.hpp │ │ ├── letter_expected.hpp │ │ ├── end_of_input_expected.hpp │ │ ├── expected_to_fail.hpp │ │ ├── unexpected_character.hpp │ │ ├── whitespace_expected.hpp │ │ ├── unexpected_end_of_input.hpp │ │ └── none_of_the_expected_cases_found.hpp │ ├── int_.hpp │ ├── iterate_c.hpp │ ├── digit_val.hpp │ ├── define_error.hpp │ ├── foldr.hpp │ ├── fail.hpp │ ├── get_col.hpp │ ├── repeated.hpp │ ├── get_line.hpp │ ├── token.hpp │ ├── get_message.hpp │ ├── get_result.hpp │ ├── repeated1.hpp │ ├── get_position.hpp │ ├── get_prev_char.hpp │ ├── get_remaining.hpp │ ├── start.hpp │ ├── unless_error.hpp │ ├── letter.hpp │ ├── next_char.hpp │ ├── next_line.hpp │ └── space.hpp │ ├── digit_val.hpp │ ├── get_line.hpp │ ├── iterate_c.hpp │ ├── repeated1.hpp │ ├── transform.hpp │ ├── accept_tag.hpp │ ├── fail_tag.hpp │ ├── middle_of.hpp │ ├── next_char.hpp │ ├── next_line.hpp │ ├── one_char.hpp │ ├── string_tag.hpp │ ├── accept_when.hpp │ ├── get_result.hpp │ ├── look_ahead.hpp │ ├── build_parser.hpp │ ├── entire_input.hpp │ ├── get_message.hpp │ ├── get_position.hpp │ ├── get_prev_char.hpp │ ├── get_remaining.hpp │ ├── limit_one_char_except_size.hpp │ ├── unless_error.hpp │ ├── one_char_except.hpp │ ├── repeated_one_of.hpp │ ├── repeated_one_of1.hpp │ ├── source_position.hpp │ ├── one_char_except_c.hpp │ ├── transform_error.hpp │ ├── source_position_tag.hpp │ ├── change_error_message.hpp │ ├── debug_parsing_error.hpp │ ├── foldl_reject_incomplete.hpp │ ├── foldl_start_with_parser.hpp │ ├── foldr_reject_incomplete.hpp │ ├── foldr_start_with_parser.hpp │ ├── util │ ├── in_range.hpp │ ├── is_letter.hpp │ ├── in_range_c.hpp │ ├── is_digit.hpp │ ├── digit_to_int.hpp │ ├── int_to_digit.hpp │ ├── is_whitespace.hpp │ ├── digit_to_int_c.hpp │ ├── int_to_digit_c.hpp │ ├── is_lcase_letter.hpp │ ├── is_ucase_letter.hpp │ └── is_whitespace_c.hpp │ ├── error │ ├── unpaired.hpp │ ├── digit_expected.hpp │ ├── letter_expected.hpp │ ├── index_out_of_range.hpp │ ├── literal_expected.hpp │ ├── end_of_input_expected.hpp │ ├── unexpected_character.hpp │ ├── whitespace_expected.hpp │ ├── unexpected_end_of_input.hpp │ └── none_of_the_expected_cases_found.hpp │ ├── foldl_reject_incomplete1.hpp │ ├── foldr_reject_incomplete1.hpp │ ├── transform_error_message.hpp │ ├── repeated_reject_incomplete.hpp │ ├── define_error.hpp │ ├── fail_at_first_char_expected.hpp │ ├── repeated_reject_incomplete1.hpp │ ├── foldl_reject_incomplete_start_with_parser.hpp │ └── string.hpp ├── README.md └── appveyor.yml /doc/.gitignore: -------------------------------------------------------------------------------- 1 | html 2 | 3 | -------------------------------------------------------------------------------- /example/parsing_error/.gitignore: -------------------------------------------------------------------------------- 1 | sample 2 | -------------------------------------------------------------------------------- /example/binary_number/README: -------------------------------------------------------------------------------- 1 | Parser for binary numbers 2 | -------------------------------------------------------------------------------- /example/rational/Jamfile.v2: -------------------------------------------------------------------------------- 1 | exe rational : main.cpp ; 2 | -------------------------------------------------------------------------------- /example/rational/README: -------------------------------------------------------------------------------- 1 | Parser for rational numbers. 2 | -------------------------------------------------------------------------------- /example/regexp/Jamfile.v2: -------------------------------------------------------------------------------- 1 | exe regexp : main.cpp ; 2 | -------------------------------------------------------------------------------- /example/binary_number/Jamfile.v2: -------------------------------------------------------------------------------- 1 | exe binary_number : main.cpp ; 2 | -------------------------------------------------------------------------------- /example/calculator/README: -------------------------------------------------------------------------------- 1 | Calculator, working at compile-time 2 | -------------------------------------------------------------------------------- /example/meta_lambda/Jamfile.v2: -------------------------------------------------------------------------------- 1 | exe meta_lambda : main.cpp ; 2 | -------------------------------------------------------------------------------- /example/parsing_error/Jamfile.v2: -------------------------------------------------------------------------------- 1 | exe parsing_error : main.cpp ; 2 | -------------------------------------------------------------------------------- /example/constexpr_parser/Jamfile.v2: -------------------------------------------------------------------------------- 1 | exe constexpr_parser : main.cpp ; 2 | -------------------------------------------------------------------------------- /example/minimal_rational/Jamfile.v2: -------------------------------------------------------------------------------- 1 | exe minimal_rational : main.cpp ; 2 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/index.html -------------------------------------------------------------------------------- /example/calculator_with_parens/Jamfile.v2: -------------------------------------------------------------------------------- 1 | exe calculator_with_parens : main.cpp ; 2 | -------------------------------------------------------------------------------- /example/compile_to_native_code/Jamfile.v2: -------------------------------------------------------------------------------- 1 | exe compile_to_native_code : main.cpp ; 2 | -------------------------------------------------------------------------------- /doc/images/folds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/folds.png -------------------------------------------------------------------------------- /example/meta_lambda/README: -------------------------------------------------------------------------------- 1 | An example on how to compile an EDSL into a C++ template metaprogram. 2 | -------------------------------------------------------------------------------- /example/compile_to_native_code/README: -------------------------------------------------------------------------------- 1 | An example on how to compile an EDSL into native executable code. 2 | -------------------------------------------------------------------------------- /doc/images/foldl_diag1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/foldl_diag1.png -------------------------------------------------------------------------------- /doc/images/foldl_diag2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/foldl_diag2.png -------------------------------------------------------------------------------- /doc/images/foldr_diag1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/foldr_diag1.png -------------------------------------------------------------------------------- /example/meta_metaparse/README: -------------------------------------------------------------------------------- 1 | This example demonstrates how to build an embedded DSL for Metaparse parsers. 2 | -------------------------------------------------------------------------------- /doc/images/repeated_diag0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/repeated_diag0.png -------------------------------------------------------------------------------- /doc/images/repeated_diag1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/repeated_diag1.png -------------------------------------------------------------------------------- /doc/images/repeated_diag2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/repeated_diag2.png -------------------------------------------------------------------------------- /doc/images/repeated_diag3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/repeated_diag3.png -------------------------------------------------------------------------------- /doc/images/tutorial_diag0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/tutorial_diag0.png -------------------------------------------------------------------------------- /doc/images/tutorial_diag1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/tutorial_diag1.png -------------------------------------------------------------------------------- /doc/images/tutorial_diag2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/tutorial_diag2.png -------------------------------------------------------------------------------- /doc/images/tutorial_diag3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/tutorial_diag3.png -------------------------------------------------------------------------------- /doc/images/tutorial_diag4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/tutorial_diag4.png -------------------------------------------------------------------------------- /doc/images/tutorial_diag5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/tutorial_diag5.png -------------------------------------------------------------------------------- /doc/images/tutorial_diag6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/tutorial_diag6.png -------------------------------------------------------------------------------- /doc/images/tutorial_diag7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/tutorial_diag7.png -------------------------------------------------------------------------------- /doc/images/tutorial_diag8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/tutorial_diag8.png -------------------------------------------------------------------------------- /doc/images/tutorial_diag9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/tutorial_diag9.png -------------------------------------------------------------------------------- /example/calculator_with_parens_and_unary_ops/Jamfile.v2: -------------------------------------------------------------------------------- 1 | exe calculator_with_parens_and_unary_ops : main.cpp ; 2 | -------------------------------------------------------------------------------- /doc/before_3.qbk: -------------------------------------------------------------------------------- 1 | [#before_3] 2 | ['Definitions before section 3.] 3 | 4 | #include 5 | 6 | -------------------------------------------------------------------------------- /doc/getting_started_14.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_14] 2 | 3 | > 4 | 5 | -------------------------------------------------------------------------------- /doc/images/tutorial_diag10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/tutorial_diag10.png -------------------------------------------------------------------------------- /doc/images/tutorial_diag11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/tutorial_diag11.png -------------------------------------------------------------------------------- /example/calculator_with_parens/README: -------------------------------------------------------------------------------- 1 | This is an extended version of the calculator example: it supports parens as 2 | well. 3 | -------------------------------------------------------------------------------- /example/grammar_calculator/README: -------------------------------------------------------------------------------- 1 | Calculator, working at compile-time. This example demonstrates how to build it 2 | with grammars. 3 | -------------------------------------------------------------------------------- /doc/getting_started_1.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_1] 2 | 3 | using int_token = token; 4 | using plus_token = token>; 5 | 6 | -------------------------------------------------------------------------------- /doc/images/foldl_reject_incomplete_diag1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/foldl_reject_incomplete_diag1.png -------------------------------------------------------------------------------- /doc/images/foldl_start_with_parser_diag1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/foldl_start_with_parser_diag1.png -------------------------------------------------------------------------------- /doc/images/foldr_reject_incomplete_diag1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/foldr_reject_incomplete_diag1.png -------------------------------------------------------------------------------- /doc/images/foldr_start_with_parser_diag1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/foldr_start_with_parser_diag1.png -------------------------------------------------------------------------------- /doc/getting_started_31.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_31] 2 | 3 | using lparen_token = token>; 4 | using rparen_token = token>; 5 | 6 | -------------------------------------------------------------------------------- /doc/images/generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for svg in *.svg 4 | do 5 | rsvg-convert -o $(echo $svg | sed 's/\.svg/\.png/') -f png $svg 6 | done 7 | 8 | -------------------------------------------------------------------------------- /doc/images/repeated_reject_incomplete_diag1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/repeated_reject_incomplete_diag1.png -------------------------------------------------------------------------------- /doc/getting_started_36.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_36] 2 | 3 | struct plus_exp3; 4 | using paren_exp4 = middle_of; 5 | 6 | -------------------------------------------------------------------------------- /example/calculator_with_parens_and_unary_ops/README: -------------------------------------------------------------------------------- 1 | This is an extended version of the calculator example: it supports unary 2 | operators (eg. -13) as well. 3 | -------------------------------------------------------------------------------- /doc/getting_started_3.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_3] 2 | 3 | eval_plus< boost::mpl::vector< mpl_::integral_c, mpl_::char_<'+'>, mpl_::integral_c >>::type 4 | 5 | -------------------------------------------------------------------------------- /doc/getting_started_6.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_6] 2 | 3 | using vector_of_numbers = boost::mpl::vector< boost::mpl::int_<2>, boost::mpl::int_<5>, boost::mpl::int_<6> >; 4 | 5 | -------------------------------------------------------------------------------- /doc/getting_started_9.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_9] 2 | 3 | sum_items< mpl_::integral_c, boost::mpl::vector, mpl_::integral_c> >::type 4 | 5 | -------------------------------------------------------------------------------- /doc/getting_started_33.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_33] 2 | 3 | #include 4 | using paren_exp2 = middle_of; 5 | 6 | -------------------------------------------------------------------------------- /doc/getting_started_8.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_8] 2 | 3 | template struct sum_items : boost::mpl::plus< Sum, typename boost::mpl::at_c::type > {}; 4 | 5 | -------------------------------------------------------------------------------- /doc/images/foldl_reject_incomplete_start_with_parser_diag1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sabel83/metaparse_test/master/doc/images/foldl_reject_incomplete_start_with_parser_diag1.png -------------------------------------------------------------------------------- /doc/tag.qbk: -------------------------------------------------------------------------------- 1 | [#tag] 2 | [section Tag] 3 | 4 | A ['tag] is a [link metaprogramming_value template metaprogramming value] used 5 | to identify groups of values. 6 | 7 | [endsect] 8 | 9 | -------------------------------------------------------------------------------- /doc/getting_started_30.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_30] 2 | 3 | exp_parser18::apply::type 4 | exp_parser18::apply::type 5 | 6 | -------------------------------------------------------------------------------- /doc/getting_started_0.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_0] 2 | 3 | #include 4 | using namespace boost::metaparse; 5 | using exp_parser1 = build_parser; 6 | 7 | -------------------------------------------------------------------------------- /doc/getting_started_21.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_21] 2 | 3 | #include 4 | template struct eval_binary_op : boost::mpl::times::type {}; 5 | 6 | -------------------------------------------------------------------------------- /example/calculator/Jamfile.v2: -------------------------------------------------------------------------------- 1 | project : requirements 2 | gcc:-ftemplate-depth=512 3 | clang:-ftemplate-depth=512 4 | ; 5 | 6 | exe calculator : main.cpp ; 7 | -------------------------------------------------------------------------------- /doc/getting_started_18.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_18] 2 | 3 | eval_binary_op, '+', boost::mpl::int_<2>>::type 4 | eval_binary_op, '-', boost::mpl::int_<2>>::type 5 | 6 | -------------------------------------------------------------------------------- /doc/getting_started_32.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_32] 2 | 3 | using plus_exp1 = foldl_start_with_parser< sequence, mult_exp4>, mult_exp4, boost::mpl::quote2 >; 4 | 5 | -------------------------------------------------------------------------------- /doc/getting_started_35.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_35] 2 | 3 | struct plus_exp2 : foldl_start_with_parser< sequence, mult_exp5>, mult_exp5, boost::mpl::quote2 > {}; 4 | 5 | -------------------------------------------------------------------------------- /example/meta_metaparse/Jamfile.v2: -------------------------------------------------------------------------------- 1 | project : requirements 2 | gcc:-ftemplate-depth=512 3 | clang:-ftemplate-depth=512 4 | ; 5 | 6 | exe meta_metaparse : main.cpp ; 7 | -------------------------------------------------------------------------------- /example/grammar_calculator/Jamfile.v2: -------------------------------------------------------------------------------- 1 | project : requirements 2 | gcc:-ftemplate-depth=512 3 | clang:-ftemplate-depth=512 4 | ; 5 | 6 | exe grammar_calculator : main.cpp ; 7 | -------------------------------------------------------------------------------- /doc/getting_started_16.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_16] 2 | 3 | using exp_parser12 = build_parser< foldl_start_with_parser< sequence, int_token>, int_token, boost::mpl::quote2 > >; 4 | 5 | -------------------------------------------------------------------------------- /doc/getting_started_19.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_19] 2 | 3 | template struct binary_op : eval_binary_op< S, boost::mpl::at_c::type::value, typename boost::mpl::at_c::type > {}; 4 | 5 | -------------------------------------------------------------------------------- /doc/getting_started_20.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_20] 2 | 3 | using exp_parser13 = build_parser< foldl_start_with_parser< sequence, int_token>, int_token, boost::mpl::quote2 > >; 4 | 5 | -------------------------------------------------------------------------------- /doc/getting_started_23.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_23] 2 | 3 | using exp_parser15 = build_parser< foldl_start_with_parser< sequence, mult_exp1>, mult_exp1, boost::mpl::quote2 > >; 4 | 5 | -------------------------------------------------------------------------------- /doc/getting_started_27.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_27] 2 | 3 | using exp_parser17 = build_parser< foldl_start_with_parser< sequence, mult_exp3>, mult_exp3, boost::mpl::quote2 > >; 4 | 5 | -------------------------------------------------------------------------------- /doc/getting_started_4.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_4] 2 | 3 | #include 4 | using exp_parser6 = build_parser< transform< sequence, boost::mpl::quote1 > >; 5 | 6 | -------------------------------------------------------------------------------- /doc/getting_started_25.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_25] 2 | 3 | template struct reverse_binary_op : eval_binary_op< typename boost::mpl::at_c::type, boost::mpl::at_c::type::value, S > {}; 4 | 5 | -------------------------------------------------------------------------------- /doc/getting_started_28.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_28] 2 | 3 | #include 4 | using unary_exp1 = foldr_start_with_parser< minus_token, int_token, boost::mpl::lambda>::type >; 5 | 6 | -------------------------------------------------------------------------------- /doc/getting_started_22.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_22] 2 | 3 | using exp_parser14 = build_parser< foldl_start_with_parser< sequence, int_token>, int_token, boost::mpl::quote2 > >; 4 | 5 | -------------------------------------------------------------------------------- /doc/getting_started_7.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_7] 2 | 3 | template struct sum_vector : boost::mpl::fold< Vector, boost::mpl::int_<0>, boost::mpl::lambda< boost::mpl::plus >::type > {}; 4 | 5 | -------------------------------------------------------------------------------- /doc/parser_combinator.qbk: -------------------------------------------------------------------------------- 1 | [#parser_combinator] 2 | [section Parser combinator] 3 | 4 | A ['parser combinator] is a [link parser parser] implemented as a template class 5 | taking one or more parsers as arguments. 6 | 7 | [endsect] 8 | 9 | -------------------------------------------------------------------------------- /example/getting_started/1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_1_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_1_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions of section 7 | 8 | #endif 9 | 10 | -------------------------------------------------------------------------------- /example/minimal_rational/README: -------------------------------------------------------------------------------- 1 | Parser for rational numbers. The aim is to present a very simple parser, 2 | therefore error messages for invalid input can be improved. To see a more 3 | advanced version, take a look at the rational example. 4 | -------------------------------------------------------------------------------- /doc/getting_started_5.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_5] 2 | 3 | using exp_parser7 = build_parser< sequence< int_token, /* The first */ repeated> /* The "+ " elements */ > >; 4 | 5 | -------------------------------------------------------------------------------- /doc/getting_started_13.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_13] 2 | 3 | using exp_parser10 = build_parser< transform< sequence< int_token, foldl< sequence, boost::mpl::int_<0>, boost::mpl::quote2 > >, boost::mpl::quote1> >; 4 | 5 | -------------------------------------------------------------------------------- /doc/getting_started_2.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_2] 2 | 3 | #include 4 | #include 5 | template struct eval_plus : boost::mpl::plus< typename boost::mpl::at_c::type, typename boost::mpl::at_c::type > {}; 6 | 7 | -------------------------------------------------------------------------------- /doc/getting_started_10.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_10] 2 | 3 | boost::mpl::fold< boost::mpl::at_c::type, /* The vector to summarise */ boost::mpl::int_<0>, /* The value to start the sum from */ boost::mpl::quote2 /* The function to call in each iteration */ >::type 4 | 5 | -------------------------------------------------------------------------------- /example/getting_started/README: -------------------------------------------------------------------------------- 1 | This example contains the code snippets of Getting Started. These headers are 2 | intended to be used from Metashell. To get all the definitions before section 3 | N. you need to include N.hpp 4 | 5 | The headers can always be re-generated by running generate_all.py 6 | 7 | -------------------------------------------------------------------------------- /example/meta_hs/README: -------------------------------------------------------------------------------- 1 | Haskell-like functional EDSL for template metafunctions. 2 | This example contains two programs. Both of them define and execute a few 3 | template metaprograms. One of the do it by using Boost.MPL directly, while the 4 | other one defines the template metaprograms using the EDSL. 5 | -------------------------------------------------------------------------------- /example/getting_started/1_1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_1_1_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_1_1_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 1 7 | #include "1.hpp" 8 | 9 | // Definitions of section 1 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /example/getting_started/5_1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_5_1_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_5_1_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 5 7 | #include "5.hpp" 8 | 9 | // Definitions of section 5 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /example/getting_started/6_1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_6_1_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_6_1_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 6 7 | #include "6.hpp" 8 | 9 | // Definitions of section 6 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /example/getting_started/7_1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_7_1_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_7_1_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 7 7 | #include "7.hpp" 8 | 9 | // Definitions of section 7 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /example/meta_hs/Jamfile.v2: -------------------------------------------------------------------------------- 1 | 2 | project meta_hs : 3 | requirements 4 | . 5 | gcc:-ftemplate-depth=512 6 | clang:-ftemplate-depth=512 7 | ; 8 | 9 | exe handcrafted : main_handcrafted.cpp ; 10 | exe in_haskell : main_in_haskell.cpp ; 11 | 12 | -------------------------------------------------------------------------------- /test/build_parser.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2010. 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 | 6 | #include 7 | 8 | -------------------------------------------------------------------------------- /example/getting_started/1_2.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_1_2_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_1_2_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 1.1 7 | #include "1_1.hpp" 8 | 9 | // Definitions of section 1.1 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /example/getting_started/2.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_2_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_2_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 1.2.2 7 | #include "1_2_2.hpp" 8 | 9 | // Definitions of section 1.2.2 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /example/getting_started/8_2.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_8_2_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_8_2_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 8.1 7 | #include "8_1.hpp" 8 | 9 | // Definitions of section 8.1 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /example/getting_started/11_2.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_11_2_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_11_2_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 11.1 7 | #include "11_1.hpp" 8 | 9 | // Definitions of section 11.1 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /example/getting_started/1_2_1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_1_2_1_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_1_2_1_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 1.2 7 | #include "1_2.hpp" 8 | 9 | // Definitions of section 1.2 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /doc/getting_started_17.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_17] 2 | 3 | template struct eval_binary_op; 4 | template struct eval_binary_op : boost::mpl::plus::type {}; 5 | template struct eval_binary_op : boost::mpl::minus::type {}; 6 | 7 | -------------------------------------------------------------------------------- /test/change_error_message.cpp: -------------------------------------------------------------------------------- 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 | 6 | #include 7 | 8 | -------------------------------------------------------------------------------- /doc/before_3_1.qbk: -------------------------------------------------------------------------------- 1 | [#before_3_1] 2 | ['Definitions before section 3.1.] 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | using namespace boost::metaparse; 10 | 11 | using exp_parser1 = build_parser; 12 | 13 | -------------------------------------------------------------------------------- /doc/before_3_2.qbk: -------------------------------------------------------------------------------- 1 | [#before_3_2] 2 | ['Definitions before section 3.2.] 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | using namespace boost::metaparse; 10 | 11 | using exp_parser1 = build_parser; 12 | 13 | -------------------------------------------------------------------------------- /example/getting_started/1_2_2.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_1_2_2_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_1_2_2_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 1.2.1 7 | #include "1_2_1.hpp" 8 | 9 | // Definitions of section 1.2.1 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /doc/getting_started_15.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_15] 2 | 3 | using exp_parser11 = build_parser< foldl_start_with_parser< sequence, /* apply this parser repeatedly */ int_token, /* use this parser to get the initial value */ boost::mpl::quote2 /* use this function to add a new value to the summary */ > >; 4 | 5 | -------------------------------------------------------------------------------- /doc/string_tag.qbk: -------------------------------------------------------------------------------- 1 | [#string_tag] 2 | [section string_tag] 3 | 4 | [h1 Synopsis] 5 | 6 | struct string_tag; 7 | 8 | This is a [link tag tag]. 9 | 10 | [h1 Description] 11 | 12 | This is the tag of the [link string `string`] values. 13 | 14 | [h1 Header] 15 | 16 | #include 17 | 18 | [endsect] 19 | 20 | -------------------------------------------------------------------------------- /doc/getting_started_39.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_39] 2 | 3 | #include 4 | struct plus_exp5 : foldl_reject_incomplete_start_with_parser< sequence, mult_exp6>, mult_exp6, boost::mpl::quote2 > {}; 5 | using exp_parser22 = build_parser; 6 | 7 | -------------------------------------------------------------------------------- /meta/libraries.json: -------------------------------------------------------------------------------- 1 | { 2 | "key": "metaparse", 3 | "name": "Metaparse", 4 | "authors": ["Abel Sinkovics"], 5 | "description": "A library for generating compile time parsers parsing embedded DSL code as part of the C++ compilation process", 6 | "category": ["Metaprogramming"], 7 | "maintainers": ["Abel Sinkovics "] 8 | } 9 | -------------------------------------------------------------------------------- /doc/getting_started_26.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_26] 2 | 3 | using mult_exp3 = foldr_start_with_parser< sequence>, /* The parser applied repeatedly */ int_token, /* The parser parsing the last number */ boost::mpl::quote2 /* The function called for every result */ /* of applying the above parser */ >; 4 | 5 | -------------------------------------------------------------------------------- /doc/accept_tag.qbk: -------------------------------------------------------------------------------- 1 | [#accept_tag] 2 | [section accept_tag] 3 | 4 | [h1 Synopsis] 5 | 6 | struct accept_tag; 7 | 8 | This is a [link tag tag]. 9 | 10 | [h1 Description] 11 | 12 | This is the tag of the values returned by a parser when parsing was successful. 13 | 14 | [h1 Header] 15 | 16 | #include 17 | 18 | [endsect] 19 | 20 | -------------------------------------------------------------------------------- /doc/fail_tag.qbk: -------------------------------------------------------------------------------- 1 | [#fail_tag] 2 | [section fail_tag] 3 | 4 | [h1 Synopsis] 5 | 6 | struct fail_tag; 7 | 8 | This is a [link tag tag]. 9 | 10 | [h1 Description] 11 | 12 | This is the tag of the values returned by a parser when parsing was not 13 | successful. 14 | 15 | [h1 Header] 16 | 17 | #include 18 | 19 | [endsect] 20 | 21 | -------------------------------------------------------------------------------- /doc/getting_started_29.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_29] 2 | 3 | using mult_exp4 = foldl_start_with_parser< sequence, unary_exp1>, unary_exp1, boost::mpl::quote2 >; 4 | using exp_parser18 = build_parser< foldl_start_with_parser< sequence, mult_exp4>, mult_exp4, boost::mpl::quote2 > >; 5 | 6 | -------------------------------------------------------------------------------- /example/regexp/README: -------------------------------------------------------------------------------- 1 | This example provides an interface in front of boost::xpressive. 2 | A regular expression can be specified by a compile-time string 3 | which is parsed (and verified) at compile-time. A boost::xpressive 4 | object is constructed at runtime based on it. 5 | This is just an example, it supports only a subset of the capabilities 6 | of boost::xpressive. 7 | 8 | -------------------------------------------------------------------------------- /doc/getting_started_12.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_12] 2 | 3 | using exp_parser9 = build_parser< transform< /* What we had so far */ sequence< int_token, transform< repeated>, boost::mpl::lambda< boost::mpl::fold< boost::mpl::_1, boost::mpl::int_<0>, boost::mpl::quote2 > >::type > >, boost::mpl::quote1 /* summarise the vector of numbers */ > >; 4 | 5 | -------------------------------------------------------------------------------- /example/getting_started/11_1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_11_1_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_11_1_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 11 7 | #include "11.hpp" 8 | 9 | // Definitions of section 11 10 | // query: 11 | // exp_parser19::apply::type 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /example/getting_started/3_2.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_3_2_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_3_2_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 3.1 7 | #include "3_1.hpp" 8 | 9 | // Definitions of section 3.1 10 | // query: 11 | // exp_parser1::apply::type 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /doc/source_position_tag.qbk: -------------------------------------------------------------------------------- 1 | [#source_position_tag] 2 | [section source_position_tag] 3 | 4 | [h1 Synopsis] 5 | 6 | struct source_position_tag; 7 | 8 | This is a [link tag tag]. 9 | 10 | [h1 Description] 11 | 12 | This is the tag of the [link source_position `source_position`] values. 13 | 14 | [h1 Header] 15 | 16 | #include 17 | 18 | [endsect] 19 | 20 | -------------------------------------------------------------------------------- /doc/start.qbk: -------------------------------------------------------------------------------- 1 | [#start] 2 | [section start] 3 | 4 | [h1 Synopsis] 5 | 6 | struct start; 7 | 8 | This is a [link metaprogramming_value template metaprogramming value] of type 9 | [link source_position source position]. 10 | 11 | [h1 Description] 12 | 13 | It represents the beginning of an input text. 14 | 15 | [h1 Header] 16 | 17 | #include 18 | 19 | [endsect] 20 | 21 | -------------------------------------------------------------------------------- /example/getting_started/5_2_1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_5_2_1_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_5_2_1_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 5.2 7 | #include "5_2.hpp" 8 | 9 | // Definitions of section 5.2 10 | using temp_result = exp_parser7::apply::type; 11 | 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /test/repeated.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2010. 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 | 6 | #include 7 | 8 | using boost::metaparse::repeated; 9 | 10 | #define TEST_NAME repeated 11 | 12 | #include "repeated_test.hpp" 13 | 14 | -------------------------------------------------------------------------------- /test/repeated1.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2010. 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 | 6 | #include 7 | 8 | using boost::metaparse::repeated1; 9 | 10 | #define TEST_NAME repeated1 11 | 12 | #include "repeated1_test.hpp" 13 | 14 | -------------------------------------------------------------------------------- /doc/before_3_3.qbk: -------------------------------------------------------------------------------- 1 | [#before_3_3] 2 | ['Definitions before section 3.3.] 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | using namespace boost::metaparse; 10 | 11 | using exp_parser1 = build_parser; 12 | #include 13 | 14 | using exp_parser2 = build_parser>; 15 | 16 | -------------------------------------------------------------------------------- /doc/getting_started_38.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_38] 2 | 3 | #include 4 | #include 5 | struct plus_exp4 : first_of< foldl_start_with_parser< sequence, mult_exp6>, mult_exp6, boost::mpl::quote2 >, fail_at_first_char_expected< sequence, mult_exp6> > > {}; 6 | using exp_parser21 = build_parser; 7 | 8 | -------------------------------------------------------------------------------- /test/one_char.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2010. 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 | 6 | #include 7 | 8 | namespace 9 | { 10 | typedef boost::metaparse::one_char oc; 11 | } 12 | 13 | #define TEST_NAME one_char 14 | 15 | #include "one_char_test.hpp" 16 | 17 | -------------------------------------------------------------------------------- /doc/README: -------------------------------------------------------------------------------- 1 | Quickbook documentation of Metaparse. 2 | 3 | The getting_started_*.qbk files are automatically generated from the content of 4 | getting_started.qbk. The header files of ../example/getting_started are also 5 | automatically generated from getting_started.qbk. 6 | 7 | These files can be regenerated by running 8 | 9 | generate_all.py 10 | 11 | in the root directory of the Metaparse source code. Note that the script has 12 | been tested on Linux only. 13 | 14 | -------------------------------------------------------------------------------- /doc/getting_started_34.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_34] 2 | 3 | using paren_exp3 = middle_of; 4 | using primary_exp2 = one_of; 5 | using unary_exp2 = foldr_start_with_parser< minus_token, primary_exp2, boost::mpl::lambda>::type >; 6 | using mult_exp5 = foldl_start_with_parser< sequence, unary_exp2>, unary_exp2, boost::mpl::quote2 >; 7 | 8 | -------------------------------------------------------------------------------- /doc/digit_expected.qbk: -------------------------------------------------------------------------------- 1 | [#digit_expected] 2 | [section digit_expected] 3 | 4 | [h1 Synopsis] 5 | 6 | namespace error 7 | { 8 | struct digit_expected; 9 | } 10 | 11 | This is a [link parsing_error_message parsing error message]. 12 | 13 | [h1 Description] 14 | 15 | Class representing the error that a digit character was expected at a specific 16 | location. 17 | 18 | [h1 Header] 19 | 20 | #include 21 | 22 | [endsect] 23 | 24 | -------------------------------------------------------------------------------- /doc/expected_to_fail.qbk: -------------------------------------------------------------------------------- 1 | [#expected_to_fail] 2 | [section expected_to_fail] 3 | 4 | [h1 Synopsis] 5 | 6 | namespace error 7 | { 8 | struct expected_to_fail; 9 | } 10 | 11 | This is a [link parsing_error_message parsing error message]. 12 | 13 | [h1 Description] 14 | 15 | Class representing the error that a parser was expected to fail but it did not 16 | fail. 17 | 18 | [h1 Header] 19 | 20 | #include 21 | 22 | [endsect] 23 | 24 | -------------------------------------------------------------------------------- /doc/letter_expected.qbk: -------------------------------------------------------------------------------- 1 | [#letter_expected] 2 | [section letter_expected] 3 | 4 | [h1 Synopsis] 5 | 6 | namespace error 7 | { 8 | struct letter_expected; 9 | } 10 | 11 | This is a [link parsing_error_message parsing error message]. 12 | 13 | [h1 Description] 14 | 15 | Class representing the error that a letter character was expected at a specific 16 | location. 17 | 18 | [h1 Header] 19 | 20 | #include 21 | 22 | [endsect] 23 | 24 | -------------------------------------------------------------------------------- /example/getting_started/3.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_3_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_3_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 2 7 | #include "2.hpp" 8 | 9 | // Definitions of section 2 10 | #include 11 | 12 | // query: 13 | // boost::metaparse::string<'1', '1', ' ', '+', ' ', '2'> 14 | 15 | // query: 16 | // BOOST_METAPARSE_STRING("11 + 2") 17 | 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /include/boost/metaparse/version.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_VERSION_HPP 2 | #define BOOST_METAPARSE_VERSION_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | #define BOOST_METAPARSE_VERSION BOOST_VERSION_NUMBER(1, 0, 0) 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /doc/end_of_input_expected.qbk: -------------------------------------------------------------------------------- 1 | [#end_of_input_expected] 2 | [section end_of_input_expected] 3 | 4 | [h1 Synopsis] 5 | 6 | namespace error 7 | { 8 | struct end_of_input_expected; 9 | } 10 | 11 | This is a [link parsing_error_message parsing error message]. 12 | 13 | [h1 Description] 14 | 15 | Class representing the error that the input contains more characters than it 16 | should. 17 | 18 | [h1 Header] 19 | 20 | #include 21 | 22 | [endsect] 23 | 24 | -------------------------------------------------------------------------------- /doc/whitespace_expected.qbk: -------------------------------------------------------------------------------- 1 | [#whitespace_expected] 2 | [section whitespace_expected] 3 | 4 | [h1 Synopsis] 5 | 6 | namespace error 7 | { 8 | struct whitespace_expected; 9 | } 10 | 11 | This is a [link parsing_error_message parsing error message]. 12 | 13 | [h1 Description] 14 | 15 | Class representing the error that a whitespace character was expected at a 16 | specific location. 17 | 18 | [h1 Header] 19 | 20 | #include 21 | 22 | [endsect] 23 | 24 | -------------------------------------------------------------------------------- /test/repeated_reject_incomplete.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 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 | 6 | #include 7 | 8 | using boost::metaparse::repeated_reject_incomplete; 9 | 10 | #define TEST_NAME repeated_reject_incomplete 11 | 12 | #include "repeated_reject_incomplete_test.hpp" 13 | 14 | -------------------------------------------------------------------------------- /include/boost/metaparse/if_.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_IF__HPP 2 | #define BOOST_METAPARSE_IF__HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::if_; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/limit_one_of_size.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_LIMIT_ONE_OF_SIZE_HPP 2 | #define BOOST_METAPARSE_LIMIT_ONE_OF_SIZE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #ifndef BOOST_METAPARSE_LIMIT_ONE_OF_SIZE 10 | # define BOOST_METAPARSE_LIMIT_ONE_OF_SIZE 20 11 | #endif 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /include/boost/metaparse/limit_string_size.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_LIMIT_STRING_SIZE_HPP 2 | #define BOOST_METAPARSE_LIMIT_STRING_SIZE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #ifndef BOOST_METAPARSE_LIMIT_STRING_SIZE 10 | # define BOOST_METAPARSE_LIMIT_STRING_SIZE 32 11 | #endif 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /test/all_headers.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 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 | 6 | #include 7 | 8 | // disable the include guard 9 | #ifndef BOOST_METAPARSE_HPP 10 | # error The include guard of boost/metaparse.hpp has changed. 11 | #endif 12 | #undef BOOST_METAPARSE_HPP 13 | 14 | #include 15 | 16 | -------------------------------------------------------------------------------- /test/repeated_reject_incomplete1.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 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 | 6 | #include 7 | 8 | using boost::metaparse::repeated_reject_incomplete1; 9 | 10 | #define TEST_NAME repeated_reject_incomplete1 11 | 12 | #include "repeated_reject_incomplete1_test.hpp" 13 | 14 | -------------------------------------------------------------------------------- /example/Jamfile.v2: -------------------------------------------------------------------------------- 1 | build-project binary_number ; 2 | build-project calculator ; 3 | build-project calculator_with_parens ; 4 | build-project calculator_with_parens_and_unary_ops ; 5 | build-project compile_to_native_code ; 6 | build-project constexpr_parser ; 7 | build-project grammar_calculator ; 8 | build-project meta_hs ; 9 | build-project meta_lambda ; 10 | build-project meta_metaparse ; 11 | build-project minimal_rational ; 12 | build-project parsing_error ; 13 | build-project rational ; 14 | build-project regexp ; 15 | -------------------------------------------------------------------------------- /include/boost/metaparse/fail.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FAIL_HPP 2 | #define BOOST_METAPARSE_FAIL_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::fail; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/int_.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_INT_HPP 2 | #define BOOST_METAPARSE_INT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::int_; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Boost.Metaparse 2 | 3 | [![Build Status](https://secure.travis-ci.org/boostorg/metaparse.png?branch=master "Build Status")](http://travis-ci.org/boostorg/metaparse) 4 | [![Windows build status](https://ci.appveyor.com/api/projects/status/u7ysxkssmrgr7vau/branch/master?svg=true)](https://ci.appveyor.com/project/sabel83/metaparse-04v04/branch/master) 5 | 6 | Metaparse is parser generator library for template metaprograms. The purpose of 7 | this library is to support the creation of parsers that parse at compile time. 8 | 9 | -------------------------------------------------------------------------------- /include/boost/metaparse/digit.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_DIGIT_HPP 2 | #define BOOST_METAPARSE_DIGIT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::digit; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/empty.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_EMPTY_HPP 2 | #define BOOST_METAPARSE_EMPTY_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::empty; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/foldl.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FOLDL_HPP 2 | #define BOOST_METAPARSE_FOLDL_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::foldl; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/foldr.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FOLDR_HPP 2 | #define BOOST_METAPARSE_FOLDR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::foldr; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/limit_sequence_size.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE_HPP 2 | #define BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #ifndef BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE 10 | # define BOOST_METAPARSE_LIMIT_SEQUENCE_SIZE 5 11 | #endif 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /include/boost/metaparse/lit.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_LIT_HPP 2 | #define BOOST_METAPARSE_LIT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::lit; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | 22 | -------------------------------------------------------------------------------- /include/boost/metaparse/range.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_RANGE_HPP 2 | #define BOOST_METAPARSE_RANGE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::range; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/token.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_TOKEN_HPP 2 | #define BOOST_METAPARSE_TOKEN_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::token; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/accept.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ACCEPT_HPP 2 | #define BOOST_METAPARSE_ACCEPT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::accept; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/always.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ALWAYS_HPP 2 | #define BOOST_METAPARSE_ALWAYS_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::always; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/except.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_EXCEPT_HPP 2 | #define BOOST_METAPARSE_EXCEPT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::except; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/foldl1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FOLDL1_HPP 2 | #define BOOST_METAPARSE_FOLDL1_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::foldl1; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/foldr1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FOLDR1_HPP 2 | #define BOOST_METAPARSE_FOLDR1_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::foldr1; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/grammar.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GRAMMAR_HPP 2 | #define BOOST_METAPARSE_GRAMMAR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::grammar; 16 | } 17 | } 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /include/boost/metaparse/letter.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_LETTER_HPP 2 | #define BOOST_METAPARSE_LETTER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::letter; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/nth_of.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_NTH_OF_HPP 2 | #define BOOST_METAPARSE_NTH_OF_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::nth_of; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/one_of.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ONE_OF_HPP 2 | #define BOOST_METAPARSE_ONE_OF_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::one_of; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/reject.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_REJECT_HPP 2 | #define BOOST_METAPARSE_REJECT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::reject; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/spaces.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_SPACES_HPP 2 | #define BOOST_METAPARSE_SPACES_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::spaces; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/start.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_START_HPP 2 | #define BOOST_METAPARSE_START_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::start; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /doc/getting_started_37.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_37] 2 | 3 | using unary_exp3 = foldr_start_with_parser< minus_token, primary_exp3, boost::mpl::lambda>::type >; 4 | using mult_exp6 = foldl_start_with_parser< sequence, unary_exp3>, unary_exp3, boost::mpl::quote2 >; 5 | struct plus_exp3 : foldl_start_with_parser< sequence, mult_exp6>, mult_exp6, boost::mpl::quote2 > {}; 6 | using exp_parser20 = build_parser; 7 | 8 | -------------------------------------------------------------------------------- /doc/unexpected_character.qbk: -------------------------------------------------------------------------------- 1 | [#unexpected_character] 2 | [section unexpected_character] 3 | 4 | [h1 Synopsis] 5 | 6 | namespace error 7 | { 8 | struct unexpected_character; 9 | } 10 | 11 | This is a [link parsing_error_message parsing error message]. 12 | 13 | [h1 Description] 14 | 15 | Class representing the error that a different character was expected than what 16 | was found at a specific location. 17 | 18 | [h1 Header] 19 | 20 | #include 21 | 22 | [endsect] 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/iterate.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ITERATE_HPP 2 | #define BOOST_METAPARSE_ITERATE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::iterate; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/keyword.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_KEYWORD_HPP 2 | #define BOOST_METAPARSE_KEYWORD_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::keyword; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/last_of.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_LAST_OF_HPP 2 | #define BOOST_METAPARSE_LAST_OF_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::last_of; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/lit_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_LIT_C_HPP 2 | #define BOOST_METAPARSE_LIT_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::lit_c; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | 22 | -------------------------------------------------------------------------------- /include/boost/metaparse/range_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_RANGE_C_HPP 2 | #define BOOST_METAPARSE_RANGE_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::range_c; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/return_.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_RETURN__HPP 2 | #define BOOST_METAPARSE_RETURN__HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::return_; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/space.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_SPACE_HPP 2 | #define BOOST_METAPARSE_SPACE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::space; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | 22 | -------------------------------------------------------------------------------- /include/boost/metaparse/alphanum.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ALPHANUM_HPP 2 | #define BOOST_METAPARSE_ALPHANUM_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::alphanum; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/always_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ALWAYS_C_HPP 2 | #define BOOST_METAPARSE_ALWAYS_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::always_c; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/first_of.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FIRST_OF_HPP 2 | #define BOOST_METAPARSE_FIRST_OF_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::first_of; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/get_col.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GET_COL_HPP 2 | #define BOOST_METAPARSE_GET_COL_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::get_col; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/is_error.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_IS_ERROR_HPP 2 | #define BOOST_METAPARSE_IS_ERROR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::is_error; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/nth_of_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_NTH_OF_C_HPP 2 | #define BOOST_METAPARSE_NTH_OF_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::nth_of_c; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/one_of_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ONE_OF_C_HPP 2 | #define BOOST_METAPARSE_ONE_OF_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::one_of_c; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/optional.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_OPTIONAL_HPP 2 | #define BOOST_METAPARSE_OPTIONAL_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::optional; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/repeated.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_REPEATED_HPP 2 | #define BOOST_METAPARSE_REPEATED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::repeated; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/sequence.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_SEQUENCE_HPP 2 | #define BOOST_METAPARSE_SEQUENCE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::sequence; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/impl/no_char.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_IMPL_NO_CHAR_HPP 2 | #define BOOST_METAPARSE_V1_IMPL_NO_CHAR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | #ifdef BOOST_NO_CHAR 12 | # error BOOST_NO_CHAR already defined 13 | #endif 14 | #define BOOST_NO_CHAR EOF 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /test/one_char_except_c.cpp: -------------------------------------------------------------------------------- 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 | 6 | #include 7 | 8 | #include "common.hpp" 9 | 10 | namespace 11 | { 12 | typedef boost::metaparse::one_char_except_c<'0', '1'> oc; 13 | } 14 | 15 | #define TEST_NAME one_char_except_c 16 | 17 | #include "one_char_except_test.hpp" 18 | 19 | -------------------------------------------------------------------------------- /doc/before_4.qbk: -------------------------------------------------------------------------------- 1 | [#before_4] 2 | ['Definitions before section 4.] 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | using namespace boost::metaparse; 10 | 11 | using exp_parser1 = build_parser; 12 | #include 13 | 14 | using exp_parser2 = build_parser>; 15 | #include 16 | 17 | using exp_parser3 = build_parser>>; 18 | 19 | -------------------------------------------------------------------------------- /include/boost/metaparse/digit_val.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_DIGIT_VAL_HPP 2 | #define BOOST_METAPARSE_DIGIT_VAL_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::digit_val; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/get_line.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GET_LINE_HPP 2 | #define BOOST_METAPARSE_GET_LINE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::get_line; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/iterate_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ITERATE_C_HPP 2 | #define BOOST_METAPARSE_ITERATE_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::iterate_c; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/repeated1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_REPEATED1_HPP 2 | #define BOOST_METAPARSE_REPEATED1_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::repeated1; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/transform.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_TRANSFORM_HPP 2 | #define BOOST_METAPARSE_TRANSFORM_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::transform; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /doc/getting_started_24.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_24] 2 | 3 | #include 4 | template struct eval_binary_op : boost::mpl::divides::type {}; 5 | using divides_token = token>; 6 | using mult_exp2 = foldl_start_with_parser< sequence, int_token>, int_token, boost::mpl::quote2 >; 7 | using exp_parser16 = build_parser< foldl_start_with_parser< sequence, mult_exp2>, mult_exp2, boost::mpl::quote2 > >; 8 | 9 | -------------------------------------------------------------------------------- /doc/unexpected_end_of_input.qbk: -------------------------------------------------------------------------------- 1 | [#unexpected_end_of_input] 2 | [section unexpected_end_of_input] 3 | 4 | [h1 Synopsis] 5 | 6 | namespace error 7 | { 8 | struct unexpected_end_of_input; 9 | } 10 | 11 | This is a [link parsing_error_message parsing error message]. 12 | 13 | [h1 Description] 14 | 15 | Class representing the error that the end of input has been reached while it 16 | should contain further characters. 17 | 18 | [h1 Header] 19 | 20 | #include 21 | 22 | [endsect] 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/accept_tag.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ACCEPT_TAG_HPP 2 | #define BOOST_METAPARSE_ACCEPT_TAG_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::accept_tag; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/fail_tag.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FAIL_TAG_HPP 2 | #define BOOST_METAPARSE_FAIL_TAG_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::fail_tag; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | 22 | -------------------------------------------------------------------------------- /include/boost/metaparse/middle_of.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_KEEP_MIDDLE_HPP 2 | #define BOOST_METAPARSE_KEEP_MIDDLE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::middle_of; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/next_char.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_NEXT_CHAR_HPP 2 | #define BOOST_METAPARSE_NEXT_CHAR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::next_char; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/next_line.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_NEXT_LINE_HPP 2 | #define BOOST_METAPARSE_NEXT_LINE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::next_line; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/one_char.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ONE_CHAR_HPP 2 | #define BOOST_METAPARSE_ONE_CHAR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::one_char; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | 22 | -------------------------------------------------------------------------------- /include/boost/metaparse/string_tag.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_STRING_TAG_HPP 2 | #define BOOST_METAPARSE_STRING_TAG_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::string_tag; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /test/one_char_except.cpp: -------------------------------------------------------------------------------- 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 | 6 | #include 7 | 8 | #include "common.hpp" 9 | 10 | namespace 11 | { 12 | typedef boost::metaparse::one_char_except oc; 13 | } 14 | 15 | #define TEST_NAME test_one_char_except 16 | 17 | #include "one_char_except_test.hpp" 18 | 19 | 20 | -------------------------------------------------------------------------------- /example/meta_hs/double_number.hpp: -------------------------------------------------------------------------------- 1 | #ifndef DOUBLE_NUMBER_HPP 2 | #define DOUBLE_NUMBER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2012. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | template 13 | struct double_number : 14 | boost::mpl::times > 15 | {}; 16 | 17 | #endif 18 | 19 | -------------------------------------------------------------------------------- /include/boost/metaparse/accept_when.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ACCEPT_WHEN_HPP 2 | #define BOOST_METAPARSE_ACCEPT_WHEN_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::accept_when; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/get_result.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GET_RESULT_HPP 2 | #define BOOST_METAPARSE_GET_RESULT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::get_result; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/look_ahead.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_LOOK_AHEAD_HPP 2 | #define BOOST_METAPARSE_LOOK_AHEAD_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::look_ahead; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /doc/getting_started_11.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_11] 2 | 3 | using exp_parser8 = build_parser< sequence< int_token, /* parse the first */ transform< repeated>, /* parse the "+ " elements */ /* lambda expression summarising the "+ " elements using fold */ boost::mpl::lambda< /* The folding expression we have just created */ boost::mpl::fold< boost::mpl::_1, /* the argument of the lambda expression, the result */ /* of the repeated<...> parser */ boost::mpl::int_<0>, boost::mpl::quote2 > >::type > > >; 4 | 5 | -------------------------------------------------------------------------------- /include/boost/metaparse/build_parser.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_BUILD_PARSER_HPP 2 | #define BOOST_METAPARSE_BUILD_PARSER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::build_parser; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/entire_input.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ENTIRE_INPUT_HPP 2 | #define BOOST_METAPARSE_ENTIRE_INPUT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::entire_input; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/get_message.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GET_MESSAGE_HPP 2 | #define BOOST_METAPARSE_GET_MESSAGE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::get_message; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /doc/none_of_the_expected_cases_found.qbk: -------------------------------------------------------------------------------- 1 | [#none_of_the_expected_cases_found] 2 | [section none_of_the_expected_cases_found] 3 | 4 | [h1 Synopsis] 5 | 6 | namespace error 7 | { 8 | struct none_of_the_expected_cases_found; 9 | } 10 | 11 | This is a [link parsing_error_message parsing error message]. 12 | 13 | [h1 Description] 14 | 15 | Class representing the error that none of a list of parsers could parse the 16 | input. 17 | 18 | [h1 Header] 19 | 20 | #include 21 | 22 | [endsect] 23 | 24 | -------------------------------------------------------------------------------- /example/getting_started/4_2.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_4_2_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_4_2_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 4.1 7 | #include "4_1.hpp" 8 | 9 | // Definitions of section 4.1 10 | using int_token = token; 11 | 12 | using plus_token = token>; 13 | 14 | using exp_parser5 = build_parser>; 15 | 16 | // query: 17 | // exp_parser5::apply::type 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/get_position.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GET_POSITION_HPP 2 | #define BOOST_METAPARSE_GET_POSITION_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::get_position; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/get_prev_char.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GET_PREV_CHAR_HPP 2 | #define BOOST_METAPARSE_GET_PREV_CHAR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::get_prev_char; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/get_remaining.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GET_REMAINING_HPP 2 | #define BOOST_METAPARSE_GET_REMAINING_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::get_remaining; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/limit_one_char_except_size.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE_HPP 2 | #define BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #ifndef BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE 10 | # define BOOST_METAPARSE_LIMIT_ONE_CHAR_EXCEPT_SIZE 10 11 | #endif 12 | 13 | #endif 14 | 15 | 16 | -------------------------------------------------------------------------------- /include/boost/metaparse/unless_error.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_UTIL_UNLESS_ERROR_HPP 2 | #define BOOST_METAPARSE_UTIL_UNLESS_ERROR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::unless_error; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /example/getting_started/3_1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_3_1_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_3_1_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 3 7 | #include "3.hpp" 8 | 9 | // Definitions of section 3 10 | #include 11 | 12 | #include 13 | 14 | using namespace boost::metaparse; 15 | 16 | using exp_parser1 = build_parser; 17 | 18 | // query: 19 | // exp_parser1::apply::type 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /include/boost/metaparse/one_char_except.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ONE_CHAR_EXCEPT_HPP 2 | #define BOOST_METAPARSE_ONE_CHAR_EXCEPT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::one_char_except; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/repeated_one_of.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_REPEATED_ONE_OF_HPP 2 | #define BOOST_METAPARSE_REPEATED_ONE_OF_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::repeated_one_of; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/repeated_one_of1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_REPEATED_ONE_OF1_HPP 2 | #define BOOST_METAPARSE_REPEATED_ONE_OF1_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::repeated_one_of1; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/source_position.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_SOURCE_POSITION_HPP 2 | #define BOOST_METAPARSE_SOURCE_POSITION_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::source_position; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /example/getting_started/4.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_4_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_4_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 3.3 7 | #include "3_3.hpp" 8 | 9 | // Definitions of section 3.3 10 | // query: 11 | // exp_parser2::apply::type 12 | 13 | #include 14 | 15 | using exp_parser3 = build_parser>>; 16 | 17 | // query: 18 | // exp_parser3::apply::type 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /include/boost/metaparse/one_char_except_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ONE_CHAR_EXCEPT_C_HPP 2 | #define BOOST_METAPARSE_ONE_CHAR_EXCEPT_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::one_char_except_c; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/transform_error.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_TRANSFORM_ERROR_HPP 2 | #define BOOST_METAPARSE_TRANSFORM_ERROR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::transform_error; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | 22 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fwd/reject.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FWD_REJECT_HPP 2 | #define BOOST_METAPARSE_V1_FWD_REJECT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | template 16 | struct reject; 17 | } 18 | } 19 | } 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /include/boost/metaparse/source_position_tag.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_SOURCE_POSITION_TAG_HPP 2 | #define BOOST_METAPARSE_SOURCE_POSITION_TAG_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::source_position_tag; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fwd/build_parser.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FWD_BUILD_PARSER_HPP 2 | #define BOOST_METAPARSE_V1_FWD_BUILD_PARSER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | template 16 | struct build_parser; 17 | } 18 | } 19 | } 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /include/boost/metaparse/change_error_message.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_CHANGE_ERROR_MESSAGE_HPP 2 | #define BOOST_METAPARSE_CHANGE_ERROR_MESSAGE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::change_error_message; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/debug_parsing_error.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_DEBUG_PARSING_ERROR_HPP 2 | #define BOOST_METAPARSE_DEBUG_PARSING_ERROR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::debug_parsing_error; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | 22 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fwd/accept.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FWD_ACCEPT_HPP 2 | #define BOOST_METAPARSE_V1_FWD_ACCEPT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | template 16 | struct accept; 17 | } 18 | } 19 | } 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /test/version.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 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 | 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | #include "test_case.hpp" 12 | 13 | BOOST_METAPARSE_TEST_CASE(version) 14 | { 15 | using boost::mpl::bool_; 16 | 17 | // test_version_number 18 | BOOST_MPL_ASSERT((bool_)); 19 | } 20 | 21 | -------------------------------------------------------------------------------- /example/constexpr_parser/README: -------------------------------------------------------------------------------- 1 | Parsers parsing "a* b* a*" and counting the appearance of the characters. 2 | This parser is implemented in three different ways: 3 | - One built with Metaparse 4 | - One implemented using constexpr functions 5 | - One built with Metaparse but parsing a subexpression with a constexpr parser: 6 | - a* at the beginning is parsed using a Metaparse parser 7 | - b* is parsed using a constexpr function 8 | - a* at the end is parsed using a Mataparse parser again 9 | 10 | This example demonstrates how Metaparse can be combined with parsers using 11 | constexpr functions. 12 | 13 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/string_tag.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_STRING_TAG_HPP 2 | #define BOOST_METAPARSE_V1_STRING_TAG_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | struct string_tag 16 | { 17 | typedef string_tag type; 18 | }; 19 | } 20 | } 21 | } 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /doc/predicate.qbk: -------------------------------------------------------------------------------- 1 | [#predicate] 2 | [section Predicate] 3 | 4 | A ['predicate] (or unary predicate) is a 5 | [link metafunction_class template metafunction class] taking one argument and 6 | returning a [link boxed_value boxed value] of type `bool`. 7 | 8 | For example the following predicate checks if its argument is the boxed `char` 9 | value `x`: 10 | 11 | struct is_x 12 | { 13 | template 14 | struct apply 15 | { 16 | static constexpr bool value = (C::value == 'x'); 17 | using type = apply; 18 | }; 19 | 20 | using type = is_x; 21 | }; 22 | 23 | [endsect] 24 | 25 | -------------------------------------------------------------------------------- /include/boost/metaparse/foldl_reject_incomplete.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FOLDL_REJECT_INCOMPLETE_HPP 2 | #define BOOST_METAPARSE_FOLDL_REJECT_INCOMPLETE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::foldl_reject_incomplete; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/foldl_start_with_parser.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FOLDL_START_WITH_PARSER_HPP 2 | #define BOOST_METAPARSE_FOLDL_START_WITH_PARSER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::foldl_start_with_parser; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/foldr_reject_incomplete.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FOLDR_REJECT_INCOMPLETE_HPP 2 | #define BOOST_METAPARSE_FOLDR_REJECT_INCOMPLETE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::foldr_reject_incomplete; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/foldr_start_with_parser.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FOLDR_START_WITH_PARSER_HPP 2 | #define BOOST_METAPARSE_FOLDR_START_WITH_PARSER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::foldr_start_with_parser; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/util/in_range.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_UTIL_IN_RANGE_HPP 2 | #define BOOST_METAPARSE_UTIL_IN_RANGE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace util 16 | { 17 | using v1::util::in_range; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/error/unpaired.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ERROR_UNPAIRED_HPP 2 | #define BOOST_METAPARSE_ERROR_UNPAIRED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace error 16 | { 17 | using v1::error::unpaired; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/foldl_reject_incomplete1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FOLDL_REJECT_INCOMPLETE1_HPP 2 | #define BOOST_METAPARSE_FOLDL_REJECT_INCOMPLETE1_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::foldl_reject_incomplete1; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/foldr_reject_incomplete1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FOLDR_REJECT_INCOMPLETE1_HPP 2 | #define BOOST_METAPARSE_FOLDR_REJECT_INCOMPLETE1_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::foldr_reject_incomplete1; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/util/is_letter.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_UTIL_IS_LETTER_HPP 2 | #define BOOST_METAPARSE_UTIL_IS_LETTER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace util 16 | { 17 | using v1::util::is_letter; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/transform_error_message.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_TRANSFORM_ERROR_MESSAGE_HPP 2 | #define BOOST_METAPARSE_TRANSFORM_ERROR_MESSAGE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::transform_error_message; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | 22 | -------------------------------------------------------------------------------- /include/boost/metaparse/util/in_range_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_UTIL_IN_RANGE_C_HPP 2 | #define BOOST_METAPARSE_UTIL_IN_RANGE_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace util 16 | { 17 | using v1::util::in_range_c; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/util/is_digit.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_UTIL_IS_DIGIT_HPP 2 | #define BOOST_METAPARSE_UTIL_IS_DIGIT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace util 16 | { 17 | using v1::util::is_digit; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/impl/void_.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_IMPL_VOID_HPP 2 | #define BOOST_METAPARSE_V1_IMPL_VOID_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | 10 | namespace boost 11 | { 12 | namespace metaparse 13 | { 14 | namespace v1 15 | { 16 | namespace impl 17 | { 18 | struct void_ { typedef void_ type; }; 19 | } 20 | } 21 | } 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /doc/metaprogramming_value.qbk: -------------------------------------------------------------------------------- 1 | [#metaprogramming_value] 2 | [section Template metaprogramming value] 3 | 4 | A ['template metaprogramming value] is a 5 | [link nullary_metafunction nullary template metafunction] returning itself. 6 | For example: 7 | 8 | struct void_ 9 | { 10 | using type = void_; 11 | }; 12 | 13 | This template metaprogramming value is called `void_`. It is a nullary 14 | metafunction returning itself as its result. Because of this, it can be treated 15 | as a nullary metafunction and evaluated any number of times. For example 16 | `void_::type::type::type` is still `void_`. 17 | 18 | [endsect] 19 | 20 | -------------------------------------------------------------------------------- /include/boost/metaparse/repeated_reject_incomplete.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_REPEATED_REJECT_INCOMPLETE_HPP 2 | #define BOOST_METAPARSE_REPEATED_REJECT_INCOMPLETE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::repeated_reject_incomplete; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /test/test_case.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_TEST_TEST_CASE_HPP 2 | #define BOOST_METAPARSE_TEST_TEST_CASE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | #ifdef BOOST_METAPARSE_TEST_CASE 12 | # error BOOST_METAPARSE_TEST_CASE already defined 13 | #endif 14 | #define BOOST_METAPARSE_TEST_CASE(name) \ 15 | void BOOST_PP_CAT(metaparse_test_case_, name)() 16 | 17 | #endif 18 | 19 | -------------------------------------------------------------------------------- /include/boost/metaparse/define_error.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_DEFINE_ERROR_HPP 2 | #define BOOST_METAPARSE_DEFINE_ERROR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | #ifdef BOOST_METAPARSE_DEFINE_ERROR 12 | # error BOOST_METAPARSE_DEFINE_ERROR already defined 13 | #endif 14 | #define BOOST_METAPARSE_DEFINE_ERROR BOOST_METAPARSE_V1_DEFINE_ERROR 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /include/boost/metaparse/fail_at_first_char_expected.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FAIL_AT_FIRST_CHAR_EXPECTED_HPP 2 | #define BOOST_METAPARSE_FAIL_AT_FIRST_CHAR_EXPECTED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::fail_at_first_char_expected; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/repeated_reject_incomplete1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_REPEATED_REJECT_INCOMPLETE1_HPP 2 | #define BOOST_METAPARSE_REPEATED_REJECT_INCOMPLETE1_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::repeated_reject_incomplete1; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/util/digit_to_int.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_UTIL_DIGIT_TO_INT_HPP 2 | #define BOOST_METAPARSE_UTIL_DIGIT_TO_INT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace util 16 | { 17 | using v1::util::digit_to_int; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/util/int_to_digit.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_UTIL_INT_TO_DIGIT_HPP 2 | #define BOOST_METAPARSE_UTIL_INT_TO_DIGIT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace util 16 | { 17 | using v1::util::int_to_digit; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/lit.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_LIT_HPP 2 | #define BOOST_METAPARSE_V1_LIT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | template 18 | struct lit : lit_c {}; 19 | } 20 | } 21 | } 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /example/meta_hs/lazy.hpp: -------------------------------------------------------------------------------- 1 | #ifndef META_HS_LAZY_HPP 2 | #define META_HS_LAZY_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2012. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace lazy 12 | { 13 | template 14 | struct value 15 | { 16 | typedef V type; 17 | }; 18 | 19 | template 20 | struct application : boost::mpl::apply_wrap1::type {}; 21 | } 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /include/boost/metaparse/util/is_whitespace.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_UTIL_IS_WHITESPACE_HPP 2 | #define BOOST_METAPARSE_UTIL_IS_WHITESPACE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace util 16 | { 17 | using v1::util::is_whitespace; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fwd/source_position.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FWD_SOURCE_POSITION_HPP 2 | #define BOOST_METAPARSE_V1_FWD_SOURCE_POSITION_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | template 16 | struct source_position; 17 | } 18 | } 19 | } 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /doc/literal_expected.qbk: -------------------------------------------------------------------------------- 1 | [#literal_expected] 2 | [section literal_expected] 3 | 4 | [h1 Synopsis] 5 | 6 | namespace error 7 | { 8 | template 9 | struct literal_expected; 10 | } 11 | 12 | This is a [link parsing_error_message parsing error message]. 13 | 14 | [table Arguments 15 | [[Name] [Type]] 16 | [[`C`] [`char` value]] 17 | ] 18 | 19 | [h1 Description] 20 | 21 | Template class representing the error that a specific literal was expected. `C` 22 | is the literal that was expected but not found. 23 | 24 | [h1 Header] 25 | 26 | #include 27 | 28 | [endsect] 29 | 30 | -------------------------------------------------------------------------------- /include/boost/metaparse/util/digit_to_int_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_UTIL_DIGIT_TO_INT_C_HPP 2 | #define BOOST_METAPARSE_UTIL_DIGIT_TO_INT_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace util 16 | { 17 | using v1::util::digit_to_int_c; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/util/int_to_digit_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_UTIL_INT_TO_DIGIT_C_HPP 2 | #define BOOST_METAPARSE_UTIL_INT_TO_DIGIT_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace util 16 | { 17 | using v1::util::int_to_digit_c; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/error/digit_expected.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ERROR_DIGIT_EXPECTED_HPP 2 | #define BOOST_METAPARSE_ERROR_DIGIT_EXPECTED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace error 16 | { 17 | using v1::error::digit_expected; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/util/is_lcase_letter.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_UTIL_IS_LCASE_LETTER_HPP 2 | #define BOOST_METAPARSE_UTIL_IS_LCASE_LETTER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace util 16 | { 17 | using v1::util::is_lcase_letter; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/util/is_ucase_letter.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_UTIL_IS_UCASE_LETTER_HPP 2 | #define BOOST_METAPARSE_UTIL_IS_UCASE_LETTER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace util 16 | { 17 | using v1::util::is_ucase_letter; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/util/is_whitespace_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_UTIL_IS_WHITESPACE_C_HPP 2 | #define BOOST_METAPARSE_UTIL_IS_WHITESPACE_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace util 16 | { 17 | using v1::util::is_whitespace_c; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fwd/get_col.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FWD_GET_COL_HPP 2 | #define BOOST_METAPARSE_V1_FWD_GET_COL_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | 10 | namespace boost 11 | { 12 | namespace metaparse 13 | { 14 | namespace v1 15 | { 16 | template 17 | struct get_col; 18 | 19 | template 20 | struct get_col_impl; 21 | } 22 | } 23 | } 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fwd/get_line.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FWD_GET_LINE_HPP 2 | #define BOOST_METAPARSE_V1_FWD_GET_LINE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | template 16 | struct get_line_impl; 17 | 18 | template 19 | struct get_line; 20 | } 21 | } 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /example/parsing_error/README: -------------------------------------------------------------------------------- 1 | This example shows how a compile-time parsing error can be debugged. 2 | The commented code fails to compile and on some platforms the error report might 3 | be difficult to understand. This example demonstrates how debug_parsing_error 4 | can be used to get a user friendly error report about such thing. You need to 5 | run the compiled code to get the error message: 6 | 7 | Compile-time parsing results 8 | ---------------------------- 9 | Input text: 10 | aaac 11 | 12 | Parsing failed: 13 | line 1, col 4: Expected: b 14 | 15 | The col and line information refers to the location of the error in the string 16 | literal. 17 | 18 | -------------------------------------------------------------------------------- /include/boost/metaparse/error/letter_expected.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ERROR_LETTER_EXPECTED_HPP 2 | #define BOOST_METAPARSE_ERROR_LETTER_EXPECTED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace error 16 | { 17 | using v1::error::letter_expected; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/spaces.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_SPACES_HPP 2 | #define BOOST_METAPARSE_V1_SPACES_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost 13 | { 14 | namespace metaparse 15 | { 16 | namespace v1 17 | { 18 | typedef repeated1 spaces; 19 | } 20 | } 21 | } 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /doc/BOOST_METAPARSE_VERSION.qbk: -------------------------------------------------------------------------------- 1 | [#BOOST_METAPARSE_VERSION] 2 | [section BOOST_METAPARSE_VERSION] 3 | 4 | [h1 Synopsis] 5 | 6 | #define BOOST_METAPARSE_VERSION \\ unspecified 7 | 8 | This is a macro. 9 | 10 | [h1 Description] 11 | 12 | Macro containing the version number of Boost.Metaparse. 13 | 14 | [h1 Header] 15 | 16 | #include 17 | 18 | [h1 Expression semantics] 19 | 20 | It has major, minor and release components: 21 | 22 | major == BOOST_METAPARSE_VERSION / 10000000 23 | minor == (BOOST_METAPARSE_VERSION % 10000000) / 100000 24 | release == BOOST_METAPARSE_VERSION % 100000 25 | 26 | [endsect] 27 | 28 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fwd/get_result.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FWD_GET_RESULT_HPP 2 | #define BOOST_METAPARSE_V1_FWD_GET_RESULT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | template 16 | struct get_result_impl; 17 | 18 | template 19 | struct get_result; 20 | } 21 | } 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fwd/get_message.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FWD_GET_MESSAGE_HPP 2 | #define BOOST_METAPARSE_V1_FWD_GET_MESSAGE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | template 16 | struct get_message_impl; 17 | 18 | template 19 | struct get_message; 20 | } 21 | } 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/error/index_out_of_range.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ERROR_INDEX_OUT_OF_RANGE_HPP 2 | #define BOOST_METAPARSE_ERROR_INDEX_OUT_OF_RANGE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace error 16 | { 17 | using v1::error::index_out_of_range; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/error/literal_expected.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ERROR_LITERAL_EXPECTED_HPP 2 | #define BOOST_METAPARSE_ERROR_LITERAL_EXPECTED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace error 16 | { 17 | using v1::error::literal_expected; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | 25 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fwd/get_position.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FWD_GET_POSITION_HPP 2 | #define BOOST_METAPARSE_V1_FWD_GET_POSITION_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | template 16 | struct get_position_impl; 17 | 18 | template 19 | struct get_position; 20 | } 21 | } 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/impl/has_type.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_IMPL_HAS_TYPE_HPP 2 | #define BOOST_METAPARSE_V1_IMPL_HAS_TYPE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | namespace impl 18 | { 19 | BOOST_MPL_HAS_XXX_TRAIT_DEF(type) 20 | } 21 | } 22 | } 23 | } 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/iterate.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_ITERATE_HPP 2 | #define BOOST_METAPARSE_V1_ITERATE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | template 18 | struct iterate : iterate_c {}; 19 | } 20 | } 21 | } 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /include/boost/metaparse/error/end_of_input_expected.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_END_OF_INPUT_EXPECTED_HPP 2 | #define BOOST_METAPARSE_END_OF_INPUT_EXPECTED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace error 16 | { 17 | using v1::error::end_of_input_expected; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fwd/get_prev_char.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FWD_GET_PREV_CHAR_HPP 2 | #define BOOST_METAPARSE_V1_FWD_GET_PREV_CHAR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | template 16 | struct get_prev_char_impl; 17 | 18 | template 19 | struct get_prev_char; 20 | } 21 | } 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fwd/get_remaining.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FWD_GET_REMAINING_HPP 2 | #define BOOST_METAPARSE_V1_FWD_GET_REMAINING_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | template 16 | struct get_remaining_impl; 17 | 18 | template 19 | struct get_remaining; 20 | } 21 | } 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fwd/next_char.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FWD_NEXT_CHAR_HPP 2 | #define BOOST_METAPARSE_V1_FWD_NEXT_CHAR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | template 16 | struct next_char_impl; 17 | 18 | template 19 | struct next_char; 20 | } 21 | } 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/impl/one_char_except_not_used.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_IMPL_ONE_CHAR_EXCEPT_NOT_USED_HPP 2 | #define BOOST_METAPARSE_V1_IMPL_ONE_CHAR_EXCEPT_NOT_USED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | namespace impl 16 | { 17 | struct one_char_except_not_used {}; 18 | } 19 | } 20 | } 21 | } 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /test/empty_string.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 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 | 6 | #define BOOST_TEST_MODULE empty_string 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include 13 | 14 | BOOST_AUTO_TEST_CASE(test_empty_string) 15 | { 16 | using boost::metaparse::v1::impl::empty_string; 17 | using std::string; 18 | 19 | // test_value 20 | BOOST_REQUIRE_EQUAL(string(), empty_string<>::value); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | os: Visual Studio 2015 2 | platform: x64 3 | configuration: Debug 4 | 5 | clone_folder: c:\build\boost\libs\metaparse 6 | 7 | init: 8 | - cd c:\build 9 | - move boost boost_ 10 | - c:\python27\python.exe c:\build\boost_\libs\metaparse\tools\build_environment.py --dep_json boost_\libs\metaparse\tools\deps.json --action checkout 11 | - move boost_\libs\metaparse boost\libs 12 | - cd boost\libs\metaparse 13 | 14 | build_script: 15 | - cd ..\.. 16 | - bootstrap.bat 17 | - b2 headers 18 | - cd libs 19 | - cd test\build 20 | - ..\..\..\b2 -d+2 21 | - cd ..\.. 22 | - cd metaparse 23 | - cd build 24 | - ..\..\..\b2 -d+2 25 | -------------------------------------------------------------------------------- /doc/parsing_error_message.qbk: -------------------------------------------------------------------------------- 1 | [#parsing_error_message] 2 | [section Parsing error message] 3 | 4 | A ['parsing error message] is a 5 | [link metaprogramming_value template metaprogramming value] with a 6 | `static std::string get_value()` member function. This function returns the 7 | pretty-printed version of the error the class represents. For example: 8 | 9 | struct example_error 10 | { 11 | using type = example_error; 12 | 13 | static std::string get_value() 14 | { 15 | return "This is a formatted example error." 16 | } 17 | }; 18 | 19 | Failing [link parser parser]s return parsing error messages as error messages. 20 | 21 | [endsect] 22 | 23 | -------------------------------------------------------------------------------- /example/getting_started/3_3.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_3_3_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_3_3_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 3.2 7 | #include "3_2.hpp" 8 | 9 | // Definitions of section 3.2 10 | // query: 11 | // exp_parser1::apply::type 12 | 13 | #include 14 | 15 | using exp_parser2 = build_parser>; 16 | 17 | // query: 18 | // exp_parser2::apply::type 19 | 20 | // query: 21 | // exp_parser2::apply::type 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /include/boost/metaparse/error/unexpected_character.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ERROR_UNEXPECTED_CHARACTER_HPP 2 | #define BOOST_METAPARSE_ERROR_UNEXPECTED_CHARACTER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace error 16 | { 17 | using v1::error::unexpected_character; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/error/whitespace_expected.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ERROR_WHITESPACE_EXPECTED_HPP 2 | #define BOOST_METAPARSE_ERROR_WHITESPACE_EXPECTED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace error 16 | { 17 | using v1::error::whitespace_expected; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | 25 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fwd/next_line.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FWD_NEXT_LINE_IMPL_HPP 2 | #define BOOST_METAPARSE_V1_FWD_NEXT_LINE_IMPL_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | template 16 | struct next_line_impl; 17 | 18 | template 19 | struct next_line; 20 | } 21 | } 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /test/returns.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 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 | 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include "test_case.hpp" 13 | 14 | BOOST_METAPARSE_TEST_CASE(returns) 15 | { 16 | using boost::metaparse::v1::impl::returns; 17 | 18 | using boost::is_same; 19 | 20 | // test_returns_evaluates_to_its_argument 21 | BOOST_MPL_ASSERT((is_same::type>)); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /test/string_tag.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 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 | 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include "test_case.hpp" 13 | 14 | BOOST_METAPARSE_TEST_CASE(string_tag) 15 | { 16 | using boost::metaparse::string_tag; 17 | 18 | using boost::is_same; 19 | 20 | // test_metaprogramming_value 21 | BOOST_MPL_ASSERT((is_same)); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /example/getting_started/5_2.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_5_2_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_5_2_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 5.1 7 | #include "5_1.hpp" 8 | 9 | // Definitions of section 5.1 10 | #include 11 | 12 | using exp_parser7 = 13 | build_parser< 14 | sequence< 15 | int_token, /* The first */ 16 | repeated> /* The "+ " elements */ 17 | > 18 | >; 19 | 20 | // query: 21 | // exp_parser7::apply::type 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/impl/returns.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_IMPL_RETURNS_HPP 2 | #define BOOST_METAPARSE_V1_IMPL_RETURNS_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | namespace impl 16 | { 17 | template 18 | struct returns 19 | { 20 | typedef T type; 21 | }; 22 | } 23 | } 24 | } 25 | } 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /example/getting_started/5_2_4.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_5_2_4_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_5_2_4_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 5.2.3 7 | #include "5_2_3.hpp" 8 | 9 | // Definitions of section 5.2.3 10 | #include 11 | 12 | using exp_parser10 = 13 | build_parser< 14 | transform< 15 | sequence< 16 | int_token, 17 | foldl< 18 | sequence, 19 | boost::mpl::int_<0>, 20 | boost::mpl::quote2 21 | > 22 | >, 23 | boost::mpl::quote1> 24 | >; 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /include/boost/metaparse/error/unexpected_end_of_input.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ERROR_UNEXPECTED_END_OF_INPUT_HPP 2 | #define BOOST_METAPARSE_ERROR_UNEXPECTED_END_OF_INPUT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace error 16 | { 17 | using v1::error::unexpected_end_of_input; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | 25 | -------------------------------------------------------------------------------- /include/boost/metaparse/foldl_reject_incomplete_start_with_parser.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_FOLDL_REJECT_INCOMPLETE_START_WITH_PARSER_HPP 2 | #define BOOST_METAPARSE_FOLDL_REJECT_INCOMPLETE_START_WITH_PARSER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | using v1::foldl_reject_incomplete_start_with_parser; 16 | } 17 | } 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/always_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_ALWAYS_C_HPP 2 | #define BOOST_METAPARSE_V1_ALWAYS_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost 13 | { 14 | namespace metaparse 15 | { 16 | namespace v1 17 | { 18 | template 19 | struct always_c : always, Result> {}; 20 | } 21 | } 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/alphanum.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_ALPHANUM_HPP 2 | #define BOOST_METAPARSE_V1_ALPHANUM_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost 14 | { 15 | namespace metaparse 16 | { 17 | namespace v1 18 | { 19 | typedef one_of alphanum; 20 | } 21 | } 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/swap.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_SWAP_HPP 2 | #define BOOST_METAPARSE_V1_SWAP_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | template 16 | struct swap 17 | { 18 | typedef swap type; 19 | 20 | template 21 | struct apply : F::template apply {}; 22 | }; 23 | } 24 | } 25 | } 26 | 27 | #endif 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/foldr.cpp: -------------------------------------------------------------------------------- 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 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | using boost::metaparse::foldr; 12 | using boost::metaparse::v1::impl::front_inserter; 13 | 14 | using boost::mpl::list; 15 | 16 | namespace 17 | { 18 | template 19 | struct repeated : foldr, front_inserter> {}; 20 | } 21 | 22 | #define TEST_NAME foldr 23 | 24 | #include "repeated_test.hpp" 25 | 26 | -------------------------------------------------------------------------------- /example/getting_started/6_2.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_6_2_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_6_2_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 6.1 7 | #include "6_1.hpp" 8 | 9 | // Definitions of section 6.1 10 | using minus_token = token>; 11 | 12 | #include 13 | 14 | using exp_parser12 = 15 | build_parser< 16 | foldl_start_with_parser< 17 | sequence, int_token>, 18 | int_token, 19 | boost::mpl::quote2 20 | > 21 | >; 22 | 23 | // query: 24 | // exp_parser12::apply::type 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /test/foldl.cpp: -------------------------------------------------------------------------------- 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 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | using boost::metaparse::foldl; 12 | using boost::metaparse::v1::impl::back_inserter; 13 | 14 | using boost::mpl::vector; 15 | 16 | namespace 17 | { 18 | template 19 | struct repeated : foldl, back_inserter> {}; 20 | } 21 | 22 | #define TEST_NAME foldl 23 | 24 | #include "repeated_test.hpp" 25 | 26 | -------------------------------------------------------------------------------- /test/foldr1.cpp: -------------------------------------------------------------------------------- 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 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | using boost::metaparse::foldr1; 12 | using boost::metaparse::v1::impl::front_inserter; 13 | 14 | using boost::mpl::list; 15 | 16 | namespace 17 | { 18 | template 19 | struct repeated1 : foldr1, front_inserter> {}; 20 | } 21 | 22 | #define TEST_NAME foldr1 23 | 24 | #include "repeated1_test.hpp" 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/impl/string_iterator_tag.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_IMPL_STRING_ITERATOR_TAG_HPP 2 | #define BOOST_METAPARSE_V1_IMPL_STRING_ITERATOR_TAG_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | namespace boost 10 | { 11 | namespace metaparse 12 | { 13 | namespace v1 14 | { 15 | namespace impl 16 | { 17 | struct string_iterator_tag 18 | { 19 | typedef string_iterator_tag type; 20 | }; 21 | } 22 | } 23 | } 24 | } 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /test/foldl1.cpp: -------------------------------------------------------------------------------- 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 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | using boost::metaparse::foldl1; 12 | using boost::metaparse::v1::impl::back_inserter; 13 | 14 | using boost::mpl::vector; 15 | 16 | namespace 17 | { 18 | template 19 | struct repeated1 : foldl1, back_inserter> {}; 20 | } 21 | 22 | #define TEST_NAME foldl1 23 | 24 | #include "repeated1_test.hpp" 25 | 26 | -------------------------------------------------------------------------------- /example/meta_hs/main_handcrafted.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2012. 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 | 6 | #include 7 | 8 | #include 9 | 10 | int main() 11 | { 12 | using boost::mpl::int_; 13 | 14 | std::cout 15 | << "fib 6 = " << fib::apply >::type::value << std::endl 16 | << "fact 4 = " << fact::apply >::type::value << std::endl 17 | << "times4 3 = " << times4::apply >::type::value << std::endl 18 | << "times11 2 = " << times11::apply >::type::value << std::endl; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /example/meta_hs/main_in_haskell.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2012. 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 | 6 | #include 7 | 8 | #include 9 | 10 | int main() 11 | { 12 | using boost::mpl::int_; 13 | 14 | std::cout 15 | << "fib 6 = " << fib::apply >::type::value << std::endl 16 | << "fact 4 = " << fact::apply >::type::value << std::endl 17 | << "times4 3 = " << times4::apply >::type::value << std::endl 18 | << "times11 2 = " << times11::apply >::type::value << std::endl; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /include/boost/metaparse/error/none_of_the_expected_cases_found.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_ERROR_NONE_OF_THE_EXPECTED_CASES_FOUND_HPP 2 | #define BOOST_METAPARSE_ERROR_NONE_OF_THE_EXPECTED_CASES_FOUND_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace error 16 | { 17 | using v1::error::none_of_the_expected_cases_found; 18 | } 19 | } 20 | } 21 | 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/error/digit_expected.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_ERROR_DIGIT_EXPECTED_HPP 2 | #define BOOST_METAPARSE_V1_ERROR_DIGIT_EXPECTED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | namespace error 18 | { 19 | BOOST_METAPARSE_V1_DEFINE_ERROR(digit_expected, "Digit expected"); 20 | } 21 | } 22 | } 23 | } 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/int_.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_INT__HPP 2 | #define BOOST_METAPARSE_V1_INT__HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost 14 | { 15 | namespace metaparse 16 | { 17 | namespace v1 18 | { 19 | typedef foldl1, impl::next_digit> int_; 20 | } 21 | } 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/iterate_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_ITERATE_C_HPP 2 | #define BOOST_METAPARSE_V1_ITERATE_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | #include 12 | 13 | namespace boost 14 | { 15 | namespace metaparse 16 | { 17 | namespace v1 18 | { 19 | template 20 | struct iterate_c : impl::iterate_impl > {}; 21 | } 22 | } 23 | } 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /include/boost/metaparse/string.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_STRING_HPP 2 | #define BOOST_METAPARSE_STRING_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | #ifdef BOOST_METAPARSE_STRING 13 | # error BOOST_METAPARSE_STRING already defined 14 | #endif 15 | #define BOOST_METAPARSE_STRING BOOST_METAPARSE_V1_STRING 16 | 17 | namespace boost 18 | { 19 | namespace metaparse 20 | { 21 | using v1::string; 22 | } 23 | } 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/error/letter_expected.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_ERROR_LETTER_EXPECTED_HPP 2 | #define BOOST_METAPARSE_V1_ERROR_LETTER_EXPECTED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | namespace error 18 | { 19 | BOOST_METAPARSE_V1_DEFINE_ERROR(letter_expected, "Letter expected"); 20 | } 21 | } 22 | } 23 | } 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /example/getting_started/4_1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_4_1_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_4_1_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 4 7 | #include "4.hpp" 8 | 9 | // Definitions of section 4 10 | #include 11 | 12 | #include 13 | 14 | using exp_parser4 = build_parser, token>, token>>; 15 | 16 | // query: 17 | // exp_parser4::apply::type 18 | 19 | #ifdef __METASHELL 20 | #include 21 | #endif 22 | 23 | // query: 24 | // exp_parser4::apply::type 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /example/getting_started/8.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_8_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_8_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 7.2 7 | #include "7_2.hpp" 8 | 9 | // Definitions of section 7.2 10 | using mult_exp1 = foldl_start_with_parser, int_token, boost::mpl::quote2>; 11 | 12 | using exp_parser15 = 13 | build_parser< 14 | foldl_start_with_parser< 15 | sequence, mult_exp1>, 16 | mult_exp1, 17 | boost::mpl::quote2 18 | > 19 | >; 20 | 21 | // query: 22 | // exp_parser15::apply::type 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/digit_val.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_DIGIT_VAL_HPP 2 | #define BOOST_METAPARSE_V1_DIGIT_VAL_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | namespace boost 15 | { 16 | namespace metaparse 17 | { 18 | namespace v1 19 | { 20 | typedef transform > digit_val; 21 | } 22 | } 23 | } 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /test/string_iterator_tag.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 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 | 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include "test_case.hpp" 13 | 14 | BOOST_METAPARSE_TEST_CASE(string_iterator_tag) 15 | { 16 | using boost::metaparse::v1::impl::string_iterator_tag; 17 | 18 | using boost::is_same; 19 | 20 | // test_metaprogramming_value 21 | BOOST_MPL_ASSERT((is_same)); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /example/getting_started/11_3_2.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_11_3_2_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_11_3_2_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 11.3.1 7 | #include "11_3_1.hpp" 8 | 9 | // Definitions of section 11.3.1 10 | #include 11 | 12 | struct plus_exp5 : 13 | foldl_reject_incomplete_start_with_parser< 14 | sequence, mult_exp6>, 15 | mult_exp6, 16 | boost::mpl::quote2 17 | > {}; 18 | 19 | using exp_parser22 = build_parser; 20 | 21 | // query: 22 | // exp_parser22::apply::type 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/define_error.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_DEFINE_ERROR_HPP 2 | #define BOOST_METAPARSE_V1_DEFINE_ERROR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | #ifdef BOOST_METAPARSE_V1_DEFINE_ERROR 12 | # error BOOST_METAPARSE_V1_DEFINE_ERROR already defined 13 | #endif 14 | #define BOOST_METAPARSE_V1_DEFINE_ERROR(name, msg) \ 15 | struct name \ 16 | { \ 17 | typedef name type; \ 18 | static std::string get_value() \ 19 | { \ 20 | return msg; \ 21 | } \ 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/foldr.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FOLDR_HPP 2 | #define BOOST_METAPARSE_V1_FOLDR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011 - 2012. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | namespace boost 13 | { 14 | namespace metaparse 15 | { 16 | namespace v1 17 | { 18 | template 19 | struct foldr : foldr_start_with_parser, BackwardOp> {}; 20 | } 21 | } 22 | } 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /doc/getting_started_40.qbk: -------------------------------------------------------------------------------- 1 | [#getting_started_40] 2 | 3 | struct plus_exp6; 4 | using paren_exp5 = middle_of; 5 | using primary_exp4 = one_of>; 6 | using unary_exp4 = foldr_start_with_parser< minus_token, primary_exp4, boost::mpl::lambda>::type >; 7 | using mult_exp7 = foldl_reject_incomplete_start_with_parser< sequence, unary_exp4>, unary_exp4, boost::mpl::quote2 >; 8 | struct plus_exp6 : foldl_reject_incomplete_start_with_parser< sequence, mult_exp7>, mult_exp7, boost::mpl::quote2 > {}; 9 | using exp_parser23 = build_parser; 10 | 11 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/fail.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_FAIL_HPP 2 | #define BOOST_METAPARSE_V1_FAIL_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | template 18 | struct fail 19 | { 20 | typedef fail type; 21 | 22 | template 23 | struct apply : reject {}; 24 | }; 25 | } 26 | } 27 | } 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /doc/boxed_value.qbk: -------------------------------------------------------------------------------- 1 | [#boxed_value] 2 | [section Boxed value] 3 | 4 | A ['boxed value] is a type representing a constant value. It has a public static 5 | `const` or `constexpr` member called `value`. The class represents that value as 6 | a type, so it can be manipulated by [link metafunction template metafunction]s. 7 | It has to be a [link metaprogramming_value template metaprogramming value]. 8 | 9 | For example the following `struct` represents the `true` value of type `bool`: 10 | 11 | struct true_type 12 | { 13 | static constexpr bool value = true; 14 | using type = true_type; 15 | }; 16 | 17 | The `value` member is the wrapped value. `true_type::type` is an alias of 18 | `true_type` which makes it a template metaprogramming value. 19 | 20 | [endsect] 21 | 22 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/get_col.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_GET_COL_HPP 2 | #define BOOST_METAPARSE_V1_GET_COL_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | template 18 | struct get_col_impl; 19 | 20 | template 21 | struct get_col : get_col_impl::template apply 22 | {}; 23 | 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/repeated.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_REPEATED_HPP 2 | #define BOOST_METAPARSE_V1_REPEATED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | namespace boost 15 | { 16 | namespace metaparse 17 | { 18 | namespace v1 19 | { 20 | template 21 | struct repeated : foldl, impl::back_inserter> {}; 22 | } 23 | } 24 | } 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /test/is_char_c.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 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 | 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | #include "test_case.hpp" 12 | 13 | BOOST_METAPARSE_TEST_CASE(is_char_c) 14 | { 15 | using boost::metaparse::v1::impl::is_char_c; 16 | 17 | using boost::mpl::char_; 18 | 19 | // test_for_the_same_char 20 | BOOST_MPL_ASSERT(( is_char_c<'x'>::apply > )); 21 | 22 | // test_for_another_char 23 | BOOST_MPL_ASSERT_NOT(( is_char_c<'x'>::apply > )); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/get_line.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_GET_LINE_HPP 2 | #define BOOST_METAPARSE_V1_GET_LINE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | template 18 | struct get_line_impl; 19 | 20 | template 21 | struct get_line : get_line_impl::template apply 22 | {}; 23 | 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/token.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_TOKEN_HPP 2 | #define BOOST_METAPARSE_V1_TOKEN_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | namespace boost 16 | { 17 | namespace metaparse 18 | { 19 | namespace v1 20 | { 21 | template 22 | struct token : first_of > {}; 23 | } 24 | } 25 | } 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /doc/before_4_1.qbk: -------------------------------------------------------------------------------- 1 | [#before_4_1] 2 | ['Definitions before section 4.1.] 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | using namespace boost::metaparse; 10 | 11 | using exp_parser1 = build_parser; 12 | #include 13 | 14 | using exp_parser2 = build_parser>; 15 | #include 16 | 17 | using exp_parser3 = build_parser>>; 18 | #include 19 | 20 | #include 21 | 22 | using exp_parser4 = build_parser, token>, token>>; 23 | 24 | #include 25 | 26 | 27 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/error/end_of_input_expected.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_END_OF_INPUT_EXPECTED_HPP 2 | #define BOOST_METAPARSE_V1_END_OF_INPUT_EXPECTED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | namespace error 18 | { 19 | BOOST_METAPARSE_V1_DEFINE_ERROR( 20 | end_of_input_expected, 21 | "End of input expected" 22 | ); 23 | } 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/error/expected_to_fail.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_ERROR_EXPECTED_TO_FAIL_HPP 2 | #define BOOST_METAPARSE_V1_ERROR_EXPECTED_TO_FAIL_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | namespace error 18 | { 19 | BOOST_METAPARSE_V1_DEFINE_ERROR( 20 | expected_to_fail, 21 | "Parser expected to fail" 22 | ); 23 | } 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | 31 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/get_message.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_GET_MESSAGE_HPP 2 | #define BOOST_METAPARSE_V1_GET_MESSAGE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | template 18 | struct get_message_impl; 19 | 20 | template 21 | struct get_message : get_message_impl::template apply 22 | {}; 23 | 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/get_result.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_GET_RESULT_HPP 2 | #define BOOST_METAPARSE_V1_GET_RESULT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | template 18 | struct get_result_impl; 19 | 20 | template 21 | struct get_result : 22 | get_result_impl::template apply 23 | {}; 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /example/getting_started/6.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_GETTING_STARTED_6_HPP 2 | #define BOOST_METAPARSE_GETTING_STARTED_6_HPP 3 | 4 | // Automatically generated header file 5 | 6 | // Definitions before section 5.2.4 7 | #include "5_2_4.hpp" 8 | 9 | // Definitions of section 5.2.4 10 | #include 11 | 12 | using exp_parser11 = 13 | build_parser< 14 | foldl_start_with_parser< 15 | sequence, /* apply this parser repeatedly */ 16 | int_token, /* use this parser to get the initial value */ 17 | boost::mpl::quote2 /* use this function to add a new value to the summary */ 18 | > 19 | >; 20 | 21 | // query: 22 | // exp_parser11::apply::type 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/error/unexpected_character.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_ERROR_UNEXPECTED_CHARACTER_HPP 2 | #define BOOST_METAPARSE_V1_ERROR_UNEXPECTED_CHARACTER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | namespace error 18 | { 19 | BOOST_METAPARSE_V1_DEFINE_ERROR( 20 | unexpected_character, 21 | "Unexpected character" 22 | ); 23 | } 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/error/whitespace_expected.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_ERROR_WHITESPACE_EXPECTED_HPP 2 | #define BOOST_METAPARSE_V1_ERROR_WHITESPACE_EXPECTED_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | namespace error 18 | { 19 | BOOST_METAPARSE_V1_DEFINE_ERROR( 20 | whitespace_expected, 21 | "Whitespace expected" 22 | ); 23 | } 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | 31 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/repeated1.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_REPEATED1_HPP 2 | #define BOOST_METAPARSE_V1_REPEATED1_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | namespace boost 15 | { 16 | namespace metaparse 17 | { 18 | namespace v1 19 | { 20 | template 21 | struct repeated1 : 22 | foldl1, impl::back_inserter> 23 | {}; 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /test/back_inserter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 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 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "test_case.hpp" 13 | 14 | BOOST_METAPARSE_TEST_CASE(back_inserter) 15 | { 16 | using boost::metaparse::v1::impl::back_inserter; 17 | 18 | using boost::mpl::equal; 19 | using boost::mpl::deque; 20 | 21 | // test_inserts_at_the_back 22 | BOOST_MPL_ASSERT(( 23 | equal, back_inserter::apply, char>::type> 24 | )); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/get_position.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_GET_POSITION_HPP 2 | #define BOOST_METAPARSE_V1_GET_POSITION_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | template 18 | struct get_position_impl; 19 | 20 | template 21 | struct get_position : get_position_impl::template apply 22 | {}; 23 | 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /test/front_inserter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 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 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "test_case.hpp" 13 | 14 | BOOST_METAPARSE_TEST_CASE(front_inserter) 15 | { 16 | using boost::metaparse::v1::impl::front_inserter; 17 | 18 | using boost::mpl::equal; 19 | using boost::mpl::deque; 20 | 21 | // test_inserts_at_the_front 22 | BOOST_MPL_ASSERT(( 23 | equal, front_inserter::apply, int>::type> 24 | )); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/get_prev_char.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_GET_PREV_CHAR_HPP 2 | #define BOOST_METAPARSE_V1_GET_PREV_CHAR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | template 18 | struct get_prev_char_impl; 19 | 20 | template 21 | struct get_prev_char : get_prev_char_impl::template apply 22 | {}; 23 | 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/get_remaining.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_GET_REMAINING_HPP 2 | #define BOOST_METAPARSE_V1_GET_REMAINING_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | template 18 | struct get_remaining_impl; 19 | 20 | template 21 | struct get_remaining : get_remaining_impl::template apply 22 | {}; 23 | 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /test/define_error.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 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 | 6 | #define BOOST_TEST_MODULE define_error 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | namespace 16 | { 17 | BOOST_METAPARSE_DEFINE_ERROR(test_error, "test error"); 18 | } 19 | 20 | BOOST_AUTO_TEST_CASE(test_define_error) 21 | { 22 | using boost::is_same; 23 | 24 | BOOST_MPL_ASSERT((is_same)); 25 | 26 | BOOST_CHECK_EQUAL("test error", test_error::get_value()); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /doc/nullary_metafunction.qbk: -------------------------------------------------------------------------------- 1 | [#nullary_metafunction] 2 | [section Nullary template metafunction] 3 | 4 | A ['nullary template metafuncion] is a [link metafunction template metafunction] 5 | taking 0 arguments. It is a type with a nested type called `type`, which is the 6 | return value of the nullary metafunction. For example: 7 | 8 | struct always13 9 | { 10 | using type = std::integral_constant; 11 | }; 12 | 13 | This metafunction is called `always13`. It is a nullary metafunction, because it 14 | takes no arguments. It always returns `std::integral_constant`. 15 | 16 | To call this metafunction, one has to access its `::type`. For example: 17 | 18 | always13::type 19 | 20 | The above example calls the metafunction to get 21 | `std::integral_constant`. 22 | 23 | [endsect] 24 | 25 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/error/unexpected_end_of_input.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_ERROR_UNEXPECTED_END_OF_INPUT_HPP 2 | #define BOOST_METAPARSE_V1_ERROR_UNEXPECTED_END_OF_INPUT_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | namespace error 18 | { 19 | BOOST_METAPARSE_V1_DEFINE_ERROR( 20 | unexpected_end_of_input, 21 | "Unexpected end of input" 22 | ); 23 | } 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | 31 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/start.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_START_HPP 2 | #define BOOST_METAPARSE_V1_START_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | namespace boost 15 | { 16 | namespace metaparse 17 | { 18 | namespace v1 19 | { 20 | typedef 21 | source_position< 22 | boost::mpl::int_<1>, 23 | boost::mpl::int_<1>, 24 | boost::mpl::char_<0> 25 | > 26 | start; 27 | } 28 | } 29 | } 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /doc/index_out_of_range.qbk: -------------------------------------------------------------------------------- 1 | [#index_out_of_range] 2 | [section index_out_of_range] 3 | 4 | [h1 Synopsis] 5 | 6 | namespace error 7 | { 8 | template 9 | struct index_out_of_range; 10 | } 11 | 12 | This is a [link parsing_error_message parsing error message]. 13 | 14 | [table Arguments 15 | [[Name] [Type]] 16 | [[`From`] [`int` value. The lower bound of the range.]] 17 | [[`To`] [`int` value. The upper bound of the range.]] 18 | [[`N`] [`int` value. The value outside of the range.]] 19 | ] 20 | 21 | [h1 Description] 22 | 23 | Template class representing an over or under indexing error. `From` and `To` 24 | represent the range and `N` is the value outside of the range. 25 | 26 | [h1 Header] 27 | 28 | #include 29 | 30 | [endsect] 31 | 32 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/unless_error.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_UTIL_UNLESS_ERROR_HPP 2 | #define BOOST_METAPARSE_V1_UTIL_UNLESS_ERROR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | namespace boost 15 | { 16 | namespace metaparse 17 | { 18 | namespace v1 19 | { 20 | template 21 | struct unless_error : 22 | boost::mpl::eval_if::type, T, NotErrorCase> 23 | {}; 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/letter.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_LETTER_HPP 2 | #define BOOST_METAPARSE_V1_LETTER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | namespace boost 16 | { 17 | namespace metaparse 18 | { 19 | namespace v1 20 | { 21 | typedef 22 | accept_when, error::letter_expected> 23 | letter; 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/next_char.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_NEXT_CHAR_HPP 2 | #define BOOST_METAPARSE_V1_NEXT_CHAR_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | #include 12 | 13 | namespace boost 14 | { 15 | namespace metaparse 16 | { 17 | namespace v1 18 | { 19 | template 20 | struct next_char : 21 | next_char_impl< 22 | typename boost::mpl::tag::type 23 | >::template apply 24 | {}; 25 | } 26 | } 27 | } 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/next_line.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_NEXT_LINE_HPP 2 | #define BOOST_METAPARSE_V1_NEXT_LINE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2011. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | #include 12 | 13 | namespace boost 14 | { 15 | namespace metaparse 16 | { 17 | namespace v1 18 | { 19 | template 20 | struct next_line : 21 | next_line_impl< 22 | typename boost::mpl::tag::type 23 | >::template apply 24 | {}; 25 | } 26 | } 27 | } 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /test/foldr_reject_incomplete.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 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 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | using boost::metaparse::foldr_reject_incomplete; 12 | using boost::metaparse::v1::impl::front_inserter; 13 | 14 | using boost::mpl::list; 15 | 16 | namespace 17 | { 18 | template 19 | struct repeated_reject_incomplete : 20 | foldr_reject_incomplete, front_inserter> 21 | {}; 22 | } 23 | 24 | #define TEST_NAME foldr_reject_incomplete 25 | 26 | #include "repeated_reject_incomplete_test.hpp" 27 | 28 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/impl/assert_string_length.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_IMPL_ASSERT_STRING_LENGTH_HPP 2 | #define BOOST_METAPARSE_V1_IMPL_ASSERT_STRING_LENGTH_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | namespace impl 18 | { 19 | template 20 | struct assert_string_length : S 21 | { 22 | BOOST_STATIC_ASSERT((Len <= BOOST_METAPARSE_LIMIT_STRING_SIZE)); 23 | }; 24 | } 25 | } 26 | } 27 | } 28 | 29 | #endif 30 | 31 | 32 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/impl/back_inserter.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_IMPL_BACK_INSERTER_HPP 2 | #define BOOST_METAPARSE_V1_IMPL_BACK_INSERTER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | namespace impl 18 | { 19 | struct back_inserter 20 | { 21 | typedef back_inserter type; 22 | 23 | template 24 | struct apply : boost::mpl::push_back {}; 25 | }; 26 | } 27 | } 28 | } 29 | } 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /test/foldl_reject_incomplete.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 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 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | using boost::metaparse::foldl_reject_incomplete; 12 | using boost::metaparse::v1::impl::back_inserter; 13 | 14 | using boost::mpl::vector; 15 | 16 | namespace 17 | { 18 | template 19 | struct repeated_reject_incomplete : 20 | foldl_reject_incomplete, back_inserter> 21 | {}; 22 | } 23 | 24 | #define TEST_NAME foldl_reject_incomplete 25 | 26 | #include "repeated_reject_incomplete_test.hpp" 27 | 28 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/impl/front_inserter.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_IMPL_FRONT_INSERTER_HPP 2 | #define BOOST_METAPARSE_V1_IMPL_FRONT_INSERTER_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | namespace impl 18 | { 19 | struct front_inserter 20 | { 21 | typedef front_inserter type; 22 | 23 | template 24 | struct apply : boost::mpl::push_front {}; 25 | }; 26 | } 27 | } 28 | } 29 | } 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/impl/is_char_c.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_IMPL_IS_CHAR_C_HPP 2 | #define BOOST_METAPARSE_V1_IMPL_IS_CHAR_C_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | namespace impl 18 | { 19 | template 20 | struct is_char_c 21 | { 22 | typedef is_char_c type; 23 | 24 | template 25 | struct apply : boost::mpl::bool_ {}; 26 | }; 27 | } 28 | } 29 | } 30 | } 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /test/foldl_reject_incomplete1.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 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 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | using boost::metaparse::foldl_reject_incomplete1; 12 | using boost::metaparse::v1::impl::back_inserter; 13 | 14 | using boost::mpl::vector; 15 | 16 | namespace 17 | { 18 | template 19 | struct repeated_reject_incomplete1 : 20 | foldl_reject_incomplete1, back_inserter> 21 | {}; 22 | } 23 | 24 | #define TEST_NAME foldl_reject_incomplete1 25 | 26 | #include "repeated_reject_incomplete1_test.hpp" 27 | 28 | -------------------------------------------------------------------------------- /test/foldr_reject_incomplete1.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2015. 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 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | using boost::metaparse::foldr_reject_incomplete1; 12 | using boost::metaparse::v1::impl::front_inserter; 13 | 14 | using boost::mpl::list; 15 | 16 | namespace 17 | { 18 | template 19 | struct repeated_reject_incomplete1 : 20 | foldr_reject_incomplete1, front_inserter> 21 | {}; 22 | } 23 | 24 | #define TEST_NAME foldr_reject_incomplete1 25 | 26 | #include "repeated_reject_incomplete1_test.hpp" 27 | 28 | -------------------------------------------------------------------------------- /test/is_digit.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2010. 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 | 6 | #include 7 | 8 | #include "common.hpp" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include "test_case.hpp" 15 | 16 | BOOST_METAPARSE_TEST_CASE(util_is_digit) 17 | { 18 | using boost::metaparse::util::is_digit; 19 | 20 | using boost::mpl::apply_wrap1; 21 | using boost::mpl::not_; 22 | 23 | // test_digit 24 | BOOST_MPL_ASSERT((apply_wrap1, char_7>)); 25 | 26 | // test_non_digit 27 | BOOST_MPL_ASSERT((not_, char_a> >)); 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/error/none_of_the_expected_cases_found.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_ERROR_NONE_OF_THE_EXPECTED_CASES_FOUND_HPP 2 | #define BOOST_METAPARSE_V1_ERROR_NONE_OF_THE_EXPECTED_CASES_FOUND_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | 11 | namespace boost 12 | { 13 | namespace metaparse 14 | { 15 | namespace v1 16 | { 17 | namespace error 18 | { 19 | BOOST_METAPARSE_V1_DEFINE_ERROR( 20 | none_of_the_expected_cases_found, 21 | "None of the expected cases found" 22 | ); 23 | } 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | -------------------------------------------------------------------------------- /include/boost/metaparse/v1/space.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BOOST_METAPARSE_V1_SPACE_HPP 2 | #define BOOST_METAPARSE_V1_SPACE_HPP 3 | 4 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2009 - 2010. 5 | // Distributed under the Boost Software License, Version 1.0. 6 | // (See accompanying file LICENSE_1_0.txt or copy at 7 | // http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | namespace boost 16 | { 17 | namespace metaparse 18 | { 19 | namespace v1 20 | { 21 | typedef 22 | accept_when, error::whitespace_expected> 23 | space; 24 | } 25 | } 26 | } 27 | 28 | #endif 29 | 30 | 31 | -------------------------------------------------------------------------------- /test/has_type.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Abel Sinkovics (abel@sinkovics.hu) 2014. 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 | 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | #include "test_case.hpp" 12 | 13 | namespace 14 | { 15 | struct nullary_metafunction 16 | { 17 | typedef int type; 18 | }; 19 | } 20 | 21 | BOOST_METAPARSE_TEST_CASE(has_type) 22 | { 23 | using boost::metaparse::v1::impl::has_type; 24 | using boost::mpl::not_; 25 | 26 | // test_int_has_no_type 27 | BOOST_MPL_ASSERT((not_::type>)); 28 | 29 | // test_nullary_metafunction_has_type 30 | BOOST_MPL_ASSERT((has_type)); 31 | } 32 | 33 | --------------------------------------------------------------------------------