Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dóra Kocsis
dynare
Commits
ac2cd6f3
Commit
ac2cd6f3
authored
Nov 15, 2013
by
Houtan Bastani
Browse files
preprocessor: support long name for exogenous, #478
parent
0f2bb4c5
Changes
5
Hide whitespace changes
Inline
Side-by-side
doc/dynare.texi
View file @
ac2cd6f3
...
...
@@ -1043,7 +1043,7 @@ var c $C$ [long_name=`Consumption'];
@end deffn
@deffn Command varexo @var{VARIABLE_NAME} [$@var{LATEX_NAME}$]@dots{};
@deffn Command varexo @var{VARIABLE_NAME} [$@var{LATEX_NAME}$
[(long_name=@var{QUOTED_STRING})]
]@dots{};
@descriptionhead
...
...
@@ -1057,6 +1057,12 @@ shocks to her model.
@code{varexo} commands can appear several times in the file and Dynare
will concatenate them.
@optionshead
@table @code
@item long_name = @var{QUOTED_STRING}
Like @ref{long_name} but value stored in @code{M_.exo_names_long}.
@end table
@examplehead
@example
...
...
@@ -1065,7 +1071,7 @@ varexo m gov;
@end deffn
@deffn Command varexo_det @var{VARIABLE_NAME} [$@var{LATEX_NAME}$]@dots{};
@deffn Command varexo_det @var{VARIABLE_NAME} [$@var{LATEX_NAME}$
[(long_name=@var{QUOTED_STRING})]
]@dots{};
@descriptionhead
...
...
@@ -1085,6 +1091,12 @@ conditions and future information.
@code{varexo_det} commands can appear several times in the file and
Dynare will concatenate them.
@optionshead
@table @code
@item long_name = @var{QUOTED_STRING}
Like @ref{long_name} but value stored in @code{M_.exo_det_names_long}.
@end table
@examplehead
@example
...
...
preprocessor/DynareBison.yy
View file @
ac2cd6f3
...
...
@@ -390,6 +390,12 @@ varexo_list : varexo_list symbol
{ driver.declare_exogenous($3, $4); }
| symbol TEX_NAME
{ driver.declare_exogenous($1, $2); }
| varexo_list symbol TEX_NAME named_var
{ driver.declare_exogenous($2, $3, $4); }
| varexo_list COMMA symbol TEX_NAME named_var
{ driver.declare_exogenous($3, $4, $5); }
| symbol TEX_NAME named_var
{ driver.declare_exogenous($1, $2, $3); }
;
varexo_det_list : varexo_det_list symbol
...
...
@@ -404,6 +410,12 @@ varexo_det_list : varexo_det_list symbol
{ driver.declare_exogenous_det($3, $4); }
| symbol TEX_NAME
{ driver.declare_exogenous_det($1, $2); }
| varexo_det_list symbol TEX_NAME named_var
{ driver.declare_exogenous_det($2, $3, $4); }
| varexo_det_list COMMA symbol TEX_NAME named_var
{ driver.declare_exogenous_det($3, $4, $5); }
| symbol TEX_NAME named_var
{ driver.declare_exogenous_det($1, $2, $3); }
;
parameter_list : parameter_list symbol
...
...
preprocessor/ParsingDriver.cc
View file @
ac2cd6f3
...
...
@@ -164,21 +164,25 @@ ParsingDriver::declare_endogenous(string *name, string *tex_name, string *long_n
}
void
ParsingDriver
::
declare_exogenous
(
string
*
name
,
string
*
tex_name
)
ParsingDriver
::
declare_exogenous
(
string
*
name
,
string
*
tex_name
,
string
*
long_name
)
{
declare_symbol
(
name
,
eExogenous
,
tex_name
,
NULL
);
declare_symbol
(
name
,
eExogenous
,
tex_name
,
long_name
);
delete
name
;
if
(
tex_name
!=
NULL
)
delete
tex_name
;
if
(
long_name
!=
NULL
)
delete
long_name
;
}
void
ParsingDriver
::
declare_exogenous_det
(
string
*
name
,
string
*
tex_name
)
ParsingDriver
::
declare_exogenous_det
(
string
*
name
,
string
*
tex_name
,
string
*
long_name
)
{
declare_symbol
(
name
,
eExogenousDet
,
tex_name
,
NULL
);
declare_symbol
(
name
,
eExogenousDet
,
tex_name
,
long_name
);
delete
name
;
if
(
tex_name
!=
NULL
)
delete
tex_name
;
if
(
long_name
!=
NULL
)
delete
long_name
;
}
void
...
...
preprocessor/ParsingDriver.hh
View file @
ac2cd6f3
...
...
@@ -260,9 +260,9 @@ public:
//! Declares an endogenous variable
void
declare_endogenous
(
string
*
name
,
string
*
tex_name
=
NULL
,
string
*
long_name
=
NULL
);
//! Declares an exogenous variable
void
declare_exogenous
(
string
*
name
,
string
*
tex_name
=
NULL
);
void
declare_exogenous
(
string
*
name
,
string
*
tex_name
=
NULL
,
string
*
long_name
=
NULL
);
//! Declares an exogenous deterministic variable
void
declare_exogenous_det
(
string
*
name
,
string
*
tex_name
=
NULL
);
void
declare_exogenous_det
(
string
*
name
,
string
*
tex_name
=
NULL
,
string
*
long_name
=
NULL
);
//! Declares a parameter
void
declare_parameter
(
string
*
name
,
string
*
tex_name
=
NULL
);
//! Declares a statement local variable
...
...
preprocessor/SymbolTable.cc
View file @
ac2cd6f3
...
...
@@ -175,20 +175,24 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException)
{
output
<<
"M_.exo_names = '"
<<
getName
(
exo_ids
[
0
])
<<
"';"
<<
endl
;
output
<<
"M_.exo_names_tex = '"
<<
getTeXName
(
exo_ids
[
0
])
<<
"';"
<<
endl
;
output
<<
"M_.exo_names_long = '"
<<
getLongName
(
exo_ids
[
0
])
<<
"';"
<<
endl
;
for
(
int
id
=
1
;
id
<
exo_nbr
();
id
++
)
{
output
<<
"M_.exo_names = char(M_.exo_names, '"
<<
getName
(
exo_ids
[
id
])
<<
"');"
<<
endl
<<
"M_.exo_names_tex = char(M_.exo_names_tex, '"
<<
getTeXName
(
exo_ids
[
id
])
<<
"');"
<<
endl
;
<<
"M_.exo_names_tex = char(M_.exo_names_tex, '"
<<
getTeXName
(
exo_ids
[
id
])
<<
"');"
<<
endl
<<
"M_.exo_names_long = char(M_.exo_names_long, '"
<<
getLongName
(
exo_ids
[
id
])
<<
"');"
<<
endl
;
}
}
if
(
exo_det_nbr
()
>
0
)
{
output
<<
"M_.exo_det_names = '"
<<
getName
(
exo_det_ids
[
0
])
<<
"';"
<<
endl
;
output
<<
"M_.exo_det_names_tex = '"
<<
getTeXName
(
exo_det_ids
[
0
])
<<
"';"
<<
endl
;
output
<<
"M_.exo_det_names_long = '"
<<
getLongName
(
exo_det_ids
[
0
])
<<
"';"
<<
endl
;
for
(
int
id
=
1
;
id
<
exo_det_nbr
();
id
++
)
{
output
<<
"M_.exo_det_names = char(M_.exo_det_names, '"
<<
getName
(
exo_det_ids
[
id
])
<<
"');"
<<
endl
<<
"M_.exo_det_names_tex = char(M_.exo_det_names_tex, '"
<<
getTeXName
(
exo_det_ids
[
id
])
<<
"');"
<<
endl
;
<<
"M_.exo_det_names_tex = char(M_.exo_det_names_tex, '"
<<
getTeXName
(
exo_det_ids
[
id
])
<<
"');"
<<
endl
<<
"M_.exo_det_names_long = char(M_.exo_det_names_long, '"
<<
getLongName
(
exo_det_ids
[
id
])
<<
"');"
<<
endl
;
}
}
if
(
endo_nbr
()
>
0
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment