Commit 856c0b53 authored by sebastien's avatar sebastien
Browse files

trunk: fixed preprocessor crash when there is an unexpected end of file


git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@2234 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 9cb1e4c0
......@@ -407,11 +407,7 @@ 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();
}
<*><<EOF>> { yyterminate(); }
<*>. { driver.error(*yylloc, "character unrecognized by lexer"); }
%%
......
......@@ -71,6 +71,12 @@ ParsingDriver::parse(istream &in, bool debug)
delete lexer;
/* Deleting filename in DynareFlex::yyterminate() is prematurate,
because if there is an unexpected end of file, the call to
ParsingDriver::error() needs filename */
if (location.begin.filename)
delete location.begin.filename;
return mod_file;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment