![]() |
Lumiera 0.pre.04
»edit your freedom«
|
Namespaces | |
| namespace | anonymous_namespace{parse.hpp} |
Typedefs | |
| using | StrView = std::string_view |
| template<class RES > | |
| using | OpaqueConnex = Connex< std::function< Eval< RES >(StrView)> > |
| special setup to be pre-declared and then used recursively | |
| template<class RES > | |
| using | ForwardConnex = Connex< std::function< Eval< RES >(StrView)> & > |
| using | NulP = decltype(buildConnex(Nil())) |
| using | Term = decltype(buildConnex(std::declval< regex >())) |
| template<typename SPEC > | |
| using | if_acceptableSpec = lib::meta::enable_if< is_usableSpec< SPEC > > |
| template<typename SPEC1 , typename SPEC2 > | |
| using | if_acceptableSpecs = lib::meta::enable_if< is_usableSpec< SPEC1 >,lib::meta::enable_if< is_usableSpec< SPEC2 > > > |
Classes | |
| struct | _Join |
| Standard case : combinator of two model branches. More... | |
| struct | _Join< TAG, R1, SubModel< R2 > > |
| struct | _Join< TAG, SubModel< R1 >, R2 > |
| Special Case : absorb sub-expression without flattening. More... | |
| struct | _Join< TAG, SubModel< R1 >, SubModel< R2 > > |
| struct | _Join< TAG, TAG< RS... >, R2 > |
| Generic case : extend a structured model by further branch. More... | |
| struct | AltModel |
| Sum Model : results from a disjunction of parsing clauses, which are are tested and accepted as alternatives, one at least. More... | |
| struct | Connex |
| Building block: parser function definition and connection element. More... | |
| struct | Eval |
| Parse evaluation result. More... | |
| struct | is_usableSpec |
| struct | is_usableSpec< SPEC, std::void_t< decltype(Parser{std::declval< SPEC >()})> > |
| struct | IterModel |
| Special case Product Model to represent iterative sequence. More... | |
| class | Parser |
| A Parser function to match and accept some syntax. More... | |
| struct | SeqModel |
| Product Model : results from a conjunction of parsing clauses, which are to be accepted in sequence, one after the other. More... | |
| struct | SubModel |
| Marker-Tag for the result from a sub-expression, not to be joined. More... | |
| class | Syntax |
| A Syntax clause with a parser and result state. More... | |
Functions | |
| auto | buildConnex (Nil) |
| »Null-Connex« which always successfully accepts the empty sequence | |
| auto | buildConnex (regex rex) |
| Foundation: build a Connex to accept a terminal symbol. | |
| Term | buildConnex (string const &rexDef) |
| build from a string with Regular-Epression spec | |
| template<class FUN > | |
| auto | buildConnex (Connex< FUN > const &anchor) |
| copy-builder from an existing parser function | |
| template<class FUN > | |
| auto | buildConnex (Connex< FUN > &&anchor) |
| template<class PAR > | |
| auto | buildConnex (Syntax< PAR > const &anchor) |
| template<class RES > | |
| auto | buildConnex (Syntax< Parser< OpaqueConnex< RES > > > &refClause) |
| special setup to attach to a pre-defined clause for recursive syntax | |
| template<class CON , class BIND > | |
| auto | adaptConnex (CON &&connex, BIND &&modelBinding) |
| Adapt by applying a result-transforming function after a successful parse. | |
| template<class CON > | |
| auto | toStringConnex (CON &&connex, uint part) |
| template<class C1 , class C2 > | |
| auto | sequenceConnex (C1 &&connex1, C2 &&connex2) |
| accept sequence of two parse functions | |
| template<class C1 , class C2 > | |
| auto | branchedConnex (C1 &&connex1, C2 &&connex2) |
| accept either one of two alternative parse functions | |
| template<class C1 , class C2 > | |
| auto | repeatedConnex (uint min, uint max, C1 &&delimConnex, C2 &&bodyConnex) |
| repeatedly accept parse-function, optionally delimited. | |
| template<class CNX > | |
| auto | optionalConnex (CNX &&connex) |
| try to accept parse-function, backtracking if not successful. | |
| template<class C1 , class C2 , class C3 > | |
| auto | bracketedConnex (C1 &&openingConnex, C2 &&closingConnex, C3 &&bodyConnex, bool isOptional) |
| accept some structure enclosed into a bracketing construct. | |
| Parser (Nil) -> Parser< NulP > | |
| Parser (regex &&) -> Parser< Term > | |
| Parser (regex const &) -> Parser< Term > | |
| Parser (string const &) -> Parser< Term > | |
| template<class FUN > | |
| Parser (Connex< FUN >) -> Parser< Connex< FUN > > | |
| template<class PAR > | |
| Parser (Syntax< PAR >) -> Parser< typename PAR::Connex > | |
| template<class RES > | |
| Parser (Syntax< Parser< OpaqueConnex< RES > > >) -> Parser< ForwardConnex< RES > > | |
| template<typename SPEC > | |
| auto | accept (SPEC &&clauseDef) |
| ===== Syntax clause builder DSL ===== | |
| auto | accept () |
| empty Syntax clause to start further definition | |
| template<typename SPEC > | |
| auto | accept_opt (SPEC &&clauseDef) |
| start Syntax clause with an optional syntax part | |
| template<typename SPEC1 , typename SPEC2 > | |
| auto | accept_repeated (uint min, uint max, SPEC1 &&delimDef, SPEC2 &&clauseDef) |
| Start Syntax clause with a repeated sub-clause, with separator and repetition limit; repetitions ∊ [min..max] The separator will be expected between instances of the repeated sub-clause and will by itself produce no model. | |
| template<typename SPEC1 , typename SPEC2 , typename = if_acceptableSpecs<SPEC1,SPEC2>> | |
| auto | accept_repeated (uint cnt, SPEC1 &&delimDef, SPEC2 &&clauseDef) |
| template<typename SPEC1 , typename SPEC2 , typename = if_acceptableSpecs<SPEC1,SPEC2>> | |
| auto | accept_repeated (SPEC1 &&delimDef, SPEC2 &&clauseDef) |
| start Syntax with an arbitrarily repeated sub-clause, with separator | |
| template<typename SPEC > | |
| auto | accept_repeated (uint min, uint max, SPEC &&clauseDef) |
| template<typename SPEC > | |
| auto | accept_repeated (uint cnt, SPEC &&clauseDef) |
| template<typename SPEC > | |
| auto | accept_repeated (SPEC &&clauseDef) |
| template<typename SPEC1 , typename SPEC2 , typename SPEC3 > | |
| auto | accept_bracket (SPEC1 &&openDef, SPEC2 &&closeDef, SPEC3 &&bodyDef) |
| Start Syntax with a sub-clause enclosed into a bracketing construct. | |
| template<typename SPEC > | |
| auto | accept_bracket (string bracketSpec, SPEC &&bodyDef) |
| Start Syntax with a bracketed sub-clause, with given single-char delimiters. | |
| template<typename SPEC > | |
| auto | accept_bracket (SPEC &&bodyDef) |
| Start Syntax with a sub-clause enclosed in parentheses. | |
| template<typename SPEC > | |
| auto | accept_bracketOpt (string bracketSpec, SPEC &&bodyDef) |
| Start Syntax with a sub-clause, optionally enclosed into brackets. | |
| template<typename SPEC > | |
| auto | accept_bracketOpt (SPEC &&bodyDef) |
| template<typename RES > | |
| auto | expectResult () |
| Setup an assignable, recursive Syntax clause, initially empty. | |
| using OpaqueConnex = Connex<std::function<Eval<RES>(StrView)> > |
| using ForwardConnex = Connex<std::function<Eval<RES>(StrView)>&> |
| using NulP = decltype(buildConnex (Nil())) |
| using Term = decltype(buildConnex (std::declval<regex>())) |
| using if_acceptableSpec = lib::meta::enable_if<is_usableSpec<SPEC> > |
| using if_acceptableSpecs = lib::meta::enable_if<is_usableSpec<SPEC1> ,lib::meta::enable_if<is_usableSpec<SPEC2> >> |
| struct util::parse::_Join |
| struct util::parse::_Join< TAG, R1, SubModel< R2 > > |
| struct util::parse::_Join< TAG, SubModel< R1 >, R2 > |
| struct util::parse::_Join< TAG, SubModel< R1 >, SubModel< R2 > > |
| struct util::parse::_Join< TAG, TAG< RS... >, R2 > |
| struct util::parse::Eval |
| struct util::parse::SubModel |
Collaboration diagram for SubModel< RES >:
|
inline |
»Null-Connex« which always successfully accepts the empty sequence
Definition at line 226 of file parse.hpp.
Referenced by buildConnex().
Here is the caller graph for this function:
|
inline |
Foundation: build a Connex to accept a terminal symbol.
the actual parsing is delegated to a Regular Expression, which must match against the beginning of the input sequence, possibly after skipping some whitespace. The defined parser returns an Eval context, to hold a Result Model and the number of characters matched by this terminal symbol.
Definition at line 245 of file parse.hpp.
References util::leadingWhitespace(), and util::matchAtStart().
Here is the call graph for this function:
|
inline |
build from a string with Regular-Epression spec
Definition at line 261 of file parse.hpp.
References buildConnex().
Here is the call graph for this function:
|
inline |
|
inline |
|
inline |
|
inline |
special setup to attach to a pre-defined clause for recursive syntax
Definition at line 294 of file parse.hpp.
References Syntax< PAR >::parse().
Here is the call graph for this function:
|
inline |
Adapt by applying a result-transforming function after a successful parse.
Definition at line 337 of file parse.hpp.
References Eval< RES >::consumed.
Referenced by Syntax< PAR >::bind().
Here is the caller graph for this function:
|
inline |
Definition at line 358 of file parse.hpp.
References util::leadingWhitespace(), and Eval< RES >::result.
Referenced by Syntax< PAR >::bindMatch().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
accept sequence of two parse functions
Definition at line 525 of file parse.hpp.
References Connex< FUN >::parse.
Referenced by Syntax< PAR >::seq().
Here is the caller graph for this function:
|
inline |
accept either one of two alternative parse functions
Definition at line 559 of file parse.hpp.
References Connex< FUN >::parse.
Referenced by Syntax< PAR >::alt().
Here is the caller graph for this function:
|
inline |
repeatedly accept parse-function, optionally delimited.
Definition at line 594 of file parse.hpp.
References util::max(), util::min(), and Connex< FUN >::parse.
Referenced by accept_repeated().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
try to accept parse-function, backtracking if not successful.
Definition at line 637 of file parse.hpp.
References Connex< FUN >::parse.
Referenced by accept_opt().
Here is the caller graph for this function:
|
inline |
accept some structure enclosed into a bracketing construct.
| isOptional | if the bracketing can be omitted |
Definition at line 659 of file parse.hpp.
References Eval< RES >::consumed.
Referenced by accept_bracket(), accept_bracket(), and accept_bracketOpt().
Here is the caller graph for this function:| Parser | ( | Syntax< Parser< OpaqueConnex< RES > > > | ) | -> Parser< ForwardConnex< RES > > |
|
inline |
|
inline |
empty Syntax clause to start further definition
Definition at line 897 of file parse.hpp.
Referenced by accept_bracket(), accept_bracket(), accept_bracketOpt(), accept_opt(), accept_repeated(), Syntax< PAR >::alt(), Syntax< PAR >::bind(), Syntax< PAR >::bindMatch(), expectResult(), and Syntax< PAR >::seq().
Here is the caller graph for this function:
|
inline |
start Syntax clause with an optional syntax part
Definition at line 903 of file parse.hpp.
References accept(), accept_opt(), and optionalConnex().
Referenced by accept_opt(), and Syntax< PAR >::opt().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Start Syntax clause with a repeated sub-clause, with separator and repetition limit; repetitions ∊ [min..max] The separator will be expected between instances of the repeated sub-clause and will by itself produce no model.
The result model is an instance of IterModel, which implies it is a vector (uses heap storage); if min ≡ 0, the model can be empty.
Definition at line 919 of file parse.hpp.
References accept(), accept_repeated(), util::max(), util::min(), and repeatedConnex().
Referenced by accept_repeated(), accept_repeated(), accept_repeated(), accept_repeated(), accept_repeated(), accept_repeated(), Syntax< PAR >::repeat(), Syntax< PAR >::repeat(), Syntax< PAR >::repeat(), and Syntax< PAR >::repeat().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
| cnt | exact number of repetitions expected |
Definition at line 936 of file parse.hpp.
References accept_repeated().
Here is the call graph for this function:
|
inline |
start Syntax with an arbitrarily repeated sub-clause, with separator
Definition at line 944 of file parse.hpp.
References accept_repeated().
Here is the call graph for this function:Definition at line 951 of file parse.hpp.
References accept_repeated(), util::max(), and util::min().
Here is the call graph for this function:
|
inline |
Definition at line 958 of file parse.hpp.
References accept_repeated().
Here is the call graph for this function:
|
inline |
Definition at line 965 of file parse.hpp.
References accept_repeated().
Here is the call graph for this function:
|
inline |
Start Syntax with a sub-clause enclosed into a bracketing construct.
The »bracket« is defined as syntax for the open marker and close marker. These are consumed without generating model elements. The parse fails unless the full sequence open body close can be matched.
Definition at line 978 of file parse.hpp.
References accept(), accept_bracket(), and bracketedConnex().
Referenced by accept_bracket(), accept_bracket(), accept_bracket(), Syntax< PAR >::bracket(), Syntax< PAR >::bracket(), and Syntax< PAR >::bracket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Start Syntax with a bracketed sub-clause, with given single-char delimiters.
| bracketSpec | a 2-char string, e.g. "{}" to expect curly braces. |
Definition at line 994 of file parse.hpp.
References accept(), accept_bracket(), and bracketedConnex().
Here is the call graph for this function:
|
inline |
Start Syntax with a sub-clause enclosed in parentheses.
Definition at line 1009 of file parse.hpp.
References accept_bracket().
Here is the call graph for this function:
|
inline |
Start Syntax with a sub-clause, optionally enclosed into brackets.
Definition at line 1017 of file parse.hpp.
References accept(), and bracketedConnex().
Referenced by accept_bracketOpt(), Syntax< PAR >::bracketOpt(), and Syntax< PAR >::bracketOpt().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inline |
Definition at line 1031 of file parse.hpp.
References accept_bracketOpt().
Here is the call graph for this function:
|
inline |
Setup an assignable, recursive Syntax clause, initially empty.
| RES | the result model type to be expected; it is necessary to augment the full definition explicitly by a model-binding to produce this type — which typically also involves writing actual code to deal with the possibly open structure enable through a recursive syntax definition |
Definition at line 1056 of file parse.hpp.
References accept().
Here is the call graph for this function: