MCPcopy Create free account
hub / github.com/boostorg/parser / main

Function main

test/parser_symbol_table.cpp:19–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17BOOST_PARSER_DEFINE_RULES(symrule);
18
19int main()
20{
21// symbols_empty
22{
23 symbols<int> roman_numerals;
24 symbols<std::string> named_strings;
25
26 std::string const str = "I";
27 BOOST_TEST(!parse(str, roman_numerals));
28 BOOST_TEST(!parse(str, named_strings));
29}
30
31// symbols_simple
32{
33 symbols<int> const roman_numerals = {
34 {"I", 1}, {"V", 5}, {"X", 10}, {"L", 50}, {"C", 100}};
35 symbols<std::string> const named_strings = {
36 {"I", "1"}, {"V", "5"}, {"X", "10"}, {"L", "50"}, {"C", "100"}};
37
38 {
39 auto const result = parse("I", roman_numerals);
40 BOOST_TEST(result);
41 BOOST_TEST(*result == 1);
42 }
43 {
44 auto const result = parse("I", named_strings);
45 BOOST_TEST(result);
46 BOOST_TEST(*result == "1");
47 }
48
49 {
50 auto const result = parse("L", roman_numerals);
51 BOOST_TEST(result);
52 BOOST_TEST(*result == 50);
53 }
54 {
55 auto const result = parse("L", named_strings);
56 BOOST_TEST(result);
57 BOOST_TEST(*result == "50");
58 }
59}
60
61// symbols_max_munch
62{
63 symbols<int> const roman_numerals = {
64 {"I", 1},
65 {"II", 2},
66 {"III", 3},
67 {"IV", 4},
68 {"V", 5},
69 {"VI", 6},
70 {"VII", 7},
71 {"VIII", 8},
72 {"IX", 9},
73
74 {"X", 10},
75 {"XX", 20},
76 {"XXX", 30},

Callers

nothing calls this directly

Calls 12

_attrFunction · 0.85
litFunction · 0.85
make_tupleFunction · 0.85
with_error_handlerFunction · 0.85
parseFunction · 0.50
getFunction · 0.50
insert_for_next_parseMethod · 0.45
insertMethod · 0.45
eraseMethod · 0.45
clearMethod · 0.45
erase_for_next_parseMethod · 0.45
clear_for_next_parseMethod · 0.45

Tested by

no test coverage detected