From fd2d3b0e4a01b09205912a2ffa3b84cd6b0d4384 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Fri, 30 Dec 2011 17:09:07 +0100 Subject: [PATCH] preprocessor: added back prior names w/o _pdf and fixed check and write --- preprocessor/ComputingTasks.cc | 4 ++-- preprocessor/DynareBison.yy | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index 81d4ec165..6d321dcd0 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/ComputingTasks.cc @@ -1669,7 +1669,7 @@ BasicPriorStatement::BasicPriorStatement(const string &name_arg, void BasicPriorStatement::checkPass(ModFileStructure &mod_file_struct) { - if (options_list.string_options.find("shape") == options_list.string_options.end()) + if (prior_shape == eNoShape) { cerr << "ERROR: You must pass the shape option to the prior statement." << endl; exit(EXIT_FAILURE); @@ -1732,7 +1732,7 @@ void BasicPriorStatement::writeShape(ostream &output, const string &lhs_field) const { assert(prior_shape != eNoShape); - output << "estimation_info" << lhs_field << "(prior_indx).shape = " << prior_shape; + output << "estimation_info" << lhs_field << "(prior_indx).shape = " << prior_shape << ";" << endl; } PriorStatement::PriorStatement(const string &name_arg, diff --git a/preprocessor/DynareBison.yy b/preprocessor/DynareBison.yy index 86dfb2c40..e688ff2e0 100644 --- a/preprocessor/DynareBison.yy +++ b/preprocessor/DynareBison.yy @@ -183,7 +183,7 @@ class ParsingDriver; %type change_type_arg %type change_type_var_list %type vec_int_elem vec_int_1 vec_int vec_int_number -%type prior_pdf +%type prior_pdf prior_distribution %% %start statement_list; @@ -1159,6 +1159,22 @@ estimated_bounds_elem : STDERR symbol COMMA expression COMMA expression ';' } ; +prior_distribution : BETA + { $$ = eBeta; } + | GAMMA + { $$ = eGamma; } + | NORMAL + { $$ = eNormal; } + | INV_GAMMA + { $$ = eInvGamma; } + | INV_GAMMA1 + { $$ = eInvGamma1; } + | UNIFORM + { $$ = eUniform; } + | INV_GAMMA2 + { $$ = eInvGamma2; } + ; + prior_pdf : BETA_PDF { $$ = eBeta; } | GAMMA_PDF @@ -1975,7 +1991,7 @@ o_last_obs : LAST_OBS EQUAL date_number { driver.option_date("last_obs", $3); } ; o_shift : SHIFT EQUAL signed_number { driver.option_num("shift", $3); }; -o_shape : SHAPE EQUAL prior_pdf { driver.prior_shape = $3; }; +o_shape : SHAPE EQUAL prior_distribution { driver.prior_shape = $3; }; o_mode : MODE EQUAL signed_number { driver.option_num("mode", $3); }; o_mean : MEAN EQUAL signed_number { driver.option_num("mean", $3); }; o_stdev : STDEV EQUAL non_negative_number { driver.option_num("stdev", $3); };