Skip to content
Merged
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
17 changes: 12 additions & 5 deletions flang/lib/Parser/openmp-parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1222,11 +1222,14 @@ struct StrictlyStructuredBlockParser {
using resultType = Block;

std::optional<resultType> Parse(ParseState &state) const {
if (auto epc{Parser<ExecutionPartConstruct>{}.Parse(state)}) {
if (IsFortranBlockConstruct(*epc)) {
Block block;
block.emplace_back(std::move(*epc));
return std::move(block);
// Detect BLOCK construct without parsing the entire thing.
if (lookAhead(skipStuffBeforeStatement >> "BLOCK"_tok).Parse(state)) {
if (auto epc{Parser<ExecutionPartConstruct>{}.Parse(state)}) {
if (IsFortranBlockConstruct(*epc)) {
Block block;
block.emplace_back(std::move(*epc));
return std::move(block);
}
}
}
return std::nullopt;
Expand All @@ -1237,6 +1240,10 @@ struct LooselyStructuredBlockParser {
using resultType = Block;

std::optional<resultType> Parse(ParseState &state) const {
// Detect BLOCK construct without parsing the entire thing.
if (lookAhead(skipStuffBeforeStatement >> "BLOCK"_tok).Parse(state)) {
return std::nullopt;
}
Block body;
if (auto epc{attempt(Parser<ExecutionPartConstruct>{}).Parse(state)}) {
if (!IsFortranBlockConstruct(*epc)) {
Expand Down
Loading