From 4a7673fed2f28a24e0c7e8bb94621b0e14ac9ed5 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sun, 28 Aug 2016 11:25:52 +0200 Subject: FORTRAN determination string in preprocessing 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. --- src/pre.l | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/pre.l b/src/pre.l index 13ca91f..e89a61c 100644 --- a/src/pre.l +++ b/src/pre.l @@ -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 @@ -1850,6 +1851,11 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) outputChar(*yytext); BEGIN( CopyString ); } +\' { + if (getLanguageFromFileName(g_yyFileName)!=SrcLangExt_Fortran) REJECT; + outputChar(*yytext); + BEGIN( CopyStringFtn ); + } [^\"\\\r\n]+ { outputArray(yytext,(int)yyleng); } @@ -1860,6 +1866,16 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) outputChar(*yytext); BEGIN( CopyLine ); } +[^\'\\\r\n]+ { + outputArray(yytext,(int)yyleng); + } +\\. { + outputArray(yytext,(int)yyleng); + } +\' { + outputChar(*yytext); + BEGIN( CopyLine ); + } {ID}/{BN}{0,80}"(" { g_expectGuard = FALSE; Define *def=0; -- cgit v0.12