From 452d3cd98609a68d97017d5dc8ed6d498a221b77 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Mon, 26 Dec 2016 13:07:46 +0100
Subject: [PATCH] Implement preprocessor interface for posterior_nograph option

---
 doc/dynare.texi                | 9 +++++++++
 matlab/global_initialization.m | 1 +
 preprocessor/DynareBison.yy    | 8 +++++++-
 preprocessor/DynareFlex.ll     | 2 ++
 4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/doc/dynare.texi b/doc/dynare.texi
index ce6ea6172..4eab4ff7f 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -5186,6 +5186,15 @@ Default value is @code{1}.
 @item nograph
 @xref{nograph}.
 
+@item posterior_nograph
+@anchor{posterior_nograph}
+Suppresses the generation of graphs associated with Bayesian IRFs (@ref{bayesian_irf}), 
+posterior smoothed objects (@ref{smoother}), and posterior forecasts (@ref{forecast}).
+
+@item posterior_graph
+@anchor{posterior_graph}
+Re-enables the generation of graphs previously shut off with @ref{posterior_nograph}.
+
 @item nodisplay
 @xref{nodisplay}.
 
diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m
index d409232a6..e65ca4a62 100644
--- a/matlab/global_initialization.m
+++ b/matlab/global_initialization.m
@@ -134,6 +134,7 @@ options_.graphics.line_width = 1;
 options_.graph_format = 'eps';
 options_.nodisplay = 0;
 options_.nograph = 0;
+options_.no_graph.posterior = 0;
 options_.no_graph.shock_decomposition = 0;
 options_.XTick = [];
 options_.XTickLabel = [];
diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy
index 03e4b8446..d84d77907 100644
--- a/preprocessor/DynareBison.yy
+++ b/preprocessor/DynareBison.yy
@@ -114,7 +114,7 @@ class ParsingDriver;
 %token FILTER_ALGORITHM PROPOSAL_APPROXIMATION CUBATURE UNSCENTED MONTECARLO DISTRIBUTION_APPROXIMATION
 %token <string_val> NAME
 %token NAN_CONSTANT NO_STATIC NOBS NOCONSTANT NODISPLAY NOCORR NODIAGNOSTIC NOFUNCTIONS NO_HOMOTOPY
-%token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF SAVE_DRAWS
+%token NOGRAPH POSTERIOR_NOGRAPH POSTERIOR_GRAPH NOMOMENTS NOPRINT NORMAL_PDF SAVE_DRAWS
 %token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS MAX_DIM_COVA_GROUP ADVANCED OUTFILE OUTVARS OVERWRITE
 %token PARALLEL_LOCAL_FILES PARAMETERS PARAMETER_SET PARTIAL_INFORMATION PERIODS PERIOD PLANNER_OBJECTIVE PLOT_CONDITIONAL_FORECAST PLOT_PRIORS PREFILTER PRESAMPLE
 %token PERFECT_FORESIGHT_SETUP PERFECT_FORESIGHT_SOLVER NO_POSTERIOR_KERNEL_DENSITY FUNCTION
@@ -1726,6 +1726,7 @@ estimation_options : o_datafile
                    | o_lik_algo
                    | o_lik_init
                    | o_nograph
+                   | o_posterior_nograph
                    | o_nodisplay
                    | o_graph_format
                    | o_forecasts_conf_sig
@@ -2816,6 +2817,11 @@ o_nograph : NOGRAPH
           | GRAPH
             { driver.option_num("nograph", "0"); }
           ;
+o_posterior_nograph : POSTERIOR_NOGRAPH
+            { driver.option_num("no_graph.posterior","1"); }
+          | POSTERIOR_GRAPH
+            { driver.option_num("no_graph.posterior", "0"); }
+          ;
 o_shock_decomposition_nograph : NOGRAPH { driver.option_num("no_graph.shock_decomposition", "1"); }
 o_nodisplay : NODISPLAY { driver.option_num("nodisplay","1"); };
 o_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats
diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll
index e461cb825..8d00b2874 100644
--- a/preprocessor/DynareFlex.ll
+++ b/preprocessor/DynareFlex.ll
@@ -276,6 +276,8 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
 <DYNARE_STATEMENT>raftery_lewis_diagnostics {return token::RAFTERY_LEWIS_DIAGNOSTICS;}
 <DYNARE_STATEMENT>graph   		{return token::GRAPH;}
 <DYNARE_STATEMENT>nograph   		{return token::NOGRAPH;}
+<DYNARE_STATEMENT>posterior_graph   		{return token::POSTERIOR_GRAPH;}
+<DYNARE_STATEMENT>posterior_nograph   		{return token::POSTERIOR_NOGRAPH;}
 <DYNARE_STATEMENT>nodisplay     {return token::NODISPLAY;}
 <DYNARE_STATEMENT>graph_format  {return token::GRAPH_FORMAT;}
 <DYNARE_STATEMENT>eps  {yylval->string_val = new string(yytext); return token::EPS;}
-- 
GitLab