[flang] Adjust indentation on public:/private: labels in class definitions.

Original-commit: flang-compiler/f18@8c0e5a52a9
This commit is contained in:
peter klausler 2018-02-05 12:54:36 -08:00
parent be830d6b35
commit bdea10d9af
13 changed files with 120 additions and 120 deletions

View File

@ -33,7 +33,7 @@ namespace Fortran {
// the type checker. The state remains valid. // the type checker. The state remains valid.
template<typename A> template<typename A>
class FailParser { class FailParser {
public: public:
using resultType = A; using resultType = A;
constexpr FailParser(const FailParser &) = default; constexpr FailParser(const FailParser &) = default;
constexpr explicit FailParser(const char *str) : str_{str} {} constexpr explicit FailParser(const char *str) : str_{str} {}
@ -41,7 +41,7 @@ class FailParser {
state->messages()->Add(Message{state->position(), str_, state->context()}); state->messages()->Add(Message{state->position(), str_, state->context()});
return {}; return {};
} }
private: private:
const char *const str_; const char *const str_;
}; };
@ -56,12 +56,12 @@ inline constexpr auto fail(const char *message) {
// parse, and returns a captured value whose type must be copy-constructible. // parse, and returns a captured value whose type must be copy-constructible.
template<typename A> template<typename A>
class PureParser { class PureParser {
public: public:
using resultType = A; using resultType = A;
constexpr PureParser(const PureParser &) = default; constexpr PureParser(const PureParser &) = default;
constexpr explicit PureParser(A &&x) : value_(std::move(x)) {} constexpr explicit PureParser(A &&x) : value_(std::move(x)) {}
std::optional<A> Parse(ParseState *) const { return {value_}; } std::optional<A> Parse(ParseState *) const { return {value_}; }
private: private:
const A value_; const A value_;
}; };
@ -74,7 +74,7 @@ inline constexpr auto pure(A x) {
// the ParseState is guaranteed to have been restored to its initial value. // the ParseState is guaranteed to have been restored to its initial value.
template<typename A> template<typename A>
class BacktrackingParser { class BacktrackingParser {
public: public:
using resultType = typename A::resultType; using resultType = typename A::resultType;
constexpr BacktrackingParser(const BacktrackingParser &) = default; constexpr BacktrackingParser(const BacktrackingParser &) = default;
constexpr BacktrackingParser(const A &parser) : parser_{parser} {} constexpr BacktrackingParser(const A &parser) : parser_{parser} {}
@ -94,7 +94,7 @@ class BacktrackingParser {
} }
return result; return result;
} }
private: private:
const A parser_; const A parser_;
}; };
@ -107,7 +107,7 @@ inline constexpr auto attempt(const A &parser) {
// x fails, returning a useless (but present) result. !x fails when x succeeds. // x fails, returning a useless (but present) result. !x fails when x succeeds.
template<typename PA> template<typename PA>
class NegatedParser { class NegatedParser {
public: public:
using resultType = Success; using resultType = Success;
constexpr NegatedParser(const NegatedParser &) = default; constexpr NegatedParser(const NegatedParser &) = default;
constexpr NegatedParser(const PA &p) : parser_{p} {} constexpr NegatedParser(const PA &p) : parser_{p} {}
@ -120,7 +120,7 @@ class NegatedParser {
} }
return {Success{}}; return {Success{}};
} }
private: private:
const PA parser_; const PA parser_;
}; };
@ -133,7 +133,7 @@ inline constexpr auto operator!(const PA &p) {
// or fails if x does, but the state is not modified. // or fails if x does, but the state is not modified.
template<typename PA> template<typename PA>
class LookAheadParser { class LookAheadParser {
public: public:
using resultType = Success; using resultType = Success;
constexpr LookAheadParser(const LookAheadParser &) = default; constexpr LookAheadParser(const LookAheadParser &) = default;
constexpr LookAheadParser(const PA &p) : parser_{p} {} constexpr LookAheadParser(const PA &p) : parser_{p} {}
@ -143,7 +143,7 @@ class LookAheadParser {
state->messages()->swap(messages); state->messages()->swap(messages);
return parser_.Parse(&forked); return parser_.Parse(&forked);
} }
private: private:
const PA parser_; const PA parser_;
}; };
@ -155,7 +155,7 @@ inline constexpr auto lookAhead(const PA &p) {
// If a is a parser, inContext("...", a) runs it in a nested message context. // If a is a parser, inContext("...", a) runs it in a nested message context.
template<typename PA> template<typename PA>
class MessageContextParser { class MessageContextParser {
public: public:
using resultType = typename PA::resultType; using resultType = typename PA::resultType;
constexpr MessageContextParser(const MessageContextParser &) = default; constexpr MessageContextParser(const MessageContextParser &) = default;
constexpr MessageContextParser(const char *str, const PA &p) constexpr MessageContextParser(const char *str, const PA &p)
@ -166,7 +166,7 @@ class MessageContextParser {
state->PopContext(); state->PopContext();
return result; return result;
} }
private: private:
const char *str_; const char *str_;
const PA parser_; const PA parser_;
}; };
@ -182,7 +182,7 @@ inline constexpr auto inContext(const char *context, const PA &parser) {
// do so, but the result is that returned by a. // do so, but the result is that returned by a.
template<typename PA, typename PB> template<typename PA, typename PB>
class SequenceParser { class SequenceParser {
public: public:
using resultType = typename PB::resultType; using resultType = typename PB::resultType;
constexpr SequenceParser(const SequenceParser &) = default; constexpr SequenceParser(const SequenceParser &) = default;
constexpr SequenceParser(const PA &pa, const PB &pb) : pa_{pa}, pb_{pb} {} constexpr SequenceParser(const PA &pa, const PB &pb) : pa_{pa}, pb_{pb} {}
@ -192,7 +192,7 @@ class SequenceParser {
} }
return {}; return {};
} }
private: private:
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
}; };
@ -204,7 +204,7 @@ inline constexpr auto operator>>(const PA &pa, const PB &pb) {
template<typename PA, typename PB> template<typename PA, typename PB>
class InvertedSequenceParser { class InvertedSequenceParser {
public: public:
using resultType = typename PA::resultType; using resultType = typename PA::resultType;
constexpr InvertedSequenceParser(const InvertedSequenceParser &) = default; constexpr InvertedSequenceParser(const InvertedSequenceParser &) = default;
constexpr InvertedSequenceParser(const PA &pa, const PB &pb) constexpr InvertedSequenceParser(const PA &pa, const PB &pb)
@ -217,7 +217,7 @@ class InvertedSequenceParser {
} }
return {}; return {};
} }
private: private:
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
}; };
@ -232,7 +232,7 @@ inline constexpr auto operator/(const PA &pa, const PB &pb) {
// must be the same type. If a succeeds, b is not attempted. // must be the same type. If a succeeds, b is not attempted.
template<typename PA, typename PB> template<typename PA, typename PB>
class AlternativeParser { class AlternativeParser {
public: public:
using resultType = typename PA::resultType; using resultType = typename PA::resultType;
constexpr AlternativeParser(const AlternativeParser &) = default; constexpr AlternativeParser(const AlternativeParser &) = default;
constexpr AlternativeParser(const PA &pa, const PB &pb) : pa_{pa}, pb_{pb} {} constexpr AlternativeParser(const PA &pa, const PB &pb) : pa_{pa}, pb_{pb} {}
@ -266,7 +266,7 @@ class AlternativeParser {
state->messages()->swap(messages); state->messages()->swap(messages);
return {}; return {};
} }
private: private:
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
}; };
@ -291,7 +291,7 @@ inline constexpr auto operator||(const AlternativeParser<PA,PB> &papb,
// All messages from the first parse are retained. // All messages from the first parse are retained.
template<typename PA, typename PB> template<typename PA, typename PB>
class RecoveryParser { class RecoveryParser {
public: public:
using resultType = typename PA::resultType; using resultType = typename PA::resultType;
constexpr RecoveryParser(const RecoveryParser &) = default; constexpr RecoveryParser(const RecoveryParser &) = default;
constexpr RecoveryParser(const PA &pa, const PB &pb) : pa_{pa}, pb_{pb} {} constexpr RecoveryParser(const PA &pa, const PB &pb) : pa_{pa}, pb_{pb} {}
@ -314,7 +314,7 @@ class RecoveryParser {
} }
return bx; return bx;
} }
private: private:
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
}; };
@ -330,7 +330,7 @@ inline constexpr auto recovery(const PA &pa, const PB &pb) {
template<typename PA> template<typename PA>
class ManyParser { class ManyParser {
using paType = typename PA::resultType; using paType = typename PA::resultType;
public: public:
using resultType = std::list<paType>; using resultType = std::list<paType>;
constexpr ManyParser(const ManyParser &) = default; constexpr ManyParser(const ManyParser &) = default;
constexpr ManyParser(const PA &parser) : parser_{parser} {} constexpr ManyParser(const PA &parser) : parser_{parser} {}
@ -346,7 +346,7 @@ class ManyParser {
} }
return {std::move(result)}; return {std::move(result)};
} }
private: private:
const BacktrackingParser<PA> parser_; const BacktrackingParser<PA> parser_;
}; };
@ -362,7 +362,7 @@ inline constexpr auto many(const PA &parser) {
template<typename PA> template<typename PA>
class SomeParser { class SomeParser {
using paType = typename PA::resultType; using paType = typename PA::resultType;
public: public:
using resultType = std::list<paType>; using resultType = std::list<paType>;
constexpr SomeParser(const SomeParser &) = default; constexpr SomeParser(const SomeParser &) = default;
constexpr SomeParser(const PA &parser) : parser_{parser} {} constexpr SomeParser(const PA &parser) : parser_{parser} {}
@ -378,7 +378,7 @@ class SomeParser {
} }
return {}; return {};
} }
private: private:
const PA parser_; const PA parser_;
}; };
@ -390,7 +390,7 @@ inline constexpr auto some(const PA &parser) {
// If x is a parser, skipMany(x) is equivalent to many(x) but with no result. // If x is a parser, skipMany(x) is equivalent to many(x) but with no result.
template<typename PA> template<typename PA>
class SkipManyParser { class SkipManyParser {
public: public:
using resultType = Success; using resultType = Success;
constexpr SkipManyParser(const SkipManyParser &) = default; constexpr SkipManyParser(const SkipManyParser &) = default;
constexpr SkipManyParser(const PA &parser) : parser_{parser} {} constexpr SkipManyParser(const PA &parser) : parser_{parser} {}
@ -401,7 +401,7 @@ class SkipManyParser {
} }
return {Success{}}; return {Success{}};
} }
private: private:
const BacktrackingParser<PA> parser_; const BacktrackingParser<PA> parser_;
}; };
@ -415,7 +415,7 @@ inline constexpr auto skipMany(const PA &parser) {
// state on failure. // state on failure.
template<typename PA> template<typename PA>
class SkipManyFastParser { class SkipManyFastParser {
public: public:
using resultType = Success; using resultType = Success;
constexpr SkipManyFastParser(const SkipManyFastParser &) = default; constexpr SkipManyFastParser(const SkipManyFastParser &) = default;
constexpr SkipManyFastParser(const PA &parser) : parser_{parser} {} constexpr SkipManyFastParser(const PA &parser) : parser_{parser} {}
@ -424,7 +424,7 @@ class SkipManyFastParser {
} }
return {Success{}}; return {Success{}};
} }
private: private:
const PA parser_; const PA parser_;
}; };
@ -438,7 +438,7 @@ inline constexpr auto skipManyFast(const PA &parser) {
template<typename PA> template<typename PA>
class MaybeParser { class MaybeParser {
using paType = typename PA::resultType; using paType = typename PA::resultType;
public: public:
using resultType = std::optional<paType>; using resultType = std::optional<paType>;
constexpr MaybeParser(const MaybeParser &) = default; constexpr MaybeParser(const MaybeParser &) = default;
constexpr MaybeParser(const PA &parser) : parser_{parser} {} constexpr MaybeParser(const PA &parser) : parser_{parser} {}
@ -448,7 +448,7 @@ class MaybeParser {
} }
return {resultType{}}; return {resultType{}};
} }
private: private:
const BacktrackingParser<PA> parser_; const BacktrackingParser<PA> parser_;
}; };
@ -462,7 +462,7 @@ inline constexpr auto maybe(const PA &parser) {
// result is a default-constructed value of x's result type. // result is a default-constructed value of x's result type.
template<typename PA> template<typename PA>
class DefaultedParser { class DefaultedParser {
public: public:
using resultType = typename PA::resultType; using resultType = typename PA::resultType;
constexpr DefaultedParser(const DefaultedParser &) = default; constexpr DefaultedParser(const DefaultedParser &) = default;
constexpr DefaultedParser(const PA &p) : parser_{p} {} constexpr DefaultedParser(const PA &p) : parser_{p} {}
@ -474,7 +474,7 @@ class DefaultedParser {
} }
return {resultType{}}; return {resultType{}};
} }
private: private:
const BacktrackingParser<PA> parser_; const BacktrackingParser<PA> parser_;
}; };
@ -505,7 +505,7 @@ template<typename PA, typename T>
class Apply1 { class Apply1 {
using paType = typename PA::resultType; using paType = typename PA::resultType;
using funcType = T (*)(paType &&); using funcType = T (*)(paType &&);
public: public:
using resultType = T; using resultType = T;
constexpr Apply1(const Apply1 &) = default; constexpr Apply1(const Apply1 &) = default;
constexpr Apply1(funcType function, const PA &parser) constexpr Apply1(funcType function, const PA &parser)
@ -516,7 +516,7 @@ class Apply1 {
} }
return {}; return {};
} }
private: private:
const funcType function_; const funcType function_;
const PA parser_; const PA parser_;
}; };
@ -531,7 +531,7 @@ template<typename PA, typename T>
class Apply1Functor { class Apply1Functor {
using paType = typename PA::resultType; using paType = typename PA::resultType;
using funcType = std::function<T(paType &&)>; using funcType = std::function<T(paType &&)>;
public: public:
using resultType = T; using resultType = T;
Apply1Functor(const Apply1Functor &) = default; Apply1Functor(const Apply1Functor &) = default;
Apply1Functor(const funcType &functor, const PA &parser) Apply1Functor(const funcType &functor, const PA &parser)
@ -542,7 +542,7 @@ class Apply1Functor {
} }
return {}; return {};
} }
private: private:
const funcType &functor_; const funcType &functor_;
const PA parser_; const PA parser_;
}; };
@ -556,7 +556,7 @@ applyLambda(const std::function<T(typename PA::resultType &&)> &f,
template<typename PA> template<typename PA>
class Apply1Mem { class Apply1Mem {
public: public:
using resultType = typename PA::resultType; using resultType = typename PA::resultType;
using funcType = void (resultType::*)(); using funcType = void (resultType::*)();
constexpr Apply1Mem(const Apply1Mem &) = default; constexpr Apply1Mem(const Apply1Mem &) = default;
@ -569,7 +569,7 @@ class Apply1Mem {
} }
return result; return result;
} }
private: private:
const funcType function_; const funcType function_;
const PA pa_; const PA pa_;
}; };
@ -585,7 +585,7 @@ class Apply2 {
using paType = typename PA::resultType; using paType = typename PA::resultType;
using pbType = typename PB::resultType; using pbType = typename PB::resultType;
using funcType = T (*)(paType &&, pbType &&); using funcType = T (*)(paType &&, pbType &&);
public: public:
using resultType = T; using resultType = T;
constexpr Apply2(const Apply2 &) = default; constexpr Apply2(const Apply2 &) = default;
constexpr Apply2(funcType function, const PA &pa, const PB &pb) constexpr Apply2(funcType function, const PA &pa, const PB &pb)
@ -598,7 +598,7 @@ class Apply2 {
} }
return {}; return {};
} }
private: private:
const funcType function_; const funcType function_;
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
@ -616,7 +616,7 @@ class Apply2Functor {
using paType = typename PA::resultType; using paType = typename PA::resultType;
using pbType = typename PB::resultType; using pbType = typename PB::resultType;
using funcType = std::function<T(paType &&, pbType &&)>; using funcType = std::function<T(paType &&, pbType &&)>;
public: public:
using resultType = T; using resultType = T;
Apply2Functor(const Apply2Functor &) = default; Apply2Functor(const Apply2Functor &) = default;
Apply2Functor(const funcType &function, const PA &pa, const PB &pb) Apply2Functor(const funcType &function, const PA &pa, const PB &pb)
@ -629,7 +629,7 @@ class Apply2Functor {
} }
return {}; return {};
} }
private: private:
const funcType &function_; const funcType &function_;
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
@ -646,7 +646,7 @@ applyLambda(const std::function<T(typename PA::resultType &&,
template<typename PA, typename PB> template<typename PA, typename PB>
class Apply2Mem { class Apply2Mem {
using pbType = typename PB::resultType; using pbType = typename PB::resultType;
public: public:
using resultType = typename PA::resultType; using resultType = typename PA::resultType;
using funcType = void (resultType::*)(pbType &&); using funcType = void (resultType::*)(pbType &&);
constexpr Apply2Mem(const Apply2Mem &) = default; constexpr Apply2Mem(const Apply2Mem &) = default;
@ -661,7 +661,7 @@ class Apply2Mem {
} }
return {}; return {};
} }
private: private:
const funcType function_; const funcType function_;
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
@ -679,7 +679,7 @@ class Apply3 {
using pbType = typename PB::resultType; using pbType = typename PB::resultType;
using pcType = typename PC::resultType; using pcType = typename PC::resultType;
using funcType = T (*) (paType &&, pbType &&, pcType &&); using funcType = T (*) (paType &&, pbType &&, pcType &&);
public: public:
using resultType = T; using resultType = T;
constexpr Apply3(const Apply3 &) = default; constexpr Apply3(const Apply3 &) = default;
constexpr Apply3(funcType function, const PA &pa, const PB &pb, const PC &pc) constexpr Apply3(funcType function, const PA &pa, const PB &pb, const PC &pc)
@ -694,7 +694,7 @@ class Apply3 {
} }
return {}; return {};
} }
private: private:
const funcType function_; const funcType function_;
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
@ -713,7 +713,7 @@ template<typename PA, typename PB, typename PC>
class Apply3Mem { class Apply3Mem {
using pbType = typename PB::resultType; using pbType = typename PB::resultType;
using pcType = typename PC::resultType; using pcType = typename PC::resultType;
public: public:
using resultType = typename PA::resultType; using resultType = typename PA::resultType;
using funcType = void (resultType::*)(pbType &&, pcType &&); using funcType = void (resultType::*)(pbType &&, pcType &&);
constexpr Apply3Mem(const Apply3Mem &) = default; constexpr Apply3Mem(const Apply3Mem &) = default;
@ -731,7 +731,7 @@ class Apply3Mem {
} }
return {}; return {};
} }
private: private:
const funcType function_; const funcType function_;
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
@ -752,7 +752,7 @@ class Apply4 {
using pcType = typename PC::resultType; using pcType = typename PC::resultType;
using pdType = typename PD::resultType; using pdType = typename PD::resultType;
using funcType = T (*) (paType &&, pbType &&, pcType &&, pdType &&); using funcType = T (*) (paType &&, pbType &&, pcType &&, pdType &&);
public: public:
using resultType = T; using resultType = T;
constexpr Apply4(const Apply4 &) = default; constexpr Apply4(const Apply4 &) = default;
constexpr Apply4(funcType function, const PA &pa, const PB &pb, const PC &pc, constexpr Apply4(funcType function, const PA &pa, const PB &pb, const PC &pc,
@ -771,7 +771,7 @@ class Apply4 {
} }
return {}; return {};
} }
private: private:
const funcType function_; const funcType function_;
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
@ -792,7 +792,7 @@ class Apply4Mem {
using pbType = typename PB::resultType; using pbType = typename PB::resultType;
using pcType = typename PC::resultType; using pcType = typename PC::resultType;
using pdType = typename PD::resultType; using pdType = typename PD::resultType;
public: public:
using resultType = typename PA::resultType; using resultType = typename PA::resultType;
using funcType = void (resultType::*) (pbType &&, pcType &&, pdType &&); using funcType = void (resultType::*) (pbType &&, pcType &&, pdType &&);
constexpr Apply4Mem(const Apply4Mem &) = default; constexpr Apply4Mem(const Apply4Mem &) = default;
@ -813,7 +813,7 @@ class Apply4Mem {
} }
return {}; return {};
} }
private: private:
const funcType function_; const funcType function_;
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
@ -847,7 +847,7 @@ struct construct {
template<typename PA> template<typename PA>
class Construct1 { class Construct1 {
public: public:
using resultType = T; using resultType = T;
constexpr Construct1(const Construct1 &) = default; constexpr Construct1(const Construct1 &) = default;
constexpr explicit Construct1(const PA &parser) : parser_{parser} {} constexpr explicit Construct1(const PA &parser) : parser_{parser} {}
@ -857,7 +857,7 @@ struct construct {
} }
return {}; return {};
} }
private: private:
const PA parser_; const PA parser_;
}; };
@ -868,7 +868,7 @@ struct construct {
template<typename PA, typename PB> template<typename PA, typename PB>
class Construct2 { class Construct2 {
public: public:
using resultType = T; using resultType = T;
constexpr Construct2(const Construct2 &) = default; constexpr Construct2(const Construct2 &) = default;
constexpr Construct2(const PA &pa, const PB &pb) : pa_{pa}, pb_{pb} {} constexpr Construct2(const PA &pa, const PB &pb) : pa_{pa}, pb_{pb} {}
@ -880,7 +880,7 @@ struct construct {
} }
return {}; return {};
} }
private: private:
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
}; };
@ -892,7 +892,7 @@ struct construct {
template<typename PA, typename PB, typename PC> template<typename PA, typename PB, typename PC>
class Construct3 { class Construct3 {
public: public:
using resultType = T; using resultType = T;
constexpr Construct3(const Construct3 &) = default; constexpr Construct3(const Construct3 &) = default;
constexpr Construct3(const PA &pa, const PB &pb, const PC &pc) constexpr Construct3(const PA &pa, const PB &pb, const PC &pc)
@ -907,7 +907,7 @@ struct construct {
} }
return {}; return {};
} }
private: private:
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
const PC pc_; const PC pc_;
@ -921,7 +921,7 @@ struct construct {
template<typename PA, typename PB, typename PC, typename PD> template<typename PA, typename PB, typename PC, typename PD>
class Construct4 { class Construct4 {
public: public:
using resultType = T; using resultType = T;
constexpr Construct4(const Construct4 &) = default; constexpr Construct4(const Construct4 &) = default;
constexpr Construct4(const PA &pa, const PB &pb, constexpr Construct4(const PA &pa, const PB &pb,
@ -940,7 +940,7 @@ struct construct {
} }
return {}; return {};
} }
private: private:
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
const PC pc_; const PC pc_;
@ -955,7 +955,7 @@ struct construct {
template<typename PA, typename PB, typename PC, typename PD, typename PE> template<typename PA, typename PB, typename PC, typename PD, typename PE>
class Construct5 { class Construct5 {
public: public:
using resultType = T; using resultType = T;
constexpr Construct5(const Construct5 &) = default; constexpr Construct5(const Construct5 &) = default;
constexpr Construct5(const PA &pa, const PB &pb, constexpr Construct5(const PA &pa, const PB &pb,
@ -977,7 +977,7 @@ struct construct {
} }
return {}; return {};
} }
private: private:
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
const PC pc_; const PC pc_;
@ -995,7 +995,7 @@ struct construct {
template<typename PA, typename PB, typename PC, typename PD, typename PE, template<typename PA, typename PB, typename PC, typename PD, typename PE,
typename PF> typename PF>
class Construct6 { class Construct6 {
public: public:
using resultType = T; using resultType = T;
constexpr Construct6(const Construct6 &) = default; constexpr Construct6(const Construct6 &) = default;
constexpr Construct6(const PA &pa, const PB &pb, constexpr Construct6(const PA &pa, const PB &pb,
@ -1019,7 +1019,7 @@ struct construct {
} }
return {}; return {};
} }
private: private:
const PA pa_; const PA pa_;
const PB pb_; const PB pb_;
const PC pc_; const PC pc_;
@ -1041,7 +1041,7 @@ struct construct {
// StatePredicateGuardParser{f} is a parser that succeeds when f() is true // StatePredicateGuardParser{f} is a parser that succeeds when f() is true
// and fails otherwise. The state is preserved. // and fails otherwise. The state is preserved.
class StatePredicateGuardParser { class StatePredicateGuardParser {
public: public:
using resultType = Success; using resultType = Success;
constexpr StatePredicateGuardParser(const StatePredicateGuardParser &) constexpr StatePredicateGuardParser(const StatePredicateGuardParser &)
= default; = default;
@ -1054,7 +1054,7 @@ class StatePredicateGuardParser {
} }
return {}; return {};
} }
private: private:
bool (*const predicate_)(const ParseState &); bool (*const predicate_)(const ParseState &);
}; };
@ -1070,9 +1070,9 @@ std::list<T> prepend(T &&head, std::list<T> &&rest) {
template<typename PA, typename PB> template<typename PA, typename PB>
class NonemptySeparated { class NonemptySeparated {
private: private:
using paType = typename PA::resultType; using paType = typename PA::resultType;
public: public:
using resultType = std::list<paType>; using resultType = std::list<paType>;
constexpr NonemptySeparated(const NonemptySeparated &) = default; constexpr NonemptySeparated(const NonemptySeparated &) = default;
constexpr NonemptySeparated(const PA &p, const PB &sep) constexpr NonemptySeparated(const PA &p, const PB &sep)
@ -1082,7 +1082,7 @@ class NonemptySeparated {
parser_, parser_,
many(separator_ >> parser_)).Parse(state); many(separator_ >> parser_)).Parse(state);
} }
private: private:
const PA parser_; const PA parser_;
const PB separator_; const PB separator_;
}; };
@ -1097,7 +1097,7 @@ nonemptySeparated(const PA &p, const PB &sep) {
// StateUpdateParser{f} is a parser that always succeeds, possibly with // StateUpdateParser{f} is a parser that always succeeds, possibly with
// side effects on the parsing state. // side effects on the parsing state.
class StateUpdateParser { class StateUpdateParser {
public: public:
using resultType = Success; using resultType = Success;
constexpr StateUpdateParser(const StateUpdateParser &) = default; constexpr StateUpdateParser(const StateUpdateParser &) = default;
constexpr StateUpdateParser(void (*function)(ParseState *)) constexpr StateUpdateParser(void (*function)(ParseState *))
@ -1106,7 +1106,7 @@ class StateUpdateParser {
function_(state); function_(state);
return {Success{}}; return {Success{}};
} }
private: private:
void (*const function_)(ParseState *); void (*const function_)(ParseState *);
}; };
@ -1118,7 +1118,7 @@ template<typename PA, typename T>
class BoundMoveParser { class BoundMoveParser {
using paType = typename PA::resultType; using paType = typename PA::resultType;
using funcType = T (*)(paType &&); using funcType = T (*)(paType &&);
public: public:
using resultType = T; using resultType = T;
constexpr BoundMoveParser(const BoundMoveParser &) = default; constexpr BoundMoveParser(const BoundMoveParser &) = default;
constexpr BoundMoveParser(const PA &pa, funcType f) : pa_{pa}, f_{f} {} constexpr BoundMoveParser(const PA &pa, funcType f) : pa_{pa}, f_{f} {}
@ -1128,7 +1128,7 @@ class BoundMoveParser {
} }
return {}; return {};
} }
private: private:
const PA pa_; const PA pa_;
const funcType f_; const funcType f_;
}; };
@ -1167,7 +1167,7 @@ constexpr FixedParser<false> cut;
// guard(bool) returns a parser that succeeds iff its dynamic argument // guard(bool) returns a parser that succeeds iff its dynamic argument
// value is true. The state is preserved. // value is true. The state is preserved.
class GuardParser { class GuardParser {
public: public:
using resultType = Success; using resultType = Success;
constexpr GuardParser(const GuardParser &) = default; constexpr GuardParser(const GuardParser &) = default;
constexpr GuardParser(bool ok) : ok_{ok} {} constexpr GuardParser(bool ok) : ok_{ok} {}
@ -1177,7 +1177,7 @@ class GuardParser {
} }
return {}; return {};
} }
private: private:
const bool ok_; const bool ok_;
}; };
@ -1207,7 +1207,7 @@ constexpr struct RawNextCharParser {
// signify that the parse is within quotes or Hollerith. // signify that the parse is within quotes or Hollerith.
template<typename PA> template<typename PA>
class WithinCharLiteral { class WithinCharLiteral {
public: public:
using resultType = typename PA::resultType; using resultType = typename PA::resultType;
constexpr WithinCharLiteral(const WithinCharLiteral &) = default; constexpr WithinCharLiteral(const WithinCharLiteral &) = default;
constexpr WithinCharLiteral(const PA &parser) : parser_{parser} {} constexpr WithinCharLiteral(const PA &parser) : parser_{parser} {}
@ -1217,7 +1217,7 @@ class WithinCharLiteral {
state->set_inCharLiteral(was); state->set_inCharLiteral(was);
return result; return result;
} }
private: private:
const PA parser_; const PA parser_;
}; };
@ -1231,7 +1231,7 @@ inline constexpr auto withinCharLiteral(const PA &parser) {
// a warning if such a warning is enabled. // a warning if such a warning is enabled.
template<typename PA> template<typename PA>
class NonstandardParser { class NonstandardParser {
public: public:
using resultType = typename PA::resultType; using resultType = typename PA::resultType;
constexpr NonstandardParser(const NonstandardParser &) = default; constexpr NonstandardParser(const NonstandardParser &) = default;
constexpr NonstandardParser(const PA &parser) : parser_{parser} {} constexpr NonstandardParser(const PA &parser) : parser_{parser} {}
@ -1249,7 +1249,7 @@ class NonstandardParser {
} }
return result; return result;
} }
private: private:
const PA parser_; const PA parser_;
}; };
@ -1263,7 +1263,7 @@ inline constexpr auto extension(const PA &parser) {
// a warning if such a warning is enabled. // a warning if such a warning is enabled.
template<typename PA> template<typename PA>
class DeprecatedParser { class DeprecatedParser {
public: public:
using resultType = typename PA::resultType; using resultType = typename PA::resultType;
constexpr DeprecatedParser(const DeprecatedParser &) = default; constexpr DeprecatedParser(const DeprecatedParser &) = default;
constexpr DeprecatedParser(const PA &parser) : parser_{parser} {} constexpr DeprecatedParser(const PA &parser) : parser_{parser} {}
@ -1281,7 +1281,7 @@ class DeprecatedParser {
} }
return result; return result;
} }
private: private:
const PA parser_; const PA parser_;
}; };

View File

@ -12,7 +12,7 @@
namespace Fortran { namespace Fortran {
class CharBuffer { class CharBuffer {
public: public:
CharBuffer() {} CharBuffer() {}
CharBuffer(CharBuffer &&that) CharBuffer(CharBuffer &&that)
: blocks_(std::move(that.blocks_)), last_{that.last_}, : blocks_(std::move(that.blocks_)), last_{that.last_},
@ -44,15 +44,15 @@ class CharBuffer {
void Put(char x) { Put(&x, 1); } void Put(char x) { Put(&x, 1); }
void CopyToContiguous(char *data); void CopyToContiguous(char *data);
private: private:
struct Block { struct Block {
static constexpr size_t capacity{1 << 20}; static constexpr size_t capacity{1 << 20};
char data[capacity]; char data[capacity];
}; };
public: public:
class iterator { class iterator {
public: public:
iterator() {} iterator() {}
iterator(std::forward_list<Block>::const_iterator block, int offset) iterator(std::forward_list<Block>::const_iterator block, int offset)
: block_{block}, offset_{offset} {} : block_{block}, offset_{offset} {}
@ -91,7 +91,7 @@ class CharBuffer {
bool operator!=(const iterator &that) const { bool operator!=(const iterator &that) const {
return block_ != that.block_ || offset_ != that.offset_; return block_ != that.block_ || offset_ != that.offset_;
} }
private: private:
std::forward_list<Block>::const_iterator block_; std::forward_list<Block>::const_iterator block_;
int offset_; int offset_;
}; };
@ -105,7 +105,7 @@ class CharBuffer {
return iterator(blocks_.end(), 0); return iterator(blocks_.end(), 0);
} }
private: private:
int LastBlockOffset() const { return bytes_ % Block::capacity; } int LastBlockOffset() const { return bytes_ % Block::capacity; }
std::forward_list<Block> blocks_; std::forward_list<Block> blocks_;
std::forward_list<Block>::iterator last_{blocks_.end()}; std::forward_list<Block>::iterator last_{blocks_.end()};

View File

@ -84,7 +84,7 @@ static inline bool InCharLiteral(const ParseState &state) {
constexpr StatePredicateGuardParser inCharLiteral{InCharLiteral}; constexpr StatePredicateGuardParser inCharLiteral{InCharLiteral};
class RawStringMatch { class RawStringMatch {
public: public:
using resultType = Success; using resultType = Success;
constexpr RawStringMatch(const RawStringMatch &) = default; constexpr RawStringMatch(const RawStringMatch &) = default;
constexpr RawStringMatch(const char *str, size_t n) : str_{str}, length_{n} {} constexpr RawStringMatch(const char *str, size_t n) : str_{str}, length_{n} {}
@ -102,7 +102,7 @@ class RawStringMatch {
} }
return {Success{}}; return {Success{}};
} }
private: private:
const char *const str_; const char *const str_;
const size_t length_; const size_t length_;
}; };

View File

@ -20,7 +20,7 @@
namespace Fortran { namespace Fortran {
class CharPredicateGuardParser { class CharPredicateGuardParser {
public: public:
using resultType = char; using resultType = char;
constexpr CharPredicateGuardParser(const CharPredicateGuardParser &) constexpr CharPredicateGuardParser(const CharPredicateGuardParser &)
= default; = default;
@ -36,7 +36,7 @@ class CharPredicateGuardParser {
state->messages()->Add(Message{at, message_, state->context()}); state->messages()->Add(Message{at, message_, state->context()});
return {}; return {};
} }
private: private:
bool (*const predicate_)(char); bool (*const predicate_)(char);
const char *const message_; const char *const message_;
}; };
@ -69,7 +69,7 @@ constexpr auto letter =
template<char good> template<char good>
class CharMatch { class CharMatch {
public: public:
using resultType = char; using resultType = char;
constexpr CharMatch() {} constexpr CharMatch() {}
static std::optional<char> Parse(ParseState *state) { static std::optional<char> Parse(ParseState *state) {
@ -102,7 +102,7 @@ constexpr struct Space {
constexpr auto spaces = skipMany(space); constexpr auto spaces = skipMany(space);
class TokenStringMatch { class TokenStringMatch {
public: public:
using resultType = Success; using resultType = Success;
constexpr TokenStringMatch(const TokenStringMatch &) = default; constexpr TokenStringMatch(const TokenStringMatch &) = default;
constexpr TokenStringMatch(const char *str, size_t n) constexpr TokenStringMatch(const char *str, size_t n)
@ -143,7 +143,7 @@ class TokenStringMatch {
} }
return spaces.Parse(state); return spaces.Parse(state);
} }
private: private:
const char *const str_; const char *const str_;
const size_t length_{std::numeric_limits<size_t>::max()}; const size_t length_{std::numeric_limits<size_t>::max()};
}; };

View File

@ -14,7 +14,7 @@
namespace Fortran { namespace Fortran {
class DebugParser { class DebugParser {
public: public:
using resultType = Success; using resultType = Success;
constexpr DebugParser(const DebugParser &) = default; constexpr DebugParser(const DebugParser &) = default;
constexpr DebugParser(const char *str, size_t n) : str_{str}, length_{n} {} constexpr DebugParser(const char *str, size_t n) : str_{str}, length_{n} {}
@ -25,7 +25,7 @@ class DebugParser {
std::cout << state->position() << ' ' << std::string{str_, length_} << '\n'; std::cout << state->position() << ' ' << std::string{str_, length_} << '\n';
return {Success{}}; return {Success{}};
} }
private: private:
const char *const str_; const char *const str_;
size_t length_; size_t length_;
}; };

View File

@ -14,7 +14,7 @@ namespace Fortran {
template<typename A> template<typename A>
class Indirection { class Indirection {
public: public:
using element_type = A; using element_type = A;
Indirection() = delete; Indirection() = delete;
Indirection(A *&p) : p_{p} { Indirection(A *&p) : p_{p} {
@ -46,7 +46,7 @@ class Indirection {
} }
A &operator*() const { return *p_; } A &operator*() const { return *p_; }
A *operator->() { return p_; } A *operator->() { return p_; }
private: private:
A *p_{nullptr}; A *p_{nullptr};
}; };

View File

@ -18,7 +18,7 @@ class Message;
using MessageContext = std::shared_ptr<Message>; using MessageContext = std::shared_ptr<Message>;
class Message { class Message {
public: public:
Message() {} Message() {}
Message(const Message &) = default; Message(const Message &) = default;
Message(Message &&) = default; Message(Message &&) = default;
@ -44,7 +44,7 @@ class Message {
return position_ < that.position_; return position_ < that.position_;
} }
private: private:
Position position_; Position position_;
std::string message_; std::string message_;
MessageContext context_; MessageContext context_;
@ -52,7 +52,7 @@ class Message {
class Messages { class Messages {
using list_type = std::forward_list<Message>; using list_type = std::forward_list<Message>;
public: public:
using iterator = list_type::iterator; using iterator = list_type::iterator;
using const_iterator = list_type::const_iterator; using const_iterator = list_type::const_iterator;
@ -96,7 +96,7 @@ class Messages {
} }
} }
private: private:
list_type messages_; list_type messages_;
iterator last_; // valid iff messages_ nonempty iterator last_; // valid iff messages_ nonempty
}; };

View File

@ -21,7 +21,7 @@ namespace Fortran {
class UserState; class UserState;
class ParseState { class ParseState {
public: public:
ParseState() {} ParseState() {}
ParseState(const char *str) : p_{str}, remaining_{std::strlen(str)} {} ParseState(const char *str) : p_{str}, remaining_{std::strlen(str)} {}
ParseState(const char *str, size_t bytes) : p_{str}, remaining_{bytes} {} ParseState(const char *str, size_t bytes) : p_{str}, remaining_{bytes} {}
@ -203,7 +203,7 @@ class ParseState {
position_.AdvanceColumn(); position_.AdvanceColumn();
} }
private: private:
// Text remaining to be parsed // Text remaining to be parsed
const char *p_{nullptr}; const char *p_{nullptr};
size_t remaining_{0}; size_t remaining_{0};

View File

@ -10,7 +10,7 @@
namespace Fortran { namespace Fortran {
class Position { class Position {
public: public:
constexpr Position() {} constexpr Position() {}
constexpr Position(const Position &) = default; constexpr Position(const Position &) = default;
constexpr Position(Position &&) = default; constexpr Position(Position &&) = default;
@ -65,7 +65,7 @@ class Position {
column_ = 1; column_ = 1;
} }
private: private:
int lineNumber_{1}; int lineNumber_{1};
int column_{1}; int column_{1};
}; };

View File

@ -26,7 +26,7 @@ class Prescanner;
// Just a const char pointer with an associated length; does not own the // Just a const char pointer with an associated length; does not own the
// referenced data. Used to describe buffered tokens and hash table keys. // referenced data. Used to describe buffered tokens and hash table keys.
class CharPointerWithLength { class CharPointerWithLength {
public: public:
CharPointerWithLength() {} CharPointerWithLength() {}
CharPointerWithLength(const char *x, size_t n) : data_{x}, bytes_{n} {} CharPointerWithLength(const char *x, size_t n) : data_{x}, bytes_{n} {}
CharPointerWithLength(const std::string &s) CharPointerWithLength(const std::string &s)
@ -46,7 +46,7 @@ class CharPointerWithLength {
bool IsBlank() const; bool IsBlank() const;
std::string ToString() const { return std::string{data_, bytes_}; } std::string ToString() const { return std::string{data_, bytes_}; }
private: private:
const char *data_{nullptr}; const char *data_{nullptr};
size_t bytes_{0}; size_t bytes_{0};
}; };
@ -78,7 +78,7 @@ namespace Fortran {
// Buffers a contiguous sequence of characters that has been partitioned into // Buffers a contiguous sequence of characters that has been partitioned into
// a sequence of preprocessing tokens. // a sequence of preprocessing tokens.
class TokenSequence { class TokenSequence {
public: public:
TokenSequence() {} TokenSequence() {}
TokenSequence(const TokenSequence &that) { Append(that); } TokenSequence(const TokenSequence &that) { Append(that); }
TokenSequence(TokenSequence &&that) TokenSequence(TokenSequence &&that)
@ -134,7 +134,7 @@ class TokenSequence {
void pop_back(); void pop_back();
void shrink_to_fit(); void shrink_to_fit();
private: private:
std::vector<int> start_; std::vector<int> start_;
size_t nextStart_{0}; size_t nextStart_{0};
std::vector<char> char_; std::vector<char> char_;
@ -142,7 +142,7 @@ class TokenSequence {
// Defines a macro // Defines a macro
class Definition { class Definition {
public: public:
Definition(const TokenSequence &, size_t firstToken, size_t tokens); Definition(const TokenSequence &, size_t firstToken, size_t tokens);
Definition(const std::vector<std::string> &argNames, const TokenSequence &, Definition(const std::vector<std::string> &argNames, const TokenSequence &,
size_t firstToken, size_t tokens, bool isVariadic = false); size_t firstToken, size_t tokens, bool isVariadic = false);
@ -159,7 +159,7 @@ class Definition {
TokenSequence Apply(const std::vector<TokenSequence> &args); TokenSequence Apply(const std::vector<TokenSequence> &args);
private: private:
static TokenSequence Tokenize(const std::vector<std::string> &argNames, static TokenSequence Tokenize(const std::vector<std::string> &argNames,
const TokenSequence &token, size_t firstToken, const TokenSequence &token, size_t firstToken,
size_t tokens); size_t tokens);
@ -174,7 +174,7 @@ class Definition {
// Preprocessing state // Preprocessing state
class Preprocessor { class Preprocessor {
public: public:
explicit Preprocessor(Prescanner &); explicit Preprocessor(Prescanner &);
// When the input contains macros to be replaced, the new token sequence // When the input contains macros to be replaced, the new token sequence
@ -186,7 +186,7 @@ class Preprocessor {
// Implements a preprocessor directive; returns true when no fatal error. // Implements a preprocessor directive; returns true when no fatal error.
bool Directive(const TokenSequence &); bool Directive(const TokenSequence &);
private: private:
enum class IsElseActive { No, Yes }; enum class IsElseActive { No, Yes };
enum class CanDeadElseAppear { No, Yes }; enum class CanDeadElseAppear { No, Yes };

View File

@ -22,7 +22,7 @@
namespace Fortran { namespace Fortran {
class Prescanner { class Prescanner {
public: public:
explicit Prescanner(Messages &messages) explicit Prescanner(Messages &messages)
: messages_{messages}, preprocessor_{*this} {} : messages_{messages}, preprocessor_{*this} {}
@ -51,7 +51,7 @@ class Prescanner {
CharBuffer Prescan(const SourceFile &source); CharBuffer Prescan(const SourceFile &source);
std::optional<TokenSequence> NextTokenizedLine(); std::optional<TokenSequence> NextTokenizedLine();
private: private:
void BeginSourceLine(const char *at) { void BeginSourceLine(const char *at) {
at_ = at; at_ = at;
atPosition_ = lineStartPosition_; atPosition_ = lineStartPosition_;

View File

@ -11,7 +11,7 @@
namespace Fortran { namespace Fortran {
class SourceFile { class SourceFile {
public: public:
SourceFile() {} SourceFile() {}
~SourceFile(); ~SourceFile();
bool Open(std::string path, std::stringstream *error); bool Open(std::string path, std::stringstream *error);
@ -19,7 +19,7 @@ class SourceFile {
std::string path() const { return path_; } std::string path() const { return path_; }
const char *content() const { return content_; } const char *content() const { return content_; }
size_t bytes() const { return bytes_; } size_t bytes() const { return bytes_; }
private: private:
std::string path_; std::string path_;
int fileDescriptor_{-1}; int fileDescriptor_{-1};
bool isMemoryMapped_{false}; bool isMemoryMapped_{false};

View File

@ -11,7 +11,7 @@
namespace Fortran { namespace Fortran {
class UserState { class UserState {
public: public:
using Label = std::uint64_t; using Label = std::uint64_t;
bool IsDoLabel(Label label) const { bool IsDoLabel(Label label) const {
return doLabels_.find(label) != doLabels_.end(); return doLabels_.find(label) != doLabels_.end();
@ -30,7 +30,7 @@ class UserState {
--nonlabelDoConstructNestingDepth_; --nonlabelDoConstructNestingDepth_;
} }
} }
private: private:
std::unordered_set<Label> doLabels_; std::unordered_set<Label> doLabels_;
int nonlabelDoConstructNestingDepth_{0}; int nonlabelDoConstructNestingDepth_{0};
}; };