Rule Reference
July 2, 2026 ยท View on GitHub
The reference documentation for all rules and combinators.
The rules related to stream parsing are documented here.
Contents
- Preamble
- Atomic
- ASCII
- Unicode
- Binary
- Member
- Combinators
- Convenience
- Exceptional
- Controlling
- Compatibility
- ICU Support
- Index
Preamble
For how rule and combinators are implemented see Implementing Rules.
For additional and experimental rules and combinators see the Extra Reference and the Example Reference.
Namespaces
All rules reside in namespace tao::pegtl or a sub-namespace of tao::pegtl.
This default can be changed via the macro TAO_PEGTL_NAMESPACE in tao/pegtl/config.hpp.
The namespace tao::pegtl is generally omitted on this page.
Equivalence
Some rules are documented as being equivalent to a combination of other rules. This equivalence is with respect to which inputs are matched, but is not (necessarily) how the rule is implemented.
For rules other than must<> that contain "must" in their name, rule equivalence shows which rule will be used as template parameter to the control when calling the raise() function when certain sub-rules fail to match.
Implementation
The "meta data and implementation mapping" section of each rule's description shows both how the rule is implemented and what the meta data looks like.
When the list of sub-rules is empty then the definition of subs_t is omitted from the description.
Remember that the default control tao::pegtl::normal does not call control functions for rules in the tao::pegtl::internal namespace.
Parameter Packs
The documentation will use (template parameter) packs when zero-or-more or one-or-more of a (template) parameter are allowed.
For example seq< R... > accepts zero-or-more template parameters.
In the zero case, i.e. seq<>, we also say R is "empty", otherwise R is "non-empty".
End Of Line Rules
Rules that can be used for end-of-line scanning mode and/or lazy end-of-line tracking are documented as being "also available in the scan and/or lazy sub-namespace".
The different end-of-line modes that can be chosen for an input are documented in Inputs and Parsing.
Atomic
Atomic rules do not rely on other rules (but might have non-rule template parameters).
These rules are in namespace tao::pegtl.
bof
- Succeeds at "beginning-of-file", i.e. when the input is at its start.
- Does not consume input.
- Requires an input
inwith anin.start()member function, and/or - requires an input
inwherein.direct_position().countis available. - Meta data and implementation mapping:
bof::rule_tisinternal::bof
bol
- Succeeds at "beginning-of-line", i.e. when the input's
column()member function returns1. - Does not consume input.
- Requires an input with eager text position tracking, more precisely:
- Requires an input
inwherein.direct_position().columnis available. - Meta data and implementation mapping:
bol::rule_tisinternal::bol
consume< Num >
- Succeeds if the input contains at least
Numfurther objects, and - unconditionally consumes
Numobjects from the input. - Limited to the buffer size when using a stream input.
- Meta data and implementation mapping:
consume< 0 >::rule_tisinternal::successconsume< N >::rule_tisinternal::consume< N >forN > 0
eof
- Succeeds at "end-of-file", i.e. when the input is empty (all input has been consumed).
- Does not consume input.
- Meta data and implementation mapping:
eof::rule_tisinternal::eof
eol
- Matches a single end-of-line as defined by the input.
- The default definition of what constitutes a lines ending is system dependent.
- On Unix-like systems a Unix line ending is matched, a single 'LF'.
- On Windows the MS-DOS line ending 'CR LF' is also accepted.
- Requires an input with an
eol_ruletype alias. - Meta data and implementation mapping:
eol::rule_tisinternal::eol
Note that the default behavior can be changed either by defining TAO_PEGTL_DEFAULT_EOL before tao/pegtl/system.hpp is (indirectly) included or by supplying an end-of-line rule as template parameter to the input.
eolf
- Matches a single end-of-line or the end-of-file.
- Requires an input with an
eol_ruletype definition. - Equivalent to
sor< eof, eol >. - Meta data and implementation mapping:
eolf::rule_tisinternal::eolf
everything
- Matches and consumes the entire input.
- Not compatible with a stream input.
- Equivalent to
until< eof, any >. - Meta data and implementation mapping:
everything::rule_tisinternal::everything
failure
- Rule that never succeeds.
- Does not consume input.
- Meta data and implementation mapping:
failure::rule_tisinternal::failure
function< F, P = void >
- Delegates matching to the function
F. - The function
Fmust returnbool. - The function
Fcan benoexcept( true )ornoexcept( false ).
| Rule form | Function signature | Behavior |
|---|---|---|
function< F > | bool F( Input& ) | Calls F with the current input. The function is responsible for matching and consuming input. |
function< F > | bool F( Input&, States... ) | Calls F with the current input and the current state objects. |
function< F, P > | bool F( Data ) | Calls P::peek( in ) and then F with the peeked data. |
function< F, P > | bool F( Data, States... ) | Calls P::peek( in ) and then F with the peeked data and the current state objects. |
When P is void, F is used as a match function and receives the current input directly.
This form should usually consume input only when returning true.
When P is not void, it is used as peek implementation; if peeking succeeds and F returns true, the rule consumes the size reported by the peek result.
For this peeked-data form, if peeking fails, or if F returns false, the rule returns false and consumes no input.
- Meta data and implementation mapping:
function< F, P >::rule_tisinternal::function< P, decltype( F ), F >function< F, P >::subs_tisempty_list
invert< R >
- Takes any rule whose
rule_tisinternal::one,internal::ione,internal::range,internal::ranges, or one of their inverted forms. - This includes the ASCII rules and the corresponding Unicode
one,range, andrangesrules when their meta data maps to these internal rules. - Rules whose meta data maps to another implementation, e.g. a single non-ASCII
utf8::one< C >that maps tointernal::ascii_string< U... >, are not supported. - Results in a rule with normal matching changed to inverted matching, or vice versa.
nested< R, P >
- Uses the peek implementation
Pto extract an object from the input. - Performs a nested parsing run with rule
Ron the extracted object's contiguous data. - The extracted object must have
value_type,data()andsize()members suitable for constructing aview_input. - Consumes 1 object from the outer input when the nested parsing run succeeds.
- Meta data and implementation mapping:
nested< R, P >::rule_tisinternal::nested< P, R >nested< R, P >::subs_tisempty_list
restart
- Rule that always succeeds.
- Rewinds the input to where it started.
- Should generally be avoided!
- Requires an input with start.
- Meta data and implementation mapping:
restart::rule_tisinternal::restart
source< R >
- Requires an input with source.
- Performs a nested parsing run with rule
Ron the input'sdirect_source(). - Supports sources of type
std::string,std::string_viewandstd::filesystem::path. - Does not consume input.
- Meta data and implementation mapping:
source< R >::rule_tisinternal::source< R >source< R >::subs_tisempty_list
success
- Rule that always succeeds.
- Does not consume input.
- Meta data and implementation mapping:
success::rule_tisinternal::success
ASCII
The ASCII rules operate on any input of integral or enum type of size 1.
Unless noted otherwise they do not restrict the range of matched values to 7-bit ASCII values.
For example rules like ascii::any or ascii::not_one< 'a' > will match all possible byte values, and all possible byte values excluding 'a', respectively.
The rules any7, many7, not_one7, not_ione7 and not_range7 are like their respective counterparts without the trailing 7 but only match values that can be represented in 7 bits.
It is possible to match UTF-8 multi-byte characters with the non-seven ASCII rules.
For example the Euro sign code point U+20AC, which is encoded by the UTF-8 sequence E2 82 AC, is matched by both ascii::string< 0xe2, 0x82, 0xac > and utf8::one< 0x20ac >.
On closer inspection one would find that both rules are implemented via internal::ascii_string< 0xe2, 0x82, 0xac >.
These rules are in the inline namespace tao::pegtl::ascii.
For all ASCII rules the template parameters representing characters are of type char.
aistring< P, C... >
- Similar to
(ascii::)astring< P, C... >, but: - For ASCII letters the match is case insensitive.
- The
std::size_t Pmust be between0and sizeofC..., excluding edges. - If the complete string
C...matches, consumes that complete string. - Otherwise, if the first
Pcharacters ofC...match, consumes thosePcharacters. - Meta data and implementation mapping:
ascii::aistring< P, C... >::rule_tisinternal::ascii_aistring< P, C... >
alnum
- Matches and consumes a single ASCII alphabetic or numeric character.
- Equivalent to
(ascii::)ranges< 'a', 'z', 'A', 'Z', '0', '9' >.
alpha
- Matches and consumes a single ASCII alphabetic character.
- Equivalent to
(ascii::)ranges< 'a', 'z', 'A', 'Z' >.
any
- Matches and consumes any single byte, including all ASCII characters.
- Equivalent to
(ascii::)many< 1 >. - Meta data and implementation mapping:
(ascii::)any::rule_tisinternal::any< internal::peek_char >
any7
- Matches and consumes any single "true" ASCII character that fits into 7 bits.
- Equivalent to
(ascii::)range< 0, 127 >. - Meta data and implementation mapping:
(ascii::)any7::rule_tisinternal::any< internal::peek_seven >
astring< P, C... >
- Like
(ascii::)string< C... >but also matches one prefix ofC.... - The
std::size_t Pmust be between0and sizeofC..., excluding edges. - If the complete string
C...matches, consumes that complete string. - Otherwise, if the first
Pcharacters ofC...match, consumes thosePcharacters. - Meta data and implementation mapping:
ascii::astring< P, C... >::rule_tisinternal::ascii_astring< P, C... >
bdigit
- Matches and consumes a single ASCII binary digit.
- Equivalent to
(ascii::)one< '0', '1' >.
blank
- Matches and consumes a single ASCII horizontal space or horizontal tabulator character.
- Equivalent to
(ascii::)one< ' ', '\t' >.
cntrl
- Matches and consumes a single ASCII control character.
- Equivalent to
(ascii::)ranges< 0, 31, 127 >.
cr
- Matches and consumes a single carriage return of value
13or0x0d. - Equivalent to
(ascii::)one< '\r' >. - Also available in the
scansub-namespace. - Also available in the
lazysub-namespace.
cr_crlf
- Matches and consumes a carriage return optionally followed by a line feed.
- Equivalent to
seq< (ascii::)cr, opt< (ascii::)lf > >. - Equivalent to
sor< (ascii::)crlf, (ascii::)cr >. - Also available in the
lazysub-namespace.
cr_lf
- Matches and consumes a carriage return or line feed.
- Equivalent to
(ascii::)one< '\r', '\n' >. - Also available in the
lazysub-namespace.
cr_lf_crlf
- Matches and consumes a carriage return and/or line feed.
- Equivalent to
sor< (ascii::)crlf, (ascii::)cr_lf >. - Also available in the
lazysub-namespace.
crlf
- Matches and consumes a carriage return followed by a line feed.
- Equivalent to
(ascii::)string< '\r', '\n' >. - Also available in the
lazysub-namespace.
digit
- Matches and consumes a single ASCII decimal digit.
- Equivalent to
(ascii::)range< '0', '9' >.
ellipsis
- Matches and consumes three dots.
- Equivalent to
(ascii::)three< '.' >.
esc
- Matches and consumes a single ASCII escape character of value
27or0x1b. - Equivalent to
(ascii::)one< 27 >.
ff
- Matches and consumes a single ASCII form feed (new page) character of value
12or0x0c. - Equivalent to
(ascii::)one< '\f' >.
graph
- Matches and consumes a single ASCII character traditionally defined as "printable but not space".
- Equivalent to
(ascii::)range< 33, 126 >.
ht
- Matches and consumes a single ASCII horizontal tab character of value
9. - Equivalent to
(ascii::)one< '\t' >.
identifier_first
- Matches and consumes a single ASCII character permissible as first character of a C identifier.
- Equivalent to
(ascii::)ranges< 'a', 'z', 'A', 'Z', '_' >. - Meta data and implementation mapping:
ascii::identifier_first::rule_tisinternal::ranges< internal::peek_char, 'a', 'z', 'A', 'Z', '_' >
identifier_other
- Matches and consumes a single ASCII character permissible as subsequent character of a C identifier.
- Equivalent to
(ascii::)ranges< 'a', 'z', 'A', 'Z', '0', '9', '_' >. - Meta data and implementation mapping:
ascii::identifier_other::rule_tisinternal::ranges< internal::peek_char, 'a', 'z', 'A', 'Z', '0', '9', '_' >
identifier
- Matches and consumes an ASCII identifier as defined for the C programming language.
- Equivalent to
seq< (ascii::)identifier_first, star< (ascii::)identifier_other > >. - Meta data and implementation mapping is subject to change.
ione< C... >
- Similar to
(ascii::)one< C... >but: - For ASCII letters the match is case insensitive.
Cmust be a non-empty character pack.- Meta data and implementation mapping:
ascii::ione< C... >::rule_tisinternal::ione< internal::peek_char, C... >.
istring< C... >
- Similar to
(ascii::)string< C... >, but: - For ASCII letters the match is case insensitive.
- Meta data and implementation mapping:
ascii::istring<>::rule_tisinternal::successascii::istring< C >::rule_tisinternal::ione< internal::peek_char, C >ascii::istring< C... >::rule_tisinternal::ascii_istring< C... >
keyword< C... >
- Matches and consumes a non-empty string not followed by an identifier character.
- Equivalent to
seq< (ascii::)string< C... >, not_at< (ascii::)identifier_other > >. Cmust be a non-empty character pack.- Meta data and implementation mapping:
ascii::keyword< C... >::rule_tisinternal::seq< internal::ascii_string< C... >, internal::not_at< internal::ranges< internal::peek_char, 'a', 'z', 'A', 'Z', '0', '9', '_' > > >
lf
- Matches and consumes a single line feed of value
10or0x0a. - Equivalent to
(ascii::)one< '\n' >. - Also available in the
scansub-namespace. - Also available in the
lazysub-namespace.
lf_crlf
- Matches and consumes a line feed optionally preceded by a carriage return.
- Equivalent to
sor< (ascii::)lf, (ascii::)crlf >. - Also available in the
scansub-namespace. - Also available in the
lazysub-namespace.
lower
- Matches and consumes a single ASCII lower-case alphabetic character.
- Equivalent to
(ascii::)range< 'a', 'z' >.
many< Num >
- Succeeds when the input contains at least
Numfurther bytes. - Consumes these
Numbytes from the input. - Equivalent to
(ascii::)rep< Num, any >. - Meta data and implementation mapping:
ascii::many< 0 >::rule_tisinternal::successascii::many< 1 >::rule_tisinternal::any< internal::peek_char >ascii::many< Num >::rule_tisinternal::many< Num, internal::peek_char >forNum > 1
many7< Num >
- True ASCII version of
manyonly matches input bytes between 0 and 127. - Equivalent to
rep< Num, (ascii::)any7 >. - Meta data and implementation mapping:
ascii::many7< 0 >::rule_tisinternal::successascii::many7< 1 >::rule_tisinternal::any< internal::peek_seven >ascii::many7< Num >::rule_tisinternal::many< Num, internal::peek_seven >forNum > 1
not_ione< C... >
- Similar to
(ascii::)not_one< C... >but: - For ASCII letters the match is case insensitive.
Cmust be a non-empty character pack.- Meta data and implementation mapping:
ascii::not_ione< C... >::rule_tisinternal::not_ione< internal::peek_char, C... >.
not_ione7< C... >
- Like
(ascii::)not_ione< C... >but only matches values that can be represented in 7 bits. Cmust be a non-empty character pack.- Meta data and implementation mapping:
ascii::not_ione7< C... >::rule_tisinternal::not_ione< internal::peek_seven, C... >.
not_one< C... >
- Succeeds when the input is not empty, and:
Cis a non-empty character pack and the next input byte is not one ofC....- Consumes one byte on success.
- Meta data and implementation mapping:
ascii::not_one< C... >::rule_tisinternal::not_one< internal::peek_char, C... >.
not_one7< C... >
- True ASCII version of
not_oneonly matches input bytes between 0 and 127. Cmust be a non-empty character pack.- Meta data and implementation mapping:
ascii::not_one7< C... >::rule_tisinternal::not_one< internal::peek_seven, C... >.
not_range< C, D >
- Succeeds when the input is not empty, and:
- The next input byte is not in the closed range
C ... D. - Consumes one byte on success.
- Meta data and implementation mapping:
ascii::not_range< C, C >::rule_tisinternal::not_one< internal::peek_char, C >.ascii::not_range< C, D >::rule_tisinternal::not_range< internal::peek_char, C, D >forC < D.
not_range7< C, D >
- True ASCII version of
not_rangeonly matches input bytes between 0 and 127. - Meta data and implementation mapping:
ascii::not_range7< C, C >::rule_tisinternal::not_one< internal::peek_seven, C >.ascii::not_range7< C, D >::rule_tisinternal::not_range< internal::peek_seven, C, D >forC < D.
not_ranges< C1, D1, C2, D2, ... >
not_ranges< C1, D1, C2, D2, ..., E >
- Succeeds when the input is not empty, and:
- The next input byte is not in any of the closed ranges
C1 ... D1,C2 ... D2, ... - For the second form the next input byte must also not be
E. - Consumes one byte on success.
- The character pack must be non-empty.
- Meta data and implementation mapping:
ascii::not_ranges< E >::rule_tisinternal::not_one< internal::peek_char, E >.ascii::not_ranges< C, C >::rule_tisinternal::not_one< internal::peek_char, C >.ascii::not_ranges< C, D >::rule_tisinternal::not_range< internal::peek_char, C, D >forC < D.ascii::not_ranges< C... >::rule_tisinternal::not_ranges< internal::peek_char, C... >for packs with more than two characters.
nul
- Matches and consumes an ASCII nul character of value
0. - Equivalent to
(ascii::)one< '\0' >.
odigit
- Matches and consumes a single ASCII octal digit.
- Equivalent to
(ascii::)range< '0', '7' >.
one< C... >
- Succeeds when the input is not empty, and:
- The next input byte is one of
C.... - Consumes one byte on success.
Cmust be a non-empty character pack.- Meta data and implementation mapping:
ascii::one< C... >::rule_tisinternal::one< internal::peek_char, C... >.
print
- Matches and consumes any single ASCII character traditionally defined as printable.
- Equivalent to
(ascii::)range< 32, 126 >.
punct
- Matches and consumes any single ASCII character defined as punctuation.
- Equivalent to
(ascii::)ranges< '!', '/', ':', '@', '[', 96, '{', '~' >.
range< C, D >
- Succeeds when the input is not empty, and:
- The next input byte is in the closed range
C ... D. - Consumes one byte on success.
- Meta data and implementation mapping:
ascii::range< C, C >::rule_tisinternal::one< internal::peek_char, C >.ascii::range< C, D >::rule_tisinternal::range< internal::peek_char, C, D >forC < D.
ranges< C1, D1, C2, D2, ... >
ranges< C1, D1, C2, D2, ..., E >
- Equivalent to
sor< (ascii::)range< C1, D1 >, (ascii::)range< C2, D2 >, ... >. - Equivalent to
sor< (ascii::)range< C1, D1 >, (ascii::)range< C2, D2 >, ..., (ascii::)one< E > >. - The character pack must be non-empty.
- Meta data and implementation mapping:
ascii::ranges< E >::rule_tisinternal::one< internal::peek_char, E >.ascii::ranges< C, C >::rule_tisinternal::one< internal::peek_char, C >.ascii::ranges< C, D >::rule_tisinternal::range< internal::peek_char, C, D >forC < D.ascii::ranges< C... >::rule_tisinternal::ranges< internal::peek_char, C... >for packs with more than two characters.
shebang
- Equivalent to
seq< (ascii::)string< '#', '!' >, until< eolf > >. - Meta data and implementation mapping:
ascii::shebang::rule_tisinternal::seq< internal::ascii_string< '#', '!' >, internal::until< internal::eolf > >ascii::shebang::subs_tistype_list< internal::ascii_string< '#', '!' >, internal::until< internal::eolf > >
sp
- Matches and consumes a single ASCII space character of value
32or0x20. - Equivalent to
(ascii::)one< ' ' >.
space
- Matches and consumes a single space, line feed, carriage return, horizontal tab, vertical tab or form feed.
- Equivalent to
(ascii::)one< ' ', '\n', '\r', '\t', '\v', '\f' >.
string< C... >
- Matches and consumes a string, a sequence of bytes or ASCII characters.
- Equivalent to
seq< (ascii::)one< C >... >. - Meta data and implementation mapping:
ascii::string<>::rule_tisinternal::successascii::string< C >::rule_tisinternal::one< internal::peek_char, C >ascii::string< C... >::rule_tisinternal::ascii_string< C... >
TAO_PEGTL_ISTRING( "..." )
- Macro where
TAO_PEGTL_ISTRING( "foo" )yields(ascii::)istring< 'f', 'o', 'o' >. - The argument must be a string literal.
- Works for strings up to 512 bytes of length (excluding trailing
'\0'). - Strings may contain embedded
'\0'.
TAO_PEGTL_KEYWORD( "..." )
- Macro where
TAO_PEGTL_KEYWORD( "foo" )yields(ascii::)keyword< 'f', 'o', 'o' >. - The argument must be a string literal.
- Works for keywords up to 512 bytes of length (excluding trailing
'\0'). - Strings may contain embedded
'\0'.
TAO_PEGTL_STRING( "..." )
- Macro where
TAO_PEGTL_STRING( "foo" )yields(ascii::)string< 'f', 'o', 'o' >. - The argument must be a string literal.
- Works for strings up to 512 bytes of length (excluding trailing
'\0'). - Strings may contain embedded
'\0'.
three< C >
- Succeeds when the input contains at least three bytes, and:
- These three input bytes are all
C. - Consumes three bytes on success.
- Meta data and implementation mapping:
ascii::three< C >::rule_tisinternal::ascii_string< C, C, C >
two< C >
- Succeeds when the input contains at least two bytes, and:
- These two input bytes are both
C. - Consumes two bytes on success.
- Meta data and implementation mapping:
ascii::two< C >::rule_tisinternal::ascii_string< C, C >
upper
- Matches and consumes a single ASCII upper-case alphabetic character.
- Equivalent to
(ascii::)range< 'A', 'Z' >.
vt
- Matches and consumes a single ASCII vertical tab of value
11or0x0b. - Equivalent to
(ascii::)one< '\v' >.
xdigit
- Matches and consumes a single ASCII hexadecimal digit character.
- Equivalent to
(ascii::)ranges< '0', '9', 'a', 'f', 'A', 'F' >.
Unicode
These rules are available in multiple versions,
- in namespace
tao::pegtl::utf8for UTF-8 inputs, - in namespace alias
tao::pegtl::utf16for native-endian UTF-16 inputs, - in namespace alias
tao::pegtl::utf32for native-endian UTF-32 inputs, - in namespace
tao::pegtl::utf16_befor big-endian UTF-16 inputs, - in namespace
tao::pegtl::utf16_lefor little-endian UTF-16 inputs, - in namespace
tao::pegtl::utf32_befor big-endian UTF-32 inputs, - in namespace
tao::pegtl::utf32_lefor little-endian UTF-32 inputs.
Except for UTF-8 the Unicode rules are not automatically included with <tao/pegtl.hpp>.
To make them available the following header files need to be included as required.
tao/pegtl/unicode/utf16.hpptao/pegtl/unicode/utf32.hpp
Remember that the column field of the input positions counts the number of input objects since the last line ending, not the actual column!
A Unicode code point is considered valid when it is in the range 0 to 0x10ffff.
- The UTF-8 rules work on the same inputs as the ASCII rules whose
data_tis an 8-bit integer or enum type. - The UTF-16 rules work with inputs whose
data_tis either an 8-bit or a 16-bit integer or enum type. - The UTF-32 rules work with inputs whose
data_tis either an 8-bit or a 32-bit integer or enum type.
In the following descriptions the parameter N stands for the size of the encoding of the next Unicode code point in the input.
- For UTF-8 the rules are multi-byte-sequence-aware and N is either 1, 2, 3 or 4.
- For UTF-16 the rules are surrogate-pair-aware and N is either 2 or 4 for 8-bit inputs, and either 1 or 2 for 16-bit inputs.
- For UTF-32 N is always 4 for 8-bit inputs, and always 1 for 32-bit inputs.
Note that the Unicode rules only match UTF-16 surrogates as part of a valid UTF-16 surrogate pair.
For all Unicode rules the template parameters representing code points are of type char32_t.
any
- Succeeds when the input is not empty, and:
- The next N input objects encode a valid Unicode code point.
- Consumes the N input objects on success.
bom
- Matches and consumes a byte-order mark of value
U+FEFF.
cr
- Matches and consumes a single carriage return of value
13orU+000D. - Also available in the
scansub-namespace. - Also available in the
lazysub-namespace.
cr_crlf
- Matches and consumes a carriage return optionally followed by a line feed.
- Also available in the
lazysub-namespace.
cr_lf
- Matches and consumes a carriage return or line feed.
- Also available in the
lazysub-namespace.
cr_lf_crlf
- Matches and consumes a carriage return and/or line feed.
- Also available in the
lazysub-namespace.
crlf
- Matches and consumes a carriage return followed by a line feed.
- Also available in the
lazysub-namespace.
eol1
- Match any single-code-point Unicode end-of-line character:
- Carriage return, line feed, form feed, vertical tab, next line, or line or paragraph separator.
eolu
- Match any Unicode end-of-line sequence, i.e.
crlforeol1. - Also available in the
lazysub-namespace.
lf
- Matches and consumes a single line feed of value
10orU+000A. - Also available in the
scansub-namespace. - Also available in the
lazysub-namespace.
lf_crlf
- Matches and consumes a line feed optionally preceded by a carriage return.
- Also available in the
scansub-namespace. - Also available in the
lazysub-namespace.
ls
- Matches and consumes a single Unicode line separator of value
U+2028. - Also available in the
scansub-namespace. - Also available in the
lazysub-namespace.
many< Num >
- Succeeds when the input contains at least
Numfurther code points. - Consumes these
Numcode points from the input. - Equivalent to
rep< Num, utf_::any >.
not_one< C... >
- Succeeds when the input is not empty, and:
- The next N input objects encode a valid Unicode code point, and:
Cis a non-empty character pack and the input code point is not one of the given code pointsC....- Consumes the N input objects on success.
not_range< C, D >
- Succeeds when the input is not empty, and:
- The next N input objects encode a valid Unicode code point, and:
- The input code point
BsatisfiesB < C || D < B. - Consumes the N input objects on success.
not_ranges< C1, D1, C2, D2, ... >
- Succeeds when the input is not empty, and:
- The next N input objects encode a valid Unicode code point, and:
- The input code point is not in any of the closed ranges
C1 ... D1,C2 ... D2, ... - Consumes the N input objects on success.
- The character pack must be non-empty.
not_ranges< C1, D1, C2, D2, ..., E >
- Succeeds when the input is not empty, and:
- The next N input objects encode a valid Unicode code point, and:
- The input code point is not in any of the closed ranges
C1 ... D1,C2 ... D2, ... - The input code point is also not
E. - Consumes the N input objects on success.
- The character pack must be non-empty.
one< C... >
- Succeeds when the input is not empty, and:
- The next N input objects encode a valid Unicode code point, and:
Cis a non-empty character pack and the input code point is one of the given code pointsC....- Consumes the N input objects on success.
nel
- Matches and consumes a single Unicode next line of value
U+0085. - Also available in the
scansub-namespace. - Also available in the
lazysub-namespace.
ps
- Matches and consumes a single Unicode paragraph separator of value
U+2029. - Also available in the
scansub-namespace. - Also available in the
lazysub-namespace.
range< C, D >
- Succeeds when the input is not empty, and:
- The next N input objects encode a valid Unicode code point, and:
- The input code point
BsatisfiesC <= B && B <= D. - Consumes the N input objects on success.
ranges< C1, D1, C2, D2, ... >
- Equivalent to
sor< utf_::range< C1, D1 >, utf_::range< C2, D2 >, ... >. - The character pack must be non-empty.
ranges< C1, D1, C2, D2, ..., E >
- Equivalent to
sor< utf_::range< C1, D1 >, utf_::range< C2, D2 >, ..., utf_::one< E > >. - The character pack must be non-empty.
string< C... >
- Equivalent to
seq< utf_::one< C >... >. - Meta data and implementation mapping:
utf_::string<>::rule_tisinternal::success.utf_::string< C... >::rule_tisinternal::seq< internal::one< internal::peek_, C >... >.utf8::string< C >::rule_tisinternal::one< internal::peek_char, U >whenUis the one-byte UTF-8 encoding ofC.utf8::string< C >::rule_tisinternal::ascii_string< U... >whenU...is the multi-byte UTF-8 encoding ofC.utf8::string< C... >::rule_tisinternal::ascii_string< U... >whereU...is the UTF-8 encoding ofC....
Binary
These rules are available in multiple versions,
- in namespace
tao::pegtl::int8forstd::int8_tvalues, - in namespace
tao::pegtl::uint8forstd::uint8_tvalues, - in namespace
tao::pegtl::int16_befor big-endianstd::int16_tvalues, - in namespace
tao::pegtl::int16_lefor little-endianstd::int16_tvalues, - in namespace
tao::pegtl::int32_befor big-endianstd::int32_tvalues, - in namespace
tao::pegtl::int32_lefor little-endianstd::int32_tvalues, - in namespace
tao::pegtl::int64_befor big-endianstd::int64_tvalues, - in namespace
tao::pegtl::int64_lefor little-endianstd::int64_tvalues, - in namespace
tao::pegtl::uint16_befor big-endianstd::uint16_tvalues, - in namespace
tao::pegtl::uint16_lefor little-endianstd::uint16_tvalues, - in namespace
tao::pegtl::uint32_befor big-endianstd::uint32_tvalues, - in namespace
tao::pegtl::uint32_lefor little-endianstd::uint32_tvalues, - in namespace
tao::pegtl::uint64_befor big-endianstd::uint64_tvalues, - in namespace
tao::pegtl::uint64_lefor little-endianstd::uint64_tvalues, - in namespace
tao::pegtl::enums_befor big-endian enumeration type values, - in namespace
tao::pegtl::enums_lefor little-endian enumeration type values, - in namespace alias
tao::pegtl::int16for native-endianstd::int16_tvalues, - in namespace alias
tao::pegtl::int32for native-endianstd::int32_tvalues, - in namespace alias
tao::pegtl::int64for native-endianstd::int64_tvalues, - in namespace alias
tao::pegtl::uint16for native-endianstd::uint16_tvalues, - in namespace alias
tao::pegtl::uint32for native-endianstd::uint32_tvalues, - in namespace alias
tao::pegtl::uint64for native-endianstd::uint64_tvalues, - in namespace alias
tao::pegtl::enumsfor native-endian enumeration type values.
The binary rules are not automatically included with <tao/pegtl.hpp>.
To make them available the following header files need to be included as required.
tao/pegtl/binary/int8.hpptao/pegtl/binary/uint8.hpptao/pegtl/binary/int16.hpptao/pegtl/binary/uint16.hpptao/pegtl/binary/int32.hpptao/pegtl/binary/uint32.hpptao/pegtl/binary/int64.hpptao/pegtl/binary/uint64.hpptao/pegtl/binary/enums.hpp
These rules operate both on byte-sized inputs and on inputs whose data size corresponds to the size of the matched integers or enums.
- The 8-bit rules work on the same inputs as the ASCII rules whose
data_tis an 8-bit integer or enum type. - The 16-bit rules work with inputs whose
data_tis either an 8-bit or a 16-bit integer or enum type. - The 32-bit rules work with inputs whose
data_tis either an 8-bit or a 32-bit integer or enum type. - The 64-bit rules work with inputs whose
data_tis either an 8-bit or a 64-bit integer or enum type.
The enum rules behave like integers of the same size.
In the following descriptions the parameter N stands for the size of the encoding of the next integer value according to the size of integer matched by the rule in question.
- For 8-bit rules N is always 1.
- For 16-bit rules N is 2 for 8-bit inputs and 1 for 16-bit inputs.
- For 32-bit rules N is 4 for 8-bit inputs and 1 for 32-bit inputs.
- For 64-bit rules N is 8 for 8-bit inputs and 1 for 64-bit inputs.
The enum rules again behave like integers of the same size.
The template parameters of an enum rule must all be of the same enum type.
Only the not_one, not_range, one, range, ranges and string rules are available for enums.
The term input value indicates an integer or enum value of the appropriate size read from the input.
any
- Succeeds when the input contains at least N objects.
- Consumes N objects on success.
many< Num >
- Succeeds when the input contains at least
Numtimes N objects. - Consumes these
Num* N objects from the input. - Equivalent to
rep< Num, any >.
mask_not_one< M, C... >
- Succeeds when the input contains at least N objects, and:
Cis a non-empty pack and the (endian adjusted) input value masked withMis not one of the valuesC....- Consumes N objects on success.
mask_not_range< M, C, D >
- Succeeds when the input contains at least N objects, and:
- The (endian adjusted) input value
bsatisfies( b & M ) < C || D < ( b & M ). - Consumes N objects on success.
mask_one< M, C... >
- Succeeds when the input contains at least N objects, and:
Cis a non-empty pack and the (endian adjusted) input value masked withMis one of the given valuesC....- Consumes N objects on success.
mask_range< M, C, D >
- Succeeds when the input contains at least N objects, and:
- The (endian adjusted) input value
bsatisfiesC <= ( b & M ) && ( b & M ) <= D. - Consumes N objects on success.
mask_ranges< M, C1, D1, C2, D2, ... >
- Equivalent to
sor< mask_range< M, C1, D1 >, mask_range< M, C2, D2 >, ... >. - The value pack must be non-empty.
mask_ranges< M, C1, D1, C2, D2, ..., E >
- Equivalent to
sor< mask_range< M, C1, D1 >, mask_range< M, C2, D2 >, ..., mask_one< M, E > >. - The value pack must be non-empty.
mask_string< M, C... >
- Equivalent to
seq< mask_one< M, C >... >.
not_one< C... >
- Succeeds when the input contains at least N objects, and:
Cis a non-empty pack and the (endian adjusted) input value is not one of the given valuesC....- Consumes N objects on success.
not_range< C, D >
- Succeeds when the input contains at least N objects, and:
- The (endian adjusted) input value
bsatisfiesb < C || D < b. - Consumes N objects on success.
not_ranges< C1, D1, C2, D2, ... >
- Succeeds when the input contains at least N objects, and:
- The (endian adjusted) input value is not in any of the closed ranges
C1 ... D1,C2 ... D2, ... - Consumes N objects on success.
- The value pack must be non-empty.
not_ranges< C1, D1, C2, D2, ..., E >
- Succeeds when the input contains at least N objects, and:
- The (endian adjusted) input value is not in any of the closed ranges
C1 ... D1,C2 ... D2, ... - The (endian adjusted) input value is also not
E. - Consumes N objects on success.
- The value pack must be non-empty.
one< C... >
- Succeeds when the input contains at least N objects, and:
Cis a non-empty pack and the (endian adjusted) input value is one of the given valuesC....- Consumes N objects on success.
range< C, D >
- Succeeds when the input contains at least N objects, and:
- The (endian adjusted) input value
bsatisfiesC <= b && b <= D. - Consumes N objects on success.
ranges< C1, D1, C2, D2, ... >
- Equivalent to
sor< range< C1, D1 >, range< C2, D2 >, ... >. - The value pack must be non-empty.
ranges< C1, D1, C2, D2, ..., E >
- Equivalent to
sor< range< C1, D1 >, range< C2, D2 >, ..., one< E > >. - The value pack must be non-empty.
string< C... >
- Equivalent to
seq< one< C >... >.
Member
The member rules apply their matching condition to a value derived from the next object in the input.
The first template parameter to the member rules must be a member pointer, a member function pointer to a "getter" function, or a function pointer to a global "getter".
More precisely, for inputs representing sequences of objects of type T, the permissible types of the first template parameter M are as follows; the functions can be noexcept( true ) or noexcept( false ).
U T::*-- pointer to data member of typeU.const U T::*-- pointer to data member of typeconst U.U* T::*-- pointer to data member of typeU*.const U* T::*-- pointer to data member of typeconst U*.U* const T::*-- pointer to data member of typeU* const.const U* const T::*-- pointer to data member of typeconst U* const.U (T::*)() const-- pointer to const member function that returns aU.const U& (T::*)() const-- pointer to const member function that returns aconst U&.const U* (T::*)() const-- pointer to const member function that returns aconst U*.U (*)( const T& )-- pointer to function that takes aconst T&and returns aU.const U& (*)( const T& )-- pointer to function that takes aconst T&and returns aconst U&.const U* (*)( const T& )-- pointer to function that takes aconst T&and returns aconst U*.
Here U is assumed to be neither a pointer nor a reference type.
Subsequent non-type template parameters, if any, must be of type U as that is the type of the object extracted from the next input object of type T on which the match condition is tested.
The member rules are not automatically included with <tao/pegtl.hpp>.
To make them available it is necessary to include tao/pegtl/member.hpp.
These rules are in namespace tao::pegtl::member.
function< M, F >
- Apply the function
Fto the extracted object of typeU. - The function
Fmust take aUorconst U&as first argument, and - if possible the function
Fis called with all State objects as additional arguments. - The function
Fmust return aboolwith the result of the match attempt. - The function
Fcan benoexcept( true )ornoexcept( false ).
nested< M, R >
- Performs a nested parsing run with rule
Ron the extracted object. - The extracted object must be suited to construct a
view_input. - Consumes 1 object from the outer input when the nested parsing run succeeds.
not_one< M, U... >
- Succeeds when the input contains at least 1 object, and:
- The object extracted from the next input object is not one of the values
U.... - Consumes 1 object on success.
Umust be a non-empty pack.
not_range< M, U, V >
- Succeeds when the input contains at least 1 object, and:
- The object
uextracted from the next input object satisfiesu < U || V < u. - Consumes 1 object on success.
not_ranges< M, U1, V1, U2, V2, ... >
- Succeeds when the input contains at least 1 object, and:
- The object extracted from the next input object is not in any of the closed ranges
U1 ... V1,U2 ... V2, ... - Consumes 1 object on success.
- The value pack must be non-empty.
not_ranges< M, U1, V1, U2, V2, ..., W >
- Succeeds when the input contains at least 1 object, and:
- The object extracted from the next input object is not in any of the closed ranges
U1 ... V1,U2 ... V2, ... - The object extracted from the next input object is also not
W. - Consumes 1 object on success.
- The value pack must be non-empty.
one< M, U... >
- Succeeds when the input contains at least 1 object, and:
- The object extracted from the next input object is one of the values
U.... - Consumes 1 object on success.
Umust be a non-empty pack.
range< M, U, V >
- Succeeds when the input contains at least 1 object, and:
- The object
uextracted from the next input object satisfiesU <= u && u <= V. - Consumes 1 object on success.
ranges< M, U1, V1, U2, V2, ... >
- Equivalent to
sor< range< M, U1, V1 >, range< M, U2, V2 >, ... >. - The value pack must be non-empty.
ranges< M, U1, V1, U2, V2, ..., W >
- Equivalent to
sor< range< M, U1, V1 >, range< M, U2, V2 >, ..., one< M, W > >. - The value pack must be non-empty.
string< M, U... >
- Equivalent to
seq< one< M, U >... >.
Combinators
These rules correspond to the classical PEG combinators or operators.
These rules are in namespace tao::pegtl.
at< R... >
- PEG and-predicate &e
- Succeeds if and only if
seq< R... >would succeed. - Consumes nothing independent of result.
- Disables all actions while matching
R.... - Meta data and implementation mapping:
at<>::rule_tisinternal::successat< R >::rule_tisinternal::at< R >at< R >::subs_tistype_list< R >at< R... >::rule_tisinternal::at< internal::seq< R... > >at< R... >::subs_tistype_list< internal::seq< R... > >
not_at< R... >
- PEG not-predicate !e
- Succeeds if and only if
seq< R... >would not succeed. - Consumes nothing independent of result.
- Disables all actions while matching
R.... - Meta data and implementation mapping:
not_at<>::rule_tisinternal::failurenot_at< R >::rule_tisinternal::not_at< R >not_at< R >::subs_tistype_list< R >not_at< R... >::rule_tisinternal::not_at< internal::seq< R... > >not_at< R... >::subs_tistype_list< internal::seq< R... > >
opt< R... >
- PEG optional e?
- Optional
seq< R... >, i.e. attempt to matchseq< R... >and always return success: - The return value of
opt< R... >does not depend on whetherR...matched. - Equivalent to
sor< seq< R... >, success >. - Meta data and implementation mapping:
opt<>::rule_tisinternal::successopt< R >::rule_tisinternal::opt< R >opt< R >::subs_tistype_list< R >opt< R... >::rule_tisinternal::opt< internal::seq< R... > >opt< R... >::subs_tistype_list< internal::seq< R... > >
plus< R... >
- PEG one-or-more e+
- Matches
seq< R... >as often as possible and succeeds if it matches at least once. - Equivalent to
seq< R..., star< R... > >. Rmust be a non-empty rule pack.- Meta data and implementation mapping:
plus< R >::rule_tisinternal::plus< R >plus< R >::subs_tistype_list< R >plus< R... >::rule_tisinternal::plus< internal::seq< R... > >plus< R... >::subs_tistype_list< internal::seq< R... > >
seq< R... >
- PEG sequence e1 e2
- Sequence or conjunction of rules.
- Matches the given rules
R...in the given order. - Fails and stops matching when one of the given rules fails.
- Consumes everything that the rules
R...consumed. - Succeeds if
Ris an empty rule pack. - Meta data and implementation mapping:
seq<>::rule_tisinternal::successseq< R >::rule_tisinternal::seq< R >seq< R >::subs_tistype_list< R >seq< R... >::rule_tisinternal::seq< R... >seq< R... >::subs_tistype_list< R... >
sor< R... >
- PEG ordered choice e1 / e2
- Choice or disjunction of rules.
- Matches the given rules
R...in the given order. - Succeeds and stops matching when one of the given rules succeeds.
- Consumes whatever the first rule that succeeded consumed.
- Fails if
Ris an empty rule pack. - Meta data and implementation mapping:
sor<>::rule_tisinternal::failuresor< R >::rule_tisinternal::sor< R >sor< R >::subs_tistype_list< R >sor< R... >::rule_tisinternal::sor< R... >sor< R... >::subs_tistype_list< R... >
star< R... >
- PEG zero-or-more e*
- Matches
seq< R... >as often as possible and always succeeds. - Equivalent to
opt< plus< R... > >. Rmust be a non-empty rule pack.- Meta data and implementation mapping:
star< R >::rule_tisinternal::star< R >star< R >::subs_tistype_list< R >star< R... >::rule_tisinternal::star< internal::seq< R... > >star< R... >::subs_tistype_list< internal::seq< R... > >
Convenience
These rules implement common rule combinations for more concise and/or efficient grammars.
These rules are in namespace tao::pegtl.
if_then_else< R, S, T >
- Attempts to match either
SorTdepending on whetherRmatched. - Equivalent to
sor< seq< R, S >, seq< not_at< R >, T > >. - Meta data and implementation mapping:
if_then_else< R, S, T >::rule_tisinternal::if_then_else< R, S, T>if_then_else< R, S, T >::subs_tistype_list< R, S, T >
list< R, S >
- Matches a non-empty list of
Rseparated byS. - Equivalent to
seq< R, star< S, R > >. - Meta data and implementation mapping:
list< R, S >::rule_tisinternal::seq< R, internal::star< S, R > >list< R, S >::subs_tistype_list< R, internal::star< S, R > >
list< R, S, P >
- Matches a non-empty list of
Rseparated bySwhere eachScan be padded byP. - Equivalent to
seq< R, star< pad< S, P >, R > >. - Meta data and implementation mapping:
list< R, S, P >::rule_tisinternal::seq< R, internal::star< internal::pad< S, P >, R > >list< R, S, P >::subs_tistype_list< R, internal::star< internal::pad< S, P >, R > >
list_opt< R, S >
- Matches an optional list of
Rseparated byS. - Equivalent to
opt< list< R, S > >. - Equivalent to
opt< R, star< S, R > >. - Meta data and implementation mapping:
list_opt< R, S >::rule_tisinternal::opt< internal::seq< R, internal::star< S, R > > >list_opt< R, S >::subs_tistype_list< internal::seq< R, internal::star< S, R > > >
list_opt< R, S, P >
- Matches an optional list of
Rseparated bySwhere eachScan be padded byP. - Equivalent to
opt< list< R, S, P > >. - Equivalent to
opt< R, star< pad< S, P >, R > >. - Meta data and implementation mapping:
list_opt< R, S, P >::rule_tisinternal::opt< internal::seq< R, internal::star< internal::pad< S, P >, R > > >list_opt< R, S, P >::subs_tistype_list< internal::seq< R, internal::star< internal::pad< S, P >, R > > >
list_tail< R, S >
- Matches a non-empty list of
Rseparated bySwith optional trailingS. - Equivalent to
seq< list< R, S >, opt< S > >. - Equivalent to
seq< R, star_partial< S, R > >. - Meta data and implementation mapping:
list_tail< R, S >::rule_tisinternal::seq< R, internal::star_partial< S, R > >list_tail< R, S >::subs_tistype_list< R, internal::star_partial< S, R > >
list_tail< R, S, P >
- Matches a non-empty list of
Rseparated bySwith optional trailingSand paddingPinside the list. - Equivalent to
seq< list< R, S, P >, opt< star< P >, S > >. - Equivalent to
seq< R, star_partial< seq< star< P >, S >, seq< star< P >, R > > >. - Meta data and implementation mapping:
list_tail< R, S, P >::rule_tisinternal::seq< R, internal::star_partial< internal::lpad< S, P >, internal::lpad< R, P > > >list_tail< R, S, P >::subs_tistype_list< R, internal::star_partial< internal::lpad< S, P >, internal::lpad< R, P > > >
minus< M, S >
- Succeeds if
Mmatches, andSdoes not match all of the input thatMmatched. - Equivalent to
rematch< M, not_at< S, eof > >. - Meta data and implementation mapping:
minus< M, S >::rule_tisinternal::rematch< M, internal::not_at< S, internal::eof > >minus< M, S >::subs_tistype_list< M, internal::not_at< S, internal::eof > >
Note that S is ignored by the grammar analysis.
pad< R, S, T = S >
- Matches an
Rthat can be padded by arbitrary manySon the left andTon the right. - Equivalent to
seq< star< S >, R, star< T > >. - Meta data and implementation mapping:
pad< R, S, T >::rule_tisinternal::seq< internal::star< S >, R, internal::star< T > >pad< R, S, T >::subs_tistype_list< internal::star< S >, R, internal::star< T > >
A common mistake is to forget about the implicit star and use e.g. star< blank > for S (and T).
This attempts to match star< star< S > > which is an infinite loop without progress.
The PEGTL grammar analysis catches this mistake.
pad_opt< R, P >
- Matches an optional
Rthat can be padded by arbitrary manyP, or just arbitrary manyP. - Equivalent to
seq< star< P >, opt< R, star< P > > >. - Meta data and implementation mapping:
pad_opt< R, P >::rule_tisinternal::seq< internal::star< P >, internal::opt< R, internal::star< P > > >pad_opt< R, P >::subs_tistype_list< internal::star< P >, internal::opt< R, internal::star< P > > >
partial< R... >
- Similar to
opt< R... >with one important difference: - Does not rewind the input after a partial match of
R.... - Attempts to match the given rules
R...in the given order. - Succeeds and stops matching when one of the given rules fails;
- also succeeds when all of the given rules succeed.
- Consumes everything that the successful rules of
R...consumed. Rmust be a non-empty rule pack.- Equivalent to
opt< R >whenR...is a single rule. - Equivalent to
opt< R1, opt< R2, opt< ...whenRisR1,R2, ... - Meta data and implementation mapping:
partial< R... >::rule_tisinternal::partial< R... >partial< R... >::subs_tistype_list< R... >
rematch< R, S... >
- Succeeds if
Rmatches, and eachSmatches the input thatRmatched. - Meta data and implementation mapping:
rematch< R, S... >::rule_tisinternal::rematch< R, S... >rematch< R, S... >::subs_tistype_list< R, S... >
Note that the rules in S... do not need to match all of the input matched by R.
(Which is why minus uses eof in its implementation to match to the end of what R matched).
Note that the S... are ignored in the grammar analysis.
rep< Num, R... >
- Matches
seq< R... >forNumtimes without checking for further matches. - Equivalent to
seq< seq< R... >, ..., seq< R... > >whereseq< R... >is repeatedNumtimes. - Meta data and implementation mapping:
rep< 0, R... >::rule_tisinternal::successrep< N >::rule_tisinternal::successrep< N, R >::rule_tisinternal::rep< N, R >forN > 0rep< N, R >::subs_tistype_list< R >rep< N, R... >::rule_tisinternal::rep< N, internal::seq< R... > >forN > 0rep< N, R... >::subs_tistype_list< internal::seq< R... > >
rep_max< Max, R... >
- Matches
seq< R... >for at mostMaxtimes and verifies that it doesn't match more often. - Equivalent to
rep_min_max< 0, Max, R... >. - Meta data and implementation mapping:
rep_max< 0, R >::rule_tisinternal::not_at< R >rep_max< 0, R >::subs_tistype_list< R >rep_max< 0, R... >::rule_tisinternal::not_at< internal::seq< R... > >rep_max< 0, R... >::subs_tistype_list< internal::seq< R... > >rep_max< Max >::rule_tisinternal::failurerep_max< Max, R >::rule_tisinternal::rep_min_max< 0, Max, R >rep_max< Max, R >::subs_tistype_list< R >rep_max< Max, R... >::rule_tisinternal::rep_min_max< 0, Max, internal::seq< R... > >rep_max< Max, R... >::subs_tistype_list< internal::seq< R... > >
rep_min< Min, R... >
- Matches
seq< R... >as often as possible and succeeds if it matches at leastMintimes. - Equivalent to
seq< rep< Min, R... >, star< R... > >. Rmust be a non-empty rule pack.- Meta data and implementation mapping:
rep_min< Min, R... >::rule_tisinternal::seq< internal::rep< Min, R... >, internal::star< R... > >rep_min< Min, R... >::subs_tistype_list< internal::rep< Min, R... >, internal::star< R... > >
rep_min_max< Min, Max, R... >
- Matches
seq< R... >forMintoMaxtimes and verifies that it doesn't match more often. - Equivalent to
seq< rep< Min, R... >, rep_opt< Max - Min, R... >, not_at< R... > >. - Meta data and implementation mapping:
rep_min_max< 0, 0, R >::rule_tisinternal::not_at< R >rep_min_max< 0, 0, R >::subs_tistype_list< R >rep_min_max< 0, 0, R... >::rule_tisinternal::not_at< internal::seq< R... > >rep_min_max< 0, 0, R... >::subs_tistype_list< internal::seq< R... > >rep_min_max< Min, Max >::rule_tisinternal::failurerep_min_max< Min, Max, R >::rule_tisinternal::rep_min_max< Min, Max, R >rep_min_max< Min, Max, R >::subs_tistype_list< R >rep_min_max< Min, Max, R... >::rule_tisinternal::rep_min_max< Min, Max, internal::seq< R... > >rep_min_max< Min, Max, R... >::subs_tistype_list< internal::seq< R... > >
rep_opt< Num, R... >
- Matches
seq< R... >for zero toNumtimes without check for further matches. - Equivalent to
rep< Num, opt< R... > >. - Meta data and implementation mapping:
rep_opt< Num >::rule_tisinternal::successrep_opt< Num, R >::rule_tisinternal::rep_opt< Num, R >forNum > 0rep_opt< Num, R >::subs_tistype_list< R >rep_opt< Num, R... >::rule_tisinternal::rep_opt< Num, internal::seq< R... > >forNum > 0rep_opt< Num, R... >::subs_tistype_list< internal::seq< R... > >
separated< S, R... >
- Like
seq< R... >but withSas separator. - Equivalent to
successfor emptyR.... - Equivalent to
seq< R >for single ruleR. - Equivalent to
seq< R1, S, R2, S, R3, ... >ifR...isR1, R2, R3, .... - Meta data and implementation mapping:
separated< S >::rule_tisinternal::successseparated< S, R >::rule_tisinternal::seq< R >separated< S, R >::subs_tistype_list< R >separated< S, R1, R2, ... >::rule_tisinternal::seq< R1, S, R2, ... >separated< S, R1, R2, ... >::subs_tistype_list< R1, S, R2, ... >
separated_pad< S, P, R... >
- Like
seq< R... >but withpad< S, P >as separator. - Equivalent to
separated< pad< S, P >, R... >. - Meta data and implementation mapping:
separated_pad< S, P >::rule_tisinternal::successseparated_pad< S, P, R >::rule_tisinternal::seq< R >separated_pad< S, P, R >::subs_tistype_list< R >separated_pad< S, P, R1, R2, ... >::rule_tisinternal::seq< R1, internal::star< P >, S, internal::star< P >, R2, ... >separated_pad< S, P, R1, R2, ... >::subs_tistype_list< R1, internal::star< P >, S, internal::star< P >, R2, ... >
star_partial< R... >
- Similar to
star< R... >with one important difference: - The final iteration does not rewind the input after a partial match of
R.... Rmust be a non-empty rule pack.- Meta data and implementation mapping:
star_partial< R... >::rule_tisinternal::star_partial< R... >star_partial< R... >::subs_tistype_list< R... >
star_strict< R... >
- Similar to
star< R... >with one important difference: - A partial match of
R...letsstar_strictfail locally. Rmust be a non-empty rule pack.- Meta data and implementation mapping:
star_strict< R... >::rule_tisinternal::star_strict< R... >star_strict< R... >::subs_tistype_list< R... >
strict< R... >
- Similar to
opt< R... >with one important difference: - A partial match of
R...letsstrictfail locally. - Equivalent to
sor< not_at< R1 >, seq< R... > >ifR1is the first rule ofR.... Rmust be a non-empty rule pack.- Meta data and implementation mapping:
strict< R... >::rule_tisinternal::strict< R... >strict< R... >::subs_tistype_list< R... >
unordered< R... >
- Matches the rules
R...in arbitrary order, more precisely: - Like
rep< sizeof...( R ), sor< R'... > >whereR'is updated each repetition to consist of those rules that have not matched in a previous repetition. - Meta data and implementation mapping:
unordered<>::rule_tisinternal::successunordered< R... >::rule_tisinternal::unordered< false, R... >unordered< R... >::subs_tistype_list< R... >
Note that the grammar analysis does not correctly handle recursions in the grammar that pass through an unordered rule.
unordered_partial< R... >
- Combines the behavior of
partialandunordered. - Meta data and implementation mapping:
unordered_partial<>::rule_tisinternal::successunordered_partial< R... >::rule_tisinternal::unordered< true, R... >unordered_partial< R... >::subs_tistype_list< R... >
Note that the grammar analysis does not correctly handle recursions in the grammar that pass through an unordered_partial rule.
until< R >
- Consumes all input until
Rmatches. - Equivalent to
until< R, consume< 1 > >. - Meta data and implementation mapping:
until< R >::rule_tisinternal::until< R >until< R >::subs_tistype_list< R >
until< R, S... >
- Matches
seq< S... >as long asat< R >does not match and succeeds whenRmatches. - Equivalent to
seq< star< not_at< R >, S... >, R >. - See the previous entry for
until< R >, i.e. whenS...is empty. - Meta data and implementation mapping:
until< R, S >::rule_tisinternal::until< R, S >until< R, S >::subs_tistype_list< R, S >until< R, S... >::rule_tisinternal::until< R, internal::seq< S... > >until< R, S... >::subs_tistype_list< R, internal::seq< S... > >
Controlling
These rules manage and change the control, action and states during a parsing run.
These rules are in namespace tao::pegtl.
action< A, R... >
- Equivalent to
seq< R... >, but: - Uses the given class template
Aas action. - Does not change whether actions are enabled or disabled!
- Meta data and implementation mapping:
action< A >::rule_tisinternal::successaction< A, R >::rule_tisinternal::action< A, R >action< A, R >::subs_tistype_list< R >action< A, R... >::rule_tisinternal::action< A, internal::seq< R... > >action< A, R... >::subs_tistype_list< internal::seq< R... > >
control< C, R... >
- Equivalent to
seq< R... >, but: - Uses the given class template
Cas control. - Meta data and implementation mapping:
control< C >::rule_tisinternal::successcontrol< C, R >::rule_tisinternal::control< C, R >control< C, R >::subs_tistype_list< R >control< C, R... >::rule_tisinternal::control< C, internal::seq< R... > >control< C, R... >::subs_tistype_list< internal::seq< R... > >
disable< R... >
- Equivalent to
seq< R... >, but: - Disables actions while parsing
R..., i.e. - calls
R...withapply_mode::disabled. - Meta data and implementation mapping:
disable<>::rule_tisinternal::successdisable< R >::rule_tisinternal::disable< R >disable< R >::subs_tistype_list< R >disable< R... >::rule_tisinternal::disable< internal::seq< R... > >disable< R... >::subs_tistype_list< internal::seq< R... > >
enable< R... >
- Equivalent to
seq< R... >, but: - Enables actions while parsing
R..., i.e. - calls
R...withapply_mode::enabled. - Meta data and implementation mapping:
enable<>::rule_tisinternal::successenable< R >::rule_tisinternal::enable< R >enable< R >::subs_tistype_list< R >enable< R... >::rule_tisinternal::enable< internal::seq< R... > >enable< R... >::subs_tistype_list< internal::seq< R... > >
state< S, R... >
- Equivalent to
seq< R... >, but: - Replaces all state arguments with a new instance
sof typeS. sis constructed with the input and all previous states as arguments, orsis default constructed ifShas no constructor for the above clause.- If
R...succeeds thens.success()is called with the input (after the match) and all previous states as arguments. - Meta data and implementation mapping:
state< S >::rule_tisinternal::successstate< S, R >::rule_tisinternal::state< S, R >state< S, R >::subs_tistype_list< R >state< S, R... >::rule_tisinternal::state< S, internal::seq< R... > >state< S, R... >::subs_tistype_list< internal::seq< R... > >
Exceptional
These rules throw and/or catch exceptions and are only available when compiling with exception support.
These rules are in namespace tao::pegtl.
if_must< R, S... >
- Attempts to match
Rand depending on the result proceeds with eithermust< S... >orfailure. - Equivalent to
seq< R, must< S... > >. - Equivalent to
if_then_else< R, must< S... >, failure >. - Meta data and implementation mapping:
if_must< R >::rule_tisinternal::if_must< false, R >if_must< R >::subs_tistype_list< R >if_must< R, S... >::rule_tisinternal::if_must< false, R, S... >if_must< R, S... >::subs_tistype_list< R, internal::must< S... > >
Note that the false template parameter to internal::if_must corresponds to the failure in the equivalent description using if_then_else.
if_must_else< R, S, T >
- Attempts to match
Rand depending on the result proceeds with eithermust< S >ormust< T >. - Equivalent to
if_then_else< R, must< S >, must< T > >. - Meta data and implementation mapping:
if_must_else< R, S, T >::rule_tisinternal::if_then_else< R, internal::must< S >, internal::must< T > >if_must_else< R, S, T >::subs_tistype_list< R, internal::must< S >, internal::must< T > >
list_must< R, S >
- Matches a non-empty list of
Rseparated byS. - Similar to
list< R, S >, but if there is anSit must be followed by anR. - Equivalent to
seq< R, star< if_must< S, R > > >. - Meta data and implementation mapping:
list_must< R, S >::rule_tisinternal::seq< R, internal::star< S, internal::must< R > > >list_must< R, S >::subs_tistype_list< R, internal::star< S, internal::must< R > > >
list_must< R, S, P >
- Matches a non-empty list of
Rseparated bySwhere eachScan be padded byP. - Similar to
list< R, S, P >, but if there is anSit must be followed by anR. - Equivalent to
seq< R, star< if_must< pad< S, P >, R > > >. - Meta data and implementation mapping:
list_must< R, S, P >::rule_tisinternal::seq< R, internal::star< internal::pad< S, P >, internal::must< R > > >list_must< R, S, P >::subs_tistype_list< R, internal::star< internal::pad< S, P >, internal::must< R > > >
must< R... >
- Equivalent to
seq< R... >, but: - Converts local failure of
R...into global failure. - Calls
raise< R >for theRthat failed. - Equivalent to
seq< sor< R, raise< R > >... >. - Meta data and implementation mapping:
must<>::rule_tisinternal::successmust< R >::rule_tisinternal::must< R >must< R >::subs_tistype_list< R >must< R... >::rule_tisinternal::seq< internal::must< R >... >::rule_tmust< R... >::subs_tistype_list< internal::must< R >... >
Note that must uses a different pattern to handle multiple sub-rules compared to the other seq-equivalent rules (which use rule< seq< R... > > rather than seq< rule< R >... >).
opt_must< R, S... >
- Equivalent to
opt< if_must< R, S... > >. - Equivalent to
if_then_else< R, must< S... >, success >. - Meta data and implementation mapping:
opt_must< R >::rule_tisinternal::if_must< true, R >opt_must< R >::subs_tistype_list< R >opt_must< R, S... >::rule_tisinternal::if_must< true, R, S... >opt_must< R, S... >::subs_tistype_list< R, internal::must< S... > >
Note that the true template parameter to internal::if_must corresponds to the success in the equivalent description using if_then_else.
raise< T >
- Generates a global failure.
- Calls the control-class'
Control< T >::raise()static member function. Tcan be a rule, but it does not have to be a rule.- Does not consume input.
- Meta data and implementation mapping:
raise< T >::rule_tisinternal::raise< T >
raise_message< C... >
- Generates a global failure with the message given by
C.... - Calls the control-class'
Control< raise_message< C... > >::raise()static member function. - Does not consume input.
- Meta data and implementation mapping:
raise_message< C... >::rule_tisinternal::raise< raise_message< C... > >
star_must< R, S... >
- Equivalent to
star< if_must< R, S... > >. - Meta data and implementation mapping:
star_must< R >::rule_tisinternal::star< internal::if_must< false, R > >star_must< R >::subs_tistype_list< internal::if_must< false, R > >star_must< R, S... >::rule_tisinternal::star< internal::if_must< false, R, S... > >star_must< R, S... >::subs_tistype_list< internal::if_must< false, R, S... > >
try_catch_any_raise_nested< R... >
- Equivalent to
seq< R... >, but: - Catches exceptions of any type via
catch( ... )and: - Throws a new exception with the caught one as nested exception.
- Throws via
Control< R >::raise_nested()whenR...is a single rule. - Throws via
Control< internal::seq< R... > >::raise_nested()whenR...is more than one rule. - Meta data and implementation mapping:
try_catch_any_raise_nested<>::rule_tisinternal::successtry_catch_any_raise_nested< R >::rule_tisinternal::try_catch_raise_nested< void, R >try_catch_any_raise_nested< R >::subs_tistype_list< R >try_catch_any_raise_nested< R... >::rule_tisinternal::try_catch_raise_nested< void, internal::seq< R... > >try_catch_any_raise_nested< R... >::subs_tistype_list< internal::seq< R... > >
try_catch_any_return_false< R... >
- Equivalent to
seq< R... >, but: - Catches exceptions of any type via
catch( ... ), and: - Converts the global failure (exception) into a local failure (return value
false). - Meta data and implementation mapping:
try_catch_any_return_false<>::rule_tisinternal::successtry_catch_any_return_false< R >::rule_tisinternal::try_catch_return_false< void, R >try_catch_any_return_false< R >::subs_tistype_list< R >try_catch_any_return_false< R... >::rule_tisinternal::try_catch_return_false< void, internal::seq< R... > >try_catch_any_return_false< R... >::subs_tistype_list< internal::seq< R... > >
try_catch_raise_nested< R... >
- Equivalent to
seq< R... >, but: - Catches exceptions of type
tao::pegtl::parse_error_base(or derived), and: - Throws a new exception with the caught one as nested exception.
- Throws via
Control< R >::raise_nested()whenR...is a single rule. - Throws via
Control< internal::seq< R... > >::raise_nested()whenR...is more than one rule. - Meta data and implementation mapping:
try_catch_raise_nested<>::rule_tisinternal::successtry_catch_raise_nested< R >::rule_tisinternal::try_catch_raise_nested< parse_error_base, R >try_catch_raise_nested< R >::subs_tistype_list< R >try_catch_raise_nested< R... >::rule_tisinternal::try_catch_raise_nested< parse_error_base, internal::seq< R... > >try_catch_raise_nested< R... >::subs_tistype_list< internal::seq< R... > >
try_catch_return_false< R... >
- Equivalent to
seq< R... >, but: - Catches exceptions of type
tao::pegtl::parse_error_base(or derived), and: - Converts the global failure (exception) into a local failure (return value
false). - Meta data and implementation mapping:
try_catch_return_false<>::rule_tisinternal::successtry_catch_return_false< R >::rule_tisinternal::try_catch_return_false< parse_error_base, R >try_catch_return_false< R >::subs_tistype_list< R >try_catch_return_false< R... >::rule_tisinternal::try_catch_return_false< parse_error_base, internal::seq< R... > >try_catch_return_false< R... >::subs_tistype_list< internal::seq< R... > >
try_catch_std_raise_nested< R... >
- Equivalent to
seq< R... >, but: - Catches exceptions of type
std::exception(or derived), and: - Throws a new exception with the caught one as nested exception.
- Throws via
Control< R >::raise_nested()whenR...is a single rule. - Throws via
Control< internal::seq< R... > >::raise_nested()whenR...is more than one rule. - Meta data and implementation mapping:
try_catch_std_raise_nested<>::rule_tisinternal::successtry_catch_std_raise_nested< R >::rule_tisinternal::try_catch_raise_nested< std::exception, R >try_catch_std_raise_nested< R >::subs_tistype_list< R >try_catch_std_raise_nested< R... >::rule_tisinternal::try_catch_raise_nested< std::exception, internal::seq< R... > >try_catch_std_raise_nested< R... >::subs_tistype_list< internal::seq< R... > >
try_catch_std_return_false< R... >
- Equivalent to
seq< R... >, but: - Catches exceptions of type
std::exception(or derived), and: - Converts the global failure (exception) into a local failure (return value
false). - Meta data and implementation mapping:
try_catch_std_return_false<>::rule_tisinternal::successtry_catch_std_return_false< R >::rule_tisinternal::try_catch_return_false< std::exception, R >try_catch_std_return_false< R >::subs_tistype_list< R >try_catch_std_return_false< R... >::rule_tisinternal::try_catch_return_false< std::exception, internal::seq< R... > >try_catch_std_return_false< R... >::subs_tistype_list< internal::seq< R... > >
try_catch_type_raise_nested< E, R... >
- Equivalent to
seq< R... >, but: - Catches exceptions of type
E(or derived), and: - Throws a new exception with the caught one as nested exception.
- Throws via
Control< R >::raise_nested()whenR...is a single rule. - Throws via
Control< internal::seq< R... > >::raise_nested()whenR...is more than one rule. - Meta data and implementation mapping:
try_catch_type_raise_nested< E >::rule_tisinternal::successtry_catch_type_raise_nested< E, R >::rule_tisinternal::try_catch_raise_nested< E, R >try_catch_type_raise_nested< E, R >::subs_tistype_list< R >try_catch_type_raise_nested< E, R... >::rule_tisinternal::try_catch_raise_nested< E, internal::seq< R... > >try_catch_type_raise_nested< E, R... >::subs_tistype_list< internal::seq< R... > >
try_catch_type_return_false< E, R... >
- Equivalent to
seq< R... >, but: - Catches exceptions of type
E(or derived), and: - Converts the global failure (exception) into a local failure (return value
false). - Meta data and implementation mapping:
try_catch_type_return_false< E >::rule_tisinternal::successtry_catch_type_return_false< E, R >::rule_tisinternal::try_catch_return_false< E, R >try_catch_type_return_false< E, R >::subs_tistype_list< R >try_catch_type_return_false< E, R... >::rule_tisinternal::try_catch_return_false< E, internal::seq< R... > >try_catch_type_return_false< E, R... >::subs_tistype_list< internal::seq< R... > >
TAO_PEGTL_RAISE_MESSAGE( "..." )
- Macro where
TAO_PEGTL_RAISE_MESSAGE( "foo" )yieldsraise_message< 'f', 'o', 'o' >. - The argument must be a string literal.
- Works for strings up to 512 bytes of length (excluding trailing
'\0').
Compatibility
These rules replicate the intrusive way action invocations were part of the grammar in the PEGTL 0.x.
The actions for these rules are classes, rather than the class templates required by parse() and action<>.
These rules respect the current apply_mode, but do not use the Control class to invoke the actions.
These rules are in namespace tao::pegtl.
apply< A... >
- Calls
A::apply()for allA, in order, with an empty input and all states as arguments. - If any
A::apply()has a boolean return type and returnsfalse, no furtherA::apply()calls are made and theapply< A... >rule returnsfalse, otherwise: - Equivalent to
successwith respect to parsing. - Meta data and implementation mapping:
apply< A... >::rule_tisinternal::apply< A... >
apply0< A... >
- Calls
A::apply0()for allA, in order, with all states as arguments. - If any
A::apply0()has a boolean return type and returnsfalse, no furtherA::apply0()calls are made and theapply0< A... >rule returnsfalse, otherwise: - Equivalent to
successwith respect to parsing. - Meta data and implementation mapping:
apply0< A... >::rule_tisinternal::apply0< A... >
if_apply< R, A... >
- Equivalent to
seq< R, apply< A... > >with respect to parsing, but also: - If
Rmatches, callsA::apply(), for allA, in order, with the input matched byRand all states as arguments. - If any
A::apply()has a boolean return type and returnsfalse, no furtherA::apply()calls are made, theif_apply< R, A... >returnsfalse, and if therewind_modeisrequiredthe input is rewound. - Meta data and implementation mapping:
if_apply< R, A... >::rule_tisinternal::if_apply< R, A... >if_apply< R, A... >::subs_tistype_list< R >
ICU Support
These rules depend on the International Components for Unicode (ICU) that provide the means to match specific Unicode character properties.
Because of this external library dependency the ICU rules are not automatically included with tao/pegtl.hpp.
The convenience ICU rules are supplied for all properties found in ICU version 3.4. Users of later versions can use the basic rules manually or create their own convenience rules derived from the basic rules for additional enumeration values found in those later versions of the ICU library.
Just as the other Unicode rules, the ICU-based rules are available in multiple versions,
- in namespace
tao::pegtl::utf8::icufor UTF-8 encoded inputs, - in namespace alias
tao::pegtl::utf16::icufor native-endian UTF-16 inputs, - in namespace alias
tao::pegtl::utf32::icufor native-endian UTF-32 inputs. - in namespace
tao::pegtl::utf16_be::icufor big-endian UTF-16 encoded inputs, - in namespace
tao::pegtl::utf16_le::icufor little-endian UTF-16 encoded inputs, - in namespace
tao::pegtl::utf32_be::icufor big-endian UTF-32 encoded inputs, - in namespace
tao::pegtl::utf32_le::icufor little-endian UTF-32 encoded inputs.
To use these rules it is necessary to provide an include path to the ICU library, to link the application against libicu, and to manually include the following header files as required.
tao/pegtl/unicode/icu8.hpptao/pegtl/unicode/icu16.hpptao/pegtl/unicode/icu32.hpp
Basic ICU Rules
Each of the above namespaces provides two basic rules for matching binary properties and property value matching for enum properties.
binary_property< P, V >
Pis a binary property defined by ICU, seeUProperty.Vis a boolean value.- Succeeds when the input is not empty, and:
- The next N input objects encode a valid Unicode code point, and:
- The code point's property
P, i.e.u_hasBinaryProperty( cp, P ), equalsV. - Consumes the N input objects on success.
binary_property< P >
- Identical to
binary_property< P, true >.
property_value< P, V >
Pis an enumerated property defined by ICU, seeUProperty.Vis an integer value.- Succeeds when the input is not empty, and:
- The next N input objects encode a valid Unicode code point, and:
- The code point's property
P, i.e.u_getIntPropertyValue( cp, P ), equalsV. - Consumes the N input objects on success.
ICU Rules for Binary Properties
Convenience wrappers for binary properties.
alphabetic
- Equivalent to
binary_property< UCHAR_ALPHABETIC >.
ascii_hex_digit
- Equivalent to
binary_property< UCHAR_ASCII_HEX_DIGIT >.
bidi_control
- Equivalent to
binary_property< UCHAR_BIDI_CONTROL >.
bidi_mirrored
- Equivalent to
binary_property< UCHAR_BIDI_MIRRORED >.
case_sensitive
- Equivalent to
binary_property< UCHAR_CASE_SENSITIVE >.
dash
- Equivalent to
binary_property< UCHAR_DASH >.
default_ignorable_code_point
- Equivalent to
binary_property< UCHAR_DEFAULT_IGNORABLE_CODE_POINT >.
deprecated
- Equivalent to
binary_property< UCHAR_DEPRECATED >.
diacritic
- Equivalent to
binary_property< UCHAR_DIACRITIC >.
extender
- Equivalent to
binary_property< UCHAR_EXTENDER >.
full_composition_exclusion
- Equivalent to
binary_property< UCHAR_FULL_COMPOSITION_EXCLUSION >.
grapheme_base
- Equivalent to
binary_property< UCHAR_GRAPHEME_BASE >.
grapheme_extend
- Equivalent to
binary_property< UCHAR_GRAPHEME_EXTEND >.
grapheme_link
- Equivalent to
binary_property< UCHAR_GRAPHEME_LINK >.
hex_digit
- Equivalent to
binary_property< UCHAR_HEX_DIGIT >.
hyphen
- Equivalent to
binary_property< UCHAR_HYPHEN >.
id_continue
- Equivalent to
binary_property< UCHAR_ID_CONTINUE >.
id_start
- Equivalent to
binary_property< UCHAR_ID_START >.
ideographic
- Equivalent to
binary_property< UCHAR_IDEOGRAPHIC >.
ids_binary_operator
- Equivalent to
binary_property< UCHAR_IDS_BINARY_OPERATOR >.
ids_trinary_operator
- Equivalent to
binary_property< UCHAR_IDS_TRINARY_OPERATOR >.
join_control
- Equivalent to
binary_property< UCHAR_JOIN_CONTROL >.
logical_order_exception
- Equivalent to
binary_property< UCHAR_LOGICAL_ORDER_EXCEPTION >.
lowercase
- Equivalent to
binary_property< UCHAR_LOWERCASE >.
math
- Equivalent to
binary_property< UCHAR_MATH >.
nfc_inert
- Equivalent to
binary_property< UCHAR_NFC_INERT >.
nfd_inert
- Equivalent to
binary_property< UCHAR_NFD_INERT >.
nfkc_inert
- Equivalent to
binary_property< UCHAR_NFKC_INERT >.
nfkd_inert
- Equivalent to
binary_property< UCHAR_NFKD_INERT >.
noncharacter_code_point
- Equivalent to
binary_property< UCHAR_NONCHARACTER_CODE_POINT >.
pattern_syntax
- Equivalent to
binary_property< UCHAR_PATTERN_SYNTAX >.
pattern_white_space
- Equivalent to
binary_property< UCHAR_PATTERN_WHITE_SPACE >.
posix_alnum
- Equivalent to
binary_property< UCHAR_POSIX_ALNUM >.
posix_blank
- Equivalent to
binary_property< UCHAR_POSIX_BLANK >.
posix_graph
- Equivalent to
binary_property< UCHAR_POSIX_GRAPH >.
posix_print
- Equivalent to
binary_property< UCHAR_POSIX_PRINT >.
posix_xdigit
- Equivalent to
binary_property< UCHAR_POSIX_XDIGIT >.
quotation_mark
- Equivalent to
binary_property< UCHAR_QUOTATION_MARK >.
radical
- Equivalent to
binary_property< UCHAR_RADICAL >.
s_term
- Equivalent to
binary_property< UCHAR_S_TERM >.
segment_starter
- Equivalent to
binary_property< UCHAR_SEGMENT_STARTER >.
soft_dotted
- Equivalent to
binary_property< UCHAR_SOFT_DOTTED >.
terminal_punctuation
- Equivalent to
binary_property< UCHAR_TERMINAL_PUNCTUATION >.
unified_ideograph
- Equivalent to
binary_property< UCHAR_UNIFIED_IDEOGRAPH >.
uppercase
- Equivalent to
binary_property< UCHAR_UPPERCASE >.
variation_selector
- Equivalent to
binary_property< UCHAR_VARIATION_SELECTOR >.
white_space
- Equivalent to
binary_property< UCHAR_WHITE_SPACE >.
xid_continue
- Equivalent to
binary_property< UCHAR_XID_CONTINUE >.
xid_start
- Equivalent to
binary_property< UCHAR_XID_START >.
ICU Rules for Enumerated Properties
Convenience wrappers for enumerated properties.
bidi_class< V >
Vis of typeUCharDirection.- Equivalent to
property_value< UCHAR_BIDI_CLASS, V >.
block< V >
Vis of typeUBlockCode.- Equivalent to
property_value< UCHAR_BLOCK, V >.
decomposition_type< V >
Vis of typeUDecompositionType.- Equivalent to
property_value< UCHAR_DECOMPOSITION_TYPE, V >.
east_asian_width< V >
Vis of typeUEastAsianWidth.- Equivalent to
property_value< UCHAR_EAST_ASIAN_WIDTH, V >.
general_category< V >
Vis of typeUCharCategory.- Equivalent to
property_value< UCHAR_GENERAL_CATEGORY, V >.
grapheme_cluster_break< V >
Vis of typeUGraphemeClusterBreak.- Equivalent to
property_value< UCHAR_GRAPHEME_CLUSTER_BREAK, V >.
hangul_syllable_type< V >
Vis of typeUHangulSyllableType.- Equivalent to
property_value< UCHAR_HANGUL_SYLLABLE_TYPE, V >.
joining_group< V >
Vis of typeUJoiningGroup.- Equivalent to
property_value< UCHAR_JOINING_GROUP, V >.
joining_type< V >
Vis of typeUJoiningType.- Equivalent to
property_value< UCHAR_JOINING_TYPE, V >.
line_break< V >
Vis of typeULineBreak.- Equivalent to
property_value< UCHAR_LINE_BREAK, V >.
numeric_type< V >
Vis of typeUNumericType.- Equivalent to
property_value< UCHAR_NUMERIC_TYPE, V >.
sentence_break< V >
Vis of typeUSentenceBreak.- Equivalent to
property_value< UCHAR_SENTENCE_BREAK, V >.
word_break< V >
Vis of typeUWordBreakValues.- Equivalent to
property_value< UCHAR_WORD_BREAK, V >.
ICU Rules for Value Properties
Convenience wrappers for enumerated properties that return a value instead of an actual enum.
canonical_combining_class< V >
Vis of typestd::uint8_t.- Equivalent to
property_value< UCHAR_CANONICAL_COMBINING_CLASS, V >.
lead_canonical_combining_class< V >
Vis of typestd::uint8_t.- Equivalent to
property_value< UCHAR_LEAD_CANONICAL_COMBINING_CLASS, V >.
trail_canonical_combining_class< V >
Vis of typestd::uint8_t.- Equivalent to
property_value< UCHAR_TRAIL_CANONICAL_COMBINING_CLASS, V >.
Index
action< A, R... >(controlling)aistring< P, C... >(ascii)alnum(ascii)alpha(ascii)alphabetic(icu rules)any(ascii)any(unicode)any(binary)any7(ascii)apply< A... >(compat)apply0< A... >(compat)ascii_hex_digit(icu rules)astring< P, C... >(ascii)at< R... >(combinators)bidi_class< V >(icu rules)bidi_control(icu rules)bidi_mirrored(icu rules)binary_property< P >(icu rules)binary_property< P, V >(icu rules)bdigit(ascii)blank(ascii)block< V >(icu rules)bof(atomic)bol(atomic)bom(unicode)canonical_combining_class< V >(icu rules)case_sensitive(icu rules)cntrl(ascii)consume< Num >(atomic)control< C, R... >(controlling)cr(ascii)cr(unicode)cr_crlf(ascii)cr_crlf(unicode)cr_lf(ascii)cr_lf(unicode)cr_lf_crlf(ascii)cr_lf_crlf(unicode)crlf(ascii)crlf(unicode)dash(icu rules)decomposition_type< V >(icu rules)default_ignorable_code_point(icu rules)deprecated(icu rules)diacritic(icu rules)digit(ascii)disable< R... >(controlling)east_asian_width< V >(icu rules)enable< R... >(controlling)eof(atomic)eol(atomic)eol1(unicode)eolf(atomic)eolu(unicode)esc(ascii)everything(atomic)extender(icu rules)failure(atomic)ff(ascii)full_composition_exclusion(icu rules)function< F, P = void >(atomic)function< M, F >(member)general_category< V >(icu rules)graph(ascii)grapheme_base(icu rules)grapheme_cluster_break< V >(icu rules)grapheme_extend(icu rules)grapheme_link(icu rules)hangul_syllable_type< V >(icu rules)hex_digit(icu rules)ht(ascii)hyphen(icu rules)id_continue(icu rules)id_start(icu rules)identifier_first(ascii)identifier_other(ascii)identifier(ascii)ideographic(icu rules)ids_binary_operator(icu rules)ids_trinary_operator(icu rules)if_apply< R, A... >(compat)if_must< R, S... >(exceptional)if_must_else< R, S, T >(exceptional)if_then_else< R, S, T >(convenience)invert< R >(atomic)ione< C... >(ascii)istring< C... >(ascii)join_control(icu rules)joining_group< V >(icu rules)joining_type< V >(icu rules)keyword< C... >(ascii)lead_canonical_combining_class< V >(icu rules)lf(ascii)lf(unicode)lf_crlf(ascii)lf_crlf(unicode)line_break< V >(icu rules)list< R, S >(convenience)list< R, S, P >(convenience)list_must< R, S >(exceptional)list_must< R, S, P >(exceptional)list_opt< R, S >(convenience)list_opt< R, S, P >(convenience)list_tail< R, S >(convenience)list_tail< R, S, P >(convenience)logical_order_exception(icu rules)lower(ascii)lowercase(icu rules)ls(unicode)many< Num >(ascii)many< Num >(unicode)many< Num >(binary)many7< Num >(ascii)mask_not_one< M, C... >(binary)mask_not_range< M, C, D >(binary)mask_one< M, C... >(binary)mask_range< M, C, D >(binary)mask_ranges< M, C1, D1, C2, D2, ... >(binary)mask_ranges< M, C1, D1, C2, D2, ..., E >(binary)mask_string< M, C... >(binary)math(icu rules)minus< M, S >(convenience)must< R... >(exceptional)nel(unicode)nested< M, R >(member)nested< R, P >(atomic)nfc_inert(icu rules)nfd_inert(icu rules)nfkc_inert(icu rules)nfkd_inert(icu rules)noncharacter_code_point(icu rules)not_at< R... >(combinators)not_ione< C... >(ascii)not_one< C... >(ascii)not_one< C... >(unicode)not_one< C... >(binary)not_one< M, U... >(member)not_one7< C... >(ascii)not_range< C, D >(ascii)not_range< C, D >(unicode)not_range< C, D >(binary)not_range< M, U, V >(member)not_range7< C, D >(ascii)not_ranges< C1, D1, C2, D2, ... >(ascii)not_ranges< C1, D1, C2, D2, ... >(unicode)not_ranges< C1, D1, C2, D2, ... >(binary)not_ranges< M, U1, V1, U2, V2, ... >(member)not_ranges< C1, D1, C2, D2, ..., E >(ascii)not_ranges< C1, D1, C2, D2, ..., E >(unicode)not_ranges< C1, D1, C2, D2, ..., E >(binary)not_ranges< M, U1, V1, U2, V2, ..., W >(member)nul(ascii)numeric_type< V >(icu rules)one< C... >(ascii)one< C... >(unicode)one< C... >(binary)one< M, U... >(member)opt< R... >(combinators)opt_must< R, S...>(exceptional)pad< R, S, T = S >(convenience)pad_opt< R, P >(convenience)partial< R... >(convenience)pattern_syntax(icu rules)pattern_white_space(icu rules)plus< R... >(combinators)posix_alnum(icu rules)posix_blank(icu rules)posix_graph(icu rules)posix_print(icu rules)posix_xdigit(icu rules)print(ascii)property_value< P, V >(icu rules)ps(unicode)quotation_mark(icu rules)radical(icu rules)raise< T >(exceptional)raise_message< C... >(exceptional)range< C, D >(ascii)range< C, D >(unicode)range< C, D >(binary)range< M, U, V >(member)ranges< C1, D1, C2, D2, ... >(ascii)ranges< C1, D1, C2, D2, ... >(unicode)ranges< C1, D1, C2, D2, ... >(binary)ranges< M, U1, V1, U2, V2, ... >(member)ranges< C1, D1, C2, D2, ..., E >(ascii)ranges< C1, D1, C2, D2, ..., E >(unicode)ranges< C1, D1, C2, D2, ..., E >(binary)ranges< M, U1, V1, U2, V2, ..., W >(member)rematch< R, S... >(convenience)rep< Num, R... >(convenience)rep_max< Max, R... >(convenience)rep_min< Min, R... >(convenience)rep_min_max< Min, Max, R... >(convenience)rep_opt< Num, R... >(convenience)restart(atomic)s_term(icu rules)segment_starter(icu rules)sentence_break< V >(icu rules)separated< S, R... >(convenience)separated_pad< S, P, R... >(convenience)seq< R... >(combinators)shebang(ascii)soft_dotted(icu rules)sor< R... >(combinators)source< R >(atomic)sp(ascii)space(ascii)star< R... >(combinators)star_must< R, S... >(exceptional)star_partial< R... >(convenience)star_strict< R... >(convenience)state< S, R... >(controlling)strict< R... >(convenience)string< C... >(ascii)string< C... >(unicode)string< C... >(binary)string< M, U... >(member)success(atomic)TAO_PEGTL_ISTRING( "..." )(ascii)TAO_PEGTL_KEYWORD( "..." )(ascii)TAO_PEGTL_RAISE_MESSAGE( "..." )(exceptional)TAO_PEGTL_STRING( "..." )(ascii)terminal_punctuation(icu rules)three< C >(ascii)trail_canonical_combining_class< V >(icu rules)try_catch_any_raise_nested< R... >(exceptional)try_catch_any_return_false< R... >(exceptional)try_catch_raise_nested< R... >(exceptional)try_catch_return_false< R... >(exceptional)try_catch_std_raise_nested< R... >(exceptional)try_catch_std_return_false< R... >(exceptional)try_catch_type_raise_nested< E, R... >(exceptional)try_catch_type_return_false< E, R... >(exceptional)two< C >(ascii)unified_ideograph(icu rules)unordered< R... >(convenience)unordered_partial< R... >(convenience)until< R >(convenience)until< R, S... >(convenience)upper(ascii)uppercase(icu rules)variation_selector(icu rules)vt(ascii)white_space(icu rules)word_break< V >(icu rules)xdigit(ascii)xid_continue(icu rules)xid_start(icu rules)
This page is part of the PEGTL and its documentation.
Copyright (c) 2014-2026 Dr. Colin Hirsch and Daniel Frey
Distributed under the Boost Software License, Version 1.0
See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt