Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions flang/lib/Parser/prescan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,12 +915,21 @@ bool Prescanner::HandleExponent(TokenSequence &tokens) {
int startColumn{column_};
TokenSequence possible;
EmitCharAndAdvance(possible, *at_);
if (InFixedFormSource()) {
SkipSpaces();
}
if (*at_ == '+' || *at_ == '-') {
EmitCharAndAdvance(possible, *at_);
if (InFixedFormSource()) {
SkipSpaces();
}
}
if (IsDecimalDigit(*at_)) { // it's an exponent; scan it
while (IsDecimalDigit(*at_)) {
EmitCharAndAdvance(possible, *at_);
if (InFixedFormSource()) {
SkipSpaces();
}
}
possible.CloseToken();
tokens.AppendRange(possible, 0); // appends to current token
Expand All @@ -940,13 +949,22 @@ bool Prescanner::HandleKindSuffix(TokenSequence &tokens) {
TokenSequence withUnderscore, separate;
EmitChar(withUnderscore, '_');
EmitCharAndAdvance(separate, '_');
if (InFixedFormSource()) {
SkipSpaces();
}
if (IsLegalInIdentifier(*at_)) {
separate.CloseToken();
EmitChar(withUnderscore, *at_);
EmitCharAndAdvance(separate, *at_);
if (InFixedFormSource()) {
SkipSpaces();
}
while (IsLegalInIdentifier(*at_)) {
EmitChar(withUnderscore, *at_);
EmitCharAndAdvance(separate, *at_);
if (InFixedFormSource()) {
SkipSpaces();
}
}
}
withUnderscore.CloseToken();
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Preprocessing/bug518.F
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s
! CHECK: k=1_4
k= 1_99999999
&4
& 4
end
Loading