Remove duplicate functions for setting current parser data tree to dynamic model

fix-tolerance-parameters
Sébastien Villemot 2022-03-30 17:27:08 +02:00
parent 40398425ae
commit ee14027e1b
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
3 changed files with 8 additions and 21 deletions

View File

@ -482,19 +482,19 @@ symbol_list_with_tex_and_partition : symbol_list_with_tex_and_partition symbol
rplot : RPLOT symbol_list ';' { driver.rplot($2); };
trend_var : TREND_VAR '(' GROWTH_FACTOR EQUAL { driver.begin_trend(); } hand_side ')' symbol_list_with_tex ';'
trend_var : TREND_VAR '(' GROWTH_FACTOR EQUAL { driver.begin_model(); } hand_side ')' symbol_list_with_tex ';'
{ driver.end_trend_var(false, $6, $8); }
;
log_trend_var : LOG_TREND_VAR '(' LOG_GROWTH_FACTOR EQUAL { driver.begin_trend(); } hand_side ')' symbol_list_with_tex ';'
log_trend_var : LOG_TREND_VAR '(' LOG_GROWTH_FACTOR EQUAL { driver.begin_model(); } hand_side ')' symbol_list_with_tex ';'
{ driver.end_trend_var(true, $6, $8); }
;
var : VAR symbol_list_with_tex_and_partition ';'
{ driver.var($2); }
| VAR '(' DEFLATOR EQUAL { driver.begin_trend(); } hand_side ')' symbol_list_with_tex_and_partition ';'
| VAR '(' DEFLATOR EQUAL { driver.begin_model(); } hand_side ')' symbol_list_with_tex_and_partition ';'
{ driver.end_nonstationary_var(false, $6, $8); }
| VAR '(' LOG_DEFLATOR EQUAL { driver.begin_trend(); } hand_side ')' symbol_list_with_tex_and_partition ';'
| VAR '(' LOG_DEFLATOR EQUAL { driver.begin_model(); } hand_side ')' symbol_list_with_tex_and_partition ';'
{ driver.end_nonstationary_var(true, $6, $8); }
;
@ -3458,7 +3458,7 @@ o_file : FILE EQUAL filename { driver.option_str("file", $3); };
o_pac_name : MODEL_NAME EQUAL symbol { driver.option_str("pac.model_name", $3); };
o_pac_aux_model_name : AUXILIARY_MODEL_NAME EQUAL symbol { driver.option_str("pac.aux_model_name", $3); };
o_pac_discount : DISCOUNT EQUAL symbol { driver.option_str("pac.discount", $3); };
o_pac_growth : GROWTH { driver.begin_pac_growth(); } EQUAL hand_side { driver.set_pac_growth($4); };
o_pac_growth : GROWTH { driver.begin_model(); } EQUAL hand_side { driver.set_pac_growth($4); };
o_pac_auxname : AUXNAME EQUAL symbol { driver.set_pac_auxname($3); };
o_pac_kind : KIND EQUAL pac_target_kind { driver.set_pac_kind($3); };
o_var_name : MODEL_NAME EQUAL symbol { driver.option_str("var.model_name", $3); };

View File

@ -265,12 +265,6 @@ ParsingDriver::set_planner_discount_latex_name(string tex_name)
planner_discount_latex_name = move(tex_name);
}
void
ParsingDriver::begin_trend()
{
set_current_data_tree(&mod_file->dynamic_model);
}
void
ParsingDriver::end_trend_var(bool log_trend, expr_t growth_factor, const vector<pair<string, string>> &symbol_list)
{
@ -2649,12 +2643,6 @@ ParsingDriver::add_pac_target_nonstationary(const string &model_name)
return data_tree->AddPacTargetNonstationary(model_name);
}
void
ParsingDriver::begin_pac_growth()
{
set_current_data_tree(&mod_file->dynamic_model);
}
void
ParsingDriver::begin_pac_model()
{

View File

@ -435,7 +435,9 @@ public:
void add_epilogue_variable(const string &varname);
//! Add equation in epilogue block
void add_epilogue_equal(const string &varname, expr_t expr);
//! Begin a model block
/* Begin a model or model_replace block, or an expression as an option value
of some statement.
Must be followed by a call to reset_data_tree(). */
void begin_model();
//! End a model or model_replace block, printing errors that were encountered in parsing
void end_model();
@ -747,7 +749,6 @@ public:
//! Adds a pac_target_nonstationary(model_name, discount, growth) node to model tree
expr_t add_pac_target_nonstationary(const string &model_name);
//! Creates pac_model statement
void begin_pac_growth();
void begin_pac_model();
void pac_model();
//! Adds growth for pac
@ -841,8 +842,6 @@ public:
void add_steady_state_model_equal(const string &varname, expr_t expr);
//! Add a multiple assignment equation in steady_state_model block
void add_steady_state_model_equal_multiple(const vector<string> &symbol_list, expr_t expr);
//! Switches datatree
void begin_trend();
//! Ends declaration of trend variable
void end_trend_var(bool log_trend, expr_t growth_factor, const vector<pair<string, string>> &symbol_list);
//! Ends declaration of nonstationary variable