From 3f3ef7ca002e7a86d924c9b6de6894cf62610d39 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Fri, 6 Dec 2019 10:40:44 +0100 Subject: [PATCH] fix bugs in initial_condition_decomposition statement closes #37 --- src/DynareBison.yy | 13 ++++++++++--- src/ParsingDriver.cc | 7 +++++++ src/ParsingDriver.hh | 2 ++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/DynareBison.yy b/src/DynareBison.yy index 063d2a98..60b77369 100644 --- a/src/DynareBison.yy +++ b/src/DynareBison.yy @@ -2869,9 +2869,9 @@ initial_condition_decomposition_option : o_icd_type | o_icd_write_xls | o_icd_plot_init_date | o_icd_plot_end_date - | o_nodisplay - | o_graph_format - | o_psd_fig_name + | o_icd_nodisplay + | o_icd_graph_format + | o_icd_fig_name | o_icd_diff | o_icd_flip ; @@ -3268,6 +3268,7 @@ o_shock_decomposition_forecast : FORECAST EQUAL INT_NUMBER { driver.option_num(" o_save_realtime : SAVE_REALTIME EQUAL vec_int { driver.option_vec_int("shock_decomp.save_realtime", $3); }; o_fast_realtime : FAST_REALTIME EQUAL INT_NUMBER { driver.option_num("shock_decomp.fast_realtime", $3); }; o_nodisplay : NODISPLAY { driver.option_num("nodisplay", "true"); }; +o_icd_nodisplay : NODISPLAY { driver.option_num("initial_condition_decomp.nodisplay", "true"); }; o_psd_nodisplay : NODISPLAY { driver.option_num("plot_shock_decomp.nodisplay", "true"); }; o_psd_init2shocks : INIT2SHOCKS { driver.option_str("plot_shock_decomp.init2shocks", "default"); } | INIT2SHOCKS EQUAL symbol { driver.option_str("plot_shock_decomp.init2shocks", $3); } @@ -3277,6 +3278,11 @@ o_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats | GRAPH_FORMAT EQUAL '(' list_allowed_graph_formats ')' { driver.process_graph_format_option(); } ; +o_icd_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats + { driver.initial_condition_decomp_process_graph_format_option(); } + | GRAPH_FORMAT EQUAL '(' list_allowed_graph_formats ')' + { driver.initial_condition_decomp_process_graph_format_option(); } + ; o_psd_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats { driver.plot_shock_decomp_process_graph_format_option(); } | GRAPH_FORMAT EQUAL '(' list_allowed_graph_formats ')' @@ -3396,6 +3402,7 @@ o_psd_interactive : INTERACTIVE { driver.option_num("plot_shock_decomp.interacti o_psd_screen_shocks : SCREEN_SHOCKS { driver.option_num("plot_shock_decomp.screen_shocks", "true"); }; o_psd_steadystate : STEADYSTATE { driver.option_num("plot_shock_decomp.steadystate", "true"); }; o_icd_steadystate : STEADYSTATE { driver.option_num("initial_condition_decomp.steadystate", "true"); }; +o_icd_fig_name : FIG_NAME EQUAL filename { driver.option_str("initial_condition_decomp.fig_name", $3); }; o_psd_fig_name : FIG_NAME EQUAL filename { driver.option_str("plot_shock_decomp.fig_name", $3); }; o_psd_type : TYPE EQUAL QOQ { driver.option_str("plot_shock_decomp.type", "qoq"); } diff --git a/src/ParsingDriver.cc b/src/ParsingDriver.cc index 535790be..0f72b0c5 100644 --- a/src/ParsingDriver.cc +++ b/src/ParsingDriver.cc @@ -3236,6 +3236,13 @@ ParsingDriver::process_graph_format_option() graph_formats.clear(); } +void +ParsingDriver::initial_condition_decomp_process_graph_format_option() +{ + options_list.symbol_list_options["initial_condition_decomp.graph_format"] = graph_formats; + graph_formats.clear(); +} + void ParsingDriver::plot_shock_decomp_process_graph_format_option() { diff --git a/src/ParsingDriver.hh b/src/ParsingDriver.hh index 4291952b..81a88a5c 100644 --- a/src/ParsingDriver.hh +++ b/src/ParsingDriver.hh @@ -852,6 +852,8 @@ public: void add_graph_format(const string &name); //! Add the graph_format option to the OptionsList structure void process_graph_format_option(); + //! Add the graph_format option to the initial_condition_decomp substructure of the OptionsList structure + void initial_condition_decomp_process_graph_format_option(); //! Add the graph_format option to the plot_shock_decomp substructure of the OptionsList structure void plot_shock_decomp_process_graph_format_option(); //! Model diagnostics -- GitLab