Fortran: Join identifiers split across continuation lines

LLVMFlang's -E output wraps lines at column 72, splitting long names
as `foo&` / `&bar`.  The dependency scanner read the halves as two
words and dropped the module, submodule, or use statement.  The lexer
now joins such split tokens and rescans them as one.

Fixes: #28138
This commit is contained in:
Daksh Mamodiya committed 2026-10-13 20:40:17 +05:30
1 parent d03477be3e
commit a9243f6a02
16 files changed
+461 -234

No files matched your search

+344 -228
View File
@@ -548,8 +548,8 @@ static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
yyg->yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 55
#define YY_END_OF_BUFFER 56
#define YY_NUM_RULES 57
#define YY_END_OF_BUFFER 58
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -557,35 +557,43 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static const flex_int16_t yy_accept[247] =
static const flex_int16_t yy_accept[312] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56, 50, 52, 51, 54, 1, 50, 34, 2, 48,
49, 36, 38, 51, 40, 50, 47, 47, 47, 47,
47, 47, 50, 47, 52, 50, 51, 52, 50, 47,
9, 8, 9, 9, 4, 3, 50, 0, 10, 0,
0, 0, 0, 0, 34, 34, 35, 37, 40, 50,
47, 47, 47, 47, 47, 47, 0, 53, 0, 47,
0, 0, 0, 12, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 50, 0, 11, 47,
0, 0, 0, 5, 0, 0, 0, 0, 0, 30,
58, 52, 54, 53, 56, 1, 52, 35, 2, 50,
51, 37, 40, 53, 42, 52, 49, 49, 49, 49,
49, 49, 52, 49, 54, 52, 53, 54, 52, 49,
9, 8, 9, 9, 4, 3, 52, 0, 10, 0,
0, 0, 0, 0, 35, 35, 36, 0, 39, 42,
52, 0, 49, 49, 49, 49, 49, 49, 0, 55,
0, 49, 0, 0, 0, 12, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 52, 0,
11, 0, 49, 0, 0, 0, 5, 0, 0, 0,
0, 34, 34, 34, 34, 0, 0, 41, 47, 47,
47, 47, 46, 12, 12, 0, 0, 0, 24, 0,
0, 0, 0, 0, 0, 24, 0, 0, 0, 0,
0, 0, 6, 0, 0, 0, 0, 0, 0, 0,
0, 0, 47, 47, 47, 47, 0, 0, 0, 0,
0, 0, 30, 0, 35, 35, 35, 35, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 43, 49,
49, 49, 49, 48, 12, 12, 0, 0, 0, 24,
0, 0, 0, 0, 0, 0, 24, 0, 0, 0,
0, 0, 11, 0, 0, 0, 0, 6, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 49, 49, 49, 49, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 31, 32,
0, 0, 0, 0, 0, 47, 47, 47, 47, 0,
25, 26, 0, 0, 0, 0, 13, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 21, 33, 28,
0, 0, 0, 47, 47, 44, 47, 0, 27, 22,
0, 0, 13, 20, 0, 0, 0, 0, 0, 19,
29, 0, 0, 42, 47, 47, 18, 23, 0, 0,
7, 39, 7, 16, 0, 47, 47, 15, 17, 43,
45, 0, 0, 0, 14, 0
0, 31, 32, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 38, 0, 0, 0, 0, 0, 0,
0, 34, 49, 49, 49, 49, 0, 25, 26, 0,
0, 0, 0, 13, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 21, 33, 28, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
49, 49, 46, 49, 0, 27, 22, 0, 0, 13,
20, 0, 0, 0, 0, 0, 19, 29, 0, 0,
0, 0, 0, 0, 44, 49, 49, 18, 23, 0,
0, 7, 41, 7, 16, 0, 0, 0, 49, 49,
15, 0, 17, 0, 45, 47, 0, 0, 0, 14,
0
} ;
static const YY_CHAR yy_ec[256] =
@@ -622,215 +630,291 @@ static const YY_CHAR yy_ec[256] =
static const YY_CHAR yy_meta[50] =
{ 0,
1, 2, 2, 2, 3, 4, 4, 1, 1, 4,
4, 4, 4, 1, 4, 5, 4, 4, 1, 4,
6, 1, 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
1, 2, 2, 2, 3, 4, 4, 1, 1, 5,
4, 4, 4, 1, 4, 6, 4, 4, 1, 4,
7, 1, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 1, 6,
8, 8, 8, 8, 8, 8, 8, 8, 8
} ;
static const flex_int16_t yy_base[256] =
static const flex_int16_t yy_base[329] =
{ 0,
0, 48, 0, 49, 55, 58, 64, 66, 75, 83,
545, 0, 546, 546, 541, 546, 86, 92, 546, 546,
546, 546, 526, 546, 521, 519, 0, 56, 59, 506,
66, 16, 105, 131, 109, 171, 534, 535, 220, 260,
546, 532, 533, 116, 546, 546, 0, 532, 546, 111,
507, 500, 34, 78, 155, 202, 546, 546, 546, 121,
0, 29, 105, 101, 508, 101, 131, 546, 528, 0,
173, 308, 0, 146, 503, 136, 135, 499, 495, 484,
136, 94, 481, 478, 519, 518, 357, 519, 546, 0,
516, 515, 222, 184, 516, 490, 491, 129, 474, 149,
830, 0, 831, 831, 826, 831, 86, 92, 831, 831,
831, 831, 54, 831, 807, 805, 816, 70, 71, 55,
95, 91, 104, 144, 108, 184, 820, 821, 233, 273,
831, 818, 819, 117, 831, 831, 0, 818, 831, 130,
793, 786, 68, 8, 145, 215, 831, 174, 831, 831,
136, 254, 808, 120, 172, 162, 101, 116, 235, 831,
814, 0, 132, 321, 0, 185, 789, 136, 95, 785,
781, 770, 124, 117, 767, 764, 805, 804, 370, 805,
831, 259, 0, 802, 801, 241, 189, 802, 776, 777,
474, 241, 312, 323, 338, 213, 467, 0, 153, 176,
184, 481, 0, 233, 235, 484, 218, 485, 162, 485,
476, 482, 463, 205, 464, 210, 464, 457, 461, 497,
496, 354, 546, 470, 472, 454, 454, 451, 452, 452,
447, 451, 274, 456, 290, 456, 459, 460, 460, 456,
458, 458, 452, 455, 454, 435, 435, 435, 432, 433,
433, 428, 430, 429, 466, 465, 436, 440, 546, 546,
423, 422, 421, 405, 407, 305, 317, 325, 341, 414,
546, 546, 401, 390, 390, 378, 370, 377, 357, 358,
357, 356, 346, 350, 386, 376, 353, 546, 546, 546,
183, 760, 160, 760, 325, 336, 351, 391, 264, 409,
797, 192, 331, 752, 400, 418, 795, 247, 787, 314,
322, 334, 348, 786, 372, 230, 767, 106, 768, 317,
768, 759, 765, 746, 337, 747, 206, 747, 740, 744,
780, 427, 432, 781, 365, 778, 439, 831, 752, 754,
736, 736, 733, 734, 734, 729, 448, 457, 771, 395,
441, 756, 404, 444, 731, 471, 480, 768, 465, 487,
0, 467, 490, 417, 352, 468, 470, 740, 741, 741,
737, 739, 739, 733, 736, 735, 716, 716, 716, 713,
714, 714, 709, 711, 710, 747, 492, 494, 746, 717,
319, 320, 300, 342, 314, 0, 281, 305, 546, 546,
292, 285, 372, 546, 213, 211, 158, 228, 0, 546,
546, 121, 113, 0, 357, 324, 546, 546, 78, 58,
546, 546, 546, 546, 30, 357, 360, 387, 546, 0,
0, 388, 0, 44, 546, 546, 407, 414, 420, 423,
430, 437, 444, 451, 458
720, 831, 831, 692, 691, 685, 659, 497, 502, 505,
508, 619, 591, 831, 589, 505, 512, 515, 519, 604,
588, 612, 503, 509, 515, 517, 588, 831, 831, 592,
591, 591, 579, 536, 587, 567, 569, 566, 564, 552,
548, 585, 581, 544, 831, 831, 831, 490, 490, 536,
544, 546, 497, 481, 477, 551, 553, 560, 469, 444,
550, 555, 454, 534, 418, 831, 831, 411, 399, 564,
831, 375, 372, 358, 571, 0, 831, 831, 347, 354,
332, 292, 298, 228, 206, 557, 558, 831, 831, 185,
165, 831, 831, 831, 831, 579, 131, 583, 560, 569,
589, 595, 831, 600, 147, 82, 604, 0, 52, 831,
831, 623, 631, 638, 642, 650, 658, 666, 674, 682,
690, 698, 701, 709, 717, 725, 733, 741
} ;
static const flex_int16_t yy_def[256] =
static const flex_int16_t yy_def[329] =
{ 0,
246, 1, 1, 1, 1, 1, 247, 247, 247, 247,
246, 248, 246, 246, 249, 246, 248, 246, 246, 246,
246, 246, 246, 246, 246, 248, 250, 250, 250, 250,
250, 250, 248, 250, 246, 246, 246, 246, 251, 246,
246, 246, 246, 246, 246, 246, 248, 249, 246, 246,
246, 246, 246, 246, 246, 252, 246, 246, 246, 248,
250, 250, 250, 250, 250, 250, 246, 246, 246, 34,
246, 246, 72, 248, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 251, 251, 246, 40,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
311, 1, 1, 1, 1, 1, 312, 312, 312, 312,
311, 313, 311, 311, 314, 311, 313, 311, 311, 311,
311, 311, 311, 311, 311, 313, 315, 315, 315, 315,
315, 315, 313, 315, 311, 311, 311, 311, 316, 311,
311, 311, 311, 311, 311, 311, 313, 314, 311, 311,
311, 311, 311, 311, 311, 317, 311, 311, 311, 311,
313, 311, 315, 315, 315, 315, 315, 315, 311, 311,
311, 34, 311, 311, 74, 313, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 316, 316,
311, 316, 40, 311, 311, 311, 311, 311, 311, 311,
246, 252, 252, 252, 252, 246, 246, 250, 250, 250,
250, 250, 250, 246, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
246, 246, 250, 250, 250, 250, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246, 250, 250, 250, 250, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
311, 311, 311, 311, 317, 317, 317, 317, 311, 311,
311, 318, 311, 311, 311, 311, 311, 319, 315, 315,
315, 315, 315, 315, 311, 311, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 311, 311,
311, 316, 311, 316, 320, 311, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 311, 321,
311, 311, 318, 318, 311, 311, 311, 311, 322, 311,
323, 319, 319, 315, 315, 315, 315, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 320, 320, 311, 311,
246, 246, 246, 250, 250, 250, 250, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 253, 254, 246,
246, 246, 246, 250, 250, 250, 246, 246, 246, 246,
246, 246, 246, 246, 246, 250, 250, 246, 246, 250,
250, 246, 255, 255, 246, 0, 246, 246, 246, 246,
246, 246, 246, 246, 246
311, 311, 311, 311, 311, 311, 311, 321, 321, 311,
324, 311, 311, 311, 311, 322, 322, 311, 325, 311,
311, 323, 315, 315, 315, 315, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 311, 324,
324, 324, 311, 311, 311, 325, 325, 325, 311, 311,
315, 315, 315, 315, 311, 311, 311, 311, 311, 311,
311, 311, 311, 311, 326, 327, 311, 311, 311, 311,
311, 311, 311, 311, 315, 315, 315, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 315, 315,
311, 311, 311, 311, 315, 315, 311, 328, 328, 311,
0, 311, 311, 311, 311, 311, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311
} ;
static const flex_int16_t yy_nxt[596] =
static const flex_int16_t yy_nxt[881] =
{ 0,
12, 13, 14, 13, 13, 15, 16, 12, 17, 18,
19, 20, 21, 12, 22, 12, 23, 24, 12, 25,
12, 26, 27, 27, 27, 27, 28, 27, 27, 29,
27, 30, 27, 27, 27, 31, 27, 32, 33, 34,
27, 27, 28, 27, 29, 27, 27, 31, 32, 35,
35, 66, 35, 35, 108, 36, 36, 37, 38, 35,
37, 38, 35, 66, 245, 36, 42, 43, 42, 43,
108, 39, 239, 44, 45, 44, 45, 42, 43, 98,
99, 46, 40, 40, 44, 42, 43, 50, 62, 46,
50, 63, 44, 55, 55, 55, 55, 56, 40, 40,
35, 103, 35, 35, 104, 36, 36, 37, 38, 35,
37, 38, 35, 58, 62, 36, 42, 43, 42, 43,
59, 39, 310, 44, 45, 44, 45, 42, 43, 62,
62, 46, 40, 40, 44, 42, 43, 50, 66, 46,
50, 62, 44, 55, 55, 55, 55, 56, 40, 40,
238, 57, 62, 65, 238, 63, 67, 68, 69, 67,
71, 51, 50, 71, 65, 50, 72, 93, 94, 95,
93, 100, 106, 52, 101, 106, 111, 113, 53, 109,
54, 47, 67, 68, 69, 67, 51, 126, 47, 47,
127, 110, 111, 113, 47, 109, 70, 115, 52, 47,
115, 47, 47, 53, 235, 54, 55, 55, 55, 55,
56, 74, 119, 234, 57, 107, 117, 120, 118, 47,
70, 47, 73, 136, 71, 73, 137, 71, 47, 47,
72, 124, 125, 143, 47, 132, 74, 151, 132, 47,
139, 47, 47, 133, 152, 140, 75, 76, 143, 230,
62, 57, 64, 65, 62, 69, 70, 71, 69, 73,
62, 51, 73, 101, 102, 74, 64, 65, 96, 97,
98, 96, 130, 52, 123, 62, 68, 131, 53, 62,
54, 50, 67, 73, 50, 179, 73, 113, 68, 74,
113, 180, 124, 67, 47, 119, 55, 55, 55, 55,
56, 47, 47, 62, 57, 51, 62, 47, 124, 72,
137, 119, 47, 138, 47, 47, 128, 52, 129, 135,
136, 62, 53, 303, 54, 109, 110, 111, 109, 112,
114, 62, 47, 72, 47, 75, 126, 122, 75, 126,
147, 47, 47, 147, 110, 164, 120, 47, 148, 76,
77, 78, 144, 103, 55, 103, 103, 104, 79, 47,
47, 105, 80, 81, 106, 82, 83, 106, 144, 84,
87, 145, 89, 93, 94, 95, 93, 87, 87, 232,
232, 232, 145, 87, 115, 87, 115, 115, 87, 115,
87, 87, 103, 55, 103, 103, 104, 148, 114, 157,
105, 160, 158, 149, 228, 227, 161, 107, 87, 87,
88, 88, 89, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 90, 88, 88, 88, 88,
88, 88, 90, 90, 90, 90, 90, 90, 90, 90,
90, 90, 90, 90, 90, 90, 90, 90, 88, 90,
76, 154, 47, 122, 47, 47, 155, 301, 121, 77,
78, 301, 120, 79, 80, 62, 106, 55, 106, 106,
107, 81, 47, 47, 108, 82, 83, 151, 84, 85,
152, 126, 86, 89, 126, 91, 69, 70, 71, 69,
89, 89, 96, 97, 98, 96, 89, 191, 89, 116,
173, 89, 192, 89, 89, 115, 116, 117, 115, 118,
142, 143, 144, 142, 145, 109, 110, 111, 109, 112,
298, 89, 89, 90, 90, 91, 90, 90, 90, 90,
90, 90, 92, 90, 90, 90, 90, 90, 93, 90,
90, 90, 90, 90, 90, 93, 93, 93, 93, 93,
90, 90, 90, 90, 90, 90, 90, 90, 90, 73,
229, 176, 73, 103, 55, 103, 103, 104, 226, 228,
178, 105, 176, 114, 103, 55, 103, 103, 104, 226,
204, 227, 105, 75, 76, 178, 225, 77, 78, 103,
55, 103, 103, 104, 205, 79, 204, 105, 223, 80,
81, 206, 82, 83, 237, 132, 84, 87, 132, 89,
205, 222, 221, 133, 87, 87, 207, 206, 224, 237,
87, 213, 87, 213, 213, 87, 213, 87, 87, 220,
219, 236, 207, 240, 224, 114, 241, 114, 242, 242,
218, 242, 242, 214, 217, 87, 87, 236, 216, 240,
93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
93, 90, 93, 93, 93, 93, 93, 93, 93, 93,
93, 93, 75, 62, 298, 75, 106, 55, 106, 106,
107, 62, 113, 297, 108, 113, 125, 106, 55, 106,
106, 107, 182, 62, 174, 108, 77, 78, 175, 183,
79, 80, 106, 55, 106, 106, 107, 62, 81, 174,
108, 62, 82, 83, 175, 84, 85, 143, 198, 86,
89, 176, 91, 126, 296, 114, 126, 89, 89, 177,
296, 188, 176, 89, 189, 89, 224, 125, 89, 295,
89, 89, 106, 55, 106, 106, 107, 158, 209, 291,
210, 209, 241, 215, 214, 243, 243, 41, 41, 41,
41, 41, 41, 41, 47, 212, 211, 210, 47, 47,
48, 48, 48, 48, 48, 48, 48, 61, 209, 61,
88, 88, 88, 88, 88, 88, 88, 102, 102, 102,
102, 102, 102, 102, 231, 231, 208, 231, 231, 231,
231, 233, 203, 202, 233, 233, 233, 233, 244, 244,
244, 244, 244, 201, 244, 200, 199, 198, 197, 196,
195, 194, 187, 193, 192, 191, 190, 182, 181, 189,
188, 187, 186, 185, 184, 183, 182, 181, 180, 179,
177, 175, 174, 173, 172, 171, 170, 169, 168, 167,
108, 115, 116, 117, 115, 118, 110, 164, 89, 89,
157, 158, 159, 157, 160, 289, 161, 288, 162, 166,
167, 168, 166, 169, 290, 170, 62, 171, 142, 143,
144, 142, 145, 166, 167, 168, 166, 169, 289, 170,
147, 171, 210, 147, 288, 210, 110, 164, 148, 157,
158, 159, 157, 160, 223, 161, 211, 162, 157, 158,
159, 157, 160, 62, 161, 223, 162, 167, 217, 116,
173, 212, 166, 167, 168, 166, 169, 62, 170, 62,
171, 166, 167, 168, 166, 169, 213, 170, 218, 171,
284, 218, 116, 173, 143, 198, 143, 198, 225, 158,
166, 165, 164, 163, 162, 159, 156, 155, 154, 153,
150, 147, 146, 142, 141, 138, 135, 134, 94, 91,
131, 89, 85, 130, 129, 128, 123, 122, 121, 116,
68, 112, 97, 96, 49, 92, 91, 86, 85, 64,
60, 59, 58, 49, 246, 11, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246
209, 283, 219, 226, 158, 209, 210, 167, 217, 210,
158, 251, 62, 225, 167, 217, 218, 220, 62, 218,
211, 167, 257, 252, 62, 282, 62, 281, 261, 280,
219, 279, 221, 278, 258, 212, 262, 270, 158, 251,
270, 263, 264, 62, 261, 220, 158, 251, 158, 251,
213, 125, 262, 167, 257, 167, 257, 263, 264, 62,
221, 252, 167, 257, 62, 270, 62, 62, 270, 62,
277, 287, 293, 293, 293, 258, 285, 286, 62, 125,
302, 299, 287, 302, 304, 276, 305, 304, 300, 275,
307, 271, 285, 307, 211, 306, 302, 299, 219, 302,
274, 304, 305, 300, 304, 307, 273, 308, 307, 267,
211, 306, 266, 272, 271, 219, 269, 268, 267, 266,
265, 62, 308, 41, 41, 41, 41, 41, 41, 41,
41, 47, 260, 259, 255, 254, 47, 47, 48, 48,
48, 48, 48, 48, 48, 48, 63, 63, 253, 63,
90, 90, 90, 90, 90, 90, 90, 90, 105, 105,
105, 105, 105, 105, 105, 105, 163, 163, 163, 163,
163, 163, 163, 163, 172, 172, 172, 172, 172, 172,
172, 172, 197, 197, 197, 197, 197, 197, 197, 197,
208, 208, 208, 208, 208, 208, 208, 208, 216, 216,
216, 216, 216, 216, 216, 216, 222, 249, 222, 250,
250, 250, 250, 250, 250, 250, 250, 256, 256, 256,
256, 256, 256, 256, 256, 292, 292, 248, 292, 292,
292, 292, 292, 294, 247, 246, 294, 294, 294, 294,
294, 309, 309, 309, 309, 309, 309, 245, 309, 244,
243, 242, 241, 234, 240, 239, 238, 237, 229, 228,
236, 235, 234, 233, 232, 231, 230, 229, 228, 227,
167, 215, 214, 158, 207, 206, 205, 204, 203, 202,
201, 200, 199, 143, 196, 195, 194, 193, 190, 187,
186, 185, 184, 181, 178, 62, 62, 116, 165, 110,
156, 153, 150, 149, 97, 94, 146, 91, 87, 141,
140, 139, 134, 133, 132, 127, 70, 62, 100, 99,
49, 95, 94, 88, 87, 62, 61, 60, 49, 311,
11, 311, 311, 311, 311, 311, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 311, 311
} ;
static const flex_int16_t yy_chk[596] =
static const flex_int16_t yy_chk[881] =
{ 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, 2,
4, 32, 2, 4, 62, 2, 4, 5, 5, 6,
6, 6, 6, 32, 244, 6, 7, 7, 8, 8,
62, 6, 235, 7, 7, 8, 8, 9, 9, 53,
53, 9, 6, 6, 9, 10, 10, 17, 28, 10,
17, 29, 10, 18, 18, 18, 18, 18, 6, 6,
4, 54, 2, 4, 54, 2, 4, 5, 5, 6,
6, 6, 6, 23, 30, 6, 7, 7, 8, 8,
23, 6, 309, 7, 7, 8, 8, 9, 9, 28,
29, 9, 6, 6, 9, 10, 10, 17, 30, 10,
17, 306, 10, 18, 18, 18, 18, 18, 6, 6,
230, 18, 28, 31, 229, 29, 33, 33, 33, 33,
35, 17, 50, 35, 31, 50, 35, 44, 44, 44,
44, 54, 60, 17, 54, 60, 64, 66, 17, 63,
17, 34, 67, 67, 67, 67, 50, 82, 34, 34,
82, 63, 64, 66, 34, 63, 34, 74, 50, 34,
74, 34, 34, 50, 223, 50, 55, 55, 55, 55,
55, 74, 77, 222, 55, 60, 76, 77, 76, 34,
34, 36, 36, 98, 71, 36, 98, 71, 36, 36,
71, 81, 81, 109, 36, 94, 36, 119, 94, 36,
100, 36, 36, 94, 119, 100, 36, 36, 109, 217,
32, 18, 28, 29, 31, 33, 33, 33, 33, 35,
67, 17, 35, 53, 53, 35, 28, 29, 44, 44,
44, 44, 79, 17, 67, 68, 32, 79, 17, 64,
17, 50, 31, 73, 50, 128, 73, 61, 32, 73,
61, 128, 68, 31, 34, 64, 55, 55, 55, 55,
55, 34, 34, 34, 55, 50, 305, 34, 68, 34,
84, 64, 34, 84, 34, 34, 78, 50, 78, 83,
83, 66, 50, 297, 50, 58, 58, 58, 58, 58,
61, 65, 34, 34, 36, 36, 76, 66, 36, 76,
97, 36, 36, 97, 112, 112, 65, 36, 97, 36,
36, 36, 110, 56, 56, 56, 56, 56, 36, 36,
36, 56, 36, 36, 106, 36, 36, 106, 110, 36,
39, 111, 39, 93, 93, 93, 93, 39, 39, 218,
218, 218, 111, 39, 114, 39, 115, 114, 39, 115,
39, 39, 102, 102, 102, 102, 102, 117, 114, 124,
102, 126, 124, 117, 216, 215, 126, 106, 39, 39,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
76, 103, 36, 66, 36, 36, 103, 291, 65, 36,
36, 290, 65, 36, 36, 285, 56, 56, 56, 56,
56, 36, 36, 36, 56, 36, 36, 101, 36, 36,
101, 126, 36, 39, 126, 39, 69, 69, 69, 69,
39, 39, 96, 96, 96, 96, 39, 137, 39, 118,
118, 39, 137, 39, 39, 62, 62, 62, 62, 62,
92, 92, 92, 92, 92, 109, 109, 109, 109, 109,
284, 39, 39, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 72,
212, 143, 72, 103, 103, 103, 103, 103, 207, 211,
145, 103, 143, 72, 104, 104, 104, 104, 104, 207,
176, 208, 104, 72, 72, 145, 205, 72, 72, 105,
105, 105, 105, 105, 177, 72, 176, 105, 203, 72,
72, 178, 72, 72, 226, 132, 72, 87, 132, 87,
177, 202, 201, 132, 87, 87, 179, 178, 204, 226,
87, 187, 87, 213, 187, 87, 213, 87, 87, 197,
196, 225, 179, 236, 204, 187, 237, 213, 238, 242,
195, 238, 242, 194, 193, 87, 87, 225, 192, 236,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 74, 120, 283, 74, 105, 105, 105, 105,
105, 121, 113, 282, 105, 113, 74, 106, 106, 106,
106, 106, 130, 122, 120, 106, 74, 74, 121, 130,
74, 74, 107, 107, 107, 107, 107, 123, 74, 120,
107, 175, 74, 74, 121, 74, 74, 145, 145, 74,
89, 122, 89, 125, 281, 113, 125, 89, 89, 123,
280, 135, 122, 89, 135, 89, 175, 125, 89, 279,
89, 89, 108, 108, 108, 108, 108, 160, 160, 274,
191, 190, 237, 189, 188, 238, 242, 247, 247, 247,
247, 247, 247, 247, 248, 186, 185, 184, 248, 248,
249, 249, 249, 249, 249, 249, 249, 250, 183, 250,
251, 251, 251, 251, 251, 251, 251, 252, 252, 252,
252, 252, 252, 252, 253, 253, 180, 253, 253, 253,
253, 254, 175, 174, 254, 254, 254, 254, 255, 255,
255, 255, 255, 173, 255, 172, 171, 168, 167, 166,
165, 164, 163, 162, 161, 160, 159, 158, 157, 156,
155, 154, 153, 152, 151, 150, 149, 148, 147, 146,
144, 142, 141, 140, 139, 138, 137, 136, 135, 134,
108, 115, 115, 115, 115, 115, 163, 163, 89, 89,
110, 110, 110, 110, 110, 273, 110, 272, 110, 116,
116, 116, 116, 116, 269, 116, 174, 116, 142, 142,
142, 142, 142, 143, 143, 143, 143, 143, 268, 143,
147, 143, 161, 147, 265, 161, 164, 164, 147, 157,
157, 157, 157, 157, 174, 157, 161, 157, 158, 158,
158, 158, 158, 263, 158, 174, 158, 169, 169, 172,
172, 161, 166, 166, 166, 166, 166, 176, 166, 177,
166, 167, 167, 167, 167, 167, 161, 167, 170, 167,
260, 170, 173, 173, 197, 197, 198, 198, 176, 208,
131, 130, 129, 128, 127, 125, 123, 122, 121, 120,
118, 116, 112, 107, 101, 99, 97, 96, 95, 92,
91, 88, 86, 85, 84, 83, 80, 79, 78, 75,
69, 65, 52, 51, 48, 43, 42, 38, 37, 30,
26, 25, 23, 15, 11, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
246, 246, 246, 246, 246
208, 259, 170, 177, 209, 209, 210, 216, 216, 210,
211, 211, 223, 176, 217, 217, 218, 170, 224, 218,
210, 219, 219, 211, 225, 255, 226, 254, 223, 253,
218, 249, 170, 248, 219, 210, 224, 234, 250, 250,
234, 225, 226, 264, 223, 218, 251, 251, 252, 252,
210, 234, 224, 256, 256, 257, 257, 225, 226, 261,
218, 252, 258, 258, 262, 270, 286, 287, 270, 299,
244, 264, 275, 275, 275, 258, 261, 262, 300, 270,
296, 286, 264, 296, 298, 243, 299, 298, 287, 242,
301, 241, 261, 301, 296, 300, 302, 286, 298, 302,
240, 304, 299, 287, 304, 307, 239, 301, 307, 238,
302, 300, 237, 236, 235, 304, 233, 232, 231, 230,
227, 222, 307, 312, 312, 312, 312, 312, 312, 312,
312, 313, 221, 220, 215, 213, 313, 313, 314, 314,
314, 314, 314, 314, 314, 314, 315, 315, 212, 315,
316, 316, 316, 316, 316, 316, 316, 316, 317, 317,
317, 317, 317, 317, 317, 317, 318, 318, 318, 318,
318, 318, 318, 318, 319, 319, 319, 319, 319, 319,
319, 319, 320, 320, 320, 320, 320, 320, 320, 320,
321, 321, 321, 321, 321, 321, 321, 321, 322, 322,
322, 322, 322, 322, 322, 322, 323, 207, 323, 324,
324, 324, 324, 324, 324, 324, 324, 325, 325, 325,
325, 325, 325, 325, 325, 326, 326, 206, 326, 326,
326, 326, 326, 327, 205, 204, 327, 327, 327, 327,
327, 328, 328, 328, 328, 328, 328, 201, 328, 200,
199, 196, 195, 194, 193, 192, 191, 190, 189, 188,
187, 186, 185, 184, 183, 182, 181, 180, 179, 178,
168, 165, 162, 159, 156, 155, 154, 153, 152, 151,
150, 149, 146, 144, 141, 140, 139, 138, 136, 134,
133, 132, 131, 129, 127, 124, 119, 117, 114, 111,
104, 102, 100, 99, 98, 95, 94, 90, 88, 87,
86, 85, 82, 81, 80, 77, 71, 63, 52, 51,
48, 43, 42, 38, 37, 27, 26, 25, 15, 11,
311, 311, 311, 311, 311, 311, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 311, 311,
311, 311, 311, 311, 311, 311, 311, 311, 311, 311
} ;
/* The intent behind this definition is that it'll catch
@@ -885,6 +969,9 @@ Modify cmFortranLexer.cxx:
/*--------------------------------------------------------------------------*/
/* Continuation splitting a token, possibly across comment lines.
Preprocessors may replace blank lines with line markers. */
#define INITIAL 0
#define free_fmt 1
#define fixed_fmt 2
@@ -1169,13 +1256,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 >= 247 )
if ( yy_current_state >= 312 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
while ( yy_base[yy_current_state] != 546 );
while ( yy_base[yy_current_state] != 831 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -1361,97 +1448,126 @@ case 33:
YY_RULE_SETUP
{ return F90PPR_ENDIF; }
YY_BREAK
/* Line continuations, possible involving comments. */
/* Rescan a token split by continuation as if written on one line. */
case 34:
/* rule 34 can match eol */
YY_RULE_SETUP
{
char const* in = yytext;
char const* end = yytext + yyleng;
int len = 0;
while (in < end) {
if (*in == '&') {
/* Skip to the '&' resuming the token, past comments and markers. */
do {
in = (char const*)memchr(in, '\n', end - in) + 1;
in += strspn(in, " \t");
} while (*in != '&');
} else {
yytext[len++] = *in;
}
++in;
}
/* unput eats yytext from the end, so the shorter token stays intact. */
while (len > 0) {
unput(yytext[--len]);
}
}
YY_BREAK
/* Line continuations, possible involving comments. */
case 35:
/* rule 35 can match eol */
YY_RULE_SETUP
YY_BREAK
case 36:
/* rule 36 can match eol */
YY_RULE_SETUP
{ return COMMA; }
YY_BREAK
case 37:
YY_RULE_SETUP
{ return DCOLON; }
{ return COMMA; }
YY_BREAK
case 38:
YY_RULE_SETUP
{ return COLON; }
YY_BREAK
/* rule 38 can match eol */
case 39:
/* rule 39 can match eol */
YY_RULE_SETUP
{ return GARBAGE; }
{ return DCOLON; }
YY_BREAK
case 40:
YY_RULE_SETUP
{ return ASSIGNMENT_OP; }
{ return COLON; }
YY_BREAK
case 41:
/* rule 41 can match eol */
YY_RULE_SETUP
{ return END; }
{ return GARBAGE; }
YY_BREAK
case 42:
YY_RULE_SETUP
{ return INCLUDE; }
{ return ASSIGNMENT_OP; }
YY_BREAK
case 43:
YY_RULE_SETUP
{ return INTERFACE; }
{ return END; }
YY_BREAK
case 44:
YY_RULE_SETUP
{ return MODULE; }
{ return INCLUDE; }
YY_BREAK
case 45:
YY_RULE_SETUP
{ return SUBMODULE; }
{ return INTERFACE; }
YY_BREAK
case 46:
YY_RULE_SETUP
{ return USE; }
{ return MODULE; }
YY_BREAK
case 47:
YY_RULE_SETUP
{ return SUBMODULE; }
YY_BREAK
case 48:
YY_RULE_SETUP
{ return USE; }
YY_BREAK
case 49:
YY_RULE_SETUP
{
yylvalp->string = strdup(yytext);
return WORD;
}
YY_BREAK
case 48:
case 50:
YY_RULE_SETUP
{ return LPAREN; }
YY_BREAK
case 49:
case 51:
YY_RULE_SETUP
{ return RPAREN; }
YY_BREAK
case 50:
YY_RULE_SETUP
{ return GARBAGE; }
YY_BREAK
case 51:
/* rule 51 can match eol */
YY_RULE_SETUP
{ return EOSTMT; }
YY_BREAK
case 52:
YY_RULE_SETUP
/* Ignore */
{ return GARBAGE; }
YY_BREAK
case 53:
/* rule 53 can match eol */
YY_RULE_SETUP
/* Ignore line-endings preceded by \ */
{ return EOSTMT; }
YY_BREAK
case 54:
YY_RULE_SETUP
/* Ignore */
YY_BREAK
case 55:
/* rule 55 can match eol */
YY_RULE_SETUP
/* Ignore line-endings preceded by \ */
YY_BREAK
case 56:
YY_RULE_SETUP
{ return *yytext; }
YY_BREAK
case YY_STATE_EOF(INITIAL):
@@ -1466,7 +1582,7 @@ case YY_STATE_EOF(str_dq):
}
}
YY_BREAK
case 55:
case 57:
YY_RULE_SETUP
ECHO;
YY_BREAK
@@ -1767,7 +1883,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 >= 247 )
if ( yy_current_state >= 312 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -1796,11 +1912,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 >= 247 )
if ( yy_current_state >= 312 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
yy_is_jam = (yy_current_state == 246);
yy_is_jam = (yy_current_state == 311);
(void)yyg;
return yy_is_jam ? 0 : yy_current_state;
+28
View File
@@ -54,6 +54,10 @@ Modify cmFortranLexer.cxx:
%s free_fmt fixed_fmt
%x str_sq str_dq
/* Continuation splitting a token, possibly across comment lines.
Preprocessors may replace blank lines with line markers. */
SPLIT_CONT &[ \t]*(!.*)?\r?\n([ \t]*(!.*|#([ \t]*(line|LINE))?[ \t]*[0-9]+.*)?\r?\n)*[ \t]*&
%%
\" {
@@ -132,12 +136,36 @@ $[ \t]*elif { return F90PPR_ELIF; }
$[ \t]*else { return F90PPR_ELSE; }
$[ \t]*endif { return F90PPR_ENDIF; }
/* Rescan a token split by continuation as if written on one line. */
[a-zA-Z_][a-zA-Z_0-9]*({SPLIT_CONT}[a-zA-Z_0-9]+)+ {
char const* in = yytext;
char const* end = yytext + yyleng;
int len = 0;
while (in < end) {
if (*in == '&') {
/* Skip to the '&' resuming the token, past comments and markers. */
do {
in = (char const*)memchr(in, '\n', end - in) + 1;
in += strspn(in, " \t");
} while (*in != '&');
} else {
yytext[len++] = *in;
}
++in;
}
/* unput eats yytext from the end, so the shorter token stays intact. */
while (len > 0) {
unput(yytext[--len]);
}
}
/* Line continuations, possible involving comments. */
&([ \t\r\n]*|!.*)*
&([ \t\r\n]*|!.*)*&
, { return COMMA; }
:{SPLIT_CONT}: |
:: { return DCOLON; }
: { return COLON; }
+14 -4
View File
@@ -6,19 +6,29 @@
# / \
# / \
# child sibling
# |
# grandchild
# | |
# grandchild nephew
# | |
# | grandnephew
# |
# GreatGrandChild
#
# where the parent node is a module and all other nodes are submodules.
# Intel's VS integration does not join names split across continuation lines.
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio")
set(split_names grandnephew.f90 nephew.f90)
endif()
add_executable(submod
# Place these first so that we do not get "lucky" and build them
# after their ancestors even if their dependencies are missed.
${split_names}
greatgrandchild.f90
grandchild.f90
main.f90
parent.f90
obfuscated_parent.f90
child.f90
grandchild.f90
greatgrandchild.f90
sibling.f90
)
@@ -0,0 +1,3 @@
! Needs nephew to be built first, despite its split name.
submodule ( parent : nephew ) grandnephew
end submodule grandnephew
@@ -1,8 +1,9 @@
! Test the notation for an Nth-generation descendant
! for N>1, which necessitates the colon.
submodule ( parent : grandchild ) GreatGrandChild
! LLVMFlang's preprocessed output splits this long name across lines.
submodule ( parent : grandchild ) GreatGrandChild_With_A_Name_Long_Enough_To_Wrap
contains
module subroutine GreatGrandChild_subroutine()
print *,"Test passed."
end subroutine
end submodule GreatGrandChild
end submodule GreatGrandChild_With_A_Name_Long_Enough_To_Wrap
@@ -0,0 +1,6 @@
! Names are split across free-form continuation lines.
submodule ( par&
&ent : sib&
&ling ) neph&
&ew
end submodule nephew
@@ -0,0 +1,14 @@
enable_language(Fortran)
# Each use_*.f90 finds its module only through a name split across lines,
# either by hand or by LLVMFlang wrapping its preprocessed output.
add_library(split_token STATIC
FortranSplitToken/use_split.f90
FortranSplitToken/use_long.f90
FortranSplitToken/use_keyword.f90
FortranSplitToken/use_dcolon.f90
FortranSplitToken/mod_split.f90
FortranSplitToken/mod_long.f90
FortranSplitToken/mod_keyword.f90
FortranSplitToken/mod_dcolon.f90
)
@@ -0,0 +1,3 @@
module split_dcolon_mod
integer :: dcolon_value = 4
end module split_dcolon_mod
@@ -0,0 +1,4 @@
mod&
&ule split_keyword_mod
integer :: keyword_value = 3
end module split_keyword_mod
@@ -0,0 +1,3 @@
module split_token_module_with_a_long_name_that_flang_wraps_in_output
integer :: long_value = 2
end module split_token_module_with_a_long_name_that_flang_wraps_in_output
@@ -0,0 +1,4 @@
module split_&
&token_mod
integer :: split_value = 1
end module split_token_mod
@@ -0,0 +1,5 @@
subroutine use_dcolon()
use, non_intrinsic :&
&: split_dcolon_mod
print *, dcolon_value
end subroutine
@@ -0,0 +1,5 @@
subroutine use_keyword()
u&
&se split_keyword_mod
print *, keyword_value
end subroutine
@@ -0,0 +1,4 @@
subroutine use_long()
use, non_intrinsic :: split_token_module_with_a_long_name_that_flang_wraps_in_output
print *, long_value
end subroutine
@@ -0,0 +1,7 @@
subroutine use_split()
use split_& ! A trailing comment & more.
! A comment line & more.
&token_mod, only: split_value
print *, split_value
end subroutine
+14
View File
@@ -233,6 +233,20 @@ function (run_LooseObjectDependsShort)
endfunction ()
run_LooseObjectDependsShort()
function(run_FortranSplitToken)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/FortranSplitToken-build)
run_cmake(FortranSplitToken)
set(objs)
foreach(src IN ITEMS use_split use_long use_keyword use_dcolon)
list(APPEND objs "CMakeFiles/split_token.dir/FortranSplitToken/${src}.f90${CMAKE_C_OUTPUT_EXTENSION}")
endforeach()
# The modules get built only if scanning found the split names.
run_ninja("${RunCMake_TEST_BINARY_DIR}" ${objs})
endfunction()
if(CMake_TEST_Fortran)
run_FortranSplitToken()
endif()
function (run_CustomCommandExplictDepends)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/CustomCommandExplicitDepends-build)
run_cmake(CustomCommandExplicitDepends)