Skip to content

Commit 15b3108

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

File tree

2 files changed

+13
-90
lines changed

2 files changed

+13
-90
lines changed

flang/lib/Parser/prescan.cpp

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,48 +1290,32 @@ 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-
}
12971295
for (const char *s{directiveSentinel_}; *s != '\0'; ++p, ++s) {
12981296
if (*s != ToLowerCaseLetter(*p)) {
12991297
return nullptr;
13001298
}
13011299
}
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-
}
13131300
} else if (features_.IsEnabled(LanguageFeature::OpenMP)) {
1314-
if (*p + 1 == '$')
1315-
return nullptr;
1316-
p += 2;
1317-
p = SkipWhiteSpace(p);
1318-
if (*p == '&') {
1319-
if (!ampersand) {
1320-
insertASpace_ = true;
1321-
}
1322-
return p + 1;
1323-
} else if (ampersand) {
1324-
return p;
1325-
} else {
1326-
return nullptr;
1301+
++p;
1302+
} else {
1303+
return nullptr;
1304+
}
1305+
p = SkipWhiteSpace(p);
1306+
if (*p == '&') {
1307+
if (!ampersand) {
1308+
insertASpace_ = true;
13271309
}
1310+
return p + 1;
1311+
} else if (ampersand) {
1312+
return p;
13281313
} else {
13291314
return nullptr;
13301315
}
13311316
} else {
13321317
if (*p == '&') {
1333-
p = SkipWhiteSpace(p + 1);
1334-
return p;
1318+
return p + 1;
13351319
} else if (*p == '!' || *p == '\n' || *p == '#') {
13361320
return nullptr;
13371321
} else if (ampersand || IsImplicitContinuation()) {

flang/test/Parser/cd_continuation.f90

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

0 commit comments

Comments
 (0)