From d36eb82b7c45c2039cba8db012706306391d4394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Thu, 5 Jan 2023 15:49:36 +0100 Subject: [PATCH] =?UTF-8?q?Macro=20processor:=20removed=20unused=20?= =?UTF-8?q?=E2=80=9Cbasename=E2=80=9D=20variable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MacroExpandModFile.cc | 4 ++-- src/macro/Directives.cc | 4 ++-- src/macro/Driver.cc | 7 +++---- src/macro/Driver.hh | 9 +++------ 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/MacroExpandModFile.cc b/src/MacroExpandModFile.cc index e3ff96f1..09dc0348 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 c8ca2898..5d160a34 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 85743f04..cffdd0c1 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 b3a897dc..ad287cc8 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; -- GitLab