Skip to content

Commit 7cc7adf

Browse files
committed
Reorganized code to eliminate repeated ampersand logic and removed whitespace skipping.
1 parent 9fc6646 commit 7cc7adf

File tree

2 files changed

+7
-81
lines changed

2 files changed

+7
-81
lines changed

flang/lib/Parser/prescan.cpp

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,30 +1290,20 @@ const char *Prescanner::FreeFormContinuationLine(bool ampersand) {
12901290
}
12911291
p = SkipWhiteSpace(p);
12921292
if (*p == '!') {
1293+
++p;
12931294
if (InCompilerDirective()) {
1294-
if (*p++ != '!') {
1295-
return nullptr;
1296-
}
1295+
12971296
for (const char *s{directiveSentinel_}; *s != '\0'; ++p, ++s) {
12981297
if (*s != ToLowerCaseLetter(*p)) {
12991298
return nullptr;
13001299
}
13011300
}
1302-
p = SkipWhiteSpace(p);
1303-
if (*p == '&') {
1304-
if (!ampersand) {
1305-
insertASpace_ = true;
1306-
}
1307-
return p + 1;
1308-
} else if (ampersand) {
1309-
return p;
1310-
} else {
1311-
return nullptr;
1312-
}
1301+
13131302
} else if (features_.IsEnabled(LanguageFeature::OpenMP)) {
1314-
if (*p + 1 == '$')
1315-
return nullptr;
1316-
p += 2;
1303+
++p;
1304+
} else {
1305+
return nullptr;
1306+
}
13171307
p = SkipWhiteSpace(p);
13181308
if (*p == '&') {
13191309
if (!ampersand) {
@@ -1325,9 +1315,6 @@ const char *Prescanner::FreeFormContinuationLine(bool ampersand) {
13251315
} else {
13261316
return nullptr;
13271317
}
1328-
} else {
1329-
return nullptr;
1330-
}
13311318
} else {
13321319
if (*p == '&') {
13331320
p = SkipWhiteSpace(p + 1);

flang/test/Parser/cd_continuation.f90

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)