@@ -71,35 +71,28 @@ bool ansi_c_languaget::parse(
71
71
ansi_c_internal_additions (code, config.ansi_c .ts_18661_3_Floatn_types );
72
72
std::istringstream codestr (code);
73
73
74
- ansi_c_parser. clear () ;
74
+ ansi_c_parsert ansi_c_parser{message_handler} ;
75
75
ansi_c_parser.set_file (ID_built_in);
76
76
ansi_c_parser.in =&codestr;
77
- ansi_c_parser.log .set_message_handler (message_handler);
78
77
ansi_c_parser.for_has_scope =config.ansi_c .for_has_scope ;
79
78
ansi_c_parser.ts_18661_3_Floatn_types =config.ansi_c .ts_18661_3_Floatn_types ;
80
79
ansi_c_parser.cpp98 =false ; // it's not C++
81
80
ansi_c_parser.cpp11 =false ; // it's not C++
82
81
ansi_c_parser.mode =config.ansi_c .mode ;
83
82
84
- ansi_c_scanner_init ();
85
-
86
83
bool result=ansi_c_parser.parse ();
87
84
88
85
if (!result)
89
86
{
90
87
ansi_c_parser.set_line_no (0 );
91
88
ansi_c_parser.set_file (path);
92
89
ansi_c_parser.in =&i_preprocessed;
93
- ansi_c_scanner_init ();
94
90
result=ansi_c_parser.parse ();
95
91
}
96
92
97
93
// save result
98
94
parse_tree.swap (ansi_c_parser.parse_tree );
99
95
100
- // save some memory
101
- ansi_c_parser.clear ();
102
-
103
96
return result;
104
97
}
105
98
@@ -197,13 +190,14 @@ bool ansi_c_languaget::to_expr(
197
190
198
191
// parsing
199
192
200
- ansi_c_parser. clear () ;
193
+ ansi_c_parsert ansi_c_parser{message_handler} ;
201
194
ansi_c_parser.set_file (irep_idt ());
202
195
ansi_c_parser.in =&i_preprocessed;
203
- ansi_c_parser.log .set_message_handler (message_handler);
204
- ansi_c_parser.mode =config.ansi_c .mode ;
196
+ ansi_c_parser.for_has_scope = config.ansi_c .for_has_scope ;
205
197
ansi_c_parser.ts_18661_3_Floatn_types =config.ansi_c .ts_18661_3_Floatn_types ;
206
- ansi_c_scanner_init ();
198
+ ansi_c_parser.cpp98 = false ; // it's not C++
199
+ ansi_c_parser.cpp11 = false ; // it's not C++
200
+ ansi_c_parser.mode = config.ansi_c .mode ;
207
201
208
202
bool result=ansi_c_parser.parse ();
209
203
0 commit comments