Merge branch 'master' into sim1-with-variable-dimension
commit
4d95aa8d42
|
@ -18,43 +18,19 @@
|
|||
*/
|
||||
|
||||
%skeleton "lalr1.cc"
|
||||
%require "2.3"
|
||||
%require "2.4"
|
||||
%defines
|
||||
|
||||
/* Prologue:
|
||||
In Bison <= 2.3, it is inserted in both the .cc and .hh files.
|
||||
In Bison >= 2.3a, it is inserted only in the .cc file.
|
||||
Since Bison 2.4, the new %code directives provide a cleaner way of dealing
|
||||
with the prologue.
|
||||
*/
|
||||
%{
|
||||
using namespace std;
|
||||
|
||||
%code top {
|
||||
class ParsingDriver;
|
||||
}
|
||||
|
||||
%code requires {
|
||||
#include "ExprNode.hh"
|
||||
#include "CodeInterpreter.hh"
|
||||
}
|
||||
|
||||
/* Little hack: we redefine the macro which computes the locations, because
|
||||
we need to access the location from within the parsing driver for error
|
||||
and warning messages. */
|
||||
#define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||
do { \
|
||||
if (N) \
|
||||
{ \
|
||||
(Current).begin = (Rhs)[1].begin; \
|
||||
(Current).end = (Rhs)[N].end; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(Current).begin = (Current).end = (Rhs)[0].end; \
|
||||
} \
|
||||
driver.location = (Current); \
|
||||
} while(false)
|
||||
|
||||
%}
|
||||
|
||||
%name-prefix="Dynare"
|
||||
%name-prefix "Dynare"
|
||||
|
||||
%parse-param { ParsingDriver &driver }
|
||||
%lex-param { ParsingDriver &driver }
|
||||
|
@ -79,7 +55,24 @@ class ParsingDriver;
|
|||
PriorDistributions prior_distributions_val;
|
||||
};
|
||||
|
||||
%{
|
||||
%code {
|
||||
/* Little hack: we redefine the macro which computes the locations, because
|
||||
we need to access the location from within the parsing driver for error
|
||||
and warning messages. */
|
||||
#define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||
do { \
|
||||
if (N) \
|
||||
{ \
|
||||
(Current).begin = YYRHSLOC(Rhs, 1).begin; \
|
||||
(Current).end = YYRHSLOC(Rhs, N).end; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(Current).begin = (Current).end = YYRHSLOC(Rhs, 0).end; \
|
||||
} \
|
||||
driver.location = (Current); \
|
||||
} while(false)
|
||||
|
||||
#include "ParsingDriver.hh"
|
||||
|
||||
/* this "connects" the bison parser in the driver to the flex scanner class
|
||||
|
@ -87,7 +80,7 @@ class ParsingDriver;
|
|||
* current lexer object of the driver context. */
|
||||
#undef yylex
|
||||
#define yylex driver.lexer->lex
|
||||
%}
|
||||
}
|
||||
|
||||
%token AIM_SOLVER ANALYTIC_DERIVATION AR AUTOCORR
|
||||
%token BAYESIAN_IRF BETA_PDF BLOCK USE_CALIBRATION
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
#ifndef _EXPR_NODE_HH
|
||||
#define _EXPR_NODE_HH
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "SymbolTable.hh"
|
||||
#include "CodeInterpreter.hh"
|
||||
#include "ExternalFunctionsTable.hh"
|
||||
|
|
|
@ -18,24 +18,14 @@
|
|||
*/
|
||||
|
||||
%skeleton "lalr1.cc"
|
||||
%require "2.3"
|
||||
%require "2.4"
|
||||
%defines
|
||||
|
||||
/* Prologue:
|
||||
In Bison <= 2.3, it is inserted in both the .cc and .hh files.
|
||||
In Bison >= 2.3a, it is inserted only in the .cc file.
|
||||
Since Bison 2.4, the new %code directives provide a cleaner way of dealing
|
||||
with the prologue.
|
||||
*/
|
||||
%{
|
||||
using namespace std;
|
||||
|
||||
#include "MacroValue.hh"
|
||||
|
||||
%code top {
|
||||
class MacroDriver;
|
||||
%}
|
||||
}
|
||||
|
||||
%name-prefix="Macro"
|
||||
%name-prefix "Macro"
|
||||
|
||||
%parse-param { MacroDriver &driver }
|
||||
%parse-param { ostream &out }
|
||||
|
@ -51,6 +41,10 @@ class MacroDriver;
|
|||
%debug
|
||||
%error-verbose
|
||||
|
||||
%code requires {
|
||||
#include "MacroValue.hh"
|
||||
}
|
||||
|
||||
%union
|
||||
{
|
||||
string *string_val;
|
||||
|
@ -58,7 +52,7 @@ class MacroDriver;
|
|||
const MacroValue *mv;
|
||||
};
|
||||
|
||||
%{
|
||||
%code {
|
||||
#include <cstdlib> // Pour atoi()
|
||||
#include "MacroDriver.hh"
|
||||
|
||||
|
@ -77,7 +71,7 @@ class MacroDriver;
|
|||
driver.error(loc, e.message); \
|
||||
}
|
||||
|
||||
%}
|
||||
}
|
||||
|
||||
%token DEFINE LINE FOR IN IF ELSE ENDIF ECHO_DIR ERROR IFDEF IFNDEF
|
||||
%token LPAREN RPAREN LBRACKET RBRACKET EQUAL EOL LENGTH
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
#ifndef _MACRO_VALUE_HH
|
||||
#define _MACRO_VALUE_HH
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class MacroDriver;
|
||||
|
||||
//! Base class for representing values in macro language
|
||||
|
|
Loading…
Reference in New Issue