summaryrefslogtreecommitdiff
path: root/Source/cmFortranLexer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmFortranLexer.cxx')
-rw-r--r--Source/cmFortranLexer.cxx183
1 files changed, 110 insertions, 73 deletions
diff --git a/Source/cmFortranLexer.cxx b/Source/cmFortranLexer.cxx
index a5ef47dfab..01c09acb7f 100644
--- a/Source/cmFortranLexer.cxx
+++ b/Source/cmFortranLexer.cxx
@@ -1,7 +1,9 @@
+#include "cmStandardLexer.h"
#line 2 "cmFortranLexer.cxx"
#line 4 "cmFortranLexer.cxx"
+#define FLEXINT_H 1
#define YY_INT_ALIGNED short int
/* A lexical scanner generated by flex */
@@ -651,22 +653,22 @@ static yyconst flex_int16_t yy_chk[633] =
/*
-This file must be translated to C and modified to build everywhere.
+This file must be translated to C++ and modified to build everywhere.
Run flex >= 2.6 like this:
- flex -i --prefix=cmFortran_yy --header-file=cmFortranLexer.h -ocmFortranLexer.cxx cmFortranLexer.in.l
+ flex -i --nounistd -DFLEXINT_H --prefix=cmFortran_yy --header-file=cmFortranLexer.h -ocmFortranLexer.cxx cmFortranLexer.in.l
Modify cmFortranLexer.cxx:
- remove trailing whitespace: sed -i 's/\s*$//' cmFortranLexer.h cmFortranLexer.cxx
- remove blank lines at end of file
- - remove "yyscanner = NULL" from end of cmFortran_yylex_destroy
- - remove all YY_BREAK lines occurring right after return statements
+ - #include "cmStandardLexer.h" at the top
- add cast in cmFortran_yy_scan_bytes for loop condition of _yybytes_len to size_t
*/
-#include "cmStandardLexer.h"
+/* IWYU pragma: no_forward_declare yyguts_t */
+
#undef YY_NO_UNPUT
#define cmFortranLexer_cxx
@@ -683,7 +685,7 @@ Modify cmFortranLexer.cxx:
/*--------------------------------------------------------------------------*/
-#line 696 "cmFortranLexer.cxx"
+#line 688 "cmFortranLexer.cxx"
#define INITIAL 0
#define free_fmt 1
@@ -691,14 +693,6 @@ Modify cmFortranLexer.cxx:
#define str_sq 3
#define str_dq 4
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-#include <unistd.h>
-#endif
-
#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif
@@ -951,10 +945,10 @@ YY_DECL
}
{
-#line 65 "cmFortranLexer.in.l"
+#line 56 "cmFortranLexer.in.l"
-#line 967 "cmFortranLexer.cxx"
+#line 951 "cmFortranLexer.cxx"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -1014,7 +1008,7 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 67 "cmFortranLexer.in.l"
+#line 58 "cmFortranLexer.in.l"
{
cmFortranParser_StringStart(yyextra);
cmFortranParser_SetOldStartcond(yyextra, YY_START);
@@ -1023,7 +1017,7 @@ YY_RULE_SETUP
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 73 "cmFortranLexer.in.l"
+#line 64 "cmFortranLexer.in.l"
{
cmFortranParser_StringStart(yyextra);
cmFortranParser_SetOldStartcond(yyextra, YY_START);
@@ -1031,28 +1025,29 @@ YY_RULE_SETUP
}
YY_BREAK
case 3:
-#line 80 "cmFortranLexer.in.l"
+#line 71 "cmFortranLexer.in.l"
case 4:
YY_RULE_SETUP
-#line 80 "cmFortranLexer.in.l"
+#line 71 "cmFortranLexer.in.l"
{
BEGIN(cmFortranParser_GetOldStartcond(yyextra) );
yylvalp->string = strdup(cmFortranParser_StringEnd(yyextra));
return STRING;
}
+ YY_BREAK
case 5:
/* rule 5 can match eol */
-#line 87 "cmFortranLexer.in.l"
+#line 78 "cmFortranLexer.in.l"
case 6:
/* rule 6 can match eol */
YY_RULE_SETUP
-#line 87 "cmFortranLexer.in.l"
+#line 78 "cmFortranLexer.in.l"
/* Ignore (continued strings, free fmt) */
YY_BREAK
case 7:
/* rule 7 can match eol */
YY_RULE_SETUP
-#line 89 "cmFortranLexer.in.l"
+#line 80 "cmFortranLexer.in.l"
{
if (cmFortranParser_GetOldStartcond(yyextra) == fixed_fmt)
; /* Ignore (cont. strings, fixed fmt) */
@@ -1065,15 +1060,16 @@ YY_RULE_SETUP
case 8:
/* rule 8 can match eol */
YY_RULE_SETUP
-#line 99 "cmFortranLexer.in.l"
+#line 90 "cmFortranLexer.in.l"
{
unput ('\n');
BEGIN(INITIAL);
return UNTERMINATED_STRING;
}
+ YY_BREAK
case 9:
YY_RULE_SETUP
-#line 105 "cmFortranLexer.in.l"
+#line 96 "cmFortranLexer.in.l"
{
cmFortranParser_StringAppend(yyextra, yytext[0]);
}
@@ -1081,205 +1077,245 @@ YY_RULE_SETUP
case 10:
/* rule 10 can match eol */
YY_RULE_SETUP
-#line 109 "cmFortranLexer.in.l"
+#line 100 "cmFortranLexer.in.l"
{ return EOSTMT; } /* Treat comments like */
+ YY_BREAK
case 11:
/* rule 11 can match eol */
YY_RULE_SETUP
-#line 110 "cmFortranLexer.in.l"
+#line 101 "cmFortranLexer.in.l"
{ return EOSTMT; } /* empty lines */
+ YY_BREAK
case 12:
YY_RULE_SETUP
-#line 112 "cmFortranLexer.in.l"
+#line 103 "cmFortranLexer.in.l"
{ return CPP_LINE_DIRECTIVE; }
+ YY_BREAK
case 13:
/* rule 13 can match eol */
YY_RULE_SETUP
-#line 113 "cmFortranLexer.in.l"
+#line 104 "cmFortranLexer.in.l"
{
yytext[yyleng-1] = 0;
yylvalp->string = strdup(strchr(yytext, '<')+1);
return CPP_INCLUDE_ANGLE;
}
+ YY_BREAK
case 14:
YY_RULE_SETUP
-#line 118 "cmFortranLexer.in.l"
+#line 109 "cmFortranLexer.in.l"
{ return CPP_INCLUDE; }
+ YY_BREAK
case 15:
YY_RULE_SETUP
-#line 119 "cmFortranLexer.in.l"
+#line 110 "cmFortranLexer.in.l"
{ return F90PPR_INCLUDE; }
+ YY_BREAK
case 16:
YY_RULE_SETUP
-#line 120 "cmFortranLexer.in.l"
+#line 111 "cmFortranLexer.in.l"
{ return COCO_INCLUDE; }
+ YY_BREAK
case 17:
YY_RULE_SETUP
-#line 122 "cmFortranLexer.in.l"
+#line 113 "cmFortranLexer.in.l"
{ return CPP_DEFINE; }
+ YY_BREAK
case 18:
YY_RULE_SETUP
-#line 123 "cmFortranLexer.in.l"
+#line 114 "cmFortranLexer.in.l"
{ return F90PPR_DEFINE; }
+ YY_BREAK
case 19:
YY_RULE_SETUP
-#line 125 "cmFortranLexer.in.l"
+#line 116 "cmFortranLexer.in.l"
{ return CPP_UNDEF; }
+ YY_BREAK
case 20:
YY_RULE_SETUP
-#line 126 "cmFortranLexer.in.l"
+#line 117 "cmFortranLexer.in.l"
{ return F90PPR_UNDEF; }
+ YY_BREAK
case 21:
YY_RULE_SETUP
-#line 128 "cmFortranLexer.in.l"
+#line 119 "cmFortranLexer.in.l"
{ return CPP_IFDEF; }
+ YY_BREAK
case 22:
YY_RULE_SETUP
-#line 129 "cmFortranLexer.in.l"
+#line 120 "cmFortranLexer.in.l"
{ return CPP_IFNDEF; }
+ YY_BREAK
case 23:
YY_RULE_SETUP
-#line 130 "cmFortranLexer.in.l"
+#line 121 "cmFortranLexer.in.l"
{ return CPP_IF; }
+ YY_BREAK
case 24:
YY_RULE_SETUP
-#line 131 "cmFortranLexer.in.l"
+#line 122 "cmFortranLexer.in.l"
{ return CPP_ELIF; }
+ YY_BREAK
case 25:
YY_RULE_SETUP
-#line 132 "cmFortranLexer.in.l"
+#line 123 "cmFortranLexer.in.l"
{ return CPP_ELSE; }
+ YY_BREAK
case 26:
YY_RULE_SETUP
-#line 133 "cmFortranLexer.in.l"
+#line 124 "cmFortranLexer.in.l"
{ return CPP_ENDIF; }
+ YY_BREAK
case 27:
YY_RULE_SETUP
-#line 135 "cmFortranLexer.in.l"
+#line 126 "cmFortranLexer.in.l"
{ return F90PPR_IFDEF; }
+ YY_BREAK
case 28:
YY_RULE_SETUP
-#line 136 "cmFortranLexer.in.l"
+#line 127 "cmFortranLexer.in.l"
{ return F90PPR_IFNDEF; }
+ YY_BREAK
case 29:
YY_RULE_SETUP
-#line 137 "cmFortranLexer.in.l"
+#line 128 "cmFortranLexer.in.l"
{ return F90PPR_IF; }
+ YY_BREAK
case 30:
YY_RULE_SETUP
-#line 138 "cmFortranLexer.in.l"
+#line 129 "cmFortranLexer.in.l"
{ return F90PPR_ELIF; }
+ YY_BREAK
case 31:
YY_RULE_SETUP
-#line 139 "cmFortranLexer.in.l"
+#line 130 "cmFortranLexer.in.l"
{ return F90PPR_ELSE; }
+ YY_BREAK
case 32:
YY_RULE_SETUP
-#line 140 "cmFortranLexer.in.l"
+#line 131 "cmFortranLexer.in.l"
{ return F90PPR_ENDIF; }
+ YY_BREAK
/* Line continuations, possible involving comments. */
case 33:
/* rule 33 can match eol */
YY_RULE_SETUP
-#line 143 "cmFortranLexer.in.l"
+#line 134 "cmFortranLexer.in.l"
YY_BREAK
case 34:
/* rule 34 can match eol */
YY_RULE_SETUP
-#line 144 "cmFortranLexer.in.l"
+#line 135 "cmFortranLexer.in.l"
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 146 "cmFortranLexer.in.l"
+#line 137 "cmFortranLexer.in.l"
{ return COMMA; }
+ YY_BREAK
case 36:
YY_RULE_SETUP
-#line 148 "cmFortranLexer.in.l"
+#line 139 "cmFortranLexer.in.l"
{ return DCOLON; }
+ YY_BREAK
case 37:
YY_RULE_SETUP
-#line 149 "cmFortranLexer.in.l"
+#line 140 "cmFortranLexer.in.l"
{ return COLON; }
+ YY_BREAK
case 38:
/* rule 38 can match eol */
YY_RULE_SETUP
-#line 151 "cmFortranLexer.in.l"
+#line 142 "cmFortranLexer.in.l"
{ return GARBAGE; }
+ YY_BREAK
case 39:
YY_RULE_SETUP
-#line 153 "cmFortranLexer.in.l"
+#line 144 "cmFortranLexer.in.l"
{ return ASSIGNMENT_OP; }
+ YY_BREAK
case 40:
YY_RULE_SETUP
-#line 155 "cmFortranLexer.in.l"
+#line 146 "cmFortranLexer.in.l"
{ return END; }
+ YY_BREAK
case 41:
YY_RULE_SETUP
-#line 156 "cmFortranLexer.in.l"
+#line 147 "cmFortranLexer.in.l"
{ return INCLUDE; }
+ YY_BREAK
case 42:
YY_RULE_SETUP
-#line 157 "cmFortranLexer.in.l"
+#line 148 "cmFortranLexer.in.l"
{ return INTERFACE; }
+ YY_BREAK
case 43:
YY_RULE_SETUP
-#line 158 "cmFortranLexer.in.l"
+#line 149 "cmFortranLexer.in.l"
{ return MODULE; }
+ YY_BREAK
case 44:
YY_RULE_SETUP
-#line 159 "cmFortranLexer.in.l"
+#line 150 "cmFortranLexer.in.l"
{ return SUBMODULE; }
+ YY_BREAK
case 45:
YY_RULE_SETUP
-#line 160 "cmFortranLexer.in.l"
+#line 151 "cmFortranLexer.in.l"
{ return USE; }
+ YY_BREAK
case 46:
YY_RULE_SETUP
-#line 162 "cmFortranLexer.in.l"
+#line 153 "cmFortranLexer.in.l"
{
yylvalp->string = strdup(yytext);
return WORD;
}
+ YY_BREAK
case 47:
YY_RULE_SETUP
-#line 167 "cmFortranLexer.in.l"
+#line 158 "cmFortranLexer.in.l"
{ return LPAREN; }
+ YY_BREAK
case 48:
YY_RULE_SETUP
-#line 168 "cmFortranLexer.in.l"
+#line 159 "cmFortranLexer.in.l"
{ return RPAREN; }
+ YY_BREAK
case 49:
YY_RULE_SETUP
-#line 170 "cmFortranLexer.in.l"
+#line 161 "cmFortranLexer.in.l"
{ return GARBAGE; }
+ YY_BREAK
case 50:
/* rule 50 can match eol */
YY_RULE_SETUP
-#line 172 "cmFortranLexer.in.l"
+#line 163 "cmFortranLexer.in.l"
{ return EOSTMT; }
+ YY_BREAK
case 51:
YY_RULE_SETUP
-#line 175 "cmFortranLexer.in.l"
+#line 166 "cmFortranLexer.in.l"
/* Ignore */
YY_BREAK
case 52:
/* rule 52 can match eol */
YY_RULE_SETUP
-#line 176 "cmFortranLexer.in.l"
+#line 167 "cmFortranLexer.in.l"
/* Ignore line-endings preceded by \ */
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 178 "cmFortranLexer.in.l"
+#line 169 "cmFortranLexer.in.l"
{ return *yytext; }
+ YY_BREAK
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(free_fmt):
case YY_STATE_EOF(fixed_fmt):
case YY_STATE_EOF(str_sq):
case YY_STATE_EOF(str_dq):
-#line 180 "cmFortranLexer.in.l"
+#line 171 "cmFortranLexer.in.l"
{
if(!cmFortranParser_FilePop(yyextra) )
{
@@ -1289,10 +1325,10 @@ case YY_STATE_EOF(str_dq):
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 187 "cmFortranLexer.in.l"
+#line 178 "cmFortranLexer.in.l"
ECHO;
YY_BREAK
-#line 1347 "cmFortranLexer.cxx"
+#line 1331 "cmFortranLexer.cxx"
case YY_END_OF_BUFFER:
{
@@ -2400,6 +2436,7 @@ int cmFortran_yylex_destroy (yyscan_t yyscanner)
/* Destroy the main struct (reentrant only). */
cmFortran_yyfree ( yyscanner , yyscanner );
+ yyscanner = NULL;
return 0;
}
@@ -2461,7 +2498,7 @@ void cmFortran_yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 187 "cmFortranLexer.in.l"
+#line 178 "cmFortranLexer.in.l"