diff --git a/src/MacroExpandModFile.cc b/src/MacroExpandModFile.cc index e3ff96f1c69f11a80a7fec7d2924a39141eb3645..09dc03486bcd91bc58ad12380370f2557a6cd123 100644 --- a/src/MacroExpandModFile.cc +++ b/src/MacroExpandModFile.cc @@ -1,5 +1,5 @@ /* - * Copyright © 2015-2020 Dynare Team + * Copyright © 2015-2023 Dynare Team * * This file is part of Dynare. * @@ -35,7 +35,7 @@ macroExpandModFile(const string &filename, const string &basename, const istream stringstream macro_output; macro::Environment env = macro::Environment(); macro::Driver m; - m.parse(filename, basename, modfile, debug, defines, env, paths, macro_output); + m.parse(filename, modfile, debug, defines, env, paths, macro_output); if (save_macro) { if (save_macro_file.empty()) diff --git a/src/macro/Directives.cc b/src/macro/Directives.cc index c8ca289813a77e48414ab09f41bdc2bd3cd535c7..5d160a348fc60e1369178470def28383ba6a3169 100644 --- a/src/macro/Directives.cc +++ b/src/macro/Directives.cc @@ -1,5 +1,5 @@ /* - * Copyright © 2019-2022 Dynare Team + * Copyright © 2019-2023 Dynare Team * * This file is part of Dynare. * @@ -77,7 +77,7 @@ Include::interpret(ostream &output, Environment &env, vector<filesystem::path> & bug in GCC/MinGW 10.2 (shipped in Debian “Bullseye” 11), that fails to accept implicit conversion to string from filename::path. See https://en.cppreference.com/w/cpp/filesystem/path/native. */ - m.parse(filename.string(), filename.stem().string(), incfile, false, {}, env, paths, output); + m.parse(filename.string(), incfile, false, {}, env, paths, output); } catch (StackTrace &ex) { diff --git a/src/macro/Driver.cc b/src/macro/Driver.cc index 85743f042d82b1ae88df521a5c34f3bdaacf8ab0..cffdd0c17a228250df674fe0090453950193a948 100644 --- a/src/macro/Driver.cc +++ b/src/macro/Driver.cc @@ -1,5 +1,5 @@ /* - * Copyright © 2019-2022 Dynare Team + * Copyright © 2019-2023 Dynare Team * * This file is part of Dynare. * @@ -25,12 +25,11 @@ using namespace macro; void -Driver::parse(const string &file_arg, const string &basename_arg, const istream &modfile, +Driver::parse(const string &file_arg, const istream &modfile, bool debug, const vector<pair<string, string>> &defines, Environment &env, vector<filesystem::path> &paths, ostream &output) { file = file_arg; - basename = basename_arg; if (!defines.empty()) { @@ -39,7 +38,7 @@ Driver::parse(const string &file_arg, const string &basename_arg, const istream command_line_defines_with_endl << "@#define " << var << " = " << val << endl; Driver m; istream is(command_line_defines_with_endl.rdbuf()); - m.parse("command_line_defines", "command_line_defines", is, debug, {}, env, paths, output); + m.parse("command_line_defines", is, debug, {}, env, paths, output); } stringstream file_with_endl; diff --git a/src/macro/Driver.hh b/src/macro/Driver.hh index b3a897dcbec4d72b9ab004550420ffc5f9da4c4f..ad287cc8592890cb0203479a1e50f2e893204d2b 100644 --- a/src/macro/Driver.hh +++ b/src/macro/Driver.hh @@ -1,5 +1,5 @@ /* - * Copyright © 2019-2022 Dynare Team + * Copyright © 2019-2023 Dynare Team * * This file is part of Dynare. * @@ -76,16 +76,13 @@ namespace macro //! Starts parsing a file, modifies `env`, `paths` and `output` //! as they are modified by various macro directives - void parse(const string &file, const string &basename, const istream &modfile, + void parse(const string &file, const istream &modfile, bool debug, const vector<pair<string, string>> &defines, Environment &env, vector<filesystem::path> &paths, ostream &output); - //! Name of main file being parsed + //! Name of main file being parsed (for error reporting purposes) string file; - //! Basename of main file being parsed - string basename; - //! Reference to the lexer unique_ptr<TokenizerFlex> lexer;