v4 preprocessor: fixed memory management error
git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1723 ac1d8469-bf42-47a9-8791-bf33cf982152issue#70
parent
818e571fdc
commit
62e216c3c0
|
@ -53,6 +53,11 @@ class ParsingDriver;
|
|||
%lex-param { ParsingDriver &driver }
|
||||
|
||||
%locations
|
||||
%initial-action
|
||||
{
|
||||
// Initialize the location filenames to NULL
|
||||
@$.begin.filename = @$.end.filename = NULL;
|
||||
}
|
||||
|
||||
%debug
|
||||
%error-verbose
|
||||
|
|
|
@ -401,6 +401,12 @@ int sigma_e = 0;
|
|||
/* Add the native statement */
|
||||
<NATIVE>.* { driver.add_native(yytext); BEGIN INITIAL; }
|
||||
|
||||
<*><<EOF>> {
|
||||
if (yylloc->begin.filename)
|
||||
delete yylloc->begin.filename;
|
||||
yyterminate();
|
||||
}
|
||||
|
||||
<*>. { driver.error(*yylloc, "character unrecognized by lexer"); }
|
||||
%%
|
||||
|
||||
|
|
|
@ -75,9 +75,6 @@ ParsingDriver::parse(istream &in)
|
|||
Dynare::parser parser(*this);
|
||||
parser.parse();
|
||||
|
||||
if (location.begin.filename)
|
||||
delete location.begin.filename;
|
||||
|
||||
delete lexer;
|
||||
delete tmp_symbol_table;
|
||||
|
||||
|
|
Loading…
Reference in New Issue