void Prescanner::Prescan(ProvenanceRange range) {
AllSources &allSources{cooked_.allSources()};
- ProvenanceRange around{allSources.GetContiguousRangeAround(range)};
startProvenance_ = range.start();
std::size_t offset{0};
const SourceFile *source{allSources.GetSourceFile(startProvenance_, &offset)};
Messages &messages_;
CookedSource &cooked_;
Preprocessor &preprocessor_;
- bool anyFatalErrors_{false};
bool inFixedForm_{false};
int fixedFormColumnLimit_{72};
Encoding encoding_{Encoding::UTF8};
template<typename T> void Before(const T &) {}
template<typename T> double Unparse(const T &); // not void, never used
- template<typename T>
- auto Pre(const T &x) ->
- typename std::enable_if<std::is_void_v<decltype(Unparse(x))>,
- bool>::type {
- // There is a local definition of Unparse() for this type. It
- // overrides the parse tree walker's default Walk() over the descendents.
- Before(x);
- Unparse(x);
- Post(x);
- return false; // Walk() does not visit descendents
- }
- template<typename T>
- auto Pre(const T &x) ->
- typename std::enable_if<!std::is_void_v<decltype(Unparse(x))>,
- bool>::type {
- Before(x);
- return true; // there's no Unparse() defined here, Walk() the descendents
+ template<typename T> bool Pre(const T &x) {
+ if constexpr (std::is_void_v<decltype(Unparse(x))>) {
+ // There is a local definition of Unparse() for this type. It
+ // overrides the parse tree walker's default Walk() over the descendents.
+ Before(x);
+ Unparse(x);
+ Post(x);
+ return false; // Walk() does not visit descendents
+ } else {
+ Before(x);
+ return true; // there's no Unparse() defined here, Walk() the descendents
+ }
}
template<typename T> void Post(const T &) {}
namespace Fortran {
namespace parser {
-class Program;
+struct Program;
/// Convert parsed program to out as Fortran.
void Unparse(std::ostream &out, const Program &program,
#include <iosfwd>
namespace Fortran::parser {
-class Program;
+struct Program;
class CookedSource;
} // namespace Fortran::parser
// Specialize from StmtClass::LabelDo to StmtClass::NonLabelDoWhile or
// StmtClass::NonLabelDoConcurrent where applicable
- SpecializeDoStmt( sema.stmt_index , std::get<x.CONTROL>(x.t) );
+ SpecializeDoStmt( sema.stmt_index , std::get<std::optional<LoopControl>>(x.t) );
return true ;
}
// Specialize from StmtClass::LabelDo to StmtClass::LabelDoWhile or
// StmtClass::LabelDoConcurrent where applicable
- SpecializeDoStmt( sema.stmt_index , std::get<x.CONTROL>(x.t) );
+ SpecializeDoStmt( sema.stmt_index , std::get<std::optional<LoopControl>>(x.t) );
return true ;
}
#include <iosfwd>
namespace Fortran::parser {
-class Program;
+struct Program;
class CookedSource;
} // namespace Fortran::parser
namespace Fortran::parser {
-class Program;
+struct Program;
} // namespace Fortran::parser
namespace Fortran::semantics {