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-bf33cf982152
issue#70
sebastien 2008-08-25 16:45:39 +00:00
parent 0e9ab2ebf4
commit bc2348f0b7
8 changed files with 16 additions and 21 deletions

View File

@ -68,23 +68,21 @@ CheckStatement::checkPass(ModFileStructure &mod_file_struct)
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)
{
}
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);
output << "model_info();\n";
}
SimulStatement::SimulStatement(const OptionsList &options_list_arg) :
options_list(options_list_arg)
{

View File

@ -98,7 +98,7 @@ class ParsingDriver;
%token KALMAN_ALGO KALMAN_TOL
%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 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 <string_val> NAME
%token NO_COMPILER NOBS NOCONSTANT NOCORR NODIAGNOSTIC NOFUNCTIONS
@ -615,7 +615,7 @@ check_options : o_solve_algo;
model_info : MODEL_INFO ';'
{ driver.model_info(); }
;
;
simul : SIMUL ';'
{ driver.simulate(); }

View File

@ -86,7 +86,6 @@ main(int argc, char** argv)
}
// Do the rest
main2(macro_output, basename, debug, clear_all);
return 0;

View File

@ -28,10 +28,10 @@ void
main2(stringstream &in, string &basename, bool debug, bool clear_all)
{
ParsingDriver p;
//cout << "OK\n";
// Do parsing and construct internal representation of mod file
ModFile *mod_file = p.parse(in, debug);
//cout << "OK1\n";
// Run checking pass
mod_file->checkPass();

View File

@ -729,15 +729,13 @@ ParsingDriver::simul()
options_list.clear();
}
void
ParsingDriver::model_info()
{
mod_file->addStatement(new Model_InfoStatement(options_list));
mod_file->addStatement(new ModelInfoStatement(options_list));
options_list.clear();
}
void
ParsingDriver::check()
{

View File

@ -76,12 +76,12 @@ public:
virtual void writeOutput(ostream &output, const string &basename) const;
};
class Model_InfoStatement : public Statement
class ModelInfoStatement : public Statement
{
private:
const OptionsList options_list;
public:
Model_InfoStatement(const OptionsList &options_list_arg);
ModelInfoStatement(const OptionsList &options_list_arg);
virtual void checkPass(ModFileStructure &mod_file_struct);
virtual void writeOutput(ostream &output, const string &basename) const;
};

View File

@ -54,7 +54,7 @@ using namespace std;
class DynareFlex : public DynareFlexLexer
{
public:
DynareFlex(std::istream* in = 0, ostream* out = 0);
DynareFlex(istream* in = 0, ostream* out = 0);
//! The main lexing function
Dynare::parser::token_type lex(Dynare::parser::semantic_type *yylval,
@ -146,7 +146,7 @@ public:
//! Starts parsing, and constructs the MOD file representation
/*! 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
class DynareFlex *lexer;

View File

@ -53,12 +53,12 @@ private:
class ScanContext
{
public:
std::istream *input;
istream *input;
struct yy_buffer_state *buffer;
const Macro::parser::location_type yylloc;
const string for_body;
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 &for_body_loc_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
/*! 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.
string for_body;
@ -125,7 +125,7 @@ private:
and initialise a new scanning context with the loop body */
bool iter_loop(MacroDriver &driver, Macro::parser::location_type *yylloc);
public:
MacroFlex(std::istream* in = 0, ostream* out = 0);
MacroFlex(istream* in = 0, ostream* out = 0);
//! The main lexing function
Macro::parser::token_type lex(Macro::parser::semantic_type *yylval,