diff --git a/doc/dynare.texi b/doc/dynare.texi index fb6d3e5d8b49175cb3881ae5e6540ae3a842b500..bf320a1dbb60583234e0dd0c4a15857f94f4ef23 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -3032,10 +3032,11 @@ used). (unless @code{nograph} is used). @item graph_format = @var{FORMAT} +@itemx graph_format = ( @var{FORMAT}, @var{FORMAT}@dots{} ) @anchor{graph_format} -Specify the file format for graphs saved to disk. Possible values are -@code{eps} (the default), @code{pdf} and @code{fig} (the latter is not -available under Octave). +Specify the file format(s) for graphs saved to disk. Possible values are +@code{eps} (the default), @code{pdf} and @code{fig} (under Octave, +only @code{eps} is available). @item noprint Don't print anything. Useful for loops. @@ -3959,6 +3960,7 @@ Default value is @code{1}. @xref{nodisplay}. @item graph_format = @var{FORMAT} +@itemx graph_format = ( @var{FORMAT}, @var{FORMAT}@dots{} ) @xref{graph_format}. @item lik_init = @var{INTEGER} @@ -4775,6 +4777,7 @@ interval. Default: @code{0.90} @xref{nodisplay}. @item graph_format = @var{FORMAT} +@itemx graph_format = ( @var{FORMAT}, @var{FORMAT}@dots{} ) @xref{graph_format}. @end table @@ -5711,6 +5714,7 @@ Critical value for correlation @math{\rho}: plot couples of parmaters with @xref{nodisplay}. @item graph_format = @var{FORMAT} +@itemx graph_format = ( @var{FORMAT}, @var{FORMAT}@dots{} ) @xref{graph_format}. @item conf_sig = @var{DOUBLE} @@ -5832,6 +5836,7 @@ Specify the parameter set to use. Default: @code{prior_mean} @xref{nodisplay}. @item graph_format = @var{FORMAT} +@itemx graph_format = ( @var{FORMAT}, @var{FORMAT}@dots{} ) @xref{graph_format}. @end table diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy index 2ee59d06204e90b9c120105275e9dfa797abc5e2..004291e167889b4b64c713a22bda5b3a95d4bb3b 100644 --- a/preprocessor/DynareBison.yy +++ b/preprocessor/DynareBison.yy @@ -2250,13 +2250,22 @@ o_nograph : NOGRAPH { driver.option_num("nograph", "0"); } ; o_nodisplay : NODISPLAY { driver.option_num("nodisplay","1"); }; -o_graph_format : GRAPH_FORMAT EQUAL EPS - { driver.option_str("graph_format", "eps"); } - | GRAPH_FORMAT EQUAL FIG - { driver.option_str("graph_format", "fig"); } - | GRAPH_FORMAT EQUAL PDF - { driver.option_str("graph_format", "pdf"); } +o_graph_format : GRAPH_FORMAT EQUAL allowed_graph_formats + { driver.process_graph_format_option(); } + | GRAPH_FORMAT EQUAL '(' list_allowed_graph_formats ')' + { driver.process_graph_format_option(); } ; +allowed_graph_formats : EPS + { driver.add_graph_format("eps"); } + | FIG + { driver.add_graph_format("fig"); } + | PDF + { driver.add_graph_format("pdf"); } + ; +list_allowed_graph_formats : allowed_graph_formats + | list_allowed_graph_formats COMMA allowed_graph_formats + ; + o_subsample_name : symbol EQUAL date_number ':' date_number { driver.set_subsample_name_equal_to_date_range($1, $3, $5); } ; diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc index 75dc4daaaf67ac7f05c108ab2a3cf472c838dc9d..76a4e951546b7783974a743e93d1413ab08eab74 100644 --- a/preprocessor/ParsingDriver.cc +++ b/preprocessor/ParsingDriver.cc @@ -2479,3 +2479,17 @@ ParsingDriver::add_steady_state_model_equal_multiple(expr_t expr) symbol_list.clear(); } + +void +ParsingDriver::add_graph_format(const string &name) +{ + graph_formats.addSymbol(name); +} + +void +ParsingDriver::process_graph_format_option() +{ + options_list.symbol_list_options["graph_format"] = graph_formats; + graph_formats.clear(); +} + diff --git a/preprocessor/ParsingDriver.hh b/preprocessor/ParsingDriver.hh index e6bbeba39752522ba532cec62ea7f57206a1a2ae..fdf188c3aed378e204b02522e5b4b50d7517e7bf 100644 --- a/preprocessor/ParsingDriver.hh +++ b/preprocessor/ParsingDriver.hh @@ -197,6 +197,8 @@ private: void reset_current_external_function_options(); //! Adds a model lagged variable to ModelTree and VariableTable expr_t add_model_variable(int symb_id, int lag); + //! For parsing the graph_format option + SymbolList graph_formats; //! The mod file representation constructed by this ParsingDriver ModFile *mod_file; @@ -628,6 +630,10 @@ public: void declare_nonstationary_var(string *name, string *tex_name = NULL); //! Ends declaration of nonstationary variable void end_nonstationary_var(expr_t deflator); + //! Add a graph format to the list of formats requested + void add_graph_format(const string &name); + //! Add the graph_format option to the OptionsList structure + void process_graph_format_option(); }; #endif // ! PARSING_DRIVER_HH