preprocessor: take care of exos in prior statements
parent
69ec4bf269
commit
008cf9dc0a
|
@ -2974,6 +2974,23 @@ PriorStatement::PriorStatement(const string &name_arg,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Statement *
|
||||||
|
PriorStatement::cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SymbolTable *new_symbol_table = dynamic_datatree.getSymbolTable();
|
||||||
|
new_symbol_table->getID(name);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
cerr << "ERROR: A variable in the prior statement was not found in the symbol table" << endl
|
||||||
|
<< " This likely means that you have declared a varexo that is not used in the model" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
return new PriorStatement(name, subsample_name, prior_shape, variance, options_list);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PriorStatement::writeOutput(ostream &output, const string &basename) const
|
PriorStatement::writeOutput(ostream &output, const string &basename) const
|
||||||
{
|
{
|
||||||
|
@ -3011,6 +3028,23 @@ StdPriorStatement::StdPriorStatement(const string &name_arg,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Statement *
|
||||||
|
StdPriorStatement::cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table)
|
||||||
|
{
|
||||||
|
SymbolTable *new_symbol_table = dynamic_datatree.getSymbolTable();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
new_symbol_table->getID(name);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
cerr << "ERROR: A variable in the std_prior statement was not found in the symbol table" << endl
|
||||||
|
<< " This likely means that you have declared a varexo that is not used in the model" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
return new StdPriorStatement(name, subsample_name, prior_shape, variance, options_list, *new_symbol_table);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
StdPriorStatement::writeOutput(ostream &output, const string &basename) const
|
StdPriorStatement::writeOutput(ostream &output, const string &basename) const
|
||||||
{
|
{
|
||||||
|
@ -3074,6 +3108,24 @@ CorrPriorStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Statement *
|
||||||
|
CorrPriorStatement::cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table)
|
||||||
|
{
|
||||||
|
SymbolTable *new_symbol_table = dynamic_datatree.getSymbolTable();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
new_symbol_table->getID(name);
|
||||||
|
new_symbol_table->getID(name1);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
cerr << "ERROR: A variable in the corr_prior statement was not found in the symbol table" << endl
|
||||||
|
<< " This likely means that you have declared a varexo that is not used in the model" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
return new CorrPriorStatement(name, name1, subsample_name, prior_shape, variance, options_list, *new_symbol_table);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CorrPriorStatement::writeOutput(ostream &output, const string &basename) const
|
CorrPriorStatement::writeOutput(ostream &output, const string &basename) const
|
||||||
{
|
{
|
||||||
|
@ -3153,6 +3205,37 @@ PriorEqualStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsoli
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Statement *
|
||||||
|
PriorEqualStatement::cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table)
|
||||||
|
{
|
||||||
|
SymbolTable *new_symbol_table = dynamic_datatree.getSymbolTable();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
new_symbol_table->getID(to_name1);
|
||||||
|
if (!to_name2.empty())
|
||||||
|
new_symbol_table->getID(to_name2);
|
||||||
|
|
||||||
|
new_symbol_table->getID(from_name1);
|
||||||
|
if (!from_name2.empty())
|
||||||
|
new_symbol_table->getID(from_name2);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
cerr << "ERROR: A variable in the prior equal statement was not found in the symbol table" << endl
|
||||||
|
<< " This likely means that you have declared a varexo that is not used in the model" << endl;
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
return new PriorEqualStatement(to_declaration_type,
|
||||||
|
to_name1,
|
||||||
|
to_name2,
|
||||||
|
to_subsample_name,
|
||||||
|
from_declaration_type,
|
||||||
|
from_name1,
|
||||||
|
from_name2,
|
||||||
|
from_subsample_name,
|
||||||
|
*new_symbol_table);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PriorEqualStatement::get_base_name(const SymbolType symb_type, string &lhs_field) const
|
PriorEqualStatement::get_base_name(const SymbolType symb_type, string &lhs_field) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -756,6 +756,7 @@ public:
|
||||||
const OptionsList &options_list_arg);
|
const OptionsList &options_list_arg);
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
virtual void writeCOutput(ostream &output, const string &basename);
|
virtual void writeCOutput(ostream &output, const string &basename);
|
||||||
|
virtual Statement *cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table);
|
||||||
};
|
};
|
||||||
|
|
||||||
class StdPriorStatement : public BasicPriorStatement
|
class StdPriorStatement : public BasicPriorStatement
|
||||||
|
@ -771,6 +772,7 @@ public:
|
||||||
const SymbolTable &symbol_table_arg);
|
const SymbolTable &symbol_table_arg);
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
virtual void writeCOutput(ostream &output, const string &basename);
|
virtual void writeCOutput(ostream &output, const string &basename);
|
||||||
|
virtual Statement *cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table);
|
||||||
};
|
};
|
||||||
|
|
||||||
class CorrPriorStatement : public BasicPriorStatement
|
class CorrPriorStatement : public BasicPriorStatement
|
||||||
|
@ -789,6 +791,7 @@ public:
|
||||||
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
virtual void writeCOutput(ostream &output, const string &basename);
|
virtual void writeCOutput(ostream &output, const string &basename);
|
||||||
|
virtual Statement *cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PriorEqualStatement : public Statement
|
class PriorEqualStatement : public Statement
|
||||||
|
@ -816,6 +819,7 @@ public:
|
||||||
void get_base_name(const SymbolType symb_type, string &lhs_field) const;
|
void get_base_name(const SymbolType symb_type, string &lhs_field) const;
|
||||||
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
|
virtual Statement *cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table);
|
||||||
};
|
};
|
||||||
|
|
||||||
class BasicOptionsStatement : public Statement
|
class BasicOptionsStatement : public Statement
|
||||||
|
|
Loading…
Reference in New Issue