cmFortranParser: Parse keywords as lexical tokens

Teach the lexer to match and return specific Fortran keywords as tokens.
Update the parser to use these instead of always using a WORD token and
then checking the text.  This avoids extra string comparisons and will
allow more grammar productions to be unambiguously added later for
additional Fortran statements.
This commit is contained in:
Brad King 2016-09-05 15:54:51 -04:00
parent 1619fb46a8
commit 695f0d0d3a
6 changed files with 578 additions and 463 deletions

View File

@ -347,8 +347,8 @@ static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner );
*yy_cp = '\0'; \ *yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp; yyg->yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 45 #define YY_NUM_RULES 50
#define YY_END_OF_BUFFER 46 #define YY_END_OF_BUFFER 51
/* This struct is not used in this scanner, /* This struct is not used in this scanner,
but its presence is necessary. */ but its presence is necessary. */
struct yy_trans_info struct yy_trans_info
@ -356,27 +356,30 @@ struct yy_trans_info
flex_int32_t yy_verify; flex_int32_t yy_verify;
flex_int32_t yy_nxt; flex_int32_t yy_nxt;
}; };
static yyconst flex_int16_t yy_accept[173] = static yyconst flex_int16_t yy_accept[199] =
{ 0, { 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
46, 40, 42, 41, 44, 1, 40, 33, 2, 35, 51, 45, 47, 46, 49, 1, 45, 33, 2, 35,
40, 41, 38, 40, 39, 40, 39, 42, 40, 41, 45, 46, 38, 45, 44, 44, 44, 44, 44, 45,
40, 39, 9, 8, 9, 4, 3, 40, 0, 10, 44, 47, 45, 46, 45, 44, 9, 8, 9, 4,
0, 0, 0, 0, 0, 33, 33, 34, 36, 38, 3, 45, 0, 10, 0, 0, 0, 0, 0, 33,
40, 39, 0, 43, 39, 0, 0, 0, 12, 0, 33, 34, 36, 38, 45, 44, 44, 44, 44, 44,
0, 0, 0, 0, 0, 40, 0, 11, 39, 0, 0, 48, 44, 0, 0, 0, 12, 0, 0, 0,
0, 5, 0, 0, 0, 29, 0, 0, 33, 33, 0, 0, 0, 45, 0, 11, 44, 0, 0, 5,
33, 33, 0, 0, 12, 12, 0, 0, 0, 23, 0, 0, 0, 29, 0, 0, 33, 33, 33, 33,
0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 39, 44, 44, 44, 43, 12, 12, 0,
0, 0, 23, 0, 0, 0, 0, 0, 0, 6,
0, 0, 0, 0, 0, 0, 0, 0, 0, 44,
44, 44, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 30, 31, 0, 0, 0, 0,
0, 0, 44, 44, 44, 0, 24, 25, 0, 0,
0, 0, 0, 0, 0, 0, 0, 32, 27, 0,
0, 20, 0, 44, 44, 42, 0, 26, 21, 0,
0, 0, 19, 0, 0, 18, 28, 0, 0, 40,
44, 17, 22, 0, 7, 37, 7, 15, 0, 44,
14, 16, 41, 0, 0, 0, 13, 0
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 30, 31,
0, 0, 0, 0, 0, 0, 0, 24, 25, 0,
0, 0, 0, 0, 0, 0, 0, 0, 32, 27,
0, 0, 20, 0, 0, 26, 21, 0, 0, 0,
19, 0, 0, 18, 28, 0, 0, 17, 22, 0,
7, 37, 7, 15, 0, 14, 16, 0, 0, 0,
13, 0
} ; } ;
static yyconst YY_CHAR yy_ec[256] = static yyconst YY_CHAR yy_ec[256] =
@ -387,14 +390,14 @@ static yyconst YY_CHAR yy_ec[256] =
1, 5, 6, 7, 8, 9, 1, 10, 11, 1, 1, 5, 6, 7, 8, 9, 1, 10, 11, 1,
1, 12, 1, 13, 1, 1, 1, 14, 14, 14, 1, 12, 1, 13, 1, 1, 1, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 15, 16, 17, 14, 14, 14, 14, 14, 14, 14, 15, 16, 17,
18, 19, 20, 1, 21, 21, 22, 23, 24, 25, 18, 19, 20, 1, 21, 22, 23, 24, 25, 26,
21, 21, 26, 21, 21, 27, 21, 28, 21, 21, 22, 22, 27, 22, 22, 28, 29, 30, 31, 22,
21, 21, 29, 21, 30, 21, 21, 21, 21, 21, 22, 32, 33, 34, 35, 22, 22, 22, 22, 22,
1, 31, 1, 1, 32, 1, 21, 21, 33, 34, 1, 36, 1, 1, 37, 1, 21, 22, 38, 39,
35, 36, 21, 21, 37, 21, 21, 38, 21, 39, 40, 41, 22, 22, 42, 22, 22, 43, 29, 44,
21, 21, 21, 21, 40, 21, 41, 21, 21, 21, 31, 22, 22, 32, 45, 34, 46, 22, 22, 22,
21, 21, 1, 1, 1, 1, 1, 1, 1, 1, 22, 22, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -411,195 +414,211 @@ static yyconst YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1 1, 1, 1, 1, 1
} ; } ;
static yyconst YY_CHAR yy_meta[42] = static yyconst YY_CHAR yy_meta[47] =
{ 0, { 0,
1, 2, 2, 3, 4, 3, 3, 1, 1, 3, 1, 2, 2, 3, 4, 3, 3, 1, 1, 3,
3, 1, 3, 5, 1, 3, 1, 3, 6, 1, 3, 1, 3, 5, 1, 3, 1, 3, 6, 1,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
1, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 1, 5, 7, 7, 7,
7 7, 7, 7, 7, 7, 7
} ; } ;
static yyconst flex_uint16_t yy_base[182] = static yyconst flex_uint16_t yy_base[208] =
{ 0, { 0,
0, 40, 0, 41, 220, 48, 44, 54, 56, 65, 0, 45, 0, 46, 392, 53, 49, 59, 61, 71,
220, 0, 535, 535, 216, 535, 81, 74, 535, 535, 392, 0, 572, 572, 364, 572, 91, 77, 572, 572,
186, 535, 153, 145, 0, 85, 122, 87, 154, 155, 342, 572, 317, 232, 0, 19, 42, 218, 40, 92,
195, 227, 535, 147, 91, 535, 535, 0, 147, 535, 137, 96, 174, 240, 220, 257, 572, 238, 97, 572,
267, 34, 70, 74, 34, 122, 141, 535, 0, 535, 572, 0, 205, 572, 302, 50, 77, 83, 59, 137,
112, 0, 98, 535, 0, 156, 307, 0, 143, 43, 156, 572, 0, 572, 123, 0, 84, 130, 90, 92,
155, 151, 48, 101, 130, 348, 130, 535, 0, 121, 167, 572, 0, 176, 347, 0, 190, 94, 175, 200,
197, 165, 172, 244, 182, 183, 191, 248, 273, 293, 121, 92, 201, 393, 193, 572, 0, 162, 222, 175,
308, 314, 321, 246, 275, 216, 269, 299, 304, 327, 171, 209, 176, 281, 184, 207, 307, 313, 328, 348,
307, 304, 312, 116, 107, 367, 535, 327, 334, 347, 338, 111, 0, 205, 213, 125, 0, 354, 185, 280,
347, 350, 352, 349, 354, 359, 357, 363, 366, 365, 336, 300, 340, 309, 278, 321, 139, 130, 245, 572,
369, 372, 369, 373, 374, 101, 86, 372, 535, 535, 335, 347, 351, 356, 360, 375, 375, 379, 383, 300,
378, 380, 386, 382, 388, 388, 389, 535, 535, 393, 80, 381, 384, 390, 392, 393, 397, 399, 397, 402,
394, 396, 392, 430, 400, 56, 47, 403, 535, 535, 403, 106, 105, 284, 572, 572, 407, 408, 411, 320,
409, 414, 535, 409, 416, 535, 535, 416, 419, 441, 413, 413, 420, 419, 421, 420, 572, 572, 421, 426,
535, 117, 0, 535, 535, 423, 426, 535, 535, 430, 428, 420, 467, 432, 101, 83, 438, 572, 572, 439,
535, 535, 535, 535, 432, 457, 535, 459, 0, 25, 446, 572, 436, 449, 63, 0, 450, 572, 572, 450,
535, 535, 476, 483, 489, 492, 499, 506, 513, 520, 453, 481, 572, 64, 0, 572, 572, 454, 460, 0,
527 464, 572, 572, 463, 572, 572, 572, 572, 468, 471,
495, 572, 0, 496, 0, 38, 572, 572, 513, 520,
526, 529, 536, 543, 550, 557, 564
} ; } ;
static yyconst flex_int16_t yy_def[182] = static yyconst flex_int16_t yy_def[208] =
{ 0, { 0,
172, 1, 1, 1, 1, 1, 173, 173, 173, 173, 198, 1, 1, 1, 1, 1, 199, 199, 199, 199,
172, 174, 172, 172, 175, 172, 174, 172, 172, 172, 198, 200, 198, 198, 201, 198, 200, 198, 198, 198,
174, 172, 172, 174, 176, 174, 176, 172, 172, 172, 200, 198, 198, 200, 202, 202, 202, 202, 202, 200,
177, 172, 172, 172, 172, 172, 172, 174, 175, 172, 202, 198, 198, 198, 203, 198, 198, 198, 198, 198,
172, 172, 172, 172, 172, 172, 178, 172, 174, 172, 198, 200, 201, 198, 198, 198, 198, 198, 198, 198,
174, 176, 172, 172, 27, 172, 172, 57, 174, 172, 204, 198, 200, 198, 200, 202, 202, 202, 202, 202,
172, 172, 172, 172, 172, 177, 177, 172, 32, 172, 198, 198, 31, 198, 198, 65, 200, 198, 198, 198,
172, 172, 172, 172, 172, 172, 172, 172, 178, 178, 198, 198, 198, 203, 203, 198, 36, 198, 198, 198,
178, 178, 172, 172, 172, 172, 172, 172, 172, 172, 198, 198, 198, 198, 198, 198, 204, 204, 204, 204,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 198, 198, 202, 202, 202, 202, 202, 198, 198, 198,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 198, 198, 198, 198, 198, 198, 198, 198, 198, 202,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 202, 202, 198, 198, 198, 198, 198, 198, 198, 198,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 198, 198, 202, 202, 202, 198, 198, 198, 198, 198,
172, 179, 180, 172, 172, 172, 172, 172, 172, 172, 198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
172, 172, 172, 172, 172, 172, 172, 172, 181, 181, 198, 198, 198, 202, 202, 202, 198, 198, 198, 198,
172, 0, 172, 172, 172, 172, 172, 172, 172, 172, 198, 198, 198, 205, 206, 198, 198, 198, 198, 202,
172 202, 198, 198, 198, 198, 198, 198, 198, 198, 202,
198, 198, 202, 198, 207, 207, 198, 0, 198, 198,
198, 198, 198, 198, 198, 198, 198
} ; } ;
static yyconst flex_uint16_t yy_nxt[577] = static yyconst flex_uint16_t yy_nxt[619] =
{ 0, { 0,
12, 13, 14, 13, 13, 15, 16, 12, 17, 18, 12, 13, 14, 13, 13, 15, 16, 12, 17, 18,
19, 12, 20, 12, 21, 22, 12, 23, 12, 24, 19, 12, 20, 12, 21, 22, 12, 23, 12, 24,
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 25, 27, 25, 28, 25,
26, 27, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 29, 30, 31, 25, 25, 26,
25, 28, 28, 171, 28, 28, 34, 29, 29, 28, 25, 27, 25, 25, 25, 29, 32, 32, 57, 32,
30, 153, 28, 35, 36, 29, 34, 73, 34, 31, 32, 38, 33, 33, 32, 34, 197, 32, 39, 40,
152, 78, 37, 35, 36, 35, 87, 34, 73, 32, 33, 38, 57, 38, 35, 186, 186, 41, 39, 40,
32, 37, 78, 92, 35, 46, 46, 87, 46, 47, 39, 58, 60, 38, 81, 36, 36, 41, 50, 50,
32, 32, 41, 48, 92, 41, 53, 54, 56, 53, 39, 50, 51, 181, 60, 58, 52, 175, 86, 81,
137, 56, 71, 72, 57, 71, 74, 75, 76, 53, 36, 36, 45, 61, 62, 45, 61, 64, 79, 80,
54, 77, 53, 42, 43, 136, 44, 74, 75, 76, 64, 79, 86, 65, 82, 174, 83, 93, 84, 156,
45, 117, 77, 83, 42, 43, 83, 44, 162, 162, 155, 144, 85, 96, 46, 47, 97, 48, 100, 82,
116, 45, 38, 46, 46, 95, 46, 47, 93, 38, 83, 106, 93, 84, 91, 49, 85, 91, 96, 46,
38, 48, 68, 38, 94, 55, 38, 84, 38, 93, 47, 97, 48, 100, 133, 106, 49, 42, 50, 50,
38, 38, 80, 46, 86, 80, 81, 86, 84, 40, 119, 50, 51, 132, 42, 42, 52, 105, 42, 92,
82, 70, 38, 55, 38, 58, 59, 56, 58, 65, 63, 42, 94, 42, 119, 42, 42, 88, 50, 122,
56, 38, 38, 57, 51, 38, 96, 59, 38, 96, 88, 89, 105, 95, 92, 90, 108, 94, 61, 62,
38, 50, 38, 38, 97, 90, 60, 61, 91, 62, 122, 61, 42, 63, 42, 66, 109, 64, 66, 109,
63, 88, 89, 64, 38, 38, 90, 60, 61, 91, 64, 42, 42, 65, 110, 42, 99, 67, 42, 99,
62, 63, 88, 89, 64, 66, 98, 68, 71, 72, 42, 99, 42, 42, 99, 76, 111, 68, 69, 114,
49, 71, 66, 66, 101, 102, 66, 98, 66, 66, 70, 71, 101, 67, 102, 107, 117, 44, 72, 42,
103, 66, 104, 66, 66, 101, 102, 86, 40, 172, 42, 111, 68, 69, 114, 70, 71, 101, 102, 72,
86, 103, 30, 104, 172, 66, 66, 67, 67, 68, 74, 117, 76, 79, 80, 103, 79, 74, 74, 104,
67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 118, 74, 120, 74, 74, 112, 74, 121, 74, 74,
69, 67, 67, 67, 67, 67, 67, 69, 69, 69, 103, 113, 78, 104, 73, 118, 109, 120, 59, 109,
69, 69, 69, 69, 69, 69, 69, 67, 69, 69, 112, 55, 121, 113, 110, 74, 74, 75, 75, 76,
69, 69, 69, 69, 69, 69, 69, 69, 41, 99, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
105, 41, 100, 106, 80, 46, 86, 80, 81, 86, 77, 75, 75, 75, 75, 75, 75, 77, 77, 77,
99, 105, 82, 100, 106, 172, 172, 172, 85, 42, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
43, 172, 44, 107, 80, 46, 45, 80, 81, 172, 77, 77, 75, 77, 77, 77, 77, 77, 77, 77,
42, 43, 82, 44, 107, 172, 172, 45, 58, 80, 77, 77, 77, 45, 115, 123, 45, 130, 88, 50,
46, 58, 80, 81, 172, 80, 46, 82, 80, 81, 116, 88, 89, 157, 88, 50, 90, 88, 89, 115,
85, 172, 83, 82, 108, 83, 110, 109, 113, 60, 123, 130, 90, 126, 116, 46, 47, 157, 48, 88,
61, 114, 62, 63, 115, 108, 64, 110, 109, 113, 50, 129, 88, 89, 143, 54, 49, 90, 126, 91,
60, 61, 114, 62, 63, 115, 84, 64, 66, 111, 46, 47, 91, 48, 131, 143, 129, 49, 66, 88,
68, 172, 118, 172, 112, 66, 66, 84, 119, 66, 50, 66, 88, 89, 161, 99, 53, 90, 99, 131,
111, 66, 66, 118, 66, 112, 66, 66, 96, 119, 98, 134, 124, 127, 92, 161, 44, 98, 125, 128,
120, 96, 121, 122, 123, 124, 97, 125, 66, 66, 68, 69, 135, 70, 71, 136, 134, 124, 127, 92,
126, 120, 127, 121, 122, 123, 124, 128, 125, 129, 125, 72, 137, 128, 138, 68, 69, 135, 70, 71,
130, 126, 131, 127, 132, 133, 134, 135, 128, 138, 136, 198, 72, 74, 34, 76, 198, 137, 139, 138,
129, 130, 139, 131, 140, 132, 133, 134, 135, 141, 74, 74, 140, 141, 74, 142, 74, 74, 145, 74,
138, 142, 143, 139, 144, 140, 145, 146, 147, 148, 146, 74, 74, 139, 198, 147, 148, 140, 141, 149,
141, 149, 142, 143, 151, 144, 154, 145, 146, 147, 142, 150, 151, 145, 152, 146, 153, 154, 74, 74,
148, 150, 149, 155, 150, 151, 156, 154, 157, 158, 147, 148, 158, 159, 149, 160, 150, 151, 162, 152,
159, 160, 150, 85, 155, 150, 164, 156, 165, 157, 163, 153, 154, 164, 165, 166, 168, 158, 159, 167,
158, 159, 160, 166, 85, 167, 172, 164, 168, 165, 160, 169, 170, 162, 171, 163, 198, 173, 164, 165,
168, 168, 172, 168, 166, 172, 167, 172, 172, 172, 166, 168, 176, 167, 177, 171, 169, 170, 172, 178,
172, 172, 172, 169, 172, 169, 33, 33, 33, 33, 179, 172, 173, 180, 182, 183, 184, 176, 188, 177,
33, 33, 33, 38, 172, 172, 172, 38, 38, 39, 98, 179, 172, 189, 178, 172, 190, 191, 180, 182,
39, 39, 39, 39, 39, 39, 52, 172, 52, 67, 183, 184, 192, 188, 98, 193, 194, 194, 189, 194,
67, 67, 67, 67, 67, 67, 79, 79, 79, 79, 194, 190, 191, 198, 198, 198, 198, 192, 198, 198,
79, 79, 79, 161, 161, 161, 172, 161, 161, 161, 193, 195, 195, 37, 37, 37, 37, 37, 37, 37,
163, 172, 163, 172, 163, 163, 163, 170, 170, 170, 42, 198, 198, 198, 42, 42, 43, 43, 43, 43,
170, 170, 172, 170, 11, 172, 172, 172, 172, 172, 43, 43, 43, 56, 198, 56, 75, 75, 75, 75,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 75, 75, 75, 87, 87, 87, 87, 87, 87, 87,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 185, 185, 185, 198, 185, 185, 185, 187, 198, 187,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 198, 187, 187, 187, 196, 196, 196, 196, 196, 198,
172, 172, 172, 172, 172, 172 196, 11, 198, 198, 198, 198, 198, 198, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198
} ; } ;
static yyconst flex_int16_t yy_chk[577] = static yyconst flex_int16_t yy_chk[619] =
{ 0, { 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 4, 170, 2, 4, 7, 2, 4, 6, 1, 1, 1, 1, 1, 1, 2, 4, 26, 2,
6, 137, 6, 7, 7, 6, 8, 42, 9, 6, 4, 7, 2, 4, 6, 6, 196, 6, 7, 7,
136, 45, 9, 8, 8, 9, 60, 10, 42, 6, 6, 8, 26, 9, 6, 174, 174, 9, 8, 8,
6, 10, 45, 63, 10, 18, 18, 60, 18, 18, 9, 27, 29, 10, 46, 6, 6, 10, 18, 18,
6, 6, 17, 18, 63, 17, 26, 26, 28, 26, 10, 18, 18, 165, 29, 27, 18, 156, 49, 46,
117, 28, 35, 35, 28, 35, 43, 43, 44, 53, 6, 6, 17, 30, 30, 17, 30, 32, 39, 39,
53, 44, 53, 17, 17, 116, 17, 43, 43, 44, 32, 39, 49, 32, 47, 155, 47, 57, 48, 133,
17, 95, 44, 51, 17, 17, 51, 17, 152, 152, 132, 121, 48, 59, 17, 17, 60, 17, 68, 47,
94, 17, 27, 46, 46, 70, 46, 46, 64, 27, 47, 72, 57, 48, 55, 17, 48, 55, 59, 17,
27, 46, 67, 27, 65, 27, 27, 51, 27, 64, 17, 60, 17, 68, 108, 72, 17, 31, 50, 50,
27, 27, 47, 47, 59, 47, 47, 59, 51, 39, 92, 50, 50, 107, 31, 31, 50, 71, 31, 55,
47, 34, 27, 27, 29, 29, 59, 56, 29, 30, 31, 31, 58, 31, 92, 31, 31, 51, 51, 96,
56, 29, 29, 56, 24, 29, 72, 29, 29, 72, 51, 51, 71, 58, 55, 51, 78, 58, 61, 61,
29, 23, 29, 29, 72, 62, 29, 29, 62, 29, 96, 61, 31, 31, 33, 33, 80, 64, 33, 80,
29, 61, 61, 29, 29, 29, 62, 29, 29, 62, 64, 33, 33, 64, 80, 33, 99, 33, 33, 99,
29, 29, 61, 61, 29, 31, 73, 31, 71, 71, 33, 67, 33, 33, 67, 75, 81, 33, 33, 83,
21, 71, 31, 31, 75, 76, 31, 73, 31, 31, 33, 33, 69, 67, 69, 73, 85, 43, 33, 33,
76, 31, 77, 31, 31, 75, 76, 86, 15, 11, 33, 81, 33, 33, 83, 33, 33, 69, 69, 33,
86, 76, 5, 77, 0, 31, 31, 32, 32, 32, 35, 85, 35, 79, 79, 70, 79, 35, 35, 70,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 35, 94, 35, 35, 82, 35, 95, 35, 35,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 70, 82, 38, 70, 34, 86, 109, 94, 28, 109,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 82, 24, 95, 82, 109, 35, 35, 36, 36, 36,
32, 32, 32, 32, 32, 32, 32, 32, 41, 74, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
78, 41, 74, 84, 79, 79, 85, 79, 79, 85, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
74, 78, 79, 74, 84, 0, 0, 0, 85, 41, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
41, 0, 41, 87, 80, 80, 41, 80, 80, 0, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
41, 41, 80, 41, 87, 0, 0, 41, 57, 81, 36, 36, 36, 45, 84, 100, 45, 105, 87, 87,
81, 57, 81, 81, 0, 82, 82, 81, 82, 82, 84, 87, 87, 134, 88, 88, 87, 88, 88, 84,
57, 0, 83, 82, 88, 83, 89, 88, 91, 57, 100, 105, 88, 102, 84, 45, 45, 134, 45, 89,
57, 92, 57, 57, 93, 88, 57, 89, 88, 91, 89, 104, 89, 89, 120, 23, 45, 89, 102, 91,
57, 57, 92, 57, 57, 93, 83, 57, 66, 90, 45, 45, 91, 45, 106, 120, 104, 45, 65, 90,
66, 0, 98, 0, 90, 66, 66, 83, 99, 66, 90, 65, 90, 90, 140, 98, 21, 90, 98, 106,
90, 66, 66, 98, 66, 90, 66, 66, 96, 99, 65, 111, 101, 103, 91, 140, 15, 98, 101, 103,
100, 96, 101, 102, 103, 104, 96, 105, 66, 66, 65, 65, 112, 65, 65, 113, 111, 101, 103, 91,
106, 100, 107, 101, 102, 103, 104, 108, 105, 109, 101, 65, 114, 103, 115, 65, 65, 112, 65, 65,
110, 106, 111, 107, 112, 113, 114, 115, 108, 118, 113, 11, 65, 74, 5, 74, 0, 114, 116, 115,
109, 110, 121, 111, 122, 112, 113, 114, 115, 123, 74, 74, 117, 118, 74, 119, 74, 74, 122, 74,
118, 124, 125, 121, 126, 122, 127, 130, 131, 132, 123, 74, 74, 116, 0, 124, 125, 117, 118, 126,
123, 133, 124, 125, 135, 126, 138, 127, 130, 131, 119, 127, 128, 122, 129, 123, 130, 131, 74, 74,
132, 134, 133, 141, 134, 135, 142, 138, 144, 145, 124, 125, 137, 138, 126, 139, 127, 128, 141, 129,
148, 149, 150, 134, 141, 150, 156, 142, 157, 144, 142, 130, 131, 143, 144, 145, 149, 137, 138, 146,
145, 148, 149, 160, 150, 165, 0, 156, 166, 157, 139, 150, 151, 141, 152, 142, 0, 154, 143, 144,
168, 166, 0, 168, 160, 0, 165, 0, 0, 0, 145, 149, 157, 146, 160, 152, 150, 151, 153, 161,
0, 0, 0, 166, 0, 168, 173, 173, 173, 173, 163, 153, 154, 164, 167, 170, 171, 157, 178, 160,
173, 173, 173, 174, 0, 0, 0, 174, 174, 175, 153, 163, 172, 179, 161, 172, 181, 184, 164, 167,
175, 175, 175, 175, 175, 175, 176, 0, 176, 177, 170, 171, 189, 178, 172, 190, 191, 194, 179, 191,
177, 177, 177, 177, 177, 177, 178, 178, 178, 178, 194, 181, 184, 0, 0, 0, 0, 189, 0, 0,
178, 178, 178, 179, 179, 179, 0, 179, 179, 179, 190, 191, 194, 199, 199, 199, 199, 199, 199, 199,
180, 0, 180, 0, 180, 180, 180, 181, 181, 181, 200, 0, 0, 0, 200, 200, 201, 201, 201, 201,
181, 181, 0, 181, 172, 172, 172, 172, 172, 172, 201, 201, 201, 202, 0, 202, 203, 203, 203, 203,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 203, 203, 203, 204, 204, 204, 204, 204, 204, 204,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 205, 205, 205, 0, 205, 205, 205, 206, 0, 206,
172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 0, 206, 206, 206, 207, 207, 207, 207, 207, 0,
172, 172, 172, 172, 172, 172 207, 198, 198, 198, 198, 198, 198, 198, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198, 198, 198,
198, 198, 198, 198, 198, 198, 198, 198
} ; } ;
/* The intent behind this definition is that it'll catch /* The intent behind this definition is that it'll catch
@ -666,7 +685,7 @@ Modify cmFortranLexer.cxx:
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
#line 670 "cmFortranLexer.cxx" #line 689 "cmFortranLexer.cxx"
#define INITIAL 0 #define INITIAL 0
#define free_fmt 1 #define free_fmt 1
@ -937,7 +956,7 @@ YY_DECL
#line 65 "cmFortranLexer.in.l" #line 65 "cmFortranLexer.in.l"
#line 941 "cmFortranLexer.cxx" #line 960 "cmFortranLexer.cxx"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{ {
@ -965,13 +984,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 173 ) if ( yy_current_state >= 199 )
yy_c = yy_meta[(unsigned int) yy_c]; yy_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
++yy_cp; ++yy_cp;
} }
while ( yy_base[yy_current_state] != 535 ); while ( yy_base[yy_current_state] != 572 );
yy_find_action: yy_find_action:
yy_act = yy_accept[yy_current_state]; yy_act = yy_accept[yy_current_state];
@ -1193,40 +1212,60 @@ YY_RULE_SETUP
case 39: case 39:
YY_RULE_SETUP YY_RULE_SETUP
#line 154 "cmFortranLexer.in.l" #line 154 "cmFortranLexer.in.l"
{ return END; }
case 40:
YY_RULE_SETUP
#line 155 "cmFortranLexer.in.l"
{ return INCLUDE; }
case 41:
YY_RULE_SETUP
#line 156 "cmFortranLexer.in.l"
{ return INTERFACE; }
case 42:
YY_RULE_SETUP
#line 157 "cmFortranLexer.in.l"
{ return MODULE; }
case 43:
YY_RULE_SETUP
#line 158 "cmFortranLexer.in.l"
{ return USE; }
case 44:
YY_RULE_SETUP
#line 160 "cmFortranLexer.in.l"
{ {
yylvalp->string = strdup(yytext); yylvalp->string = strdup(yytext);
return WORD; return WORD;
} }
case 40: case 45:
YY_RULE_SETUP
#line 159 "cmFortranLexer.in.l"
{ return GARBAGE; }
case 41:
/* rule 41 can match eol */
YY_RULE_SETUP
#line 161 "cmFortranLexer.in.l"
{ return EOSTMT; }
case 42:
YY_RULE_SETUP
#line 164 "cmFortranLexer.in.l"
/* Ignore */
YY_BREAK
case 43:
/* rule 43 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 165 "cmFortranLexer.in.l" #line 165 "cmFortranLexer.in.l"
/* Ignore line-endings preceded by \ */ { return GARBAGE; }
YY_BREAK case 46:
case 44: /* rule 46 can match eol */
YY_RULE_SETUP YY_RULE_SETUP
#line 167 "cmFortranLexer.in.l" #line 167 "cmFortranLexer.in.l"
{ return EOSTMT; }
case 47:
YY_RULE_SETUP
#line 170 "cmFortranLexer.in.l"
/* Ignore */
YY_BREAK
case 48:
/* rule 48 can match eol */
YY_RULE_SETUP
#line 171 "cmFortranLexer.in.l"
/* Ignore line-endings preceded by \ */
YY_BREAK
case 49:
YY_RULE_SETUP
#line 173 "cmFortranLexer.in.l"
{ return *yytext; } { return *yytext; }
case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(free_fmt): case YY_STATE_EOF(free_fmt):
case YY_STATE_EOF(fixed_fmt): case YY_STATE_EOF(fixed_fmt):
case YY_STATE_EOF(str_sq): case YY_STATE_EOF(str_sq):
case YY_STATE_EOF(str_dq): case YY_STATE_EOF(str_dq):
#line 169 "cmFortranLexer.in.l" #line 175 "cmFortranLexer.in.l"
{ {
if(!cmFortranParser_FilePop(yyextra) ) if(!cmFortranParser_FilePop(yyextra) )
{ {
@ -1234,12 +1273,12 @@ case YY_STATE_EOF(str_dq):
} }
} }
YY_BREAK YY_BREAK
case 45: case 50:
YY_RULE_SETUP YY_RULE_SETUP
#line 176 "cmFortranLexer.in.l" #line 182 "cmFortranLexer.in.l"
ECHO; ECHO;
YY_BREAK YY_BREAK
#line 1276 "cmFortranLexer.cxx" #line 1320 "cmFortranLexer.cxx"
case YY_END_OF_BUFFER: case YY_END_OF_BUFFER:
{ {
@ -1533,7 +1572,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 173 ) if ( yy_current_state >= 199 )
yy_c = yy_meta[(unsigned int) yy_c]; yy_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
@ -1562,11 +1601,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{ {
yy_current_state = (int) yy_def[yy_current_state]; yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 173 ) if ( yy_current_state >= 199 )
yy_c = yy_meta[(unsigned int) yy_c]; yy_c = yy_meta[(unsigned int) yy_c];
} }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
yy_is_jam = (yy_current_state == 172); yy_is_jam = (yy_current_state == 198);
(void)yyg; (void)yyg;
return yy_is_jam ? 0 : yy_current_state; return yy_is_jam ? 0 : yy_current_state;
@ -2408,7 +2447,7 @@ void cmFortran_yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables" #define YYTABLES_NAME "yytables"
#line 176 "cmFortranLexer.in.l" #line 182 "cmFortranLexer.in.l"

View File

@ -337,7 +337,7 @@ extern int cmFortran_yylex (yyscan_t yyscanner);
#undef YY_DECL #undef YY_DECL
#endif #endif
#line 176 "cmFortranLexer.in.l" #line 182 "cmFortranLexer.in.l"
#line 344 "cmFortranLexer.h" #line 344 "cmFortranLexer.h"

View File

@ -151,6 +151,12 @@ $[ \t]*endif { return F90PPR_ENDIF; }
=|=> { return ASSIGNMENT_OP; } =|=> { return ASSIGNMENT_OP; }
[Ee][Nn][Dd] { return END; }
[Ii][Nn][Cc][Ll][Uu][Dd][Ee] { return INCLUDE; }
[Ii][Nn][Tt][Ee][Rr][Ff][Aa][Cc][Ee] { return INTERFACE; }
[Mm][Oo][Dd][Uu][Ll][Ee] { return MODULE; }
[Uu][Ss][Ee] { return USE; }
[a-zA-Z_][a-zA-Z_0-9]* { [a-zA-Z_][a-zA-Z_0-9]* {
yylvalp->string = strdup(yytext); yylvalp->string = strdup(yytext);
return WORD; return WORD;

View File

@ -123,12 +123,6 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* message)
cmFortranParser_Error(parser, message); cmFortranParser_Error(parser, message);
} }
static bool cmFortranParserIsKeyword(const char* word,
const char* keyword)
{
return cmsysString_strcasecmp(word, keyword) == 0;
}
/* Disable some warnings in the generated code. */ /* Disable some warnings in the generated code. */
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4102) /* Unused goto label. */
@ -139,7 +133,7 @@ static bool cmFortranParserIsKeyword(const char* word,
# pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */ # pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */
#endif #endif
#line 143 "cmFortranParser.cxx" /* yacc.c:339 */ #line 137 "cmFortranParser.cxx" /* yacc.c:339 */
# ifndef YY_NULLPTR # ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus # if defined __cplusplus && 201103L <= __cplusplus
@ -202,7 +196,12 @@ extern int cmFortran_yydebug;
UNTERMINATED_STRING = 283, UNTERMINATED_STRING = 283,
STRING = 284, STRING = 284,
WORD = 285, WORD = 285,
CPP_INCLUDE_ANGLE = 286 CPP_INCLUDE_ANGLE = 286,
END = 287,
INCLUDE = 288,
INTERFACE = 289,
MODULE = 290,
USE = 291
}; };
#endif #endif
/* Tokens. */ /* Tokens. */
@ -235,17 +234,22 @@ extern int cmFortran_yydebug;
#define STRING 284 #define STRING 284
#define WORD 285 #define WORD 285
#define CPP_INCLUDE_ANGLE 286 #define CPP_INCLUDE_ANGLE 286
#define END 287
#define INCLUDE 288
#define INTERFACE 289
#define MODULE 290
#define USE 291
/* Value type. */ /* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE union YYSTYPE
{ {
#line 81 "cmFortranParser.y" /* yacc.c:355 */ #line 75 "cmFortranParser.y" /* yacc.c:355 */
char* string; char* string;
#line 249 "cmFortranParser.cxx" /* yacc.c:355 */ #line 253 "cmFortranParser.cxx" /* yacc.c:355 */
}; };
typedef union YYSTYPE YYSTYPE; typedef union YYSTYPE YYSTYPE;
@ -261,7 +265,7 @@ int cmFortran_yyparse (yyscan_t yyscanner);
/* Copy the second part of user declarations. */ /* Copy the second part of user declarations. */
#line 265 "cmFortranParser.cxx" /* yacc.c:358 */ #line 269 "cmFortranParser.cxx" /* yacc.c:358 */
#ifdef short #ifdef short
# undef short # undef short
@ -503,21 +507,21 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */ /* YYFINAL -- State number of the termination state. */
#define YYFINAL 2 #define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */ /* YYLAST -- Last index in YYTABLE. */
#define YYLAST 216 #define YYLAST 469
/* YYNTOKENS -- Number of terminals. */ /* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 32 #define YYNTOKENS 37
/* YYNNTS -- Number of nonterminals. */ /* YYNNTS -- Number of nonterminals. */
#define YYNNTS 14 #define YYNNTS 14
/* YYNRULES -- Number of rules. */ /* YYNRULES -- Number of rules. */
#define YYNRULES 49 #define YYNRULES 57
/* YYNSTATES -- Number of states. */ /* YYNSTATES -- Number of states. */
#define YYNSTATES 91 #define YYNSTATES 109
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */ by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2 #define YYUNDEFTOK 2
#define YYMAXUTOK 286 #define YYMAXUTOK 291
#define YYTRANSLATE(YYX) \ #define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@ -554,18 +558,20 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36
}; };
#if YYDEBUG #if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] = static const yytype_uint8 yyrline[] =
{ {
0, 103, 103, 103, 106, 113, 131, 139, 149, 157, 0, 102, 102, 102, 105, 109, 114, 119, 124, 128,
162, 167, 172, 177, 182, 187, 192, 196, 200, 204, 133, 141, 146, 151, 156, 161, 166, 171, 176, 181,
208, 209, 214, 214, 214, 215, 215, 216, 216, 217, 185, 189, 193, 197, 198, 203, 203, 203, 204, 204,
217, 218, 218, 219, 219, 220, 220, 221, 221, 222, 205, 205, 206, 206, 207, 207, 208, 208, 209, 209,
222, 223, 223, 226, 227, 228, 229, 230, 231, 232 210, 210, 211, 211, 212, 212, 215, 216, 217, 218,
219, 220, 221, 222, 223, 224, 225, 226
}; };
#endif #endif
@ -580,9 +586,9 @@ static const char *const yytname[] =
"CPP_IFNDEF", "CPP_IF", "CPP_ELSE", "CPP_ELIF", "CPP_ENDIF", "CPP_IFNDEF", "CPP_IF", "CPP_ELSE", "CPP_ELIF", "CPP_ENDIF",
"F90PPR_IFDEF", "F90PPR_IFNDEF", "F90PPR_IF", "F90PPR_ELSE", "F90PPR_IFDEF", "F90PPR_IFNDEF", "F90PPR_IF", "F90PPR_ELSE",
"F90PPR_ELIF", "F90PPR_ENDIF", "COMMA", "DCOLON", "UNTERMINATED_STRING", "F90PPR_ELIF", "F90PPR_ENDIF", "COMMA", "DCOLON", "UNTERMINATED_STRING",
"STRING", "WORD", "CPP_INCLUDE_ANGLE", "$accept", "code", "stmt", "STRING", "WORD", "CPP_INCLUDE_ANGLE", "END", "INCLUDE", "INTERFACE",
"include", "define", "undef", "ifdef", "ifndef", "if", "elif", "else", "MODULE", "USE", "$accept", "code", "stmt", "include", "define", "undef",
"endif", "other", "misc_code", YY_NULLPTR "ifdef", "ifndef", "if", "elif", "else", "endif", "other", "misc_code", YY_NULLPTR
}; };
#endif #endif
@ -594,14 +600,14 @@ static const yytype_uint16 yytoknum[] =
0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286 285, 286, 287, 288, 289, 290, 291
}; };
# endif # endif
#define YYPACT_NINF -34 #define YYPACT_NINF -38
#define yypact_value_is_default(Yystate) \ #define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-34))) (!!((Yystate) == (-38)))
#define YYTABLE_NINF -1 #define YYTABLE_NINF -1
@ -612,16 +618,17 @@ static const yytype_uint16 yytoknum[] =
STATE-NUM. */ STATE-NUM. */
static const yytype_int16 yypact[] = static const yytype_int16 yypact[] =
{ {
-34, 18, -34, 1, -34, -23, -34, -34, -34, -34, -38, 39, -38, 3, -38, -20, -38, -38, -38, -38,
-34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
-34, -34, -34, -34, -34, 186, -34, -34, -22, -19, -38, -38, -38, -38, -38, -38, -22, -16, 1, -8,
-13, -10, -8, -34, -34, -34, -34, -34, -34, -34, -6, -38, -4, -7, -3, -2, -1, -38, -38, -38,
17, 23, -34, -34, 41, -34, -34, -34, -34, -34, -38, -38, -38, 62, -38, -38, -38, -38, -38, 0,
47, 52, 57, 85, 90, 31, -34, 95, 100, -34, 2, -38, -38, -38, -38, -38, -38, 73, 107, 118,
-34, -34, -34, -34, -34, -34, -34, -34, 105, 133, 152, 163, -38, -38, -38, -38, -38, -38, -38, -38,
138, 143, 148, -34, -34, -34, -34, -34, 29, 153, -38, -38, -38, -38, -38, -38, 197, 208, 242, 253,
-34, -34, -34, -34, -34, -34, -34, -34, -34, 181, 6, -38, 287, 298, 332, 343, 377, 388, -38, -38,
-34 -38, -38, -38, -38, -38, -38, -38, 4, 422, -38,
-38, -38, -38, -38, -38, -38, -38, 433, -38
}; };
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@ -629,30 +636,31 @@ static const yytype_int16 yypact[] =
means the default is an error. */ means the default is an error. */
static const yytype_uint8 yydefact[] = static const yytype_uint8 yydefact[] =
{ {
2, 0, 1, 0, 20, 0, 22, 23, 24, 26, 2, 0, 1, 0, 23, 0, 25, 26, 27, 29,
25, 28, 27, 29, 31, 33, 37, 35, 39, 30, 28, 31, 30, 32, 34, 36, 40, 38, 42, 33,
32, 34, 38, 36, 40, 0, 41, 3, 0, 0, 35, 37, 41, 39, 43, 44, 0, 0, 0, 0,
0, 0, 0, 41, 41, 41, 41, 21, 41, 4, 0, 3, 0, 0, 0, 0, 0, 44, 44, 44,
0, 0, 41, 41, 0, 41, 41, 41, 41, 41, 44, 24, 44, 0, 44, 44, 4, 44, 44, 0,
0, 0, 0, 0, 0, 0, 41, 0, 0, 10, 0, 44, 44, 44, 44, 44, 44, 0, 0, 0,
46, 45, 48, 47, 49, 44, 43, 42, 0, 0, 0, 0, 13, 54, 53, 56, 55, 57, 52, 46,
0, 0, 0, 16, 17, 18, 19, 9, 0, 0, 47, 48, 49, 50, 51, 45, 0, 0, 0, 0,
8, 5, 11, 12, 13, 14, 15, 41, 6, 0, 0, 44, 0, 0, 0, 0, 0, 0, 19, 20,
7 21, 22, 12, 8, 11, 7, 6, 0, 0, 5,
14, 15, 16, 17, 18, 44, 9, 0, 10
}; };
/* YYPGOTO[NTERM-NUM]. */ /* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] = static const yytype_int8 yypgoto[] =
{ {
-34, -34, -34, -34, -34, -34, -34, -34, -34, -34, -38, -38, -38, -38, -38, -38, -38, -38, -38, -38,
-34, -34, -33, -34 -38, -38, -37, -38
}; };
/* YYDEFGOTO[NTERM-NUM]. */ /* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] = static const yytype_int8 yydefgoto[] =
{ {
-1, 1, 27, 28, 29, 30, 31, 32, 33, 34, -1, 1, 31, 32, 33, 34, 35, 36, 37, 38,
35, 36, 44, 67 39, 40, 43, 75
}; };
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
@ -660,90 +668,143 @@ static const yytype_int8 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */ number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_uint8 yytable[] = static const yytype_uint8 yytable[] =
{ {
50, 51, 52, 53, 37, 54, 38, 45, 0, 57, 57, 58, 59, 60, 46, 61, 41, 76, 77, 42,
58, 46, 68, 69, 70, 71, 72, 47, 2, 3, 78, 79, 44, 45, 82, 83, 84, 85, 86, 87,
48, 4, 49, 79, 5, 6, 7, 8, 9, 10, 49, 50, 48, 53, 51, 52, 0, 54, 55, 56,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 80, 47, 81, 97, 105, 0, 0, 0, 0, 2,
21, 22, 23, 24, 59, 60, 61, 55, 25, 26, 3, 0, 4, 0, 98, 5, 6, 7, 8, 9,
73, 60, 61, 56, 89, 74, 60, 61, 78, 87, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
75, 60, 61, 0, 0, 0, 0, 62, 63, 64, 20, 21, 22, 23, 24, 62, 63, 64, 107, 0,
65, 66, 0, 62, 63, 64, 65, 66, 62, 63, 25, 26, 27, 28, 29, 30, 88, 63, 64, 0,
64, 65, 66, 62, 63, 64, 65, 66, 76, 60, 0, 0, 0, 0, 0, 0, 0, 0, 65, 66,
61, 0, 0, 77, 60, 61, 0, 0, 80, 60, 67, 68, 69, 0, 70, 71, 72, 73, 74, 65,
61, 0, 0, 81, 60, 61, 0, 0, 82, 60, 66, 67, 68, 69, 0, 70, 71, 72, 73, 74,
61, 62, 63, 64, 65, 66, 62, 63, 64, 65, 89, 63, 64, 0, 0, 0, 0, 0, 0, 0,
66, 62, 63, 64, 65, 66, 62, 63, 64, 65, 0, 90, 63, 64, 0, 0, 0, 0, 0, 0,
66, 62, 63, 64, 65, 66, 83, 60, 61, 0, 0, 0, 0, 65, 66, 67, 68, 69, 0, 70,
0, 84, 60, 61, 0, 0, 85, 60, 61, 0, 71, 72, 73, 74, 65, 66, 67, 68, 69, 0,
0, 86, 60, 61, 0, 0, 88, 60, 61, 62, 70, 71, 72, 73, 74, 91, 63, 64, 0, 0,
63, 64, 65, 66, 62, 63, 64, 65, 66, 62, 0, 0, 0, 0, 0, 0, 92, 63, 64, 0,
63, 64, 65, 66, 62, 63, 64, 65, 66, 62, 0, 0, 0, 0, 0, 0, 0, 0, 65, 66,
63, 64, 65, 66, 90, 60, 61, 0, 0, 39, 67, 68, 69, 0, 70, 71, 72, 73, 74, 65,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, 67, 68, 69, 0, 70, 71, 72, 73, 74,
0, 0, 0, 0, 0, 0, 0, 62, 63, 64, 93, 63, 64, 0, 0, 0, 0, 0, 0, 0,
65, 66, 40, 41, 0, 42, 43 0, 94, 63, 64, 0, 0, 0, 0, 0, 0,
0, 0, 0, 65, 66, 67, 68, 69, 0, 70,
71, 72, 73, 74, 65, 66, 67, 68, 69, 0,
70, 71, 72, 73, 74, 95, 63, 64, 0, 0,
0, 0, 0, 0, 0, 0, 96, 63, 64, 0,
0, 0, 0, 0, 0, 0, 0, 0, 65, 66,
67, 68, 69, 0, 70, 71, 72, 73, 74, 65,
66, 67, 68, 69, 0, 70, 71, 72, 73, 74,
99, 63, 64, 0, 0, 0, 0, 0, 0, 0,
0, 100, 63, 64, 0, 0, 0, 0, 0, 0,
0, 0, 0, 65, 66, 67, 68, 69, 0, 70,
71, 72, 73, 74, 65, 66, 67, 68, 69, 0,
70, 71, 72, 73, 74, 101, 63, 64, 0, 0,
0, 0, 0, 0, 0, 0, 102, 63, 64, 0,
0, 0, 0, 0, 0, 0, 0, 0, 65, 66,
67, 68, 69, 0, 70, 71, 72, 73, 74, 65,
66, 67, 68, 69, 0, 70, 71, 72, 73, 74,
103, 63, 64, 0, 0, 0, 0, 0, 0, 0,
0, 104, 63, 64, 0, 0, 0, 0, 0, 0,
0, 0, 0, 65, 66, 67, 68, 69, 0, 70,
71, 72, 73, 74, 65, 66, 67, 68, 69, 0,
70, 71, 72, 73, 74, 106, 63, 64, 0, 0,
0, 0, 0, 0, 0, 0, 108, 63, 64, 0,
0, 0, 0, 0, 0, 0, 0, 0, 65, 66,
67, 68, 69, 0, 70, 71, 72, 73, 74, 65,
66, 67, 68, 69, 0, 70, 71, 72, 73, 74
}; };
static const yytype_int8 yycheck[] = static const yytype_int8 yycheck[] =
{ {
33, 34, 35, 36, 3, 38, 29, 29, -1, 42, 37, 38, 39, 40, 3, 42, 3, 44, 45, 29,
43, 30, 45, 46, 47, 48, 49, 30, 0, 1, 47, 48, 34, 29, 51, 52, 53, 54, 55, 56,
30, 3, 30, 56, 6, 7, 8, 9, 10, 11, 26, 27, 30, 30, 30, 29, -1, 30, 30, 30,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 30, 30, 30, 27, 30, -1, -1, -1, -1, 0,
22, 23, 24, 25, 3, 4, 5, 30, 30, 31, 1, -1, 3, -1, 81, 6, 7, 8, 9, 10,
3, 4, 5, 30, 87, 3, 4, 5, 27, 30, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
3, 4, 5, -1, -1, -1, -1, 26, 27, 28, 21, 22, 23, 24, 25, 3, 4, 5, 105, -1,
29, 30, -1, 26, 27, 28, 29, 30, 26, 27, 31, 32, 33, 34, 35, 36, 3, 4, 5, -1,
28, 29, 30, 26, 27, 28, 29, 30, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, 26, 27,
5, -1, -1, 3, 4, 5, -1, -1, 3, 4, 28, 29, 30, -1, 32, 33, 34, 35, 36, 26,
5, -1, -1, 3, 4, 5, -1, -1, 3, 4, 27, 28, 29, 30, -1, 32, 33, 34, 35, 36,
5, 26, 27, 28, 29, 30, 26, 27, 28, 29, 3, 4, 5, -1, -1, -1, -1, -1, -1, -1,
30, 26, 27, 28, 29, 30, 26, 27, 28, 29, -1, 3, 4, 5, -1, -1, -1, -1, -1, -1,
30, 26, 27, 28, 29, 30, 3, 4, 5, -1, -1, -1, -1, 26, 27, 28, 29, 30, -1, 32,
-1, 3, 4, 5, -1, -1, 3, 4, 5, -1, 33, 34, 35, 36, 26, 27, 28, 29, 30, -1,
-1, 3, 4, 5, -1, -1, 3, 4, 5, 26, 32, 33, 34, 35, 36, 3, 4, 5, -1, -1,
27, 28, 29, 30, 26, 27, 28, 29, 30, 26, -1, -1, -1, -1, -1, -1, 3, 4, 5, -1,
27, 28, 29, 30, 26, 27, 28, 29, 30, 26, -1, -1, -1, -1, -1, -1, -1, -1, 26, 27,
27, 28, 29, 30, 3, 4, 5, -1, -1, 3, 28, 29, 30, -1, 32, 33, 34, 35, 36, 26,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 27, 28, 29, 30, -1, 32, 33, 34, 35, 36,
-1, -1, -1, -1, -1, -1, -1, 26, 27, 28, 3, 4, 5, -1, -1, -1, -1, -1, -1, -1,
29, 30, 26, 27, -1, 29, 30 -1, 3, 4, 5, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 26, 27, 28, 29, 30, -1, 32,
33, 34, 35, 36, 26, 27, 28, 29, 30, -1,
32, 33, 34, 35, 36, 3, 4, 5, -1, -1,
-1, -1, -1, -1, -1, -1, 3, 4, 5, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 26, 27,
28, 29, 30, -1, 32, 33, 34, 35, 36, 26,
27, 28, 29, 30, -1, 32, 33, 34, 35, 36,
3, 4, 5, -1, -1, -1, -1, -1, -1, -1,
-1, 3, 4, 5, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 26, 27, 28, 29, 30, -1, 32,
33, 34, 35, 36, 26, 27, 28, 29, 30, -1,
32, 33, 34, 35, 36, 3, 4, 5, -1, -1,
-1, -1, -1, -1, -1, -1, 3, 4, 5, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 26, 27,
28, 29, 30, -1, 32, 33, 34, 35, 36, 26,
27, 28, 29, 30, -1, 32, 33, 34, 35, 36,
3, 4, 5, -1, -1, -1, -1, -1, -1, -1,
-1, 3, 4, 5, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 26, 27, 28, 29, 30, -1, 32,
33, 34, 35, 36, 26, 27, 28, 29, 30, -1,
32, 33, 34, 35, 36, 3, 4, 5, -1, -1,
-1, -1, -1, -1, -1, -1, 3, 4, 5, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 26, 27,
28, 29, 30, -1, 32, 33, 34, 35, 36, 26,
27, 28, 29, 30, -1, 32, 33, 34, 35, 36
}; };
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */ symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] = static const yytype_uint8 yystos[] =
{ {
0, 33, 0, 1, 3, 6, 7, 8, 9, 10, 0, 38, 0, 1, 3, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 30, 31, 34, 35, 36, 21, 22, 23, 24, 25, 31, 32, 33, 34, 35,
37, 38, 39, 40, 41, 42, 43, 3, 29, 3, 36, 39, 40, 41, 42, 43, 44, 45, 46, 47,
26, 27, 29, 30, 44, 29, 30, 30, 30, 30, 48, 3, 29, 49, 34, 29, 3, 30, 30, 26,
44, 44, 44, 44, 44, 30, 30, 44, 44, 3, 27, 30, 29, 30, 30, 30, 30, 49, 49, 49,
4, 5, 26, 27, 28, 29, 30, 45, 44, 44, 49, 49, 3, 4, 5, 26, 27, 28, 29, 30,
44, 44, 44, 3, 3, 3, 3, 3, 27, 44, 32, 33, 34, 35, 36, 50, 49, 49, 49, 49,
3, 3, 3, 3, 3, 3, 3, 30, 3, 44, 30, 30, 49, 49, 49, 49, 49, 49, 3, 3,
3 3, 3, 3, 3, 3, 3, 3, 27, 49, 3,
3, 3, 3, 3, 3, 30, 3, 49, 3
}; };
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] = static const yytype_uint8 yyr1[] =
{ {
0, 32, 33, 33, 34, 34, 34, 34, 34, 34, 0, 37, 38, 38, 39, 39, 39, 39, 39, 39,
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
34, 34, 35, 35, 35, 36, 36, 37, 37, 38, 39, 39, 39, 39, 39, 40, 40, 40, 41, 41,
38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46,
43, 44, 44, 45, 45, 45, 45, 45, 45, 45 47, 47, 48, 48, 49, 49, 50, 50, 50, 50,
50, 50, 50, 50, 50, 50, 50, 50
}; };
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const yytype_uint8 yyr2[] = static const yytype_uint8 yyr2[] =
{ {
0, 2, 0, 2, 2, 4, 5, 7, 4, 4, 0, 2, 0, 2, 2, 4, 4, 4, 4, 5,
3, 4, 4, 4, 4, 4, 3, 3, 3, 3, 7, 4, 4, 3, 4, 4, 4, 4, 4, 3,
1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1, 2, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 2, 1, 1, 1, 1, 1, 1, 1 1, 1, 1, 1, 0, 2, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1
}; };
@ -1426,201 +1487,206 @@ yyreduce:
switch (yyn) switch (yyn)
{ {
case 4: case 4:
#line 106 "cmFortranParser.y" /* yacc.c:1646 */ #line 105 "cmFortranParser.y" /* yacc.c:1646 */
{ {
if (cmFortranParserIsKeyword((yyvsp[-1].string), "interface")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_SetInInterface(parser, true);
cmFortranParser_SetInInterface(parser, true);
}
free((yyvsp[-1].string));
} }
#line 1438 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1496 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 5: case 5:
#line 113 "cmFortranParser.y" /* yacc.c:1646 */ #line 109 "cmFortranParser.y" /* yacc.c:1646 */
{ {
if (cmFortranParserIsKeyword((yyvsp[-3].string), "use")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUse(parser, (yyvsp[-2].string));
cmFortranParser_RuleUse(parser, (yyvsp[-2].string));
} else if (cmFortranParserIsKeyword((yyvsp[-3].string), "module")) {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleModule(parser, (yyvsp[-2].string));
} else if (cmFortranParserIsKeyword((yyvsp[-3].string), "interface")) {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, true);
} else if (cmFortranParserIsKeyword((yyvsp[-2].string), "interface") &&
cmFortranParserIsKeyword((yyvsp[-3].string), "end")) {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, false);
}
free((yyvsp[-3].string));
free((yyvsp[-2].string)); free((yyvsp[-2].string));
} }
#line 1461 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1506 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 6: case 6:
#line 131 "cmFortranParser.y" /* yacc.c:1646 */ #line 114 "cmFortranParser.y" /* yacc.c:1646 */
{ {
if (cmFortranParserIsKeyword((yyvsp[-4].string), "use")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleModule(parser, (yyvsp[-2].string));
cmFortranParser_RuleUse(parser, (yyvsp[-2].string));
}
free((yyvsp[-4].string));
free((yyvsp[-2].string)); free((yyvsp[-2].string));
} }
#line 1474 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1516 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 7: case 7:
#line 139 "cmFortranParser.y" /* yacc.c:1646 */ #line 119 "cmFortranParser.y" /* yacc.c:1646 */
{ {
if (cmFortranParserIsKeyword((yyvsp[-6].string), "use") && cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParserIsKeyword((yyvsp[-4].string), "non_intrinsic") ) { cmFortranParser_SetInInterface(parser, true);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, (yyvsp[-2].string));
}
free((yyvsp[-6].string));
free((yyvsp[-4].string));
free((yyvsp[-2].string)); free((yyvsp[-2].string));
} }
#line 1489 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1526 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 8: case 8:
#line 149 "cmFortranParser.y" /* yacc.c:1646 */ #line 124 "cmFortranParser.y" /* yacc.c:1646 */
{ {
if (cmFortranParserIsKeyword((yyvsp[-3].string), "include")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_SetInInterface(parser, false);
cmFortranParser_RuleInclude(parser, (yyvsp[-2].string));
}
free((yyvsp[-3].string));
free((yyvsp[-2].string));
} }
#line 1502 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1535 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 9: case 9:
#line 157 "cmFortranParser.y" /* yacc.c:1646 */ #line 128 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
#line 1545 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 10:
#line 133 "cmFortranParser.y" /* yacc.c:1646 */
{
if (cmsysString_strcasecmp((yyvsp[-4].string), "non_intrinsic") == 0) {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, (yyvsp[-2].string));
}
free((yyvsp[-4].string));
free((yyvsp[-2].string));
}
#line 1558 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 11:
#line 141 "cmFortranParser.y" /* yacc.c:1646 */
{
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, (yyvsp[-2].string));
free((yyvsp[-2].string));
}
#line 1568 "cmFortranParser.cxx" /* yacc.c:1646 */
break;
case 12:
#line 146 "cmFortranParser.y" /* yacc.c:1646 */
{ {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleLineDirective(parser, (yyvsp[-2].string)); cmFortranParser_RuleLineDirective(parser, (yyvsp[-2].string));
free((yyvsp[-2].string)); free((yyvsp[-2].string));
} }
#line 1512 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1578 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 10: case 13:
#line 162 "cmFortranParser.y" /* yacc.c:1646 */ #line 151 "cmFortranParser.y" /* yacc.c:1646 */
{ {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string));
free((yyvsp[-2].string)); free((yyvsp[-2].string));
} }
#line 1522 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1588 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 11: case 14:
#line 167 "cmFortranParser.y" /* yacc.c:1646 */ #line 156 "cmFortranParser.y" /* yacc.c:1646 */
{ {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string));
free((yyvsp[-2].string)); free((yyvsp[-2].string));
} }
#line 1532 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1598 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 12: case 15:
#line 172 "cmFortranParser.y" /* yacc.c:1646 */ #line 161 "cmFortranParser.y" /* yacc.c:1646 */
{ {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleDefine(parser, (yyvsp[-2].string)); cmFortranParser_RuleDefine(parser, (yyvsp[-2].string));
free((yyvsp[-2].string)); free((yyvsp[-2].string));
} }
#line 1542 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1608 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 13: case 16:
#line 177 "cmFortranParser.y" /* yacc.c:1646 */ #line 166 "cmFortranParser.y" /* yacc.c:1646 */
{ {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUndef(parser, (yyvsp[-2].string)); cmFortranParser_RuleUndef(parser, (yyvsp[-2].string));
free((yyvsp[-2].string)); free((yyvsp[-2].string));
} }
#line 1552 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1618 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 14: case 17:
#line 182 "cmFortranParser.y" /* yacc.c:1646 */ #line 171 "cmFortranParser.y" /* yacc.c:1646 */
{ {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIfdef(parser, (yyvsp[-2].string)); cmFortranParser_RuleIfdef(parser, (yyvsp[-2].string));
free((yyvsp[-2].string)); free((yyvsp[-2].string));
} }
#line 1562 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1628 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 15: case 18:
#line 187 "cmFortranParser.y" /* yacc.c:1646 */ #line 176 "cmFortranParser.y" /* yacc.c:1646 */
{ {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIfndef(parser, (yyvsp[-2].string)); cmFortranParser_RuleIfndef(parser, (yyvsp[-2].string));
free((yyvsp[-2].string)); free((yyvsp[-2].string));
} }
#line 1572 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1638 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 16: case 19:
#line 192 "cmFortranParser.y" /* yacc.c:1646 */ #line 181 "cmFortranParser.y" /* yacc.c:1646 */
{ {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleIf(parser); cmFortranParser_RuleIf(parser);
} }
#line 1581 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1647 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 17: case 20:
#line 196 "cmFortranParser.y" /* yacc.c:1646 */ #line 185 "cmFortranParser.y" /* yacc.c:1646 */
{ {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleElif(parser); cmFortranParser_RuleElif(parser);
} }
#line 1590 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1656 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 18: case 21:
#line 200 "cmFortranParser.y" /* yacc.c:1646 */ #line 189 "cmFortranParser.y" /* yacc.c:1646 */
{ {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleElse(parser); cmFortranParser_RuleElse(parser);
} }
#line 1599 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1665 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 19: case 22:
#line 204 "cmFortranParser.y" /* yacc.c:1646 */ #line 193 "cmFortranParser.y" /* yacc.c:1646 */
{ {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleEndif(parser); cmFortranParser_RuleEndif(parser);
} }
#line 1608 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1674 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 43: case 46:
#line 226 "cmFortranParser.y" /* yacc.c:1646 */ #line 215 "cmFortranParser.y" /* yacc.c:1646 */
{ free ((yyvsp[0].string)); } { free ((yyvsp[0].string)); }
#line 1614 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1680 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
case 44: case 52:
#line 227 "cmFortranParser.y" /* yacc.c:1646 */ #line 221 "cmFortranParser.y" /* yacc.c:1646 */
{ free ((yyvsp[0].string)); } { free ((yyvsp[0].string)); }
#line 1620 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1686 "cmFortranParser.cxx" /* yacc.c:1646 */
break; break;
#line 1624 "cmFortranParser.cxx" /* yacc.c:1646 */ #line 1690 "cmFortranParser.cxx" /* yacc.c:1646 */
default: break; default: break;
} }
/* User semantic actions sometimes alter yychar, and that requires /* User semantic actions sometimes alter yychar, and that requires
@ -1850,6 +1916,6 @@ yyreturn:
#endif #endif
return yyresult; return yyresult;
} }
#line 235 "cmFortranParser.y" /* yacc.c:1906 */ #line 229 "cmFortranParser.y" /* yacc.c:1906 */
/* End of grammar */ /* End of grammar */

View File

@ -52,12 +52,6 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* message)
cmFortranParser_Error(parser, message); cmFortranParser_Error(parser, message);
} }
static bool cmFortranParserIsKeyword(const char* word,
const char* keyword)
{
return cmsysString_strcasecmp(word, keyword) == 0;
}
/* Disable some warnings in the generated code. */ /* Disable some warnings in the generated code. */
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning (disable: 4102) /* Unused goto label. */ # pragma warning (disable: 4102) /* Unused goto label. */
@ -95,6 +89,11 @@ static bool cmFortranParserIsKeyword(const char* word,
%token <number> UNTERMINATED_STRING %token <number> UNTERMINATED_STRING
%token <string> STRING WORD %token <string> STRING WORD
%token <string> CPP_INCLUDE_ANGLE %token <string> CPP_INCLUDE_ANGLE
%token END
%token INCLUDE
%token INTERFACE
%token MODULE
%token USE
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* grammar */ /* grammar */
@ -103,55 +102,45 @@ static bool cmFortranParserIsKeyword(const char* word,
code: /* empty */ | code stmt; code: /* empty */ | code stmt;
stmt: stmt:
WORD EOSTMT { INTERFACE EOSTMT {
if (cmFortranParserIsKeyword($1, "interface")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_SetInInterface(parser, true);
cmFortranParser_SetInInterface(parser, true);
}
free($1);
} }
| WORD WORD other EOSTMT { | USE WORD other EOSTMT {
if (cmFortranParserIsKeyword($1, "use")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUse(parser, $2);
cmFortranParser_RuleUse(parser, $2);
} else if (cmFortranParserIsKeyword($1, "module")) {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleModule(parser, $2);
} else if (cmFortranParserIsKeyword($1, "interface")) {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, true);
} else if (cmFortranParserIsKeyword($2, "interface") &&
cmFortranParserIsKeyword($1, "end")) {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, false);
}
free($1);
free($2); free($2);
} }
| WORD DCOLON WORD other EOSTMT { | MODULE WORD other EOSTMT {
if (cmFortranParserIsKeyword($1, "use")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleModule(parser, $2);
cmFortranParser_RuleUse(parser, $3); free($2);
} }
free($1); | INTERFACE WORD other EOSTMT {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, true);
free($2);
}
| END INTERFACE other EOSTMT {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_SetInInterface(parser, false);
}
| USE DCOLON WORD other EOSTMT {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, $3);
free($3); free($3);
} }
| WORD COMMA WORD DCOLON WORD other EOSTMT { | USE COMMA WORD DCOLON WORD other EOSTMT {
if (cmFortranParserIsKeyword($1, "use") && if (cmsysString_strcasecmp($3, "non_intrinsic") == 0) {
cmFortranParserIsKeyword($3, "non_intrinsic") ) {
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser_RuleUse(parser, $5); cmFortranParser_RuleUse(parser, $5);
} }
free($1);
free($3); free($3);
free($5); free($5);
} }
| WORD STRING other EOSTMT { | INCLUDE STRING other EOSTMT {
if (cmFortranParserIsKeyword($1, "include")) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, $2);
cmFortranParser_RuleInclude(parser, $2);
}
free($1);
free($2); free($2);
} }
| CPP_LINE_DIRECTIVE STRING other EOSTMT { | CPP_LINE_DIRECTIVE STRING other EOSTMT {
@ -224,6 +213,11 @@ other: /* empty */ | other misc_code ;
misc_code: misc_code:
WORD { free ($1); } WORD { free ($1); }
| END
| INCLUDE
| INTERFACE
| MODULE
| USE
| STRING { free ($1); } | STRING { free ($1); }
| GARBAGE | GARBAGE
| ASSIGNMENT_OP | ASSIGNMENT_OP

View File

@ -73,7 +73,12 @@ extern int cmFortran_yydebug;
UNTERMINATED_STRING = 283, UNTERMINATED_STRING = 283,
STRING = 284, STRING = 284,
WORD = 285, WORD = 285,
CPP_INCLUDE_ANGLE = 286 CPP_INCLUDE_ANGLE = 286,
END = 287,
INCLUDE = 288,
INTERFACE = 289,
MODULE = 290,
USE = 291
}; };
#endif #endif
/* Tokens. */ /* Tokens. */
@ -106,17 +111,22 @@ extern int cmFortran_yydebug;
#define STRING 284 #define STRING 284
#define WORD 285 #define WORD 285
#define CPP_INCLUDE_ANGLE 286 #define CPP_INCLUDE_ANGLE 286
#define END 287
#define INCLUDE 288
#define INTERFACE 289
#define MODULE 290
#define USE 291
/* Value type. */ /* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE union YYSTYPE
{ {
#line 81 "cmFortranParser.y" /* yacc.c:1909 */ #line 75 "cmFortranParser.y" /* yacc.c:1909 */
char* string; char* string;
#line 120 "cmFortranParserTokens.h" /* yacc.c:1909 */ #line 130 "cmFortranParserTokens.h" /* yacc.c:1909 */
}; };
typedef union YYSTYPE YYSTYPE; typedef union YYSTYPE YYSTYPE;