Commit c3d114a7 authored by sebastien's avatar sebastien
Browse files

v4 parser:

* declared ExprNode::cost as const
* Makefile: removed DynareBison.{cc,hh} from "clean" rule. Added a "distclean" rule for that purpose
* various minor changes


git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1179 ac1d8469-bf42-47a9-8791-bf33cf982152
parent ba57343a
......@@ -82,7 +82,7 @@ StochSimulStatement::writeOutput(ostream &output, const string &basename) const
}
RamseyPolicyStatement::RamseyPolicyStatement(const TmpSymbolTable &tmp_symbol_table_arg,
const OptionsList &options_list_arg) :
const OptionsList &options_list_arg) :
tmp_symbol_table(tmp_symbol_table_arg),
options_list(options_list_arg)
{
......
......@@ -46,7 +46,7 @@ ExprNode::precedence(const temporary_terms_type &temporary_terms) const
}
int
ExprNode::cost(temporary_terms_type &temporary_terms) const
ExprNode::cost(const temporary_terms_type &temporary_terms) const
{
// For a terminal node, the cost is null
return 0;
......@@ -318,7 +318,7 @@ UnaryOpNode::computeDerivative(int varID)
}
int
UnaryOpNode::cost(temporary_terms_type &temporary_terms) const
UnaryOpNode::cost(const temporary_terms_type &temporary_terms) const
{
// For a temporary term, the cost is null
temporary_terms_type::const_iterator it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
......@@ -617,7 +617,7 @@ BinaryOpNode::precedence(const temporary_terms_type &temporary_terms) const
}
int
BinaryOpNode::cost(temporary_terms_type &temporary_terms) const
BinaryOpNode::cost(const temporary_terms_type &temporary_terms) const
{
temporary_terms_type::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
// For a temporary term, the cost is null
......
......@@ -101,10 +101,14 @@ DynareBison.cc include/DynareBison.hh: DynareBison.yy include/ParsingDriver.hh
clean:
rm -f *.o *.P \
*~ include/*~ \
DynareBison.cc \
include/DynareBison.hh \
DynareBison.output \
DynareFlex.cc \
$(DYNARE_M) \
$(DYNARE_S)
distclean: clean
rm -f DynareBison.cc \
include/position.hh \
include/stack.hh \
include/location.hh \
include/DynareBison.hh
......@@ -237,7 +237,7 @@ ParsingDriver::init_val(string *name, ExpObj *rhs)
&& type != eExogenousDet)
error("initval/endval: " + *name + " should be an endogenous or exogenous variable");
init_values.push_back(pair<string, string>(*name, get_expression(rhs)));
init_values.push_back(make_pair(*name, get_expression(rhs)));
delete name;
delete rhs;
......@@ -434,7 +434,7 @@ ParsingDriver::add_period(string *p1, string *p2)
{
int p1_val = atoi(p1->c_str());
int p2_val = atoi(p2->c_str());
det_shocks_periods.push_back(pair<int, int>(p1_val, p2_val));
det_shocks_periods.push_back(make_pair(p1_val, p2_val));
delete p1;
delete p2;
}
......@@ -443,7 +443,7 @@ void
ParsingDriver::add_period(string *p1)
{
int p1_val = atoi(p1->c_str());
det_shocks_periods.push_back(pair<int, int>(p1_val, p1_val));
det_shocks_periods.push_back(make_pair(p1_val, p1_val));
delete p1;
}
......@@ -510,7 +510,7 @@ ParsingDriver::option_num(const string &name_option, string *opt1, string *opt2)
!= options_list.paired_num_options.end())
error("option " + name_option + " declared twice");
options_list.paired_num_options[name_option] = pair<string, string>(*opt1, *opt2);
options_list.paired_num_options[name_option] = make_pair(*opt1, *opt2);
delete opt1;
delete opt2;
}
......@@ -802,7 +802,7 @@ ParsingDriver::set_calib_var(string *name, string *weight, ExpObj *expression)
if (calib_var.find(*name) != calib_var.end())
error("calib_var: " + *name + " declared twice");
calib_var[*name] = pair<string, string>(*weight, get_expression(expression));
calib_var[*name] = make_pair(*weight, get_expression(expression));
delete name;
delete weight;
......@@ -827,7 +827,7 @@ ParsingDriver::set_calib_covar(string *name1, string *name2,
error("calib_var: pair of variables (" + *name1 + ", " + *name2
+ ") declared twice");
calib_covar[covar_key] = pair<string, string>(*weight, get_expression(expression));
calib_covar[covar_key] = make_pair(*weight, get_expression(expression));
delete name1;
delete name2;
......@@ -849,7 +849,7 @@ ParsingDriver::set_calib_ac(string *name, string *ar,
if (calib_ac.find(ac_key) != calib_ac.end())
error("calib_var: autocorr " + *name + "(" + *ar + ") declared twice");
calib_ac[ac_key] = pair<string, string>(*weight, get_expression(expression));
calib_ac[ac_key] = make_pair(*weight, get_expression(expression));
delete name;
delete ar;
......
......@@ -56,7 +56,7 @@ private:
const OptionsList options_list;
public:
RamseyPolicyStatement(const TmpSymbolTable &tmp_symbol_table_arg,
const OptionsList &options_list_arg);
const OptionsList &options_list_arg);
virtual void checkPass(ModFileStructure &mod_file_struct);
virtual void writeOutput(ostream &output, const string &basename) const;
};
......
......@@ -49,7 +49,7 @@ protected:
//! Cost of computing current node
/*! Nodes included in temporary_terms are considered having a null cost */
virtual int cost(temporary_terms_type &temporary_terms) const;
virtual int cost(const temporary_terms_type &temporary_terms) const;
public:
ExprNode(DataTree &datatree_arg);
......@@ -137,7 +137,7 @@ private:
const UnaryOpcode op_code;
virtual NodeID computeDerivative(int varID);
int cost(temporary_terms_type &temporary_terms) const;
int cost(const temporary_terms_type &temporary_terms) const;
public:
UnaryOpNode(DataTree &datatree_arg, UnaryOpcode op_code_arg, const NodeID arg_arg);
virtual void computeTemporaryTerms(map<NodeID, int> &reference_count, temporary_terms_type &temporary_terms) const;
......@@ -162,7 +162,7 @@ private:
const NodeID arg1, arg2;
const BinaryOpcode op_code;
virtual NodeID computeDerivative(int varID);
int cost(temporary_terms_type &temporary_terms) const;
int cost(const temporary_terms_type &temporary_terms) const;
public:
BinaryOpNode(DataTree &datatree_arg, const NodeID arg1_arg,
BinaryOpcode op_code_arg, const NodeID arg2_arg);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment