Lines Matching defs:parser

12 // Let a "parser" be an instance of any class that supports this
22 // This header defines the fundamental parser class templates and helper
23 // template functions. See parser-combinators.txt for documentation.
43 namespace Fortran::parser {
45 // fail<A>("..."_err_en_US) returns a parser that never succeeds. It reports an
67 // pure(x) returns a parser that always succeeds, does not advance the
99 // If a is a parser, attempt(a) is the same parser, but on failure
105 constexpr BacktrackingParser(const A &parser) : parser_{parser} {}
123 template <typename A> inline constexpr auto attempt(const A &parser) {
124 return BacktrackingParser<A>{parser};
127 // For any parser x, the parser returned by !x is one that succeeds when
152 // For any parser x, the parser returned by lookAhead(x) is one that succeeds
176 // If a is a parser, inContext("..."_en_US, a) runs it in a nested message
197 inline constexpr auto inContext(MessageFixedText context, PA parser) {
198 return MessageContextParser{context, parser};
201 // If a is a parser, withMessage("..."_en_US, a) runs it unchanged if it
250 inline constexpr auto withMessage(MessageFixedText msg, PA parser) {
251 return WithMessageParser{msg, parser};
254 // If a and b are parsers, then a >> b returns a parser that succeeds when
350 // If a and b are parsers, then recovery(a,b) returns a parser that succeeds if
414 // If x is a parser, then many(x) returns a parser that always succeeds
423 constexpr ManyParser(PA parser) : parser_{parser} {}
441 template <typename PA> inline constexpr auto many(PA parser) {
442 return ManyParser<PA>{parser};
445 // If x is a parser, then some(x) returns a parser that succeeds if x does
455 constexpr SomeParser(PA parser) : parser_{parser} {}
473 template <typename PA> inline constexpr auto some(PA parser) {
474 return SomeParser<PA>{parser};
477 // If x is a parser, skipMany(x) is equivalent to many(x) but with no result.
482 constexpr SkipManyParser(PA parser) : parser_{parser} {}
495 template <typename PA> inline constexpr auto skipMany(PA parser) {
496 return SkipManyParser<PA>{parser};
499 // If x is a parser, skipManyFast(x) is equivalent to skipMany(x).
500 // The parser x must always advance on success and never invalidate the
506 constexpr SkipManyFastParser(PA parser) : parser_{parser} {}
517 template <typename PA> inline constexpr auto skipManyFast(PA parser) {
518 return SkipManyFastParser<PA>{parser};
521 // If x is a parser returning some type A, then maybe(x) returns a
522 // parser that returns std::optional<A>, always succeeding.
529 constexpr MaybeParser(PA parser) : parser_{parser} {}
542 template <typename PA> inline constexpr auto maybe(PA parser) {
543 return MaybeParser<PA>{parser};
546 // If x is a parser, then defaulted(x) returns a parser that always
570 // If a is a parser, and f is a function mapping an rvalue of a's result type
571 // to some other type T, then applyFunction(f, a) returns a parser that succeeds
584 // parser a succeeds and returns some value ax of type C, the result is that
585 // returned by ax.f(). Additional parser arguments can be specified to supply
644 ApplicableFunctionPointer<RESULT, PARSER...> f, const PARSER &...parser) {
646 f, parser...};
651 ApplicableFunctionObject<RESULT, PARSER...> f, const PARSER &...parser) {
653 f, parser...};
695 MEMFUNC memfn, const OBJPARSER &objParser, PARSER... parser) {
697 memfn, objParser, parser...};
703 // construct<T>(a, b, ...) returns a parser that succeeds if all of
706 // With a single argument that is a parser with no usable value,
762 // For a parser p, indirect(p) returns a parser that builds an indirect
768 // If a and b are parsers, then nonemptySeparated(a, b) returns a parser
802 // ok is a parser that always succeeds. It is useful when a parser
821 // nextCh is a parser that succeeds if the parsing state is not
838 // If a is a parser for some nonstandard language feature LF, extension<LF>(a)
839 // is a parser that optionally enabled, sets a strict conformance violation
845 constexpr NonstandardParser(PA parser, MessageFixedText msg)
846 : parser_{parser}, message_{msg} {}
847 constexpr NonstandardParser(PA parser) : parser_{parser} {}
869 inline constexpr auto extension(MessageFixedText feature, PA parser) {
870 return NonstandardParser<LF, PA>(parser, feature);
874 inline constexpr auto extension(PA parser) {
875 return NonstandardParser<LF, PA>(parser);
878 // If a is a parser for some deprecated or deleted language feature LF,
879 // deprecated<LF>(a) is a parser that is optionally enabled, sets a strict
885 constexpr DeprecatedParser(PA parser) : parser_{parser} {}
906 inline constexpr auto deprecated(PA parser) {
907 return DeprecatedParser<LF, PA>(parser);
915 constexpr SourcedParser(PA parser) : parser_{parser} {}
934 template <typename PA> inline constexpr auto sourced(PA parser) {
935 return SourcedParser<PA>{parser};
937 } // namespace Fortran::parser