v4 preprocessor: ignore Ctrl-M in macro-processor
git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1699 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
567a518b4a
commit
0eca1351d9
|
@ -72,7 +72,7 @@ int sigma_e = 0;
|
||||||
|
|
||||||
/* Rules for matching @line directives */
|
/* Rules for matching @line directives */
|
||||||
<*>^@line\ \" { line_caller = YYSTATE; BEGIN(LINE1); }
|
<*>^@line\ \" { line_caller = YYSTATE; BEGIN(LINE1); }
|
||||||
<LINE1>[^\"\n]* {
|
<LINE1>[^\"]* {
|
||||||
if (yylloc->begin.filename)
|
if (yylloc->begin.filename)
|
||||||
delete yylloc->begin.filename;
|
delete yylloc->begin.filename;
|
||||||
yylloc->begin.filename = yylloc->end.filename = new string(yytext);
|
yylloc->begin.filename = yylloc->end.filename = new string(yytext);
|
||||||
|
|
|
@ -62,11 +62,11 @@ typedef Macro::parser::token token;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Ignore @line declarations, replace them by a blank line */
|
/* Ignore @line declarations, replace them by a blank line */
|
||||||
<INITIAL>^@line[^\n]*\n { yylloc->lines(1); yylloc->step(); *yyout << endl; }
|
<INITIAL>^@line[^\r\n]*(\r)?\n { yylloc->lines(1); yylloc->step(); *yyout << endl; }
|
||||||
|
|
||||||
<INITIAL>^@include[ \t]+\" BEGIN(INCLUDE);
|
<INITIAL>^@include[ \t]+\" BEGIN(INCLUDE);
|
||||||
|
|
||||||
<INCLUDE>[^\"\n]* {
|
<INCLUDE>[^\"\r\n]* {
|
||||||
driver.ifs = new ifstream(yytext);
|
driver.ifs = new ifstream(yytext);
|
||||||
if (driver.ifs->fail())
|
if (driver.ifs->fail())
|
||||||
driver.error(*yylloc, "Could not open " + string(yytext));
|
driver.error(*yylloc, "Could not open " + string(yytext));
|
||||||
|
@ -88,13 +88,13 @@ typedef Macro::parser::token token;
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
<END_INCLUDE>\"[^\n]*\n {
|
<END_INCLUDE>\"[^\r\n]*(\r)?\n {
|
||||||
yylloc->lines(1);
|
yylloc->lines(1);
|
||||||
yylloc->step();
|
yylloc->step();
|
||||||
*yyout << "@line \"" << *yylloc->begin.filename << "\" "
|
*yyout << "@line \"" << *yylloc->begin.filename << "\" "
|
||||||
<< yylloc->begin.line << endl;
|
<< yylloc->begin.line << endl;
|
||||||
BEGIN(INITIAL);
|
BEGIN(INITIAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
<<EOF>> {
|
<<EOF>> {
|
||||||
/* We don't use yypop_buffer_state(), since it doesn't exist in
|
/* We don't use yypop_buffer_state(), since it doesn't exist in
|
||||||
|
@ -116,6 +116,10 @@ typedef Macro::parser::token token;
|
||||||
BEGIN(END_INCLUDE);
|
BEGIN(END_INCLUDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Ignore Ctrl-M */
|
||||||
|
<INITIAL>(\r)+ { yylloc->step(); }
|
||||||
|
|
||||||
|
/* Copy everything else to output */
|
||||||
<INITIAL>[\n]+ { yylloc->lines(yyleng); yylloc->step(); ECHO; }
|
<INITIAL>[\n]+ { yylloc->lines(yyleng); yylloc->step(); ECHO; }
|
||||||
<INITIAL>. { yylloc->step(); ECHO; }
|
<INITIAL>. { yylloc->step(); ECHO; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue