@@ -237,12 +237,11 @@ namespace hal
237
237
238
238
// First, create a Bitwuzla options instance.
239
239
bitwuzla::Options options;
240
+ bitwuzla::TermManager tm ;
240
241
// We will parse example file `smt2/quickstart.smt2`.
241
242
// Create parser instance.
242
243
// We expect no error to occur.
243
- const char * smt2_char_string = input.c_str ();
244
244
245
- auto in_stream = fmemopen ((void *)smt2_char_string, strlen (smt2_char_string), " r" );
246
245
std::stringbuf result_string;
247
246
std::ostream output_stream (&result_string);
248
247
@@ -256,16 +255,16 @@ namespace hal
256
255
// std::filesystem::path tmp_path = utils::get_unique_temp_directory().get();
257
256
// std::string output_file = std::string(tmp_path) + "/out.smt2";
258
257
259
- bitwuzla::parser::Parser parser (options, " VIRTUAL_FILE " , in_stream , " smt2" , &output_stream);
258
+ bitwuzla::parser::Parser parser (tm , options , " smt2" , &output_stream);
260
259
// Now parse the input file.
261
- std::string err_msg = parser.parse (false );
262
-
263
- if (!err_msg.empty ())
260
+ try
264
261
{
265
- return ERR (" failed to parse input file: " + err_msg);
262
+ parser.parse (input, false , false );
263
+ }
264
+ catch (bitwuzla::Exception& e)
265
+ {
266
+ return ERR (" failed to parse input file: " + e.msg ());
266
267
}
267
-
268
- fclose (in_stream);
269
268
270
269
std::string output (result_string.str ());
271
270
// std::cout << "output" << std::endl;
0 commit comments