Skip to content

Commit

Permalink
FORTRAN determination string in preprocessing
Browse files Browse the repository at this point in the history
In FORTRAN a string can start (and end) either with a double quote or a single quote. The later was not considered in the preprocessing resulting in unwanted substitutions in strings.
  • Loading branch information
albert-github committed Aug 28, 2016
1 parent cd6a8d3 commit 4a7673f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/pre.l
Expand Up @@ -1737,6 +1737,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
%x SkipString
%x CopyLine
%x CopyString
%x CopyStringFtn
%x Include
%x IncludeID
%x EndImport
Expand Down Expand Up @@ -1850,6 +1851,11 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
outputChar(*yytext);
BEGIN( CopyString );
}
<CopyLine>\' {
if (getLanguageFromFileName(g_yyFileName)!=SrcLangExt_Fortran) REJECT;
outputChar(*yytext);
BEGIN( CopyStringFtn );
}
<CopyString>[^\"\\\r\n]+ {
outputArray(yytext,(int)yyleng);
}
Expand All @@ -1860,6 +1866,16 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
outputChar(*yytext);
BEGIN( CopyLine );
}
<CopyStringFtn>[^\'\\\r\n]+ {
outputArray(yytext,(int)yyleng);
}
<CopyStringFtn>\\. {
outputArray(yytext,(int)yyleng);
}
<CopyStringFtn>\' {
outputChar(*yytext);
BEGIN( CopyLine );
}
<CopyLine>{ID}/{BN}{0,80}"(" {
g_expectGuard = FALSE;
Define *def=0;
Expand Down

0 comments on commit 4a7673f

Please sign in to comment.