preprocessor: added back prior names w/o _pdf and fixed check and write

time-shift
Houtan Bastani 2011-12-30 17:09:07 +01:00
parent 6c5722ad2a
commit fd2d3b0e4a
2 changed files with 20 additions and 4 deletions

View File

@ -1669,7 +1669,7 @@ BasicPriorStatement::BasicPriorStatement(const string &name_arg,
void void
BasicPriorStatement::checkPass(ModFileStructure &mod_file_struct) 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; cerr << "ERROR: You must pass the shape option to the prior statement." << endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -1732,7 +1732,7 @@ void
BasicPriorStatement::writeShape(ostream &output, const string &lhs_field) const BasicPriorStatement::writeShape(ostream &output, const string &lhs_field) const
{ {
assert(prior_shape != eNoShape); 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, PriorStatement::PriorStatement(const string &name_arg,

View File

@ -183,7 +183,7 @@ class ParsingDriver;
%type <symbol_type_val> change_type_arg %type <symbol_type_val> change_type_arg
%type <vector_string_val> change_type_var_list %type <vector_string_val> change_type_var_list
%type <vector_int_val> vec_int_elem vec_int_1 vec_int vec_int_number %type <vector_int_val> vec_int_elem vec_int_1 vec_int vec_int_number
%type <prior_distributions_val> prior_pdf %type <prior_distributions_val> prior_pdf prior_distribution
%% %%
%start statement_list; %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 prior_pdf : BETA_PDF
{ $$ = eBeta; } { $$ = eBeta; }
| GAMMA_PDF | GAMMA_PDF
@ -1975,7 +1991,7 @@ o_last_obs : LAST_OBS EQUAL date_number
{ driver.option_date("last_obs", $3); } { driver.option_date("last_obs", $3); }
; ;
o_shift : SHIFT EQUAL signed_number { driver.option_num("shift", $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_mode : MODE EQUAL signed_number { driver.option_num("mode", $3); };
o_mean : MEAN EQUAL signed_number { driver.option_num("mean", $3); }; o_mean : MEAN EQUAL signed_number { driver.option_num("mean", $3); };
o_stdev : STDEV EQUAL non_negative_number { driver.option_num("stdev", $3); }; o_stdev : STDEV EQUAL non_negative_number { driver.option_num("stdev", $3); };