Merge branch 'master' into remove-dynDate-class
commit
cef58f7646
|
@ -130,7 +130,7 @@ class ParsingDriver;
|
||||||
%token UNIFORM_PDF UNIT_ROOT_VARS USE_DLL USEAUTOCORR GSA_SAMPLE_FILE USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED
|
%token UNIFORM_PDF UNIT_ROOT_VARS USE_DLL USEAUTOCORR GSA_SAMPLE_FILE USE_UNIVARIATE_FILTERS_IF_SINGULARITY_IS_DETECTED
|
||||||
%token VALUES VAR VAREXO VAREXO_DET VAROBS PREDETERMINED_VARIABLES
|
%token VALUES VAR VAREXO VAREXO_DET VAROBS PREDETERMINED_VARIABLES
|
||||||
%token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL
|
%token WRITE_LATEX_DYNAMIC_MODEL WRITE_LATEX_STATIC_MODEL
|
||||||
%token XLS_SHEET XLS_RANGE
|
%token XLS_SHEET XLS_RANGE LONG_NAME
|
||||||
%left COMMA
|
%left COMMA
|
||||||
%left EQUAL_EQUAL EXCLAMATION_EQUAL
|
%left EQUAL_EQUAL EXCLAMATION_EQUAL
|
||||||
%left LESS GREATER LESS_EQUAL GREATER_EQUAL
|
%left LESS GREATER LESS_EQUAL GREATER_EQUAL
|
||||||
|
@ -180,7 +180,7 @@ class ParsingDriver;
|
||||||
%type <string_val> non_negative_number signed_number signed_integer date_str
|
%type <string_val> non_negative_number signed_number signed_integer date_str
|
||||||
%type <string_val> filename symbol vec_of_vec_value vec_value_list date_expr
|
%type <string_val> filename symbol vec_of_vec_value vec_value_list date_expr
|
||||||
%type <string_val> vec_value_1 vec_value signed_inf signed_number_w_inf
|
%type <string_val> vec_value_1 vec_value signed_inf signed_number_w_inf
|
||||||
%type <string_val> range vec_value_w_inf vec_value_1_w_inf
|
%type <string_val> range vec_value_w_inf vec_value_1_w_inf named_var
|
||||||
%type <symbol_type_val> change_type_arg
|
%type <symbol_type_val> change_type_arg
|
||||||
%type <vector_string_val> change_type_var_list subsamples_eq_opt prior_eq_opt options_eq_opt
|
%type <vector_string_val> change_type_var_list subsamples_eq_opt prior_eq_opt options_eq_opt
|
||||||
%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
|
||||||
|
@ -337,6 +337,12 @@ nonstationary_var_list : nonstationary_var_list symbol
|
||||||
{ driver.declare_nonstationary_var($3, $4); }
|
{ driver.declare_nonstationary_var($3, $4); }
|
||||||
| symbol TEX_NAME
|
| symbol TEX_NAME
|
||||||
{ driver.declare_nonstationary_var($1, $2); }
|
{ driver.declare_nonstationary_var($1, $2); }
|
||||||
|
| nonstationary_var_list symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_nonstationary_var($2, $3, $4); }
|
||||||
|
| nonstationary_var_list COMMA symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_nonstationary_var($3, $4, $5); }
|
||||||
|
| symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_nonstationary_var($1, $2, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
varexo : VAREXO varexo_list ';';
|
varexo : VAREXO varexo_list ';';
|
||||||
|
@ -347,6 +353,10 @@ predetermined_variables : PREDETERMINED_VARIABLES predetermined_variables_list '
|
||||||
|
|
||||||
parameters : PARAMETERS parameter_list ';';
|
parameters : PARAMETERS parameter_list ';';
|
||||||
|
|
||||||
|
named_var : '(' LONG_NAME EQUAL QUOTED_STRING ')'
|
||||||
|
{ $$ = $4; }
|
||||||
|
;
|
||||||
|
|
||||||
var_list : var_list symbol
|
var_list : var_list symbol
|
||||||
{ driver.declare_endogenous($2); }
|
{ driver.declare_endogenous($2); }
|
||||||
| var_list COMMA symbol
|
| var_list COMMA symbol
|
||||||
|
@ -359,6 +369,12 @@ var_list : var_list symbol
|
||||||
{ driver.declare_endogenous($3, $4); }
|
{ driver.declare_endogenous($3, $4); }
|
||||||
| symbol TEX_NAME
|
| symbol TEX_NAME
|
||||||
{ driver.declare_endogenous($1, $2); }
|
{ driver.declare_endogenous($1, $2); }
|
||||||
|
| var_list symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_endogenous($2, $3, $4); }
|
||||||
|
| var_list COMMA symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_endogenous($3, $4, $5); }
|
||||||
|
| symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_endogenous($1, $2, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
varexo_list : varexo_list symbol
|
varexo_list : varexo_list symbol
|
||||||
|
@ -373,6 +389,12 @@ varexo_list : varexo_list symbol
|
||||||
{ driver.declare_exogenous($3, $4); }
|
{ driver.declare_exogenous($3, $4); }
|
||||||
| symbol TEX_NAME
|
| symbol TEX_NAME
|
||||||
{ driver.declare_exogenous($1, $2); }
|
{ driver.declare_exogenous($1, $2); }
|
||||||
|
| varexo_list symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_exogenous($2, $3, $4); }
|
||||||
|
| varexo_list COMMA symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_exogenous($3, $4, $5); }
|
||||||
|
| symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_exogenous($1, $2, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
varexo_det_list : varexo_det_list symbol
|
varexo_det_list : varexo_det_list symbol
|
||||||
|
@ -387,6 +409,12 @@ varexo_det_list : varexo_det_list symbol
|
||||||
{ driver.declare_exogenous_det($3, $4); }
|
{ driver.declare_exogenous_det($3, $4); }
|
||||||
| symbol TEX_NAME
|
| symbol TEX_NAME
|
||||||
{ driver.declare_exogenous_det($1, $2); }
|
{ driver.declare_exogenous_det($1, $2); }
|
||||||
|
| varexo_det_list symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_exogenous_det($2, $3, $4); }
|
||||||
|
| varexo_det_list COMMA symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_exogenous_det($3, $4, $5); }
|
||||||
|
| symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_exogenous_det($1, $2, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
parameter_list : parameter_list symbol
|
parameter_list : parameter_list symbol
|
||||||
|
@ -401,6 +429,12 @@ parameter_list : parameter_list symbol
|
||||||
{ driver.declare_parameter($3, $4); }
|
{ driver.declare_parameter($3, $4); }
|
||||||
| symbol TEX_NAME
|
| symbol TEX_NAME
|
||||||
{ driver.declare_parameter($1, $2); }
|
{ driver.declare_parameter($1, $2); }
|
||||||
|
| parameter_list symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_parameter($2, $3, $4); }
|
||||||
|
| parameter_list COMMA symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_parameter($3, $4, $5); }
|
||||||
|
| symbol TEX_NAME named_var
|
||||||
|
{ driver.declare_parameter($1, $2, $3); }
|
||||||
;
|
;
|
||||||
|
|
||||||
predetermined_variables_list : predetermined_variables_list symbol
|
predetermined_variables_list : predetermined_variables_list symbol
|
||||||
|
|
|
@ -501,6 +501,8 @@ string eofbuff;
|
||||||
<DYNARE_STATEMENT>analytic_derivation {return token::ANALYTIC_DERIVATION;}
|
<DYNARE_STATEMENT>analytic_derivation {return token::ANALYTIC_DERIVATION;}
|
||||||
<DYNARE_STATEMENT>solver_periods {return token::SOLVER_PERIODS;}
|
<DYNARE_STATEMENT>solver_periods {return token::SOLVER_PERIODS;}
|
||||||
<DYNARE_STATEMENT>endogenous_prior {return token::ENDOGENOUS_PRIOR;}
|
<DYNARE_STATEMENT>endogenous_prior {return token::ENDOGENOUS_PRIOR;}
|
||||||
|
<DYNARE_STATEMENT>long_name {return token::LONG_NAME;}
|
||||||
|
|
||||||
|
|
||||||
<DYNARE_STATEMENT>[\$][^$]*[\$] {
|
<DYNARE_STATEMENT>[\$][^$]*[\$] {
|
||||||
strtok(yytext+1, "$");
|
strtok(yytext+1, "$");
|
||||||
|
|
|
@ -131,14 +131,17 @@ ParsingDriver::warning(const string &m)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ParsingDriver::declare_symbol(const string *name, SymbolType type, const string *tex_name)
|
ParsingDriver::declare_symbol(const string *name, SymbolType type, const string *tex_name, const string *long_name)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (tex_name == NULL)
|
if (tex_name == NULL && long_name == NULL)
|
||||||
mod_file->symbol_table.addSymbol(*name, type);
|
mod_file->symbol_table.addSymbol(*name, type);
|
||||||
else
|
else
|
||||||
mod_file->symbol_table.addSymbol(*name, type, *tex_name);
|
if (long_name == NULL)
|
||||||
|
mod_file->symbol_table.addSymbol(*name, type, *tex_name);
|
||||||
|
else
|
||||||
|
mod_file->symbol_table.addSymbol(*name, type, *tex_name, *long_name);
|
||||||
}
|
}
|
||||||
catch (SymbolTable::AlreadyDeclaredException &e)
|
catch (SymbolTable::AlreadyDeclaredException &e)
|
||||||
{
|
{
|
||||||
|
@ -150,39 +153,47 @@ ParsingDriver::declare_symbol(const string *name, SymbolType type, const string
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ParsingDriver::declare_endogenous(string *name, string *tex_name)
|
ParsingDriver::declare_endogenous(string *name, string *tex_name, string *long_name)
|
||||||
{
|
{
|
||||||
declare_symbol(name, eEndogenous, tex_name);
|
declare_symbol(name, eEndogenous, tex_name, long_name);
|
||||||
delete name;
|
delete name;
|
||||||
if (tex_name != NULL)
|
if (tex_name != NULL)
|
||||||
delete tex_name;
|
delete tex_name;
|
||||||
|
if (long_name != NULL)
|
||||||
|
delete long_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ParsingDriver::declare_exogenous(string *name, string *tex_name)
|
ParsingDriver::declare_exogenous(string *name, string *tex_name, string *long_name)
|
||||||
{
|
{
|
||||||
declare_symbol(name, eExogenous, tex_name);
|
declare_symbol(name, eExogenous, tex_name, long_name);
|
||||||
delete name;
|
delete name;
|
||||||
if (tex_name != NULL)
|
if (tex_name != NULL)
|
||||||
delete tex_name;
|
delete tex_name;
|
||||||
|
if (long_name != NULL)
|
||||||
|
delete long_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ParsingDriver::declare_exogenous_det(string *name, string *tex_name)
|
ParsingDriver::declare_exogenous_det(string *name, string *tex_name, string *long_name)
|
||||||
{
|
{
|
||||||
declare_symbol(name, eExogenousDet, tex_name);
|
declare_symbol(name, eExogenousDet, tex_name, long_name);
|
||||||
delete name;
|
delete name;
|
||||||
if (tex_name != NULL)
|
if (tex_name != NULL)
|
||||||
delete tex_name;
|
delete tex_name;
|
||||||
|
if (long_name != NULL)
|
||||||
|
delete long_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ParsingDriver::declare_parameter(string *name, string *tex_name)
|
ParsingDriver::declare_parameter(string *name, string *tex_name, string *long_name)
|
||||||
{
|
{
|
||||||
declare_symbol(name, eParameter, tex_name);
|
declare_symbol(name, eParameter, tex_name, long_name);
|
||||||
delete name;
|
delete name;
|
||||||
if (tex_name != NULL)
|
if (tex_name != NULL)
|
||||||
delete tex_name;
|
delete tex_name;
|
||||||
|
if (long_name != NULL)
|
||||||
|
delete long_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -191,7 +202,7 @@ ParsingDriver::declare_statement_local_variable(string *name)
|
||||||
if (mod_file->symbol_table.exists(*name))
|
if (mod_file->symbol_table.exists(*name))
|
||||||
error("Symbol " + *name + " cannot be assigned within a statement " +
|
error("Symbol " + *name + " cannot be assigned within a statement " +
|
||||||
"while being assigned elsewhere in the modfile");
|
"while being assigned elsewhere in the modfile");
|
||||||
declare_symbol(name, eStatementDeclaredVariable, NULL);
|
declare_symbol(name, eStatementDeclaredVariable, NULL, NULL);
|
||||||
delete name;
|
delete name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +226,7 @@ ParsingDriver::begin_trend()
|
||||||
void
|
void
|
||||||
ParsingDriver::declare_trend_var(bool log_trend, string *name, string *tex_name)
|
ParsingDriver::declare_trend_var(bool log_trend, string *name, string *tex_name)
|
||||||
{
|
{
|
||||||
declare_symbol(name, log_trend ? eLogTrend : eTrend, tex_name);
|
declare_symbol(name, log_trend ? eLogTrend : eTrend, tex_name, NULL);
|
||||||
declared_trend_vars.push_back(mod_file->symbol_table.getID(*name));
|
declared_trend_vars.push_back(mod_file->symbol_table.getID(*name));
|
||||||
delete name;
|
delete name;
|
||||||
if (tex_name != NULL)
|
if (tex_name != NULL)
|
||||||
|
@ -333,17 +344,22 @@ ParsingDriver::add_expression_variable(string *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ParsingDriver::declare_nonstationary_var(string *name, string *tex_name)
|
ParsingDriver::declare_nonstationary_var(string *name, string *tex_name, string *long_name)
|
||||||
{
|
{
|
||||||
if (tex_name != NULL)
|
if (tex_name != NULL)
|
||||||
declare_endogenous(new string(*name), new string(*tex_name));
|
if (long_name != NULL)
|
||||||
|
declare_endogenous(new string(*name), new string(*tex_name), new string(*long_name));
|
||||||
|
else
|
||||||
|
declare_endogenous(new string(*name), new string(*tex_name));
|
||||||
else
|
else
|
||||||
declare_endogenous(new string(*name), tex_name);
|
declare_endogenous(new string(*name));
|
||||||
declared_nonstationary_vars.push_back(mod_file->symbol_table.getID(*name));
|
declared_nonstationary_vars.push_back(mod_file->symbol_table.getID(*name));
|
||||||
mod_file->nonstationary_variables = true;
|
mod_file->nonstationary_variables = true;
|
||||||
delete name;
|
delete name;
|
||||||
if (tex_name != NULL)
|
if (tex_name != NULL)
|
||||||
delete tex_name;
|
delete tex_name;
|
||||||
|
if (long_name != NULL)
|
||||||
|
delete long_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2292,7 +2308,7 @@ ParsingDriver::external_function_option(const string &name_option, const string
|
||||||
{
|
{
|
||||||
if (opt.empty())
|
if (opt.empty())
|
||||||
error("An argument must be passed to the 'name' option of the external_function() statement.");
|
error("An argument must be passed to the 'name' option of the external_function() statement.");
|
||||||
declare_symbol(&opt, eExternalFunction, NULL);
|
declare_symbol(&opt, eExternalFunction, NULL, NULL);
|
||||||
current_external_function_id = mod_file->symbol_table.getID(opt);
|
current_external_function_id = mod_file->symbol_table.getID(opt);
|
||||||
}
|
}
|
||||||
else if (name_option == "first_deriv_provided")
|
else if (name_option == "first_deriv_provided")
|
||||||
|
@ -2301,7 +2317,7 @@ ParsingDriver::external_function_option(const string &name_option, const string
|
||||||
current_external_function_options.firstDerivSymbID = eExtFunSetButNoNameProvided;
|
current_external_function_options.firstDerivSymbID = eExtFunSetButNoNameProvided;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
declare_symbol(&opt, eExternalFunction, NULL);
|
declare_symbol(&opt, eExternalFunction, NULL, NULL);
|
||||||
current_external_function_options.firstDerivSymbID = mod_file->symbol_table.getID(opt);
|
current_external_function_options.firstDerivSymbID = mod_file->symbol_table.getID(opt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2311,7 +2327,7 @@ ParsingDriver::external_function_option(const string &name_option, const string
|
||||||
current_external_function_options.secondDerivSymbID = eExtFunSetButNoNameProvided;
|
current_external_function_options.secondDerivSymbID = eExtFunSetButNoNameProvided;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
declare_symbol(&opt, eExternalFunction, NULL);
|
declare_symbol(&opt, eExternalFunction, NULL, NULL);
|
||||||
current_external_function_options.secondDerivSymbID = mod_file->symbol_table.getID(opt);
|
current_external_function_options.secondDerivSymbID = mod_file->symbol_table.getID(opt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2435,7 +2451,7 @@ ParsingDriver::add_model_var_or_external_function(string *function_name, bool in
|
||||||
if (in_model_block)
|
if (in_model_block)
|
||||||
error("To use an external function (" + *function_name + ") within the model block, you must first declare it via the external_function() statement.");
|
error("To use an external function (" + *function_name + ") within the model block, you must first declare it via the external_function() statement.");
|
||||||
|
|
||||||
declare_symbol(function_name, eExternalFunction, NULL);
|
declare_symbol(function_name, eExternalFunction, NULL, NULL);
|
||||||
current_external_function_options.nargs = stack_external_function_args.top().size();
|
current_external_function_options.nargs = stack_external_function_args.top().size();
|
||||||
mod_file->external_functions_table.addExternalFunction(mod_file->symbol_table.getID(*function_name),
|
mod_file->external_functions_table.addExternalFunction(mod_file->symbol_table.getID(*function_name),
|
||||||
current_external_function_options, in_model_block);
|
current_external_function_options, in_model_block);
|
||||||
|
|
|
@ -94,7 +94,7 @@ private:
|
||||||
void check_symbol_is_endogenous_or_exogenous(string *name);
|
void check_symbol_is_endogenous_or_exogenous(string *name);
|
||||||
|
|
||||||
//! Helper to add a symbol declaration
|
//! Helper to add a symbol declaration
|
||||||
void declare_symbol(const string *name, SymbolType type, const string *tex_name);
|
void declare_symbol(const string *name, SymbolType type, const string *tex_name, const string *long_name);
|
||||||
|
|
||||||
//! Creates option "optim_opt" in OptionsList if it doesn't exist, else add a comma, and adds the option name
|
//! Creates option "optim_opt" in OptionsList if it doesn't exist, else add a comma, and adds the option name
|
||||||
void optim_options_helper(const string &name);
|
void optim_options_helper(const string &name);
|
||||||
|
@ -261,13 +261,13 @@ public:
|
||||||
//! Sets the FILENAME for the initial value in initval
|
//! Sets the FILENAME for the initial value in initval
|
||||||
void initval_file(string *filename);
|
void initval_file(string *filename);
|
||||||
//! Declares an endogenous variable
|
//! Declares an endogenous variable
|
||||||
void declare_endogenous(string *name, string *tex_name = NULL);
|
void declare_endogenous(string *name, string *tex_name = NULL, string *long_name = NULL);
|
||||||
//! Declares an exogenous variable
|
//! Declares an exogenous variable
|
||||||
void declare_exogenous(string *name, string *tex_name = NULL);
|
void declare_exogenous(string *name, string *tex_name = NULL, string *long_name = NULL);
|
||||||
//! Declares an exogenous deterministic variable
|
//! Declares an exogenous deterministic variable
|
||||||
void declare_exogenous_det(string *name, string *tex_name = NULL);
|
void declare_exogenous_det(string *name, string *tex_name = NULL, string *long_name = NULL);
|
||||||
//! Declares a parameter
|
//! Declares a parameter
|
||||||
void declare_parameter(string *name, string *tex_name = NULL);
|
void declare_parameter(string *name, string *tex_name = NULL, string *long_name = NULL);
|
||||||
//! Declares a statement local variable
|
//! Declares a statement local variable
|
||||||
void declare_statement_local_variable(string *name);
|
void declare_statement_local_variable(string *name);
|
||||||
//! Completes a subsample statement
|
//! Completes a subsample statement
|
||||||
|
@ -644,7 +644,7 @@ public:
|
||||||
//! Ends declaration of trend variable
|
//! Ends declaration of trend variable
|
||||||
void end_trend_var(expr_t growth_factor);
|
void end_trend_var(expr_t growth_factor);
|
||||||
//! Declares a nonstationary variable with its deflator
|
//! Declares a nonstationary variable with its deflator
|
||||||
void declare_nonstationary_var(string *name, string *tex_name = NULL);
|
void declare_nonstationary_var(string *name, string *tex_name = NULL, string *long_name = NULL);
|
||||||
//! Ends declaration of nonstationary variable
|
//! Ends declaration of nonstationary variable
|
||||||
void end_nonstationary_var(bool log_deflator, expr_t deflator);
|
void end_nonstationary_var(bool log_deflator, expr_t deflator);
|
||||||
//! Add a graph format to the list of formats requested
|
//! Add a graph format to the list of formats requested
|
||||||
|
|
|
@ -39,7 +39,7 @@ SymbolTable::SymbolTable() : frozen(false), size(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_name) throw (AlreadyDeclaredException, FrozenException)
|
SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_name, const string &long_name) throw (AlreadyDeclaredException, FrozenException)
|
||||||
{
|
{
|
||||||
if (frozen)
|
if (frozen)
|
||||||
throw FrozenException();
|
throw FrozenException();
|
||||||
|
@ -58,10 +58,17 @@ SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_na
|
||||||
type_table.push_back(type);
|
type_table.push_back(type);
|
||||||
name_table.push_back(name);
|
name_table.push_back(name);
|
||||||
tex_name_table.push_back(tex_name);
|
tex_name_table.push_back(tex_name);
|
||||||
|
long_name_table.push_back(long_name);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_name) throw (AlreadyDeclaredException, FrozenException)
|
||||||
|
{
|
||||||
|
return addSymbol(name, type, tex_name, name);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SymbolTable::addSymbol(const string &name, SymbolType type) throw (AlreadyDeclaredException, FrozenException)
|
SymbolTable::addSymbol(const string &name, SymbolType type) throw (AlreadyDeclaredException, FrozenException)
|
||||||
{
|
{
|
||||||
|
@ -168,40 +175,48 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
|
||||||
{
|
{
|
||||||
output << "M_.exo_names = '" << getName(exo_ids[0]) << "';" << endl;
|
output << "M_.exo_names = '" << getName(exo_ids[0]) << "';" << endl;
|
||||||
output << "M_.exo_names_tex = '" << getTeXName(exo_ids[0]) << "';" << endl;
|
output << "M_.exo_names_tex = '" << getTeXName(exo_ids[0]) << "';" << endl;
|
||||||
|
output << "M_.exo_names_long = '" << getLongName(exo_ids[0]) << "';" << endl;
|
||||||
for (int id = 1; id < exo_nbr(); id++)
|
for (int id = 1; id < exo_nbr(); id++)
|
||||||
{
|
{
|
||||||
output << "M_.exo_names = char(M_.exo_names, '" << getName(exo_ids[id]) << "');" << endl
|
output << "M_.exo_names = char(M_.exo_names, '" << getName(exo_ids[id]) << "');" << endl
|
||||||
<< "M_.exo_names_tex = char(M_.exo_names_tex, '" << getTeXName(exo_ids[id]) << "');" << endl;
|
<< "M_.exo_names_tex = char(M_.exo_names_tex, '" << getTeXName(exo_ids[id]) << "');" << endl
|
||||||
|
<< "M_.exo_names_long = char(M_.exo_names_long, '" << getLongName(exo_ids[id]) << "');" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exo_det_nbr() > 0)
|
if (exo_det_nbr() > 0)
|
||||||
{
|
{
|
||||||
output << "M_.exo_det_names = '" << getName(exo_det_ids[0]) << "';" << endl;
|
output << "M_.exo_det_names = '" << getName(exo_det_ids[0]) << "';" << endl;
|
||||||
output << "M_.exo_det_names_tex = '" << getTeXName(exo_det_ids[0]) << "';" << endl;
|
output << "M_.exo_det_names_tex = '" << getTeXName(exo_det_ids[0]) << "';" << endl;
|
||||||
|
output << "M_.exo_det_names_long = '" << getLongName(exo_det_ids[0]) << "';" << endl;
|
||||||
for (int id = 1; id < exo_det_nbr(); id++)
|
for (int id = 1; id < exo_det_nbr(); id++)
|
||||||
{
|
{
|
||||||
output << "M_.exo_det_names = char(M_.exo_det_names, '" << getName(exo_det_ids[id]) << "');" << endl
|
output << "M_.exo_det_names = char(M_.exo_det_names, '" << getName(exo_det_ids[id]) << "');" << endl
|
||||||
<< "M_.exo_det_names_tex = char(M_.exo_det_names_tex, '" << getTeXName(exo_det_ids[id]) << "');" << endl;
|
<< "M_.exo_det_names_tex = char(M_.exo_det_names_tex, '" << getTeXName(exo_det_ids[id]) << "');" << endl
|
||||||
|
<< "M_.exo_det_names_long = char(M_.exo_det_names_long, '" << getLongName(exo_det_ids[id]) << "');" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (endo_nbr() > 0)
|
if (endo_nbr() > 0)
|
||||||
{
|
{
|
||||||
output << "M_.endo_names = '" << getName(endo_ids[0]) << "';" << endl;
|
output << "M_.endo_names = '" << getName(endo_ids[0]) << "';" << endl;
|
||||||
output << "M_.endo_names_tex = '" << getTeXName(endo_ids[0]) << "';" << endl;
|
output << "M_.endo_names_tex = '" << getTeXName(endo_ids[0]) << "';" << endl;
|
||||||
|
output << "M_.endo_names_long = '" << getLongName(endo_ids[0]) << "';" << endl;
|
||||||
for (int id = 1; id < endo_nbr(); id++)
|
for (int id = 1; id < endo_nbr(); id++)
|
||||||
{
|
{
|
||||||
output << "M_.endo_names = char(M_.endo_names, '" << getName(endo_ids[id]) << "');" << endl
|
output << "M_.endo_names = char(M_.endo_names, '" << getName(endo_ids[id]) << "');" << endl
|
||||||
<< "M_.endo_names_tex = char(M_.endo_names_tex, '" << getTeXName(endo_ids[id]) << "');" << endl;
|
<< "M_.endo_names_tex = char(M_.endo_names_tex, '" << getTeXName(endo_ids[id]) << "');" << endl
|
||||||
|
<< "M_.endo_names_long = char(M_.endo_names_long, '" << getLongName(endo_ids[id]) << "');" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (param_nbr() > 0)
|
if (param_nbr() > 0)
|
||||||
{
|
{
|
||||||
output << "M_.param_names = '" << getName(param_ids[0]) << "';" << endl;
|
output << "M_.param_names = '" << getName(param_ids[0]) << "';" << endl;
|
||||||
output << "M_.param_names_tex = '" << getTeXName(param_ids[0]) << "';" << endl;
|
output << "M_.param_names_tex = '" << getTeXName(param_ids[0]) << "';" << endl;
|
||||||
|
output << "M_.param_names_long = '" << getLongName(param_ids[0]) << "';" << endl;
|
||||||
for (int id = 1; id < param_nbr(); id++)
|
for (int id = 1; id < param_nbr(); id++)
|
||||||
{
|
{
|
||||||
output << "M_.param_names = char(M_.param_names, '" << getName(param_ids[id]) << "');" << endl
|
output << "M_.param_names = char(M_.param_names, '" << getName(param_ids[id]) << "');" << endl
|
||||||
<< "M_.param_names_tex = char(M_.param_names_tex, '" << getTeXName(param_ids[id]) << "');" << endl;
|
<< "M_.param_names_tex = char(M_.param_names_tex, '" << getTeXName(param_ids[id]) << "');" << endl
|
||||||
|
<< "M_.param_names_long = char(M_.param_names_long, '" << getLongName(param_ids[id]) << "');" << endl;
|
||||||
|
|
||||||
if (getName(param_ids[id]) == "dsge_prior_weight")
|
if (getName(param_ids[id]) == "dsge_prior_weight")
|
||||||
output << "options_.dsge_var = 1;" << endl;
|
output << "options_.dsge_var = 1;" << endl;
|
||||||
|
|
|
@ -87,6 +87,8 @@ private:
|
||||||
vector<string> name_table;
|
vector<string> name_table;
|
||||||
//! Maps IDs to TeX names
|
//! Maps IDs to TeX names
|
||||||
vector<string> tex_name_table;
|
vector<string> tex_name_table;
|
||||||
|
//! Maps IDs to string names of variables
|
||||||
|
vector<string> long_name_table;
|
||||||
//! Maps IDs to types
|
//! Maps IDs to types
|
||||||
vector<SymbolType> type_table;
|
vector<SymbolType> type_table;
|
||||||
|
|
||||||
|
@ -182,6 +184,9 @@ private:
|
||||||
public:
|
public:
|
||||||
//! Add a symbol
|
//! Add a symbol
|
||||||
/*! Returns the symbol ID */
|
/*! Returns the symbol ID */
|
||||||
|
int addSymbol(const string &name, SymbolType type, const string &tex_name, const string &long_name) throw (AlreadyDeclaredException, FrozenException);
|
||||||
|
//! Add a symbol without its long name (will be equal to its name)
|
||||||
|
/*! Returns the symbol ID */
|
||||||
int addSymbol(const string &name, SymbolType type, const string &tex_name) throw (AlreadyDeclaredException, FrozenException);
|
int addSymbol(const string &name, SymbolType type, const string &tex_name) throw (AlreadyDeclaredException, FrozenException);
|
||||||
//! Add a symbol without its TeX name (will be equal to its name)
|
//! Add a symbol without its TeX name (will be equal to its name)
|
||||||
/*! Returns the symbol ID */
|
/*! Returns the symbol ID */
|
||||||
|
@ -242,6 +247,8 @@ public:
|
||||||
inline string getName(int id) const throw (UnknownSymbolIDException);
|
inline string getName(int id) const throw (UnknownSymbolIDException);
|
||||||
//! Get TeX name
|
//! Get TeX name
|
||||||
inline string getTeXName(int id) const throw (UnknownSymbolIDException);
|
inline string getTeXName(int id) const throw (UnknownSymbolIDException);
|
||||||
|
//! Get long name
|
||||||
|
inline string getLongName(int id) const throw (UnknownSymbolIDException);
|
||||||
//! Get type (by ID)
|
//! Get type (by ID)
|
||||||
inline SymbolType getType(int id) const throw (UnknownSymbolIDException);
|
inline SymbolType getType(int id) const throw (UnknownSymbolIDException);
|
||||||
//! Get type (by name)
|
//! Get type (by name)
|
||||||
|
@ -318,6 +325,15 @@ SymbolTable::getTeXName(int id) const throw (UnknownSymbolIDException)
|
||||||
return tex_name_table[id];
|
return tex_name_table[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline string
|
||||||
|
SymbolTable::getLongName(int id) const throw (UnknownSymbolIDException)
|
||||||
|
{
|
||||||
|
if (id < 0 || id >= size)
|
||||||
|
throw UnknownSymbolIDException(id);
|
||||||
|
else
|
||||||
|
return long_name_table[id];
|
||||||
|
}
|
||||||
|
|
||||||
inline SymbolType
|
inline SymbolType
|
||||||
SymbolTable::getType(int id) const throw (UnknownSymbolIDException)
|
SymbolTable::getType(int id) const throw (UnknownSymbolIDException)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue