summaryrefslogtreecommitdiffstats
path: root/Source/cmDependsFortranLexer.in.l
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-10-03 19:41:39 (GMT)
committerBrad King <brad.king@kitware.com>2007-10-03 19:41:39 (GMT)
commitf8caab461315c1588412047eab965d3972f52efb (patch)
treee21fe14303ffcee50995cbb5352284a19f55da3e /Source/cmDependsFortranLexer.in.l
parent00c33e7e8f0ec3e8be1a1f06eea86e5d00b7514f (diff)
downloadCMake-f8caab461315c1588412047eab965d3972f52efb.zip
CMake-f8caab461315c1588412047eab965d3972f52efb.tar.gz
CMake-f8caab461315c1588412047eab965d3972f52efb.tar.bz2
BUG: Fix for bug#5809. Applied patch supplied in the bug report. Updated pre-generated lexer and parser sources. This updates the makedepf90 version to 2.8.8. The parser actions have been updated to ignore "use" in comments properly.
Diffstat (limited to 'Source/cmDependsFortranLexer.in.l')
-rw-r--r--Source/cmDependsFortranLexer.in.l62
1 files changed, 34 insertions, 28 deletions
diff --git a/Source/cmDependsFortranLexer.in.l b/Source/cmDependsFortranLexer.in.l
index 8326eae..05210eb 100644
--- a/Source/cmDependsFortranLexer.in.l
+++ b/Source/cmDependsFortranLexer.in.l
@@ -16,7 +16,7 @@
=========================================================================*/
/*-------------------------------------------------------------------------
- Portions of this source have been derived from makefdep90 version 2.6.2,
+ Portions of this source have been derived from makefdep90 version 2.8.8,
Copyright (C) 2000,2001 Erik Edelmann <eedelman@beam.helsinki.fi>.
@@ -64,6 +64,7 @@ Modify cmDependsFortranLexer.h:
/*--------------------------------------------------------------------------*/
%}
+
%option reentrant
%option noyywrap
%pointer
@@ -75,16 +76,19 @@ Modify cmDependsFortranLexer.h:
\" {
cmDependsFortranParser_StringStart(yyextra);
+ cmDependsFortranParser_SetOldStartcond(yyextra, YY_START);
BEGIN(str_dq);
}
' {
cmDependsFortranParser_StringStart(yyextra);
+ cmDependsFortranParser_SetOldStartcond(yyextra, YY_START);
BEGIN(str_sq);
}
<str_dq>\" |
<str_sq>' {
+ BEGIN(cmDependsFortranParser_GetOldStartcond(yyextra) );
yylvalp->string = strdup(cmDependsFortranParser_StringEnd(yyextra));
return STRING;
}
@@ -92,7 +96,15 @@ Modify cmDependsFortranLexer.h:
<str_dq,str_sq>&[ \t]*\n |
<str_dq,str_sq>&[ \t]*\n[ \t]*& /* Ignore (continued strings, free fmt) */
-<fixed_fmt,str_dq,str_sq>\n[ ]{5}[^ \t\n] /*Ignore (cont. strings, fixed fmt) */
+<fixed_fmt,str_dq,str_sq>\n[ ]{5}[^ \t\n] {
+ if (cmDependsFortranParser_GetOldStartcond(yyextra) == fixed_fmt)
+ ; /* Ignore (cont. strings, fixed fmt) */
+ else
+ {
+ unput(yytext[strlen(yytext)-1]);
+ }
+}
+
<str_dq,str_sq>\n {
unput ('\n');
@@ -110,23 +122,6 @@ Modify cmDependsFortranLexer.h:
#[ \t]*include { return CPP_INCLUDE; }
\$[ \t]*include { return F90PPR_INCLUDE; }
\?\?[ \t]*include { return COCO_INCLUDE; }
-INCLUDE { return F_INCLUDE; }
-USE { return USE; }
-
-END" "*INTERFACE {
- cmDependsFortranParser_SetInInterface(yyextra, 0);
-}
-INTERFACE {
- cmDependsFortranParser_SetInInterface(yyextra, 1);
-}
-
-END" "*MODULE /* Ignore */
-MODULE {
- if(!cmDependsFortranParser_GetInInterface(yyextra))
- {
- return MODULE;
- }
-}
#[ \t]*define { return CPP_DEFINE; }
\$[ \t]*DEFINE { return F90PPR_DEFINE; }
@@ -148,23 +143,34 @@ $[ \t]*elif { return F90PPR_ELIF; }
$[ \t]*else { return F90PPR_ELSE; }
$[ \t]*endif { return F90PPR_ENDIF; }
-&[ \t]*\n |
-&[ \t]*\n[ \t]*& /* Ignore */
+ /* Line continuations, possible involving comments. */
+&([ \t\n]*|!.*)*
+&([ \t\n]*|!.*)*&
+
+<fixed_fmt>\n[ ]{5}[^ ] { return GARBAGE; }
+
+=|=> { return ASSIGNMENT_OP; }
+
+[a-zA-Z_][a-zA-Z_0-9]* {
+ yylvalp->string = strdup(yytext);
+ return WORD;
+}
+[^ \t\n\r;,!'"a-zA-Z=&]+ { return GARBAGE; }
-[^ \t\n\r;,!'""']+ { yylvalp->string = strdup(yytext); return WORD; }
+;|\n { return EOSTMT; }
-;|\n { return EOSTMT; }
[ \t\r,] /* Ignore */
+\\[ \t]*\n /* Ignore line-endings preceeded by \ */
-. { return *yytext; }
+. { return *yytext; }
<<EOF>> {
- if(!cmDependsFortranParser_FilePop(yyextra))
- {
- return YY_NULL;
- }
+ if(!cmDependsFortranParser_FilePop(yyextra) )
+ {
+ return YY_NULL;
+ }
}
%%