[flang] Fix some F90 unparsings; address review comments.
Original-commit: flang-compiler/f18@af33f37600 Reviewed-on: https://github.com/flang-compiler/f18/pull/25 Tree-same-pre-rewrite: false
This commit is contained in:
parent
d39a33f80c
commit
46c3538c7a
|
@ -385,7 +385,7 @@ public:
|
|||
if (std::optional<paType> first{parser_.Parse(state)}) {
|
||||
resultType result;
|
||||
result.emplace_back(std::move(*first));
|
||||
if ((state->GetLocation() > start)) {
|
||||
if (state->GetLocation() > start) {
|
||||
result.splice(result.end(), *many(parser_).Parse(state));
|
||||
}
|
||||
return {std::move(result)};
|
||||
|
|
|
@ -36,7 +36,8 @@ bool Parsing::Prescan(const std::string &path, Options options) {
|
|||
.set_enableOldDebugLines(options.enableOldDebugLines);
|
||||
ProvenanceRange range{
|
||||
allSources_.AddIncludedFile(*sourceFile, ProvenanceRange{})};
|
||||
if ((anyFatalError_ = !prescanner.Prescan(range))) {
|
||||
anyFatalError_ = !prescanner.Prescan(range);
|
||||
if (anyFatalError_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -195,7 +195,8 @@ struct CharLiteralChar {
|
|||
for (int j = (ch > 3 ? 1 : 2); j-- > 0;) {
|
||||
static constexpr auto octalDigit = attempt(CharPredicateGuardParser{
|
||||
IsOctalDigit, "expected octal digit"_en_US});
|
||||
if ((och = octalDigit.Parse(state)).has_value()) {
|
||||
och = octalDigit.Parse(state);
|
||||
if (och.has_value()) {
|
||||
ch = 8 * ch + *och - '0';
|
||||
}
|
||||
}
|
||||
|
@ -204,7 +205,8 @@ struct CharLiteralChar {
|
|||
for (int j = 0; j++ < 2;) {
|
||||
static constexpr auto hexDigit = attempt(CharPredicateGuardParser{
|
||||
IsHexadecimalDigit, "expected hexadecimal digit"_en_US});
|
||||
if ((och = hexDigit.Parse(state)).has_value()) {
|
||||
och = hexDigit.Parse(state);
|
||||
if (och.has_value()) {
|
||||
ch = 16 * ch + HexadecimalDigitValue(*och);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,9 +217,9 @@ public:
|
|||
Put("EXTENDS("), Walk(x.v), Put(')');
|
||||
return false;
|
||||
}
|
||||
void Post(const EndTypeStmt &) { // R730
|
||||
Outdent();
|
||||
Put("END TYPE");
|
||||
bool Pre(const EndTypeStmt &x) { // R730
|
||||
Outdent(), Put("END TYPE"), Walk(" ", x.v);
|
||||
return false;
|
||||
}
|
||||
bool Pre(const SequenceStmt &x) { // R731
|
||||
Put("SEQUENCE");
|
||||
|
@ -411,6 +411,11 @@ public:
|
|||
Walk(",", x.step);
|
||||
return false;
|
||||
}
|
||||
bool Pre(const AcImpliedDo &x) { // R774
|
||||
Put('('), Walk(std::get<std::list<AcValue>>(x.t), ", ");
|
||||
Put(", "), Walk(std::get<AcImpliedDoControl>(x.t)), Put(')');
|
||||
return false;
|
||||
}
|
||||
bool Pre(const AcImpliedDoControl &x) { // R775
|
||||
Walk(std::get<std::optional<IntegerTypeSpec>>(x.t), "::");
|
||||
Walk(std::get<LoopBounds<ScalarIntExpr>>(x.t));
|
||||
|
|
Loading…
Reference in a new issue