preprocessor: take care of exos in options statements
parent
7cc464b5ea
commit
1165c2608b
|
@ -3391,6 +3391,23 @@ OptionsStatement::OptionsStatement(const string &name_arg,
|
|||
{
|
||||
}
|
||||
|
||||
Statement *
|
||||
OptionsStatement::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 options 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 OptionsStatement(name, subsample_name, options_list);
|
||||
}
|
||||
|
||||
void
|
||||
OptionsStatement::writeOutput(ostream &output, const string &basename) const
|
||||
{
|
||||
|
@ -3419,6 +3436,23 @@ StdOptionsStatement::StdOptionsStatement(const string &name_arg,
|
|||
{
|
||||
}
|
||||
|
||||
Statement *
|
||||
StdOptionsStatement::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_options 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 StdOptionsStatement(name, subsample_name, options_list, *new_symbol_table);
|
||||
}
|
||||
|
||||
void
|
||||
StdOptionsStatement::writeOutput(ostream &output, const string &basename) const
|
||||
{
|
||||
|
@ -3474,6 +3508,24 @@ CorrOptionsStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsol
|
|||
}
|
||||
}
|
||||
|
||||
Statement *
|
||||
CorrOptionsStatement::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_options 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 CorrOptionsStatement(name, name1, subsample_name, options_list, *new_symbol_table);
|
||||
}
|
||||
|
||||
void
|
||||
CorrOptionsStatement::writeOutput(ostream &output, const string &basename) const
|
||||
{
|
||||
|
@ -3521,6 +3573,37 @@ OptionsEqualStatement::checkPass(ModFileStructure &mod_file_struct, WarningConso
|
|||
}
|
||||
}
|
||||
|
||||
Statement *
|
||||
OptionsEqualStatement::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 options 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 OptionsEqualStatement(to_declaration_type,
|
||||
to_name1,
|
||||
to_name2,
|
||||
to_subsample_name,
|
||||
from_declaration_type,
|
||||
from_name1,
|
||||
from_name2,
|
||||
from_subsample_name,
|
||||
*new_symbol_table);
|
||||
}
|
||||
|
||||
void
|
||||
OptionsEqualStatement::get_base_name(const SymbolType symb_type, string &lhs_field) const
|
||||
{
|
||||
|
|
|
@ -850,6 +850,7 @@ public:
|
|||
OptionsStatement(const string &name_arg, const string &subsample_name_arg, const OptionsList &options_list_arg);
|
||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||
virtual void writeCOutput(ostream &output, const string &basename);
|
||||
virtual Statement *cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table);
|
||||
};
|
||||
|
||||
class StdOptionsStatement : public BasicOptionsStatement
|
||||
|
@ -863,6 +864,7 @@ public:
|
|||
const SymbolTable &symbol_table_arg);
|
||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||
virtual void writeCOutput(ostream &output, const string &basename);
|
||||
virtual Statement *cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table);
|
||||
};
|
||||
|
||||
class CorrOptionsStatement : public BasicOptionsStatement
|
||||
|
@ -878,6 +880,7 @@ public:
|
|||
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||
virtual void writeCOutput(ostream &output, const string &basename);
|
||||
virtual Statement *cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table);
|
||||
};
|
||||
|
||||
class OptionsEqualStatement : public Statement
|
||||
|
@ -905,6 +908,7 @@ public:
|
|||
void get_base_name(const SymbolType symb_type, string &lhs_field) const;
|
||||
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||
virtual Statement *cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table);
|
||||
};
|
||||
|
||||
class ModelDiagnosticsStatement : public Statement
|
||||
|
|
Loading…
Reference in New Issue