8
8
#include " ../../../src/tml/parser.hpp"
9
9
10
10
namespace {
11
- enum action_enum{
11
+ enum class action_enum {
12
12
children_start,
13
13
children_end,
14
14
string_item
@@ -20,14 +20,14 @@ class test_listener : public tml::listener{
20
20
void on_children_parse_finished (tml::location)override {
21
21
// TRACE(<< "}" << std::endl)
22
22
tst::check (this ->actions .size () > 0 , SL);
23
- tst::check (this ->actions .front ().first == children_end, SL) << " first = " << this ->actions .front ().first << " second = " << this ->actions .front ().second ;
23
+ tst::check (this ->actions .front ().first == action_enum:: children_end, SL) << " first = " << unsigned ( this ->actions .front ().first ) << " second = " << this ->actions .front ().second ;
24
24
this ->actions .pop_front ();
25
25
}
26
26
27
27
void on_children_parse_started (tml::location)override {
28
28
// TRACE(<< "{" << std::endl)
29
29
tst::check (this ->actions .size () > 0 , SL);
30
- tst::check (this ->actions .front ().first == children_start, SL) << " first = " << this ->actions .front ().first << " second = " << this ->actions .front ().second ;
30
+ tst::check (this ->actions .front ().first == action_enum:: children_start, SL) << " first = " << unsigned ( this ->actions .front ().first ) << " second = " << this ->actions .front ().second ;
31
31
this ->actions .pop_front ();
32
32
}
33
33
@@ -38,13 +38,13 @@ class test_listener : public tml::listener{
38
38
// o << " line = " << info.location.line << '\n';
39
39
// });
40
40
tst::check (this ->actions .size () > 0 , SL);
41
- tst::check (this ->actions .front ().first == string_item, [&](auto &o){
42
- o << " first = " << this ->actions .front ().first ;
41
+ tst::check (this ->actions .front ().first == action_enum:: string_item, [&](auto &o){
42
+ o << " first = " << unsigned ( this ->actions .front ().first ) ;
43
43
o << " second = " << this ->actions .front ().second ;
44
44
o << " line = " << info.location .line ;
45
45
}, SL);
46
46
tst::check (this ->actions .front ().second == str, [&](auto &o){
47
- o << " first = " << this ->actions .front ().first ;
47
+ o << " first = " << unsigned ( this ->actions .front ().first ) ;
48
48
o << " second = " << this ->actions .front ().second ;
49
49
o << " str = " << str;
50
50
}, SL);
@@ -71,64 +71,64 @@ const tst::set set("parser", [](auto& suite){
71
71
suite.add (" parse" , [](){
72
72
test_listener l;
73
73
74
- l.actions .emplace_back (string_item, " test string" );
75
- l.actions .emplace_back (string_item, " another string" );
76
- l.actions .emplace_back (string_item, " unquotedString" );
74
+ l.actions .emplace_back (action_enum:: string_item, " test string" );
75
+ l.actions .emplace_back (action_enum:: string_item, " another string" );
76
+ l.actions .emplace_back (action_enum:: string_item, " unquotedString" );
77
77
78
- l.actions .emplace_back (string_item, " string with empty children list" );
79
- l.actions .emplace_back (children_start, " " );
80
- l.actions .emplace_back (children_end, " " );
78
+ l.actions .emplace_back (action_enum:: string_item, " string with empty children list" );
79
+ l.actions .emplace_back (action_enum:: children_start, " " );
80
+ l.actions .emplace_back (action_enum:: children_end, " " );
81
81
82
- l.actions .emplace_back (string_item, " unquoted_string_with_empty_children_list" );
83
- l.actions .emplace_back (children_start, " " );
84
- l.actions .emplace_back (children_end, " " );
82
+ l.actions .emplace_back (action_enum:: string_item, " unquoted_string_with_empty_children_list" );
83
+ l.actions .emplace_back (action_enum:: children_start, " " );
84
+ l.actions .emplace_back (action_enum:: children_end, " " );
85
85
86
- l.actions .emplace_back (string_item, " " );
87
- l.actions .emplace_back (children_start, " " );
88
- l.actions .emplace_back (children_end, " " );
86
+ l.actions .emplace_back (action_enum:: string_item, " " );
87
+ l.actions .emplace_back (action_enum:: children_start, " " );
88
+ l.actions .emplace_back (action_enum:: children_end, " " );
89
89
90
- l.actions .emplace_back (string_item, " " );
91
- l.actions .emplace_back (children_start, " " );
90
+ l.actions .emplace_back (action_enum:: string_item, " " );
91
+ l.actions .emplace_back (action_enum:: children_start, " " );
92
92
93
- l.actions .emplace_back (string_item, " " );
94
- l.actions .emplace_back (children_start, " " );
95
- l.actions .emplace_back (children_end, " " );
93
+ l.actions .emplace_back (action_enum:: string_item, " " );
94
+ l.actions .emplace_back (action_enum:: children_start, " " );
95
+ l.actions .emplace_back (action_enum:: children_end, " " );
96
96
97
- l.actions .emplace_back (string_item, " " );
98
- l.actions .emplace_back (children_start, " " );
99
- l.actions .emplace_back (children_end, " " );
97
+ l.actions .emplace_back (action_enum:: string_item, " " );
98
+ l.actions .emplace_back (action_enum:: children_start, " " );
99
+ l.actions .emplace_back (action_enum:: children_end, " " );
100
100
101
- l.actions .emplace_back (children_end, " " );
101
+ l.actions .emplace_back (action_enum:: children_end, " " );
102
102
103
- l.actions .emplace_back (string_item, " " );
104
- l.actions .emplace_back (children_start, " " );
103
+ l.actions .emplace_back (action_enum:: string_item, " " );
104
+ l.actions .emplace_back (action_enum:: children_start, " " );
105
105
106
- l.actions .emplace_back (string_item, " child string" );
106
+ l.actions .emplace_back (action_enum:: string_item, " child string" );
107
107
108
- l.actions .emplace_back (string_item, " aaa" );
109
- l.actions .emplace_back (children_start, " " );
110
- l.actions .emplace_back (children_end, " " );
108
+ l.actions .emplace_back (action_enum:: string_item, " aaa" );
109
+ l.actions .emplace_back (action_enum:: children_start, " " );
110
+ l.actions .emplace_back (action_enum:: children_end, " " );
111
111
112
- l.actions .emplace_back (string_item, " bbb" );
112
+ l.actions .emplace_back (action_enum:: string_item, " bbb" );
113
113
114
- l.actions .emplace_back (string_item, " ccc" );
115
- l.actions .emplace_back (children_start, " " );
116
- l.actions .emplace_back (string_item, " ddd" );
117
- l.actions .emplace_back (children_end, " " );
114
+ l.actions .emplace_back (action_enum:: string_item, " ccc" );
115
+ l.actions .emplace_back (action_enum:: children_start, " " );
116
+ l.actions .emplace_back (action_enum:: string_item, " ddd" );
117
+ l.actions .emplace_back (action_enum:: children_end, " " );
118
118
119
- l.actions .emplace_back (children_end, " " );
119
+ l.actions .emplace_back (action_enum:: children_end, " " );
120
120
121
- l.actions .emplace_back (string_item, " Tab\t Backslash\\ Slash/ Doubleslash// Newline\n Doublequotes\" {}{}{}{}" );
121
+ l.actions .emplace_back (action_enum:: string_item, " Tab\t Backslash\\ Slash/ Doubleslash// Newline\n Doublequotes\" {}{}{}{}" );
122
122
123
- l.actions .emplace_back (string_item, " quoted string with trailing slash /" );
123
+ l.actions .emplace_back (action_enum:: string_item, " quoted string with trailing slash /" );
124
124
125
- l.actions .emplace_back (string_item, " fff ggg" );
125
+ l.actions .emplace_back (action_enum:: string_item, " fff ggg" );
126
126
127
- l.actions .emplace_back (string_item, " tralala tro lo lo\n tre lele" );
127
+ l.actions .emplace_back (action_enum:: string_item, " tralala tro lo lo\n tre lele" );
128
128
129
- l.actions .emplace_back (string_item, " -1213.33" );
129
+ l.actions .emplace_back (action_enum:: string_item, " -1213.33" );
130
130
131
- l.actions .emplace_back (string_item, " UnquotedStringAtTheVeryEndOfTheFile" );
131
+ l.actions .emplace_back (action_enum:: string_item, " UnquotedStringAtTheVeryEndOfTheFile" );
132
132
133
133
papki::fs_file fi (" parser_data/test.tml" );
134
134
0 commit comments