Exception thrown when parsing a text markup document or fragment fails.
Reader implementation that keeps the current nest level in case of recursive parsing of block-level elements.
Provides additional combinator methods to parsers via implicit conversion.
API for specifying further constraints on the parsers provided by this base trait.
Retrieves the block directive with the specified name.
Retrieves the block directive with the specified name.
See laika.parse.rst.Directives for details on how to implement directives.
Retrieves the span directive with the specified name.
Retrieves the span directive with the specified name.
See laika.parse.rst.Directives for details on how to implement directives.
Retrieves the text role with the specified name.
Retrieves the text role with the specified name.
See laika.parse.rst.TextRoles for details on how to implement text roles.
Consumes any kind of input, always succeeds.
Consumes any kind of input, always succeeds.
This parser would consume the entire input unless a max
constraint
is specified.
Consumes any number of consecutive characters that are not one of the specified characters.
Consumes any number of consecutive characters that are not one of the specified characters. Always succeeds unless a minimum number of required matches is specified.
Consumes any number of consecutive characters that are in one of the specified character ranges.
Consumes any number of consecutive characters that are in one of the specified character ranges. Always succeeds unless a minimum number of required matches is specified.
Consumes any number of consecutive occurrences of the specified characters.
Consumes any number of consecutive occurrences of the specified characters. Always succeeds unless a minimum number of required matches is specified.
Consumes any number of characters for which the specified parser fails on the corresponding offset.
Consumes any number of characters for which the specified parser fails on the corresponding offset.
This parser fails if the end of input is reached without the specified parser ever succeeding or
if the parser causes an Error result instead of a plain Failure or Success.
Further constraints like minimum or maximum number of required matching characters can be specified
through the API of the returned TextParser
instance.
Consumes any number of consecutive characters that are not one of the specified characters.
Consumes any number of consecutive characters that are not one of the specified characters.
This parser is identical to the anyBut
parser except for two differences: this parser fails
if it reaches the end of the input without seeing any of the specified
characters and it also consumes this final character, without adding it
to the result. This parser is usually used when a construct like a span
enclosed between two characters needs to be parsed.
Consumes any number of consecutive characters which satisfy the specified predicate.
Consumes any number of consecutive characters which satisfy the specified predicate. Always succeeds unless a minimum number of required matches is specified.
Succeeds at the start of the input.
Succeeds at the start of the input.
Parses a blank line from the current input offset (which may not be at the start of the line).
Parses a blank line from the current input offset (which may not be at the start of the line). Fails for lines that contain any non-whitespace character. Does always produce an empty string as the result, discarding any whitespace characters found in the line.
Since it also succeeds at the end of the input
it should never be used in the form of (blankLine *)
or (blankLine +)
. Use
the blankLines
parser instead in these cases.
Parses one or more blanklines, producing a list of empty strings corresponding to the number of blank lines consumed.
Parses one or more blanklines, producing a list of empty strings corresponding to the number of blank lines consumed.
Parses a full block based on the specified helper parsers.
Parses a full block based on the specified helper parsers.
parser that recognizes the start of the first line of this block
parser that recognizes the start of subsequent lines that still belong to the same block
parser that recognizes whether a line after one or more blank lines still belongs to the same block
Parses a block-level directive.
Parses a block-level directive.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#directives.
Builds a parser for a list of blocks based on the parser for a single block.
Builds a parser for a list of blocks based on the parser for a single block.
Overridden to add the processing required for cases where a block has influence on the parsing or processing of the subsequent block.
This includes checking each Paragraph for a double colon ending which turns the following block into a literal block as well as processing internal link targets and section headers.
the parser for a single block element
a parser for a list of blocks
Parses a block quote with an optional attribution.
Parses a block quote with an optional attribution.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#block-quotes
Parses a bullet list with any of the supported bullet characters.
Parses a bullet list with any of the supported bullet characters.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#bullet-lists.
Implicit conversion that allows to pass a single
character to the range-based anyIn
parser.
Implicit conversion that allows to pass a single
character to the range-based anyIn
parser.
Parses a citation.
Parses a citation.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#citations.
Parses a comment.
Parses a comment.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#comments.
Parses a definition list.
Parses a definition list.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#definition-lists.
Parses a doctest block.
Parses a doctest block. This is a feature which is very specific to the
world of Python where reStructuredText originates. Therefore the resulting
DoctestBlock
tree element is not part of the standard Laika tree model.
When this block type is used the corresponding special renderers must
be enabled (e.g. the ExtendedHTML
renderer for HTML).
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#doctest-blocks
Parses an enumerated list in any of the supported combinations of enumeration style and formatting.
Parses an enumerated list in any of the supported combinations of enumeration style and formatting.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#enumerated-lists.
Succeeds at the end of the input.
Succeeds at the end of the input.
Succeeds at the end of a line, including the end of the input.
Succeeds at the end of a line, including the end of the input. Produces an empty string as a result and consumes any new line characters.
Parses all types of explicit block items.
Parses all types of explicit block items.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#explicit-markup-blocks.
Parses a field list.
Parses a field list.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#field-lists.
Parses a footnote.
Parses a footnote.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#footnotes.
Parses a grid table.
Parses a grid table.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables.
Parses a section header with both overline and underline.
Parses a section header with both overline and underline.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#sections.
Parses a section header with an underline, but no overline.
Parses a section header with an underline, but no overline.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#sections.
Parses a full block based on the specified helper parsers, expecting an indentation for all lines except the first.
Parses a full block based on the specified helper parsers, expecting an indentation for all lines except the first. The indentation may vary between the parts of the indented block, so that this parser only cuts off the minimum indentation shared by all lines, but each line must have at least the specified minimum indentation.
the minimum indentation that each line in this block must have
parser that recognizes the start of subsequent lines that still belong to the same block
indicates whether parsing should end on the first blank line
indicates whether the first line is expected to be indented, too
the maximum indentation that will get dropped from the start of each line of the result
a parser that produces an instance of IndentedBlock
Parses a block of lines with line breaks preserved.
Parses a block of lines with line breaks preserved.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#line-blocks.
Parses a link definition, either an internal, external or indirect link.
Parses a link definition, either an internal, external or indirect link.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#hyperlink-targets.
Parses a literal block, either quoted or indented.
Parses a literal block, either quoted or indented.
Only used when the preceding block ends with a double colon (::
).
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#literal-blocks
Applies the specified parser at the specified offset behind the current position.
Applies the specified parser at the specified offset behind the current position. Never consumes any input.
The maximum level of block nesting.
The maximum level of block nesting. Some block types like lists and blockquotes contain nested blocks. To protect against malicious input or accidentally broken markup, the level of nesting is restricted.
Returns the current nest level from the specified input or 0 if it cannot be determined.
Returns the current nest level from the specified input or 0 if it cannot be determined.
The nest level is usually only used to prevent endless recursion of nested blocks.
Parses any kind of nested block supported by a concrete markup language.
Parses any kind of nested block supported by a concrete markup language.
Parses reStructuredText blocks, except for blocks that allow nesting of blocks.
Parses reStructuredText blocks, except for blocks that allow nesting of blocks. Only used in rare cases when the maximum nest level allowed had been reached
Returns an optimized, Array-based lookup function for the specified characters.
Returns an optimized, Array-based lookup function for the specified characters.
Returns an optimized, Array-based lookup function for the specified ranges of characters.
Returns an optimized, Array-based lookup function for the specified ranges of characters.
Parses an option list.
Parses an option list.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#option-lists.
Parses a single paragraph.
Parses a single paragraph. Everything between two blank lines that is not recognized as a special reStructuredText block type will be parsed as a regular paragraph.
Fully parses the input from the specified reader and returns the configuration and root element.
Fully parses the input from the specified reader and returns the configuration and root element.
Utility method to be used by custom parsers for directive argument or body.
Utility method to be used by custom parsers for directive argument or body.
It translates a Success
into a Right
and a NoSuccess
into a Left
.
Fully parses the input from the specified reader and returns the document tree.
Fully parses the input from the specified reader and returns the document tree. This function is expected to always succeed, errors would be considered a bug of this library, as the parsers treat all unknown or malformed markup as regular text.
Fully parses the input from the specified reader and returns the result.
Fully parses the input from the specified reader and returns the result. This function is expected to always succeed, errors would be considered a bug in this library, as the parsers treat all unknown or malformed markup as regular text.
Fully parses the specified input string and returns the result.
Fully parses the specified input string and returns the result. This function is expected to always succeed, errors would be considered a bug in this library, as the parsers treat all unknown or malformed markup as regular text.
Parses all nested blocks inside the specified indented block.
Parses all nested blocks inside the specified indented block.
Parses all nested blocks for the specified input and nest level.
Parses all nested blocks for the specified input and nest level.
Delegates to the abstract nestedBlock
parser that sub-traits need to define.
The nest level is primarily used as a protection against malicious
input that forces endless recursion.
the input to parse
the level of nesting with 0 being the outermost level
the parser result as a list of blocks
Parses all nested blocks for the specified input and nest level.
Parses all nested blocks for the specified input and nest level.
Delegates to the abstract nestedBlock
parser that sub-traits need to define.
The nest level is primarily used as a protection against malicious
input that forces endless recursion.
the input to parse
the level of nesting with 0 being the outermost level
the parser result as a list of blocks
Extension hook for assembling the block parsers for a particular markup format.
Extension hook for assembling the block parsers for a particular markup format.
true if these are parsers for nested blocks, false if they are for top level blocks
a list of block parsers which later will be interpreted as choices in the specified order
Parses punctuation characters as supported by transitions (rules) and overlines and underlines for header sections.
Parses punctuation characters as supported by transitions (rules) and overlines and underlines for header sections.
A parser generator for repetitions where all subsequent parsers after the first depend on the result of the previous.
A parser generator for repetitions where all subsequent parsers after the first depend on the result of the previous.
the parser to use for the first piece of input
a function that determines the next parser based on the result of the previous
(Changed in version 2.9.0) The p0
call-by-name arguments is evaluated at most once per constructed Parser object, instead of on every need that arises during parsing.
Uses the parser for at most the specified number of repetitions, always succeeds.
Uses the parser for at most the specified number of repetitions, always succeeds. The result is the list of results from applying the parser repeatedly.
Uses the parser for at least the specified number of repetitions or otherwise fails.
Uses the parser for at least the specified number of repetitions or otherwise fails. Continues to apply the parser after the minimum has been reached until if fails. The result is the list of results from applying the parser repeatedly.
Parses the rest of the line from the current input offset no matter whether it consist of whitespace only or some text.
Parses the rest of the line from the current input offset no matter whether it consist of whitespace only or some text. Does not include the eol character(s).
Parses a role directive.
Parses a role directive.
See http://docutils.sourceforge.net/docs/ref/rst/directives.html#custom-interpreted-text-roles.
Parses a full document, delegating most of the work to the topLevelBlock
parser.
Parses a full document, delegating most of the work to the topLevelBlock
parser.
Parses the short variant of an anonymous link definition
(that starts with
) instead of
.. :
Parses the short variant of an anonymous link definition
(that starts with
) instead of
.. :
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#anonymous-hyperlinks.
Parses a simple table.
Parses a simple table.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#simple-tables.
Parses a substitution definition.
Parses a substitution definition.
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#substitution-definitions.
Parses a single text line from the current input offset (which may not be at the start of the line.
Parses a single text line from the current input offset (which may not be at the start of the line. Fails for blank lines. Does not include the eol character(s).
All the base text roles supported by this parser not including any custom roles specified within document markup.
Parses any kind of top-level block supported by a concrete markup language.
Parses any kind of top-level block supported by a concrete markup language.
Parses a transition (rule).
Parses a transition (rule).
See http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#transitions.
Overrides the failure message to the specified parser.
Overrides the failure message to the specified parser.
Creates a new parser that produces a tuple containing the current nest level as well as the result from the specified parser.
Creates a new parser that produces a tuple containing the current nest level as well as the result from the specified parser.
The nest level is usually only used to prevent endless recursion of nested blocks.
Parses horizontal whitespace (space and tab).
Parses horizontal whitespace (space and tab). Always succeeds, consuming all whitespace found.
(Since version 2.10.0) lastNoSuccess was not thread-safe and will be removed in 2.11.0
(Since version 2.10.0) lastNoSuccess was not thread-safe and will be removed in 2.11.0
Provides the parsers for all types of block-level elements of reStructuredText. It merges the individual traits that provide implementations for list, tables, etc. and adds the remaining block level parsers that do not fit into any of the subcategories supported by the other traits.
Block parsers are only concerned with splitting the document into (potentially nested) blocks. They are used in the first phase of parsing, while delegating to inline parsers for the 2nd phase.