std::list<IoControlSpec> &&cs, std::list<InputItem> &&its)
: iounit{std::move(i)}, format{std::move(f)}, controls(std::move(cs)),
items(std::move(its)) {}
- std::optional<IoUnit> iounit; // if first in controls without UNIT=
- std::optional<Format> format; // if second in controls without FMT=, or
+ std::optional<IoUnit> iounit; // if first in controls without UNIT= &/or
+ // followed by untagged format/namelist
+ std::optional<Format> format; // if second in controls without FMT=/NML=, or
// no (io-control-spec-list); might be
- // an untagged namelist group name, too
+ // an untagged namelist group name
std::list<IoControlSpec> controls;
std::list<InputItem> items;
};
std::list<IoControlSpec> &&cs, std::list<OutputItem> &&its)
: iounit{std::move(i)}, format{std::move(f)}, controls(std::move(cs)),
items(std::move(its)) {}
- std::optional<IoUnit> iounit; // if first in controls without UNIT=
- std::optional<Format> format; // if second in controls without FMT=;
+ std::optional<IoUnit> iounit; // if first in controls without UNIT= &/or
+ // followed by untagged format/namelist
+ std::optional<Format> format; // if second in controls without FMT=/NML=;
// might be an untagged namelist group, too
std::list<IoControlSpec> controls;
std::list<OutputItem> items;
// name had appeared with NML=.
template<typename READ_OR_WRITE>
void FixMisparsedUntaggedNamelistName(READ_OR_WRITE &x) {
- if (x.format.has_value()) {
+ if (x.iounit.has_value() && x.format.has_value()) {
if (auto *charExpr{
std::get_if<parser::DefaultCharExpr>(&x.format.value().u)}) {
parser::Expr &expr{charExpr->thing.value()};