@@ -1278,17 +1278,23 @@ const char *Prescanner::FixedFormContinuationLine(bool mightNeedSpace) {
1278
1278
tabInCurrentLine_ = false ;
1279
1279
char col1{*nextLine_};
1280
1280
if (InCompilerDirective ()) {
1281
- if (preprocessingOnly_ && directiveSentinel_[0 ] == ' $' &&
1282
- directiveSentinel_[1 ] == ' \0 ' ) {
1283
- // in -E mode, don't treat "!$ &" as a continuation
1281
+ if (directiveSentinel_[0 ] == ' $' && directiveSentinel_[1 ] == ' \0 ' ) {
1282
+ if (preprocessingOnly_) {
1283
+ // in -E mode, don't treat "!$ &" as a continuation
1284
+ return nullptr ;
1285
+ } else if (IsFixedFormCommentChar (col1) && nextLine_[1 ] == ' $' ) {
1286
+ // accept but do not require a matching sentinel
1287
+ if (IsLetter (nextLine_[2 ])) {
1288
+ return nullptr ; // not !$
1289
+ }
1290
+ }
1284
1291
} else if (IsFixedFormCommentChar (col1)) {
1285
1292
int j{1 };
1286
1293
for (; j < 5 ; ++j) {
1287
1294
char ch{directiveSentinel_[j - 1 ]};
1288
1295
if (ch == ' \0 ' ) {
1289
1296
break ;
1290
- }
1291
- if (ch != ToLowerCaseLetter (nextLine_[j])) {
1297
+ } else if (ch != ToLowerCaseLetter (nextLine_[j])) {
1292
1298
return nullptr ;
1293
1299
}
1294
1300
}
@@ -1297,13 +1303,15 @@ const char *Prescanner::FixedFormContinuationLine(bool mightNeedSpace) {
1297
1303
return nullptr ;
1298
1304
}
1299
1305
}
1300
- const char *col6{nextLine_ + 5 };
1301
- if (*col6 != ' \n ' && *col6 != ' 0' && !IsSpaceOrTab (col6)) {
1302
- if (mightNeedSpace && !IsSpace (nextLine_ + 6 )) {
1303
- insertASpace_ = true ;
1304
- }
1305
- return nextLine_ + 6 ;
1306
+ } else {
1307
+ return nullptr ;
1308
+ }
1309
+ const char *col6{nextLine_ + 5 };
1310
+ if (*col6 != ' \n ' && *col6 != ' 0' && !IsSpaceOrTab (col6)) {
1311
+ if (mightNeedSpace && !IsSpace (nextLine_ + 6 )) {
1312
+ insertASpace_ = true ;
1306
1313
}
1314
+ return nextLine_ + 6 ;
1307
1315
}
1308
1316
} else {
1309
1317
// Normal case: not in a compiler directive.
@@ -1351,26 +1359,37 @@ const char *Prescanner::FreeFormContinuationLine(bool ampersand) {
1351
1359
}
1352
1360
p = SkipWhiteSpaceIncludingEmptyMacros (p);
1353
1361
if (InCompilerDirective ()) {
1354
- if (preprocessingOnly_ && directiveSentinel_[0 ] == ' $' &&
1355
- directiveSentinel_[1 ] == ' \0 ' ) {
1356
- // in -E mode, don't treat !$ as a continuation
1362
+ if (directiveSentinel_[0 ] == ' $' && directiveSentinel_[1 ] == ' \0 ' ) {
1363
+ if (preprocessingOnly_) {
1364
+ // in -E mode, don't treat !$ as a continuation
1365
+ return nullptr ;
1366
+ } else if (p[0 ] == ' !' && p[1 ] == ' $' ) {
1367
+ // accept but do not require a matching sentinel
1368
+ if (IsLetter (p[2 ])) {
1369
+ return nullptr ; // not !$
1370
+ }
1371
+ p += 2 ;
1372
+ }
1357
1373
} else if (*p++ == ' !' ) {
1358
1374
for (const char *s{directiveSentinel_}; *s != ' \0 ' ; ++p, ++s) {
1359
1375
if (*s != ToLowerCaseLetter (*p)) {
1360
1376
return nullptr ; // not the same directive class
1361
1377
}
1362
1378
}
1363
- p = SkipWhiteSpace (p);
1364
- if (*p == ' &' ) {
1365
- if (!ampersand) {
1366
- insertASpace_ = true ;
1367
- }
1368
- return p + 1 ;
1369
- } else if (ampersand) {
1370
- return p;
1379
+ } else {
1380
+ return nullptr ;
1381
+ }
1382
+ p = SkipWhiteSpace (p);
1383
+ if (*p == ' &' ) {
1384
+ if (!ampersand) {
1385
+ insertASpace_ = true ;
1371
1386
}
1387
+ return p + 1 ;
1388
+ } else if (ampersand) {
1389
+ return p;
1390
+ } else {
1391
+ return nullptr ;
1372
1392
}
1373
- return nullptr ;
1374
1393
}
1375
1394
if (p[0 ] == ' !' && p[1 ] == ' $' && !preprocessingOnly_ &&
1376
1395
features_.IsEnabled (LanguageFeature::OpenMP)) {
0 commit comments