diff --git a/src/DynareBison.yy b/src/DynareBison.yy index ab5d0bc94893dd544d75ba63e8dfc5a629588e46..ac49f71ec86368e27f9001596b0e664d5dbd0d13 100644 --- a/src/DynareBison.yy +++ b/src/DynareBison.yy @@ -28,21 +28,19 @@ %define parse.error verbose %define parse.trace -%code top { -class ParsingDriver; -} - %code requires { +// Only headers needed for the value and location types go here +// Headers needed by the Bison file itself go in the unqualified %code section #include <string> #include <vector> #include <map> -#include <utility> #include <tuple> #include <variant> -#include <ranges> #include "CommonEnums.hh" #include "ExprNode.hh" + +class ParsingDriver; } %param { ParsingDriver &driver } @@ -55,6 +53,9 @@ class ParsingDriver; } %code { +#include <ranges> +#include <utility> + /* Little hack: we redefine the macro which computes the locations, because we need to access the location from within the parsing driver for error and warning messages. */ @@ -245,8 +246,8 @@ str_tolower(string s) %type <tuple<string,string,string,string>> prior_eq_opt options_eq_opt %type <vector<pair<int, int>>> period_list %type <vector<expr_t>> matched_moments_list value_list ramsey_constraints_list -%type <tuple<string, BinaryOpNode *, BinaryOpNode *, expr_t, expr_t>> occbin_constraints_regime -%type <vector<tuple<string, BinaryOpNode *, BinaryOpNode *, expr_t, expr_t>>> occbin_constraints_regimes_list +%type <tuple<string, BinaryOpNode*, BinaryOpNode*, expr_t, expr_t>> occbin_constraints_regime +%type <vector<tuple<string, BinaryOpNode*, BinaryOpNode*, expr_t, expr_t>>> occbin_constraints_regimes_list %type <map<string, expr_t>> occbin_constraints_regime_options_list %type <pair<string, expr_t>> occbin_constraints_regime_option %type <PacTargetKind> pac_target_kind diff --git a/src/ParsingDriver.hh b/src/ParsingDriver.hh index 628cd5a0a4de6070d7bd40a606a6e9f4d72505c0..a33642677f693b07c8945edb9caba3866f480c19 100644 --- a/src/ParsingDriver.hh +++ b/src/ParsingDriver.hh @@ -34,7 +34,6 @@ #include "ModFile.hh" #include "SymbolList.hh" -class ParsingDriver; #include "DynareBison.hh" #include "ExprNode.hh" diff --git a/src/macro/Parser.yy b/src/macro/Parser.yy index 42ddd2d01353d227c75240dceccd5bbeb6b1d5f4..82bf6061455e3468eddae9f9ac4ea96693627f25 100644 --- a/src/macro/Parser.yy +++ b/src/macro/Parser.yy @@ -1,6 +1,6 @@ // -*- C++ -*- /* - * Copyright © 2019-2023 Dynare Team + * Copyright © 2019-2024 Dynare Team * * This file is part of Dynare. * @@ -28,10 +28,6 @@ %define parse.error verbose %define parse.trace -%code requires { -namespace macro { class Driver; } -} - %param { macro::Driver& driver } %locations @@ -43,6 +39,9 @@ namespace macro { class Driver; } %code requires { #include "Directives.hh" + +namespace macro { class Driver; } + using namespace macro; }