namespace Fortran {
namespace parser {
+static constexpr int maxPrescannerNesting{100};
+
Prescanner::Prescanner(
Messages &messages, CookedSource &cooked, Preprocessor &preprocessor)
: messages_{messages}, cooked_{cooked}, preprocessor_{preprocessor} {}
enableBackslashEscapesInCharLiterals_{
that.enableBackslashEscapesInCharLiterals_},
warnOnNonstandardUsage_{that.warnOnNonstandardUsage_},
+ prescannerNesting_{that.prescannerNesting_ + 1},
compilerDirectiveBloomFilter_{that.compilerDirectiveBloomFilter_},
compilerDirectiveSentinels_{that.compilerDirectiveSentinels_} {}
limit_ = start_ + range.size();
lineStart_ = start_;
const bool beganInFixedForm{inFixedForm_};
+ if (prescannerNesting_ > maxPrescannerNesting) {
+ Say("too many nested INCLUDE/#include files, possibly circular"_err_en_US,
+ GetProvenance(start_));
+ return;
+ }
while (lineStart_ < limit_) {
Statement();
}
bool enableBackslashEscapesInCharLiterals_{true};
bool warnOnNonstandardUsage_{false};
int delimiterNesting_{0};
+ int prescannerNesting_{0};
Provenance startProvenance_;
const char *start_{nullptr}; // beginning of current source file content