diff options
-rw-r--r-- | Source/cmFortranLexer.cxx | 477 | ||||
-rw-r--r-- | Source/cmFortranLexer.h | 2 | ||||
-rw-r--r-- | Source/cmFortranLexer.in.l | 6 | ||||
-rw-r--r-- | Source/cmFortranParser.cxx | 464 | ||||
-rw-r--r-- | Source/cmFortranParser.y | 82 | ||||
-rw-r--r-- | Source/cmFortranParserTokens.h | 16 |
6 files changed, 581 insertions, 466 deletions
diff --git a/Source/cmFortranLexer.cxx b/Source/cmFortranLexer.cxx index 195c44951b..7bcd993685 100644 --- a/Source/cmFortranLexer.cxx +++ b/Source/cmFortranLexer.cxx @@ -347,8 +347,8 @@ static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 45 -#define YY_END_OF_BUFFER 46 +#define YY_NUM_RULES 50 +#define YY_END_OF_BUFFER 51 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -356,27 +356,30 @@ struct yy_trans_info flex_int32_t yy_verify; 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, - 46, 40, 42, 41, 44, 1, 40, 33, 2, 35, - 40, 41, 38, 40, 39, 40, 39, 42, 40, 41, - 40, 39, 9, 8, 9, 4, 3, 40, 0, 10, - 0, 0, 0, 0, 0, 33, 33, 34, 36, 38, - 40, 39, 0, 43, 39, 0, 0, 0, 12, 0, - 0, 0, 0, 0, 0, 40, 0, 11, 39, 0, - 0, 5, 0, 0, 0, 29, 0, 0, 33, 33, - 33, 33, 0, 0, 12, 12, 0, 0, 0, 23, - 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, + 51, 45, 47, 46, 49, 1, 45, 33, 2, 35, + 45, 46, 38, 45, 44, 44, 44, 44, 44, 45, + 44, 47, 45, 46, 45, 44, 9, 8, 9, 4, + 3, 45, 0, 10, 0, 0, 0, 0, 0, 33, + 33, 34, 36, 38, 45, 44, 44, 44, 44, 44, + 0, 48, 44, 0, 0, 0, 12, 0, 0, 0, + 0, 0, 0, 45, 0, 11, 44, 0, 0, 5, + 0, 0, 0, 29, 0, 0, 33, 33, 33, 33, + 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] = @@ -387,14 +390,14 @@ static yyconst YY_CHAR yy_ec[256] = 1, 5, 6, 7, 8, 9, 1, 10, 11, 1, 1, 12, 1, 13, 1, 1, 1, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 16, 17, - 18, 19, 20, 1, 21, 21, 22, 23, 24, 25, - 21, 21, 26, 21, 21, 27, 21, 28, 21, 21, - 21, 21, 29, 21, 30, 21, 21, 21, 21, 21, - 1, 31, 1, 1, 32, 1, 21, 21, 33, 34, - - 35, 36, 21, 21, 37, 21, 21, 38, 21, 39, - 21, 21, 21, 21, 40, 21, 41, 21, 21, 21, - 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, + 18, 19, 20, 1, 21, 22, 23, 24, 25, 26, + 22, 22, 27, 22, 22, 28, 29, 30, 31, 22, + 22, 32, 33, 34, 35, 22, 22, 22, 22, 22, + 1, 36, 1, 1, 37, 1, 21, 22, 38, 39, + + 40, 41, 22, 22, 42, 22, 22, 43, 29, 44, + 31, 22, 22, 32, 45, 34, 46, 22, 22, 22, + 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, @@ -411,195 +414,211 @@ static yyconst YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst YY_CHAR yy_meta[42] = +static yyconst YY_CHAR yy_meta[47] = { 0, 1, 2, 2, 3, 4, 3, 3, 1, 1, 3, 3, 1, 3, 5, 1, 3, 1, 3, 6, 1, 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, 7, 1, 5, 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, 40, 0, 41, 220, 48, 44, 54, 56, 65, - 220, 0, 535, 535, 216, 535, 81, 74, 535, 535, - 186, 535, 153, 145, 0, 85, 122, 87, 154, 155, - 195, 227, 535, 147, 91, 535, 535, 0, 147, 535, - 267, 34, 70, 74, 34, 122, 141, 535, 0, 535, - 112, 0, 98, 535, 0, 156, 307, 0, 143, 43, - 155, 151, 48, 101, 130, 348, 130, 535, 0, 121, - 197, 165, 172, 244, 182, 183, 191, 248, 273, 293, - 308, 314, 321, 246, 275, 216, 269, 299, 304, 327, - 307, 304, 312, 116, 107, 367, 535, 327, 334, 347, - - 347, 350, 352, 349, 354, 359, 357, 363, 366, 365, - 369, 372, 369, 373, 374, 101, 86, 372, 535, 535, - 378, 380, 386, 382, 388, 388, 389, 535, 535, 393, - 394, 396, 392, 430, 400, 56, 47, 403, 535, 535, - 409, 414, 535, 409, 416, 535, 535, 416, 419, 441, - 535, 117, 0, 535, 535, 423, 426, 535, 535, 430, - 535, 535, 535, 535, 432, 457, 535, 459, 0, 25, - 535, 535, 476, 483, 489, 492, 499, 506, 513, 520, - 527 + 0, 45, 0, 46, 392, 53, 49, 59, 61, 71, + 392, 0, 572, 572, 364, 572, 91, 77, 572, 572, + 342, 572, 317, 232, 0, 19, 42, 218, 40, 92, + 137, 96, 174, 240, 220, 257, 572, 238, 97, 572, + 572, 0, 205, 572, 302, 50, 77, 83, 59, 137, + 156, 572, 0, 572, 123, 0, 84, 130, 90, 92, + 167, 572, 0, 176, 347, 0, 190, 94, 175, 200, + 121, 92, 201, 393, 193, 572, 0, 162, 222, 175, + 171, 209, 176, 281, 184, 207, 307, 313, 328, 348, + 338, 111, 0, 205, 213, 125, 0, 354, 185, 280, + + 336, 300, 340, 309, 278, 321, 139, 130, 245, 572, + 335, 347, 351, 356, 360, 375, 375, 379, 383, 300, + 80, 381, 384, 390, 392, 393, 397, 399, 397, 402, + 403, 106, 105, 284, 572, 572, 407, 408, 411, 320, + 413, 413, 420, 419, 421, 420, 572, 572, 421, 426, + 428, 420, 467, 432, 101, 83, 438, 572, 572, 439, + 446, 572, 436, 449, 63, 0, 450, 572, 572, 450, + 453, 481, 572, 64, 0, 572, 572, 454, 460, 0, + 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, - 172, 1, 1, 1, 1, 1, 173, 173, 173, 173, - 172, 174, 172, 172, 175, 172, 174, 172, 172, 172, - 174, 172, 172, 174, 176, 174, 176, 172, 172, 172, - 177, 172, 172, 172, 172, 172, 172, 174, 175, 172, - 172, 172, 172, 172, 172, 172, 178, 172, 174, 172, - 174, 176, 172, 172, 27, 172, 172, 57, 174, 172, - 172, 172, 172, 172, 172, 177, 177, 172, 32, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 178, 178, - 178, 178, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 179, 180, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 181, 181, - 172, 0, 172, 172, 172, 172, 172, 172, 172, 172, - 172 + 198, 1, 1, 1, 1, 1, 199, 199, 199, 199, + 198, 200, 198, 198, 201, 198, 200, 198, 198, 198, + 200, 198, 198, 200, 202, 202, 202, 202, 202, 200, + 202, 198, 198, 198, 203, 198, 198, 198, 198, 198, + 198, 200, 201, 198, 198, 198, 198, 198, 198, 198, + 204, 198, 200, 198, 200, 202, 202, 202, 202, 202, + 198, 198, 31, 198, 198, 65, 200, 198, 198, 198, + 198, 198, 198, 203, 203, 198, 36, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 204, 204, 204, 204, + 198, 198, 202, 202, 202, 202, 202, 198, 198, 198, + + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 202, + 202, 202, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 202, 202, 202, 198, 198, 198, 198, 198, + 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, + 198, 198, 198, 202, 202, 202, 198, 198, 198, 198, + 198, 198, 198, 205, 206, 198, 198, 198, 198, 202, + 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, 12, 13, 14, 13, 13, 15, 16, 12, 17, 18, 19, 12, 20, 12, 21, 22, 12, 23, 12, 24, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 26, 27, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 28, 28, 171, 28, 28, 34, 29, 29, 28, - 30, 153, 28, 35, 36, 29, 34, 73, 34, 31, - 152, 78, 37, 35, 36, 35, 87, 34, 73, 32, - 32, 37, 78, 92, 35, 46, 46, 87, 46, 47, - 32, 32, 41, 48, 92, 41, 53, 54, 56, 53, - 137, 56, 71, 72, 57, 71, 74, 75, 76, 53, - - 54, 77, 53, 42, 43, 136, 44, 74, 75, 76, - 45, 117, 77, 83, 42, 43, 83, 44, 162, 162, - 116, 45, 38, 46, 46, 95, 46, 47, 93, 38, - 38, 48, 68, 38, 94, 55, 38, 84, 38, 93, - 38, 38, 80, 46, 86, 80, 81, 86, 84, 40, - 82, 70, 38, 55, 38, 58, 59, 56, 58, 65, - 56, 38, 38, 57, 51, 38, 96, 59, 38, 96, - 38, 50, 38, 38, 97, 90, 60, 61, 91, 62, - 63, 88, 89, 64, 38, 38, 90, 60, 61, 91, - 62, 63, 88, 89, 64, 66, 98, 68, 71, 72, - - 49, 71, 66, 66, 101, 102, 66, 98, 66, 66, - 103, 66, 104, 66, 66, 101, 102, 86, 40, 172, - 86, 103, 30, 104, 172, 66, 66, 67, 67, 68, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 69, 67, 67, 67, 67, 67, 67, 69, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 67, 69, 69, - 69, 69, 69, 69, 69, 69, 69, 69, 41, 99, - 105, 41, 100, 106, 80, 46, 86, 80, 81, 86, - 99, 105, 82, 100, 106, 172, 172, 172, 85, 42, - 43, 172, 44, 107, 80, 46, 45, 80, 81, 172, - - 42, 43, 82, 44, 107, 172, 172, 45, 58, 80, - 46, 58, 80, 81, 172, 80, 46, 82, 80, 81, - 85, 172, 83, 82, 108, 83, 110, 109, 113, 60, - 61, 114, 62, 63, 115, 108, 64, 110, 109, 113, - 60, 61, 114, 62, 63, 115, 84, 64, 66, 111, - 68, 172, 118, 172, 112, 66, 66, 84, 119, 66, - 111, 66, 66, 118, 66, 112, 66, 66, 96, 119, - 120, 96, 121, 122, 123, 124, 97, 125, 66, 66, - 126, 120, 127, 121, 122, 123, 124, 128, 125, 129, - 130, 126, 131, 127, 132, 133, 134, 135, 128, 138, - - 129, 130, 139, 131, 140, 132, 133, 134, 135, 141, - 138, 142, 143, 139, 144, 140, 145, 146, 147, 148, - 141, 149, 142, 143, 151, 144, 154, 145, 146, 147, - 148, 150, 149, 155, 150, 151, 156, 154, 157, 158, - 159, 160, 150, 85, 155, 150, 164, 156, 165, 157, - 158, 159, 160, 166, 85, 167, 172, 164, 168, 165, - 168, 168, 172, 168, 166, 172, 167, 172, 172, 172, - 172, 172, 172, 169, 172, 169, 33, 33, 33, 33, - 33, 33, 33, 38, 172, 172, 172, 38, 38, 39, - 39, 39, 39, 39, 39, 39, 52, 172, 52, 67, - - 67, 67, 67, 67, 67, 67, 79, 79, 79, 79, - 79, 79, 79, 161, 161, 161, 172, 161, 161, 161, - 163, 172, 163, 172, 163, 163, 163, 170, 170, 170, - 170, 170, 172, 170, 11, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172 + 25, 25, 25, 25, 26, 25, 27, 25, 28, 25, + 25, 25, 25, 25, 29, 30, 31, 25, 25, 26, + 25, 27, 25, 25, 25, 29, 32, 32, 57, 32, + 32, 38, 33, 33, 32, 34, 197, 32, 39, 40, + 33, 38, 57, 38, 35, 186, 186, 41, 39, 40, + 39, 58, 60, 38, 81, 36, 36, 41, 50, 50, + 39, 50, 51, 181, 60, 58, 52, 175, 86, 81, + 36, 36, 45, 61, 62, 45, 61, 64, 79, 80, + + 64, 79, 86, 65, 82, 174, 83, 93, 84, 156, + 155, 144, 85, 96, 46, 47, 97, 48, 100, 82, + 83, 106, 93, 84, 91, 49, 85, 91, 96, 46, + 47, 97, 48, 100, 133, 106, 49, 42, 50, 50, + 119, 50, 51, 132, 42, 42, 52, 105, 42, 92, + 63, 42, 94, 42, 119, 42, 42, 88, 50, 122, + 88, 89, 105, 95, 92, 90, 108, 94, 61, 62, + 122, 61, 42, 63, 42, 66, 109, 64, 66, 109, + 64, 42, 42, 65, 110, 42, 99, 67, 42, 99, + 42, 99, 42, 42, 99, 76, 111, 68, 69, 114, + + 70, 71, 101, 67, 102, 107, 117, 44, 72, 42, + 42, 111, 68, 69, 114, 70, 71, 101, 102, 72, + 74, 117, 76, 79, 80, 103, 79, 74, 74, 104, + 118, 74, 120, 74, 74, 112, 74, 121, 74, 74, + 103, 113, 78, 104, 73, 118, 109, 120, 59, 109, + 112, 55, 121, 113, 110, 74, 74, 75, 75, 76, + 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, + 77, 75, 75, 75, 75, 75, 75, 77, 77, 77, + 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, + 77, 77, 75, 77, 77, 77, 77, 77, 77, 77, + + 77, 77, 77, 45, 115, 123, 45, 130, 88, 50, + 116, 88, 89, 157, 88, 50, 90, 88, 89, 115, + 123, 130, 90, 126, 116, 46, 47, 157, 48, 88, + 50, 129, 88, 89, 143, 54, 49, 90, 126, 91, + 46, 47, 91, 48, 131, 143, 129, 49, 66, 88, + 50, 66, 88, 89, 161, 99, 53, 90, 99, 131, + 98, 134, 124, 127, 92, 161, 44, 98, 125, 128, + 68, 69, 135, 70, 71, 136, 134, 124, 127, 92, + 125, 72, 137, 128, 138, 68, 69, 135, 70, 71, + 136, 198, 72, 74, 34, 76, 198, 137, 139, 138, + + 74, 74, 140, 141, 74, 142, 74, 74, 145, 74, + 146, 74, 74, 139, 198, 147, 148, 140, 141, 149, + 142, 150, 151, 145, 152, 146, 153, 154, 74, 74, + 147, 148, 158, 159, 149, 160, 150, 151, 162, 152, + 163, 153, 154, 164, 165, 166, 168, 158, 159, 167, + 160, 169, 170, 162, 171, 163, 198, 173, 164, 165, + 166, 168, 176, 167, 177, 171, 169, 170, 172, 178, + 179, 172, 173, 180, 182, 183, 184, 176, 188, 177, + 98, 179, 172, 189, 178, 172, 190, 191, 180, 182, + 183, 184, 192, 188, 98, 193, 194, 194, 189, 194, + + 194, 190, 191, 198, 198, 198, 198, 192, 198, 198, + 193, 195, 195, 37, 37, 37, 37, 37, 37, 37, + 42, 198, 198, 198, 42, 42, 43, 43, 43, 43, + 43, 43, 43, 56, 198, 56, 75, 75, 75, 75, + 75, 75, 75, 87, 87, 87, 87, 87, 87, 87, + 185, 185, 185, 198, 185, 185, 185, 187, 198, 187, + 198, 187, 187, 187, 196, 196, 196, 196, 196, 198, + 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, 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, - 6, 137, 6, 7, 7, 6, 8, 42, 9, 6, - 136, 45, 9, 8, 8, 9, 60, 10, 42, 6, - 6, 10, 45, 63, 10, 18, 18, 60, 18, 18, - 6, 6, 17, 18, 63, 17, 26, 26, 28, 26, - 117, 28, 35, 35, 28, 35, 43, 43, 44, 53, - - 53, 44, 53, 17, 17, 116, 17, 43, 43, 44, - 17, 95, 44, 51, 17, 17, 51, 17, 152, 152, - 94, 17, 27, 46, 46, 70, 46, 46, 64, 27, - 27, 46, 67, 27, 65, 27, 27, 51, 27, 64, - 27, 27, 47, 47, 59, 47, 47, 59, 51, 39, - 47, 34, 27, 27, 29, 29, 59, 56, 29, 30, - 56, 29, 29, 56, 24, 29, 72, 29, 29, 72, - 29, 23, 29, 29, 72, 62, 29, 29, 62, 29, - 29, 61, 61, 29, 29, 29, 62, 29, 29, 62, - 29, 29, 61, 61, 29, 31, 73, 31, 71, 71, - - 21, 71, 31, 31, 75, 76, 31, 73, 31, 31, - 76, 31, 77, 31, 31, 75, 76, 86, 15, 11, - 86, 76, 5, 77, 0, 31, 31, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 41, 74, - 78, 41, 74, 84, 79, 79, 85, 79, 79, 85, - 74, 78, 79, 74, 84, 0, 0, 0, 85, 41, - 41, 0, 41, 87, 80, 80, 41, 80, 80, 0, - - 41, 41, 80, 41, 87, 0, 0, 41, 57, 81, - 81, 57, 81, 81, 0, 82, 82, 81, 82, 82, - 57, 0, 83, 82, 88, 83, 89, 88, 91, 57, - 57, 92, 57, 57, 93, 88, 57, 89, 88, 91, - 57, 57, 92, 57, 57, 93, 83, 57, 66, 90, - 66, 0, 98, 0, 90, 66, 66, 83, 99, 66, - 90, 66, 66, 98, 66, 90, 66, 66, 96, 99, - 100, 96, 101, 102, 103, 104, 96, 105, 66, 66, - 106, 100, 107, 101, 102, 103, 104, 108, 105, 109, - 110, 106, 111, 107, 112, 113, 114, 115, 108, 118, - - 109, 110, 121, 111, 122, 112, 113, 114, 115, 123, - 118, 124, 125, 121, 126, 122, 127, 130, 131, 132, - 123, 133, 124, 125, 135, 126, 138, 127, 130, 131, - 132, 134, 133, 141, 134, 135, 142, 138, 144, 145, - 148, 149, 150, 134, 141, 150, 156, 142, 157, 144, - 145, 148, 149, 160, 150, 165, 0, 156, 166, 157, - 168, 166, 0, 168, 160, 0, 165, 0, 0, 0, - 0, 0, 0, 166, 0, 168, 173, 173, 173, 173, - 173, 173, 173, 174, 0, 0, 0, 174, 174, 175, - 175, 175, 175, 175, 175, 175, 176, 0, 176, 177, - - 177, 177, 177, 177, 177, 177, 178, 178, 178, 178, - 178, 178, 178, 179, 179, 179, 0, 179, 179, 179, - 180, 0, 180, 0, 180, 180, 180, 181, 181, 181, - 181, 181, 0, 181, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172 + 1, 1, 1, 1, 1, 1, 2, 4, 26, 2, + 4, 7, 2, 4, 6, 6, 196, 6, 7, 7, + 6, 8, 26, 9, 6, 174, 174, 9, 8, 8, + 9, 27, 29, 10, 46, 6, 6, 10, 18, 18, + 10, 18, 18, 165, 29, 27, 18, 156, 49, 46, + 6, 6, 17, 30, 30, 17, 30, 32, 39, 39, + + 32, 39, 49, 32, 47, 155, 47, 57, 48, 133, + 132, 121, 48, 59, 17, 17, 60, 17, 68, 47, + 47, 72, 57, 48, 55, 17, 48, 55, 59, 17, + 17, 60, 17, 68, 108, 72, 17, 31, 50, 50, + 92, 50, 50, 107, 31, 31, 50, 71, 31, 55, + 31, 31, 58, 31, 92, 31, 31, 51, 51, 96, + 51, 51, 71, 58, 55, 51, 78, 58, 61, 61, + 96, 61, 31, 31, 33, 33, 80, 64, 33, 80, + 64, 33, 33, 64, 80, 33, 99, 33, 33, 99, + 33, 67, 33, 33, 67, 75, 81, 33, 33, 83, + + 33, 33, 69, 67, 69, 73, 85, 43, 33, 33, + 33, 81, 33, 33, 83, 33, 33, 69, 69, 33, + 35, 85, 35, 79, 79, 70, 79, 35, 35, 70, + 86, 35, 94, 35, 35, 82, 35, 95, 35, 35, + 70, 82, 38, 70, 34, 86, 109, 94, 28, 109, + 82, 24, 95, 82, 109, 35, 35, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + + 36, 36, 36, 45, 84, 100, 45, 105, 87, 87, + 84, 87, 87, 134, 88, 88, 87, 88, 88, 84, + 100, 105, 88, 102, 84, 45, 45, 134, 45, 89, + 89, 104, 89, 89, 120, 23, 45, 89, 102, 91, + 45, 45, 91, 45, 106, 120, 104, 45, 65, 90, + 90, 65, 90, 90, 140, 98, 21, 90, 98, 106, + 65, 111, 101, 103, 91, 140, 15, 98, 101, 103, + 65, 65, 112, 65, 65, 113, 111, 101, 103, 91, + 101, 65, 114, 103, 115, 65, 65, 112, 65, 65, + 113, 11, 65, 74, 5, 74, 0, 114, 116, 115, + + 74, 74, 117, 118, 74, 119, 74, 74, 122, 74, + 123, 74, 74, 116, 0, 124, 125, 117, 118, 126, + 119, 127, 128, 122, 129, 123, 130, 131, 74, 74, + 124, 125, 137, 138, 126, 139, 127, 128, 141, 129, + 142, 130, 131, 143, 144, 145, 149, 137, 138, 146, + 139, 150, 151, 141, 152, 142, 0, 154, 143, 144, + 145, 149, 157, 146, 160, 152, 150, 151, 153, 161, + 163, 153, 154, 164, 167, 170, 171, 157, 178, 160, + 153, 163, 172, 179, 161, 172, 181, 184, 164, 167, + 170, 171, 189, 178, 172, 190, 191, 194, 179, 191, + + 194, 181, 184, 0, 0, 0, 0, 189, 0, 0, + 190, 191, 194, 199, 199, 199, 199, 199, 199, 199, + 200, 0, 0, 0, 200, 200, 201, 201, 201, 201, + 201, 201, 201, 202, 0, 202, 203, 203, 203, 203, + 203, 203, 203, 204, 204, 204, 204, 204, 204, 204, + 205, 205, 205, 0, 205, 205, 205, 206, 0, 206, + 0, 206, 206, 206, 207, 207, 207, 207, 207, 0, + 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 @@ -666,7 +685,7 @@ Modify cmFortranLexer.cxx: /*--------------------------------------------------------------------------*/ -#line 670 "cmFortranLexer.cxx" +#line 689 "cmFortranLexer.cxx" #define INITIAL 0 #define free_fmt 1 @@ -937,7 +956,7 @@ YY_DECL #line 65 "cmFortranLexer.in.l" -#line 941 "cmFortranLexer.cxx" +#line 960 "cmFortranLexer.cxx" 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 ) { 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_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 535 ); + while ( yy_base[yy_current_state] != 572 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1193,40 +1212,60 @@ YY_RULE_SETUP case 39: YY_RULE_SETUP #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); return WORD; } -case 40: +case 45: YY_RULE_SETUP -#line 159 "cmFortranLexer.in.l" +#line 165 "cmFortranLexer.in.l" { return GARBAGE; } -case 41: -/* rule 41 can match eol */ +case 46: +/* rule 46 can match eol */ YY_RULE_SETUP -#line 161 "cmFortranLexer.in.l" +#line 167 "cmFortranLexer.in.l" { return EOSTMT; } -case 42: +case 47: YY_RULE_SETUP -#line 164 "cmFortranLexer.in.l" +#line 170 "cmFortranLexer.in.l" /* Ignore */ YY_BREAK -case 43: -/* rule 43 can match eol */ +case 48: +/* rule 48 can match eol */ YY_RULE_SETUP -#line 165 "cmFortranLexer.in.l" +#line 171 "cmFortranLexer.in.l" /* Ignore line-endings preceded by \ */ YY_BREAK -case 44: +case 49: YY_RULE_SETUP -#line 167 "cmFortranLexer.in.l" +#line 173 "cmFortranLexer.in.l" { return *yytext; } 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 169 "cmFortranLexer.in.l" +#line 175 "cmFortranLexer.in.l" { if(!cmFortranParser_FilePop(yyextra) ) { @@ -1234,12 +1273,12 @@ case YY_STATE_EOF(str_dq): } } YY_BREAK -case 45: +case 50: YY_RULE_SETUP -#line 176 "cmFortranLexer.in.l" +#line 182 "cmFortranLexer.in.l" ECHO; YY_BREAK -#line 1276 "cmFortranLexer.cxx" +#line 1320 "cmFortranLexer.cxx" 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 ) { 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_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 ) { 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_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; return yy_is_jam ? 0 : yy_current_state; @@ -2408,7 +2447,7 @@ void cmFortran_yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 176 "cmFortranLexer.in.l" +#line 182 "cmFortranLexer.in.l" diff --git a/Source/cmFortranLexer.h b/Source/cmFortranLexer.h index e20c0aa957..cb175ec621 100644 --- a/Source/cmFortranLexer.h +++ b/Source/cmFortranLexer.h @@ -337,7 +337,7 @@ extern int cmFortran_yylex (yyscan_t yyscanner); #undef YY_DECL #endif -#line 176 "cmFortranLexer.in.l" +#line 182 "cmFortranLexer.in.l" #line 344 "cmFortranLexer.h" diff --git a/Source/cmFortranLexer.in.l b/Source/cmFortranLexer.in.l index aa879e8ca9..6870f7cac4 100644 --- a/Source/cmFortranLexer.in.l +++ b/Source/cmFortranLexer.in.l @@ -151,6 +151,12 @@ $[ \t]*endif { return F90PPR_ENDIF; } =|=> { 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]* { yylvalp->string = strdup(yytext); return WORD; diff --git a/Source/cmFortranParser.cxx b/Source/cmFortranParser.cxx index d60db290de..bf4e7c409e 100644 --- a/Source/cmFortranParser.cxx +++ b/Source/cmFortranParser.cxx @@ -123,12 +123,6 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* 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. */ #ifdef _MSC_VER # 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. */ #endif -#line 143 "cmFortranParser.cxx" /* yacc.c:339 */ +#line 137 "cmFortranParser.cxx" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -202,7 +196,12 @@ extern int cmFortran_yydebug; UNTERMINATED_STRING = 283, STRING = 284, WORD = 285, - CPP_INCLUDE_ANGLE = 286 + CPP_INCLUDE_ANGLE = 286, + END = 287, + INCLUDE = 288, + INTERFACE = 289, + MODULE = 290, + USE = 291 }; #endif /* Tokens. */ @@ -235,17 +234,22 @@ extern int cmFortran_yydebug; #define STRING 284 #define WORD 285 #define CPP_INCLUDE_ANGLE 286 +#define END 287 +#define INCLUDE 288 +#define INTERFACE 289 +#define MODULE 290 +#define USE 291 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { -#line 81 "cmFortranParser.y" /* yacc.c:355 */ +#line 75 "cmFortranParser.y" /* yacc.c:355 */ char* string; -#line 249 "cmFortranParser.cxx" /* yacc.c:355 */ +#line 253 "cmFortranParser.cxx" /* yacc.c:355 */ }; typedef union YYSTYPE YYSTYPE; @@ -261,7 +265,7 @@ int cmFortran_yyparse (yyscan_t yyscanner); /* Copy the second part of user declarations. */ -#line 265 "cmFortranParser.cxx" /* yacc.c:358 */ +#line 269 "cmFortranParser.cxx" /* yacc.c:358 */ #ifdef short # undef short @@ -503,21 +507,21 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 216 +#define YYLAST 469 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 32 +#define YYNTOKENS 37 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 14 /* YYNRULES -- Number of rules. */ -#define YYNRULES 49 +#define YYNRULES 57 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 91 +#define YYNSTATES 109 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 286 +#define YYMAXUTOK 291 #define YYTRANSLATE(YYX) \ ((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, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 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 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 103, 103, 103, 106, 113, 131, 139, 149, 157, - 162, 167, 172, 177, 182, 187, 192, 196, 200, 204, - 208, 209, 214, 214, 214, 215, 215, 216, 216, 217, - 217, 218, 218, 219, 219, 220, 220, 221, 221, 222, - 222, 223, 223, 226, 227, 228, 229, 230, 231, 232 + 0, 102, 102, 102, 105, 109, 114, 119, 124, 128, + 133, 141, 146, 151, 156, 161, 166, 171, 176, 181, + 185, 189, 193, 197, 198, 203, 203, 203, 204, 204, + 205, 205, 206, 206, 207, 207, 208, 208, 209, 209, + 210, 210, 211, 211, 212, 212, 215, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226 }; #endif @@ -580,9 +586,9 @@ static const char *const yytname[] = "CPP_IFNDEF", "CPP_IF", "CPP_ELSE", "CPP_ELIF", "CPP_ENDIF", "F90PPR_IFDEF", "F90PPR_IFNDEF", "F90PPR_IF", "F90PPR_ELSE", "F90PPR_ELIF", "F90PPR_ENDIF", "COMMA", "DCOLON", "UNTERMINATED_STRING", - "STRING", "WORD", "CPP_INCLUDE_ANGLE", "$accept", "code", "stmt", - "include", "define", "undef", "ifdef", "ifndef", "if", "elif", "else", - "endif", "other", "misc_code", YY_NULLPTR + "STRING", "WORD", "CPP_INCLUDE_ANGLE", "END", "INCLUDE", "INTERFACE", + "MODULE", "USE", "$accept", "code", "stmt", "include", "define", "undef", + "ifdef", "ifndef", "if", "elif", "else", "endif", "other", "misc_code", YY_NULLPTR }; #endif @@ -594,14 +600,14 @@ static const yytype_uint16 yytoknum[] = 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286 + 285, 286, 287, 288, 289, 290, 291 }; # endif -#define YYPACT_NINF -34 +#define YYPACT_NINF -38 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-34))) + (!!((Yystate) == (-38))) #define YYTABLE_NINF -1 @@ -612,16 +618,17 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - -34, 18, -34, 1, -34, -23, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, 186, -34, -34, -22, -19, - -13, -10, -8, -34, -34, -34, -34, -34, -34, -34, - 17, 23, -34, -34, 41, -34, -34, -34, -34, -34, - 47, 52, 57, 85, 90, 31, -34, 95, 100, -34, - -34, -34, -34, -34, -34, -34, -34, -34, 105, 133, - 138, 143, 148, -34, -34, -34, -34, -34, 29, 153, - -34, -34, -34, -34, -34, -34, -34, -34, -34, 181, - -34 + -38, 39, -38, 3, -38, -20, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, -22, -16, 1, -8, + -6, -38, -4, -7, -3, -2, -1, -38, -38, -38, + -38, -38, -38, 62, -38, -38, -38, -38, -38, 0, + 2, -38, -38, -38, -38, -38, -38, 73, 107, 118, + 152, 163, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -38, -38, -38, -38, 197, 208, 242, 253, + 6, -38, 287, 298, 332, 343, 377, 388, -38, -38, + -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. @@ -629,30 +636,31 @@ static const yytype_int16 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 2, 0, 1, 0, 20, 0, 22, 23, 24, 26, - 25, 28, 27, 29, 31, 33, 37, 35, 39, 30, - 32, 34, 38, 36, 40, 0, 41, 3, 0, 0, - 0, 0, 0, 41, 41, 41, 41, 21, 41, 4, - 0, 0, 41, 41, 0, 41, 41, 41, 41, 41, - 0, 0, 0, 0, 0, 0, 41, 0, 0, 10, - 46, 45, 48, 47, 49, 44, 43, 42, 0, 0, - 0, 0, 0, 16, 17, 18, 19, 9, 0, 0, - 8, 5, 11, 12, 13, 14, 15, 41, 6, 0, - 7 + 2, 0, 1, 0, 23, 0, 25, 26, 27, 29, + 28, 31, 30, 32, 34, 36, 40, 38, 42, 33, + 35, 37, 41, 39, 43, 44, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 0, 0, 44, 44, 44, + 44, 24, 44, 0, 44, 44, 4, 44, 44, 0, + 0, 44, 44, 44, 44, 44, 44, 0, 0, 0, + 0, 0, 13, 54, 53, 56, 55, 57, 52, 46, + 47, 48, 49, 50, 51, 45, 0, 0, 0, 0, + 0, 44, 0, 0, 0, 0, 0, 0, 19, 20, + 21, 22, 12, 8, 11, 7, 6, 0, 0, 5, + 14, 15, 16, 17, 18, 44, 9, 0, 10 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -34, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -33, -34 + -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, + -38, -38, -37, -38 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { - -1, 1, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 44, 67 + -1, 1, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 43, 75 }; /* 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. */ static const yytype_uint8 yytable[] = { - 50, 51, 52, 53, 37, 54, 38, 45, 0, 57, - 58, 46, 68, 69, 70, 71, 72, 47, 2, 3, - 48, 4, 49, 79, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 59, 60, 61, 55, 25, 26, - 73, 60, 61, 56, 89, 74, 60, 61, 78, 87, - 75, 60, 61, 0, 0, 0, 0, 62, 63, 64, - 65, 66, 0, 62, 63, 64, 65, 66, 62, 63, - 64, 65, 66, 62, 63, 64, 65, 66, 76, 60, - 61, 0, 0, 77, 60, 61, 0, 0, 80, 60, - 61, 0, 0, 81, 60, 61, 0, 0, 82, 60, - 61, 62, 63, 64, 65, 66, 62, 63, 64, 65, - 66, 62, 63, 64, 65, 66, 62, 63, 64, 65, - 66, 62, 63, 64, 65, 66, 83, 60, 61, 0, - 0, 84, 60, 61, 0, 0, 85, 60, 61, 0, - 0, 86, 60, 61, 0, 0, 88, 60, 61, 62, - 63, 64, 65, 66, 62, 63, 64, 65, 66, 62, - 63, 64, 65, 66, 62, 63, 64, 65, 66, 62, - 63, 64, 65, 66, 90, 60, 61, 0, 0, 39, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 62, 63, 64, - 65, 66, 40, 41, 0, 42, 43 + 57, 58, 59, 60, 46, 61, 41, 76, 77, 42, + 78, 79, 44, 45, 82, 83, 84, 85, 86, 87, + 49, 50, 48, 53, 51, 52, 0, 54, 55, 56, + 80, 47, 81, 97, 105, 0, 0, 0, 0, 2, + 3, 0, 4, 0, 98, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 62, 63, 64, 107, 0, + 25, 26, 27, 28, 29, 30, 88, 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, + 89, 63, 64, 0, 0, 0, 0, 0, 0, 0, + 0, 90, 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, 91, 63, 64, 0, 0, + 0, 0, 0, 0, 0, 0, 92, 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, + 93, 63, 64, 0, 0, 0, 0, 0, 0, 0, + 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[] = { - 33, 34, 35, 36, 3, 38, 29, 29, -1, 42, - 43, 30, 45, 46, 47, 48, 49, 30, 0, 1, - 30, 3, 30, 56, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 3, 4, 5, 30, 30, 31, - 3, 4, 5, 30, 87, 3, 4, 5, 27, 30, - 3, 4, 5, -1, -1, -1, -1, 26, 27, 28, - 29, 30, -1, 26, 27, 28, 29, 30, 26, 27, - 28, 29, 30, 26, 27, 28, 29, 30, 3, 4, - 5, -1, -1, 3, 4, 5, -1, -1, 3, 4, - 5, -1, -1, 3, 4, 5, -1, -1, 3, 4, - 5, 26, 27, 28, 29, 30, 26, 27, 28, 29, - 30, 26, 27, 28, 29, 30, 26, 27, 28, 29, - 30, 26, 27, 28, 29, 30, 3, 4, 5, -1, - -1, 3, 4, 5, -1, -1, 3, 4, 5, -1, - -1, 3, 4, 5, -1, -1, 3, 4, 5, 26, - 27, 28, 29, 30, 26, 27, 28, 29, 30, 26, - 27, 28, 29, 30, 26, 27, 28, 29, 30, 26, - 27, 28, 29, 30, 3, 4, 5, -1, -1, 3, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 26, 27, 28, - 29, 30, 26, 27, -1, 29, 30 + 37, 38, 39, 40, 3, 42, 3, 44, 45, 29, + 47, 48, 34, 29, 51, 52, 53, 54, 55, 56, + 26, 27, 30, 30, 30, 29, -1, 30, 30, 30, + 30, 30, 30, 27, 30, -1, -1, -1, -1, 0, + 1, -1, 3, -1, 81, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 3, 4, 5, 105, -1, + 31, 32, 33, 34, 35, 36, 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, 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 symbol of state STATE-NUM. */ 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, - 21, 22, 23, 24, 25, 30, 31, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 3, 29, 3, - 26, 27, 29, 30, 44, 29, 30, 30, 30, 30, - 44, 44, 44, 44, 44, 30, 30, 44, 44, 3, - 4, 5, 26, 27, 28, 29, 30, 45, 44, 44, - 44, 44, 44, 3, 3, 3, 3, 3, 27, 44, - 3, 3, 3, 3, 3, 3, 3, 30, 3, 44, - 3 + 21, 22, 23, 24, 25, 31, 32, 33, 34, 35, + 36, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 3, 29, 49, 34, 29, 3, 30, 30, 26, + 27, 30, 29, 30, 30, 30, 30, 49, 49, 49, + 49, 49, 3, 4, 5, 26, 27, 28, 29, 30, + 32, 33, 34, 35, 36, 50, 49, 49, 49, 49, + 30, 30, 49, 49, 49, 49, 49, 49, 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. */ static const yytype_uint8 yyr1[] = { - 0, 32, 33, 33, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 35, 35, 35, 36, 36, 37, 37, 38, - 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, - 43, 44, 44, 45, 45, 45, 45, 45, 45, 45 + 0, 37, 38, 38, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, + 39, 39, 39, 39, 39, 40, 40, 40, 41, 41, + 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, + 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. */ static const yytype_uint8 yyr2[] = { - 0, 2, 0, 2, 2, 4, 5, 7, 4, 4, - 3, 4, 4, 4, 4, 4, 3, 3, 3, 3, - 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 2, 0, 2, 2, 4, 4, 4, 4, 5, + 7, 4, 4, 3, 4, 4, 4, 4, 4, 3, + 3, 3, 3, 1, 2, 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) { 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_SetInInterface(parser, true); - } - free((yyvsp[-1].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); } -#line 1438 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1496 "cmFortranParser.cxx" /* yacc.c:1646 */ break; 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_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)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1461 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1506 "cmFortranParser.cxx" /* yacc.c:1646 */ break; 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_RuleUse(parser, (yyvsp[-2].string)); - } - free((yyvsp[-4].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleModule(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1474 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1516 "cmFortranParser.cxx" /* yacc.c:1646 */ break; case 7: -#line 139 "cmFortranParser.y" /* yacc.c:1646 */ +#line 119 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[-6].string), "use") && - cmFortranParserIsKeyword((yyvsp[-4].string), "non_intrinsic") ) { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); + free((yyvsp[-2].string)); + } +#line 1526 "cmFortranParser.cxx" /* yacc.c:1646 */ + break; + + case 8: +#line 124 "cmFortranParser.y" /* yacc.c:1646 */ + { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, false); + } +#line 1535 "cmFortranParser.cxx" /* yacc.c:1646 */ + break; + + case 9: +#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[-6].string)); free((yyvsp[-4].string)); free((yyvsp[-2].string)); } -#line 1489 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1558 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 8: -#line 149 "cmFortranParser.y" /* yacc.c:1646 */ + case 11: +#line 141 "cmFortranParser.y" /* yacc.c:1646 */ { - if (cmFortranParserIsKeyword((yyvsp[-3].string), "include")) { - cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); - } - free((yyvsp[-3].string)); + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1502 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1568 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 9: -#line 157 "cmFortranParser.y" /* yacc.c:1646 */ + case 12: +#line 146 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleLineDirective(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1512 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1578 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 10: -#line 162 "cmFortranParser.y" /* yacc.c:1646 */ + case 13: +#line 151 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1522 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1588 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 11: -#line 167 "cmFortranParser.y" /* yacc.c:1646 */ + case 14: +#line 156 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleInclude(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1532 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1598 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 12: -#line 172 "cmFortranParser.y" /* yacc.c:1646 */ + case 15: +#line 161 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleDefine(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1542 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1608 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 13: -#line 177 "cmFortranParser.y" /* yacc.c:1646 */ + case 16: +#line 166 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUndef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1552 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1618 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 14: -#line 182 "cmFortranParser.y" /* yacc.c:1646 */ + case 17: +#line 171 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfdef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1562 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1628 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 15: -#line 187 "cmFortranParser.y" /* yacc.c:1646 */ + case 18: +#line 176 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIfndef(parser, (yyvsp[-2].string)); free((yyvsp[-2].string)); } -#line 1572 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1638 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 16: -#line 192 "cmFortranParser.y" /* yacc.c:1646 */ + case 19: +#line 181 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleIf(parser); } -#line 1581 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1647 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 17: -#line 196 "cmFortranParser.y" /* yacc.c:1646 */ + case 20: +#line 185 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElif(parser); } -#line 1590 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1656 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 18: -#line 200 "cmFortranParser.y" /* yacc.c:1646 */ + case 21: +#line 189 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleElse(parser); } -#line 1599 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1665 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 19: -#line 204 "cmFortranParser.y" /* yacc.c:1646 */ + case 22: +#line 193 "cmFortranParser.y" /* yacc.c:1646 */ { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleEndif(parser); } -#line 1608 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1674 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 43: -#line 226 "cmFortranParser.y" /* yacc.c:1646 */ + case 46: +#line 215 "cmFortranParser.y" /* yacc.c:1646 */ { free ((yyvsp[0].string)); } -#line 1614 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1680 "cmFortranParser.cxx" /* yacc.c:1646 */ break; - case 44: -#line 227 "cmFortranParser.y" /* yacc.c:1646 */ + case 52: +#line 221 "cmFortranParser.y" /* yacc.c:1646 */ { free ((yyvsp[0].string)); } -#line 1620 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1686 "cmFortranParser.cxx" /* yacc.c:1646 */ break; -#line 1624 "cmFortranParser.cxx" /* yacc.c:1646 */ +#line 1690 "cmFortranParser.cxx" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1850,6 +1916,6 @@ yyreturn: #endif return yyresult; } -#line 235 "cmFortranParser.y" /* yacc.c:1906 */ +#line 229 "cmFortranParser.y" /* yacc.c:1906 */ /* End of grammar */ diff --git a/Source/cmFortranParser.y b/Source/cmFortranParser.y index 686d2f4fe7..b856a1a3ad 100644 --- a/Source/cmFortranParser.y +++ b/Source/cmFortranParser.y @@ -52,12 +52,6 @@ static void cmFortran_yyerror(yyscan_t yyscanner, const char* 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. */ #ifdef _MSC_VER # pragma warning (disable: 4102) /* Unused goto label. */ @@ -95,6 +89,11 @@ static bool cmFortranParserIsKeyword(const char* word, %token <number> UNTERMINATED_STRING %token <string> STRING WORD %token <string> CPP_INCLUDE_ANGLE +%token END +%token INCLUDE +%token INTERFACE +%token MODULE +%token USE /*-------------------------------------------------------------------------*/ /* grammar */ @@ -103,55 +102,45 @@ static bool cmFortranParserIsKeyword(const char* word, code: /* empty */ | code stmt; stmt: - WORD EOSTMT { - if (cmFortranParserIsKeyword($1, "interface")) { - cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_SetInInterface(parser, true); - } - free($1); + INTERFACE EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_SetInInterface(parser, true); } -| WORD WORD other EOSTMT { - if (cmFortranParserIsKeyword($1, "use")) { - cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - 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); +| USE WORD other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleUse(parser, $2); free($2); } -| WORD DCOLON WORD other EOSTMT { - if (cmFortranParserIsKeyword($1, "use")) { - cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleUse(parser, $3); - } - free($1); +| MODULE WORD other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleModule(parser, $2); + free($2); + } +| 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); } -| WORD COMMA WORD DCOLON WORD other EOSTMT { - if (cmFortranParserIsKeyword($1, "use") && - cmFortranParserIsKeyword($3, "non_intrinsic") ) { +| USE COMMA WORD DCOLON WORD other EOSTMT { + if (cmsysString_strcasecmp($3, "non_intrinsic") == 0) { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); cmFortranParser_RuleUse(parser, $5); } - free($1); free($3); free($5); } -| WORD STRING other EOSTMT { - if (cmFortranParserIsKeyword($1, "include")) { - cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); - cmFortranParser_RuleInclude(parser, $2); - } - free($1); +| INCLUDE STRING other EOSTMT { + cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); + cmFortranParser_RuleInclude(parser, $2); free($2); } | CPP_LINE_DIRECTIVE STRING other EOSTMT { @@ -224,6 +213,11 @@ other: /* empty */ | other misc_code ; misc_code: WORD { free ($1); } +| END +| INCLUDE +| INTERFACE +| MODULE +| USE | STRING { free ($1); } | GARBAGE | ASSIGNMENT_OP diff --git a/Source/cmFortranParserTokens.h b/Source/cmFortranParserTokens.h index 176f6fe624..e988df429c 100644 --- a/Source/cmFortranParserTokens.h +++ b/Source/cmFortranParserTokens.h @@ -73,7 +73,12 @@ extern int cmFortran_yydebug; UNTERMINATED_STRING = 283, STRING = 284, WORD = 285, - CPP_INCLUDE_ANGLE = 286 + CPP_INCLUDE_ANGLE = 286, + END = 287, + INCLUDE = 288, + INTERFACE = 289, + MODULE = 290, + USE = 291 }; #endif /* Tokens. */ @@ -106,17 +111,22 @@ extern int cmFortran_yydebug; #define STRING 284 #define WORD 285 #define CPP_INCLUDE_ANGLE 286 +#define END 287 +#define INCLUDE 288 +#define INTERFACE 289 +#define MODULE 290 +#define USE 291 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { -#line 81 "cmFortranParser.y" /* yacc.c:1909 */ +#line 75 "cmFortranParser.y" /* yacc.c:1909 */ char* string; -#line 120 "cmFortranParserTokens.h" /* yacc.c:1909 */ +#line 130 "cmFortranParserTokens.h" /* yacc.c:1909 */ }; typedef union YYSTYPE YYSTYPE; |