v4 preprocessor: another minor tweak

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1752 ac1d8469-bf42-47a9-8791-bf33cf982152
issue#70
sebastien 2008-03-28 17:38:10 +00:00
parent 76da313b98
commit 9276fcb8b6
6 changed files with 12 additions and 19 deletions

View File

@ -74,10 +74,10 @@ main(int argc, char** argv)
basename.erase(basename.size() - 4, 4);
// Do macro processing
MacroDriver m(debug);
MacroDriver m;
stringstream macro_output;
m.parse(argv[1], macro_output);
m.parse(argv[1], macro_output, debug);
if (save_macro)
{
ofstream macro_output_file((basename + "-macroexp.mod").c_str());

View File

@ -27,10 +27,10 @@ using namespace std;
void
main2(stringstream &in, string &basename, bool debug, bool clear_all)
{
ParsingDriver p(debug);
ParsingDriver p;
// Do parsing and construct internal representation of mod file
ModFile *mod_file = p.parse(in);
ModFile *mod_file = p.parse(in, debug);
// Run checking pass
mod_file->checkPass();

View File

@ -23,7 +23,7 @@
#include "ParsingDriver.hh"
#include "Statement.hh"
ParsingDriver::ParsingDriver(bool debug_arg) : debug(debug_arg)
ParsingDriver::ParsingDriver()
{
}
@ -61,7 +61,7 @@ ParsingDriver::reset_data_tree()
}
ModFile *
ParsingDriver::parse(istream &in)
ParsingDriver::parse(istream &in, bool debug)
{
mod_file = new ModFile();

View File

@ -137,18 +137,15 @@ private:
//! The mod file representation constructed by this ParsingDriver
ModFile *mod_file;
//! Output debugging info during scanning and parsing ?
const bool debug;
public:
//! Constructor
ParsingDriver(bool debug_arg);
ParsingDriver();
//! Destructor
virtual ~ParsingDriver();
//! Starts parsing, and constructs the MOD file representation
/*! The returned pointer should be deleted after use */
ModFile *parse(istream &in);
ModFile *parse(istream &in, bool debug);
//! Reference to the lexer
class DynareFlex *lexer;

View File

@ -22,7 +22,7 @@
#include "MacroDriver.hh"
MacroDriver::MacroDriver(bool debug_arg) : debug(debug_arg)
MacroDriver::MacroDriver()
{
}
@ -34,10 +34,9 @@ MacroDriver::~MacroDriver()
}
void
MacroDriver::parse(const string &f, ostream &out)
MacroDriver::parse(const string &f, ostream &out, bool debug)
{
file = f;
out_stream = &out;
ifstream in(f.c_str(), ios::binary);
if (in.fail())

View File

@ -138,9 +138,6 @@ class MacroDriver
{
friend class MacroValue;
private:
//! Output debugging info during scanning and parsing ?
const bool debug;
//! Stores all created macro values
set<const MacroValue *> values;
@ -160,12 +157,12 @@ public:
};
//! Constructor
MacroDriver(bool debug_arg);
MacroDriver();
//! Destructor
virtual ~MacroDriver();
//! Starts parsing a file, returns output in out
void parse(const string &f, ostream &out);
void parse(const string &f, ostream &out, bool debug);
//! Name of main file being parsed
string file;