Whether c may appear in the name of a footnote or a link reference. A name is written literally,
so a backslash denotes itself elsewhere and is not part of a name.
Equations
Instances For
Parses as p, but discards the result.
Equations
- Lean.Doc.Parser.ignoreFn p c s = (p c s).shrinkStack s.stxStack.size
Instances For
Consumes the whitespace that separates a block from what follows it: the rest of the current line, any blank lines, and the indentation of the line where content resumes.
Tabs are not valid whitespace characters, so they are not consumed. The next block actually throws the error.
Equations
- Lean.Doc.Parser.lineTailWsFn = Lean.Parser.takeWhileFn fun (ch : Char) => ch == ' ' || ch == '\n'
Instances For
Matches an arbitrary parser and pushes the consumed input as a Syntax.atom. The trailing parser
runs after the token's content, and the input it consumes becomes the token's trailing whitespace.
Equations
- Lean.Doc.Parser.asTokenFn p trailing c s = if (p c s).hasError = true then p c s else Lean.Doc.Parser.asTokenAux✝ trailing s.pos c ((p c s).shrinkStack s.stxStack.size)
Instances For
Ordered lists may have two styles of marker, with trailing dots or parentheses.
- numDot : OrderedListType
Items like
1. - parenAfter : OrderedListType
Items like
1)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- Lean.Doc.Parser.instBEqOrderedListType.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Unordered lists may have three markers: asterisks, dashes, or pluses.
- asterisk : UnorderedListType
Items like
* - dash : UnorderedListType
Items like
- - plus : UnorderedListType
Items like
+
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Doc.Parser.instBEqUnorderedListType.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Parses a character that's allowed as part of inline text. This resolves escaped characters and performs limited lookahead for characters that only begin a different inline as part of a sequence.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses block opener prefixes. If this parser succeeds at the beginning of a line, then a special block is beginning.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses an argument value, which may be a string, an identifier, or a numeral. The value's token
records the input consumed by trailing as its trailing whitespace.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Runs p, and on failure consumes input with recover until parsing may continue. The error is
recorded where p stopped, so that it marks the input that could not be read rather than the input
that recovery passed over.
Equations
Instances For
The whitespace after an argument, recorded on the argument's last token as its trailing whitespace: the spaces that follow it.
Instances For
Parses an argument to a role, directive, command, or code block, which may be named or positional or
a flag. The argument's final token records the input tail consumes as its trailing whitespace.
Error recovery stops at characters that satisfy closes, which should delimit the current argument
list (e.g. via a role's }).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses zero or more arguments to a role, directive, command, or code block. Each argument's final
token records the input tail consumes as its trailing whitespace. The argument list must be on
the line the parser starts on. A starting position at the beginning of a line means the list has
already ended, so the list is empty.
Error recovery stops at characters that satisfy closes, which should delimit the current argument
list (e.g. via a role's }).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses a name and zero or more arguments to a role, directive, command, or code block. The final
token of the name and of each argument records the input that tail consumes as its trailing
whitespace. The name and arguments must be on the line the parser starts on. A starting position
at the beginning of a line fails to parse a name.
The caller's own tokens record the whitespace before the name. If a caller lets this parser consume that whitespace instead, no token records it.
Error recovery stops at characters that satisfy closes, which should delimit the current argument
list (e.g. via a role's }).
Equations
- One or more equations did not get rendered due to their size.
Instances For
The context within which a newline element is parsed.
- allowNewlines : Bool
Are newlines allowed here?
How many asterisks introduced the current level of boldness?
nonemeans no bold here.How many underscores introduced the current level of emphasis?
nonemeans no emphasis here.- inLink : Bool
Are we in a link?
- tail : Parser.ParserFn
The trailing whitespace parser for the final token of a top-level inline element.
- baseColumn : Nat
The docstring's base column, which allows inline code and math to be parsed relative to the docstring's indentation.
Instances For
Equations
Parses emphasis: a matched pair of one or more _.
Parses bold: a matched pair of one or more *.
Parses inline code. The content is one versoCodeLine token per source line. Each line's token
records the docstring's indentation on the line after it as trailing whitespace, while indentation
past that column is part of the code. A space written at each end of the content to escape a
backtick or a space becomes whitespace on the token before it.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses mathematics. The content is inline code, with its lines and indentation read the same way.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reads a prefix of a line of text, stopping at a text-mode special character.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses a footnote.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses an image.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses an inline that is self-delimiting (that is, with well-defined start and stop characters).
Parses any inline element.
Parses a line of text (that is, one or more inline elements). When recordTrailing is set, each
top-level inline's final token consumes the whitespace that follows it as its trailing whitespace.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The fields of a metadata block, which are the fields of a structure instance.
Equations
Instances For
The style of a list, shared by all of its items.
- ordered (type : OrderedListType) : ListStyle
A list whose items are numbered.
- unordered (type : UnorderedListType) : ListStyle
A list whose items are bulleted.
Instances For
The context within which a block should be valid.
- topLevel : Bool
Whether blocks in this context are at the document's top level, rather than the contents of another block.
- recordTrailing : Bool
Whether each block's final token records the whitespace that follows the block as its trailing whitespace.
The block's maximal directive size (that is, the greatest number of allowed colons).
- docStartPosition : Position
The position at which the document content starts, used to allow headers on the first line of a docstring (e.g.
/-! # Header -/). With the default value⟨1, 0⟩, the beginning-of-line check is unaffected for normal documents. - baseColumn : Nat
The base column of the docstring, which is the least indentation of any non-empty line in it, including the opening and closing delimiters. Items that may not nest in blocks, such as headers, start at this column, and a code element's lines treat the indentation up to it as whitespace.
Instances For
Equations
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Computes the BlockCtxt for parsing a docstring whose opening delimiter is at openPos and whose
content begins at startPos, on the line where that content starts and separated from it by spaces
alone. endPos is the position of the - before the / in the closing delimiter.
When the docstring content starts mid-line (e.g. /-! # Header -/), the docStartPosition is set
to the position after any leading spaces so that headers on the first line are recognized. For
indented docstrings, baseColumn is computed as the minimum column among the opening delimiter, the
closing delimiter, and the least-indented non-empty content line.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses a metadata block, which contains the contents of a Lean structure initialization but is
surrounded by %%% on each side.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Succeeds when the parser is looking at an ordered list marker.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Succeeds when the parser is looking at an unordered list marker.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Sets the leading whitespace of the first token in stx to run from startPos. Syntax without
tokens stays unchanged.
Every token that a parse produces has empty leading whitespace, because the token before it records the whitespace between them. The first token of an input records the whitespace that the input starts with, and this applies it.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses an item of a list in the given style. The saved position is the first item marker's, which every marker lines up with.
Parses an item from a description list. The saved position is the first item's colon, which every item's colon lines up with.
Parses a block quote.
Parses an unordered list.
Parses an ordered list.
Parses a definition list.
Parses a paragraph (that is, a sequence of otherwise-undecorated inlines). A paragraph contains something other than whitespace, so a run of empty lines is not a paragraph.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses a header.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses a code block. Each line's token records the fence's indentation on the line after it as trailing whitespace, so the code the block denotes is what the lines' tokens contain.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses a directive.
Parses a block command.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses a link reference target.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses a footnote reference target.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses a block.
When recordTrailing is set, the block's final token consumes the whitespace that follows the
block (including the indentation of the next line), even when error recovery lost the token that
would have consumed it.
Parses zero or more blocks. Each block's final token consumes the whitespace that follows it, the
next line's indentation included, and blockSepFallback parses the whitespace after a block whose
final token was lost to error recovery.
Parses one or more blocks.
Parses a document: the whitespace it starts with, then zero or more blocks.
The document's first token records the whitespace between the position where this parser starts and that token. A caller that starts it part-way into a larger input is responsible for the whitespace before that position, which a doc comment's opening delimiter records as its trailing whitespace.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns the start and end of the range over which a Verso parse error at pos is reported, along
with the error to report. An end position of none indicates that the error has no range, but is to
be reported at a single point.
An error that includes an unexpected token is reported at that token's range. When such an error has no message of its own, as with errors from Lean's own parsers, a message is derived from the token.
Otherwise, the range starts at pos and covers the character there, or the whole run of it when a
Verso element repeats that character to make a single delimiter (e.g. *** for bold text). At the
end of the input, and at a newline, the end is none.
Whitespace before the error stays outside the range.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The syntax kinds of the nodes that documentFn produces.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parser information for Verso markup.
Listing the syntax kinds that documentFn produces ensures that we don't get spurious module
dependencies.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses as ifVerso if the option doc.verso is true, or as ifNotVerso otherwise.
Equations
Instances For
Parses as ifVerso if the option doc.verso is true, or as ifNotVerso otherwise.
Equations
- Lean.Doc.Parser.ifVerso ifVerso ifNotVerso = { info := Lean.Parser.orelseInfo ifVerso.info ifNotVerso.info, fn := Lean.Doc.Parser.ifVersoFn ifVerso.fn ifNotVerso.fn }
Instances For
Formatter for ifVerso—formats according to the underlying formatters.
Equations
- Lean.Doc.Parser.ifVerso.formatter f1 f2 = (f1 <|> f2)
Instances For
Parenthesizer for ifVerso—parenthesizes according to the underlying parenthesizers.
Equations
- Lean.Doc.Parser.ifVerso.parenthesizer p1 p2 = (p1 <|> p2)
Instances For
Parses as ifVerso if module docs should use Verso syntax, or as ifNotVerso otherwise.
Checks doc.verso.module if explicitly set, otherwise falls back to doc.verso.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parses as ifVerso if module docs should use Verso syntax, or as ifNotVerso otherwise.
Checks doc.verso.module if explicitly set, otherwise falls back to doc.verso.
Equations
- Lean.Doc.Parser.ifVersoModuleDocs ifVerso ifNotVerso = { info := Lean.Parser.orelseInfo ifVerso.info ifNotVerso.info, fn := Lean.Doc.Parser.ifVersoModuleDocsFn ifVerso.fn ifNotVerso.fn }
Instances For
Formatter for ifVersoModuleDocs—formats according to the underlying formatters.
Equations
- Lean.Doc.Parser.ifVersoModuleDocs.formatter f1 f2 = (f1 <|> f2)
Instances For
Parenthesizer for ifVersoModuleDocs—parenthesizes according to the underlying parenthesizers.
Equations
- Lean.Doc.Parser.ifVersoModuleDocs.parenthesizer p1 p2 = (p1 <|> p2)
Instances For
Disables the option doc.verso while running a parser.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Formatter for withoutVersoSyntax—formats according to the underlying formatter.
Equations
Instances For
Parenthesizer for withoutVersoSyntax—parenthesizes according to the underlying parenthesizer.