API reference
Parsing functions
These functions are intended as the main entry points to parsing something
with a grammar defined with the Parser combinators. All parsing functions
can also be directly imported from the bite
package.
|
Parse an in-memory bytes object. |
|
Parse bytes from an asynchronous stream incrementally. |
Parser combinators
These classes can be combined to create the desired parser for a given grammar.
All parser combinators can also be directly imported from the bite
package.
Parsing concrete bytes
Parses a case-insensitive sequence of bytes. |
|
Parses a single byte from a given set. |
|
Parses a fixed number of bytes. |
|
Parses an exact sequence of bytes. |
Combining parsers
Parser instances can also be combined with the following operators:
+
(And
): Apply parsers in sequence.
|
(MatchFirst
): Apply the first parser that succeeds parsing the input.
~
(Not
): Negative look-ahead.
Apply multiple parsers in sequence. |
|
Combine parse tree leaves into a single node. |
|
Forward declaration allowing the definition of recursive rules. |
|
Apply the first parser that succeeds parsing the input. |
|
Negative look-ahead. |
Repetition of parsers
Repetition of a parser instance can also be declared with indexing/bracket
notation as parser[x, y]
. `` x`` must be a non-negative integer. y
must
be either a positive integer or the ellipsis ...
to allow for unlimited
repetitions.
Read a count and create a parser from it. |
|
Require a parser to apply one or more times. |
|
Make a parser optional. |
|
Apply a parser repeatedly. |
|
Require a parser to apply zero or more times. |
Transforming parsed values
Group the values of a resulting parse tree node into a tuple. |
|
Suppresses a parse tree from the values. |
|
Transform a resulting parse tree node to produce different values. |
|
Transform parsed values. |
Parse tree nodes
These classes define the structure of the parse tree returned from a parser.
The general protocol of these classes is given by parsers.ParsedNode
.
Besides the fundamental class listed here, many parsers define their
specialized implemenations.
A leaf node in a parse tree. |
|
A leaf node in a parse tree representing a zero-length segment. |
|
A single node in a parse tree. |
Module reference
- bite.io module
- bite.parse_functions module
- bite.parsers module
ParseError
TrailingBytesError
UnmetExpectationError
And
CaselessLiteral
CharacterSet
Combine
Counted
CountedParseTree
FixedByteCount
Forward
Literal
MatchFirst
Not
OneOrMore
Opt
ParsedBaseNode
ParsedCounted
ParsedLeaf
ParsedList
ParsedMatchFirst
ParsedNil
ParsedNode
ParsedOneOrMore
ParsedOpt
ParsedRepeat
ParsedZeroOrMore
Parser
Repeat
ZeroOrMore
- bite.tests module
- bite.transformers module