Fix compatibility with Flex 2.6.

In Flex 2.6, the C++ scanner changed. yyout is now a reference (and no
longer a pointer).
issue#70
Sébastien Villemot 2016-03-14 16:28:24 +01:00
parent d38d6e26b4
commit 42d166e272
2 changed files with 25 additions and 4 deletions

View File

@ -238,7 +238,13 @@ DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2
unput('d');
free( yycopy );
}
<DYNARE_STATEMENT>${DATE} { yylloc->step(); *yyout << yytext + 1; }
<DYNARE_STATEMENT>${DATE} { yylloc->step();
#if (YY_FLEX_MAJOR_VERSION > 2) || (YY_FLEX_MAJOR_VERSION == 2 && YY_FLEX_MINOR_VERSION >= 6)
yyout << yytext + 1;
#else
*yyout << yytext + 1;
#endif
}
<DYNARE_STATEMENT>dates {dates_parens_nb=0; BEGIN DATES_STATEMENT; yylval->string_val = new string("dates");}
<DYNARE_STATEMENT>file {return token::FILE;}
<DYNARE_STATEMENT>datafile {return token::DATAFILE;}

View File

@ -188,7 +188,11 @@ CONT \\\\
}
else
{
#if (YY_FLEX_MAJOR_VERSION > 2) || (YY_FLEX_MAJOR_VERSION == 2 && YY_FLEX_MINOR_VERSION >= 6)
yyout << endl;
#else
*yyout << endl;
#endif
BEGIN(INITIAL);
}
return token::EOL;
@ -383,7 +387,13 @@ CONT \\\\
}
/* We don't use echo, because under Cygwin it will add an extra \r */
<INITIAL>{EOL} { yylloc->lines(1); yylloc->step(); *yyout << endl; }
<INITIAL>{EOL} { yylloc->lines(1); yylloc->step();
#if (YY_FLEX_MAJOR_VERSION > 2) || (YY_FLEX_MAJOR_VERSION == 2 && YY_FLEX_MINOR_VERSION >= 6)
yyout << endl;
#else
*yyout << endl;
#endif
}
/* Copy everything else to output */
<INITIAL>. { yylloc->step(); ECHO; }
@ -401,8 +411,13 @@ void
MacroFlex::output_line(Macro::parser::location_type *yylloc) const
{
if (!no_line_macro)
*yyout << endl << "@#line \"" << *yylloc->begin.filename << "\" "
<< yylloc->begin.line << endl;
#if (YY_FLEX_MAJOR_VERSION > 2) || (YY_FLEX_MAJOR_VERSION == 2 && YY_FLEX_MINOR_VERSION >= 6)
const_cast<ostream&>(yyout)
#else
*yyout
#endif
<< endl << "@#line \"" << *yylloc->begin.filename << "\" "
<< yylloc->begin.line << endl;
}
void