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
5 changes: 5 additions & 0 deletions flang-rt/include/flang-rt/runtime/io-stmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,11 @@ class ListDirectedStatementState<Direction::Input>
namelistGroup_ = namelistGroup;
}

RT_API_ATTRS bool eatComma() const { return eatComma_; }
RT_API_ATTRS void set_eatComma(bool yes) { eatComma_ = yes; }
RT_API_ATTRS bool hitSlash() const { return hitSlash_; }
RT_API_ATTRS void set_hitSlash(bool yes) { hitSlash_ = yes; }

protected:
const NamelistGroup *namelistGroup_{nullptr};

Expand Down
16 changes: 16 additions & 0 deletions flang-rt/lib/runtime/io-stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,14 @@ void ChildFormattedIoStatementState<DIR, CHAR>::CompleteOperation() {

template <Direction DIR, typename CHAR>
int ChildFormattedIoStatementState<DIR, CHAR>::EndIoStatement() {
if constexpr (DIR == Direction::Input) {
if (auto *listInput{this->child()
.parent()
.template get_if<
ListDirectedStatementState<Direction::Input>>()}) {
listInput->set_eatComma(false);
}
}
CompleteOperation();
return ChildIoStatementState<DIR>::EndIoStatement();
}
Expand All @@ -1097,6 +1105,7 @@ ChildListIoStatementState<DIR>::ChildListIoStatementState(
if constexpr (DIR == Direction::Input) {
if (auto *listInput{child.parent()
.get_if<ListDirectedStatementState<Direction::Input>>()}) {
this->set_eatComma(listInput->eatComma());
this->namelistGroup_ = listInput->namelistGroup();
}
}
Expand All @@ -1121,6 +1130,13 @@ bool ChildListIoStatementState<DIR>::AdvanceRecord(int n) {

template <Direction DIR> int ChildListIoStatementState<DIR>::EndIoStatement() {
if constexpr (DIR == Direction::Input) {
if (auto *listInput{this->child()
.parent()
.template get_if<
ListDirectedStatementState<Direction::Input>>()}) {
listInput->set_eatComma(this->eatComma());
listInput->set_hitSlash(this->hitSlash());
}
if (int status{ListDirectedStatementState<DIR>::EndIoStatement()};
status != IostatOk) {
return status;
Expand Down
Loading