v4 preprocessor:
* DynareBison.yy: added missing declaration of MODEL_INFO as a token * various cosmetic changes git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1995 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
f18859fef2
commit
2a7ee3d056
|
@ -68,23 +68,21 @@ CheckStatement::checkPass(ModFileStructure &mod_file_struct)
|
||||||
mod_file_struct.check_present = true;
|
mod_file_struct.check_present = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Model_InfoStatement::Model_InfoStatement(const OptionsList &options_list_arg) :
|
ModelInfoStatement::ModelInfoStatement(const OptionsList &options_list_arg) :
|
||||||
options_list(options_list_arg)
|
options_list(options_list_arg)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Model_InfoStatement::checkPass(ModFileStructure &mod_file_struct)
|
void ModelInfoStatement::checkPass(ModFileStructure &mod_file_struct)
|
||||||
{
|
{
|
||||||
//mod_file_struct.model_info_present = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Model_InfoStatement::writeOutput(ostream &output, const string &basename) const
|
void ModelInfoStatement::writeOutput(ostream &output, const string &basename) const
|
||||||
{
|
{
|
||||||
options_list.writeOutput(output);
|
options_list.writeOutput(output);
|
||||||
output << "model_info();\n";
|
output << "model_info();\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SimulStatement::SimulStatement(const OptionsList &options_list_arg) :
|
SimulStatement::SimulStatement(const OptionsList &options_list_arg) :
|
||||||
options_list(options_list_arg)
|
options_list(options_list_arg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,7 +98,7 @@ class ParsingDriver;
|
||||||
%token KALMAN_ALGO KALMAN_TOL
|
%token KALMAN_ALGO KALMAN_TOL
|
||||||
%token LAPLACE LCC_COMPILER LIK_ALGO LIK_INIT LINEAR LOAD_MH_FILE LOGLINEAR LU MARKOWITZ MAX
|
%token LAPLACE LCC_COMPILER LIK_ALGO LIK_INIT LINEAR LOAD_MH_FILE LOGLINEAR LU MARKOWITZ MAX
|
||||||
%token METHOD MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER MIN
|
%token METHOD MH_DROP MH_INIT_SCALE MH_JSCALE MH_MODE MH_NBLOCKS MH_REPLIC MH_RECOVER MIN
|
||||||
%token MODE_CHECK MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MSHOCKS
|
%token MODE_CHECK MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS
|
||||||
%token MODEL_COMPARISON_APPROXIMATION MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER
|
%token MODEL_COMPARISON_APPROXIMATION MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER
|
||||||
%token <string_val> NAME
|
%token <string_val> NAME
|
||||||
%token NO_COMPILER NOBS NOCONSTANT NOCORR NODIAGNOSTIC NOFUNCTIONS
|
%token NO_COMPILER NOBS NOCONSTANT NOCORR NODIAGNOSTIC NOFUNCTIONS
|
||||||
|
@ -615,7 +615,7 @@ check_options : o_solve_algo;
|
||||||
|
|
||||||
model_info : MODEL_INFO ';'
|
model_info : MODEL_INFO ';'
|
||||||
{ driver.model_info(); }
|
{ driver.model_info(); }
|
||||||
;
|
;
|
||||||
|
|
||||||
simul : SIMUL ';'
|
simul : SIMUL ';'
|
||||||
{ driver.simulate(); }
|
{ driver.simulate(); }
|
||||||
|
|
|
@ -86,7 +86,6 @@ main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the rest
|
// Do the rest
|
||||||
|
|
||||||
main2(macro_output, basename, debug, clear_all);
|
main2(macro_output, basename, debug, clear_all);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -28,10 +28,10 @@ void
|
||||||
main2(stringstream &in, string &basename, bool debug, bool clear_all)
|
main2(stringstream &in, string &basename, bool debug, bool clear_all)
|
||||||
{
|
{
|
||||||
ParsingDriver p;
|
ParsingDriver p;
|
||||||
//cout << "OK\n";
|
|
||||||
// Do parsing and construct internal representation of mod file
|
// Do parsing and construct internal representation of mod file
|
||||||
ModFile *mod_file = p.parse(in, debug);
|
ModFile *mod_file = p.parse(in, debug);
|
||||||
//cout << "OK1\n";
|
|
||||||
// Run checking pass
|
// Run checking pass
|
||||||
mod_file->checkPass();
|
mod_file->checkPass();
|
||||||
|
|
||||||
|
|
|
@ -729,15 +729,13 @@ ParsingDriver::simul()
|
||||||
options_list.clear();
|
options_list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ParsingDriver::model_info()
|
ParsingDriver::model_info()
|
||||||
{
|
{
|
||||||
mod_file->addStatement(new Model_InfoStatement(options_list));
|
mod_file->addStatement(new ModelInfoStatement(options_list));
|
||||||
options_list.clear();
|
options_list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ParsingDriver::check()
|
ParsingDriver::check()
|
||||||
{
|
{
|
||||||
|
|
|
@ -76,12 +76,12 @@ public:
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Model_InfoStatement : public Statement
|
class ModelInfoStatement : public Statement
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
const OptionsList options_list;
|
const OptionsList options_list;
|
||||||
public:
|
public:
|
||||||
Model_InfoStatement(const OptionsList &options_list_arg);
|
ModelInfoStatement(const OptionsList &options_list_arg);
|
||||||
virtual void checkPass(ModFileStructure &mod_file_struct);
|
virtual void checkPass(ModFileStructure &mod_file_struct);
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,7 +54,7 @@ using namespace std;
|
||||||
class DynareFlex : public DynareFlexLexer
|
class DynareFlex : public DynareFlexLexer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DynareFlex(std::istream* in = 0, ostream* out = 0);
|
DynareFlex(istream* in = 0, ostream* out = 0);
|
||||||
|
|
||||||
//! The main lexing function
|
//! The main lexing function
|
||||||
Dynare::parser::token_type lex(Dynare::parser::semantic_type *yylval,
|
Dynare::parser::token_type lex(Dynare::parser::semantic_type *yylval,
|
||||||
|
@ -146,7 +146,7 @@ public:
|
||||||
|
|
||||||
//! Starts parsing, and constructs the MOD file representation
|
//! Starts parsing, and constructs the MOD file representation
|
||||||
/*! The returned pointer should be deleted after use */
|
/*! The returned pointer should be deleted after use */
|
||||||
ModFile *parse(std::istream &in, bool debug);
|
ModFile *parse(istream &in, bool debug);
|
||||||
|
|
||||||
//! Reference to the lexer
|
//! Reference to the lexer
|
||||||
class DynareFlex *lexer;
|
class DynareFlex *lexer;
|
||||||
|
|
|
@ -53,12 +53,12 @@ private:
|
||||||
class ScanContext
|
class ScanContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::istream *input;
|
istream *input;
|
||||||
struct yy_buffer_state *buffer;
|
struct yy_buffer_state *buffer;
|
||||||
const Macro::parser::location_type yylloc;
|
const Macro::parser::location_type yylloc;
|
||||||
const string for_body;
|
const string for_body;
|
||||||
const Macro::parser::location_type for_body_loc;
|
const Macro::parser::location_type for_body_loc;
|
||||||
ScanContext(std::istream *input_arg, struct yy_buffer_state *buffer_arg,
|
ScanContext(istream *input_arg, struct yy_buffer_state *buffer_arg,
|
||||||
Macro::parser::location_type &yylloc_arg, const string &for_body_arg,
|
Macro::parser::location_type &yylloc_arg, const string &for_body_arg,
|
||||||
Macro::parser::location_type &for_body_loc_arg) :
|
Macro::parser::location_type &for_body_loc_arg) :
|
||||||
input(input_arg), buffer(buffer_arg), yylloc(yylloc_arg), for_body(for_body_arg),
|
input(input_arg), buffer(buffer_arg), yylloc(yylloc_arg), for_body(for_body_arg),
|
||||||
|
@ -70,7 +70,7 @@ private:
|
||||||
|
|
||||||
//! Input stream used for initialization of current scanning context
|
//! Input stream used for initialization of current scanning context
|
||||||
/*! Kept for deletion at end of current scanning buffer */
|
/*! Kept for deletion at end of current scanning buffer */
|
||||||
std::istream *input;
|
istream *input;
|
||||||
|
|
||||||
//! If current context is the body of a loop, contains the string of the loop body. Empty otherwise.
|
//! If current context is the body of a loop, contains the string of the loop body. Empty otherwise.
|
||||||
string for_body;
|
string for_body;
|
||||||
|
@ -125,7 +125,7 @@ private:
|
||||||
and initialise a new scanning context with the loop body */
|
and initialise a new scanning context with the loop body */
|
||||||
bool iter_loop(MacroDriver &driver, Macro::parser::location_type *yylloc);
|
bool iter_loop(MacroDriver &driver, Macro::parser::location_type *yylloc);
|
||||||
public:
|
public:
|
||||||
MacroFlex(std::istream* in = 0, ostream* out = 0);
|
MacroFlex(istream* in = 0, ostream* out = 0);
|
||||||
|
|
||||||
//! The main lexing function
|
//! The main lexing function
|
||||||
Macro::parser::token_type lex(Macro::parser::semantic_type *yylval,
|
Macro::parser::token_type lex(Macro::parser::semantic_type *yylval,
|
||||||
|
|
Loading…
Reference in New Issue