v4 preprocessor: fixed memory management error

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1723 ac1d8469-bf42-47a9-8791-bf33cf982152
issue#70
sebastien 2008-02-29 16:20:19 +00:00
parent 818e571fdc
commit 62e216c3c0
3 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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"); }
%%

View File

@ -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;