TOML Parser Utilities #
Generic parser utilities used by Lake's TOML parser.
@[inline]
ParserFn
combinator that runs f
with the current position.
Equations
- Lake.Toml.usePosFn f c s = f s.pos c s
Instances For
Match an arbitrary parser or do nothing.
Equations
Instances For
@[inline]
A sequence of n
repetitions of a parser function.
Equations
- Lake.Toml.repeatFn n p c s = Lake.Toml.repeatFn.loop p c n s
Instances For
@[specialize #[]]
Instances For
def
Lake.Toml.mkUnexpectedCharError
(s : Lean.Parser.ParserState)
(c : Char)
(expected : List String := [])
(pushMissing : Bool := true)
:
Instances For
@[inline]
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Consume a single digit (i.e., Char.isDigit
).
Instances For
Consume a two digits (i.e., Char.isDigit
).
Equations
- Lake.Toml.digitPairFn expected = Lake.Toml.digitFn expected >> Lake.Toml.digitFn expected
Instances For
def
Lake.Toml.strFn
(str : String)
(expected : List String := [toString "'" ++ toString str ++ toString "'"])
:
Consume a matching string atomically.
Equations
- Lake.Toml.strFn str expected = Lean.Parser.atomicFn (Lake.Toml.strAuxFn str expected 0)
Instances For
def
Lake.Toml.pushAtom
(startPos : String.Pos)
(trailingFn : Lean.Parser.ParserFn := Lake.Toml.skipFn)
:
Push a new atom onto the syntax stack.
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lake.Toml.atomFn
(p : Lean.Parser.ParserFn)
(trailingFn : Lean.Parser.ParserFn := Lake.Toml.skipFn)
:
Match an arbitrary ParserFn
and return the consumed String in a Syntax.atom
.
Instances For
def
Lake.Toml.atom
(p : Lean.Parser.ParserFn)
(trailingFn : Lean.Parser.ParserFn := Lake.Toml.skipFn)
:
Equations
- Lake.Toml.atom p trailingFn = { info := { collectTokens := id, collectKinds := id, firstTokens := Lean.Parser.FirstTokens.unknown }, fn := Lake.Toml.atomFn p trailingFn }
Instances For
Equations
- Lake.Toml.getInfoExprPos? (Lean.SourceInfo.synthetic pos endPos canonical) = some pos
- Lake.Toml.getInfoExprPos? x = none
Instances For
Equations
- Lake.Toml.getSyntaxExprPos? (Lean.Syntax.node info kind args) = Lake.Toml.getInfoExprPos? info
- Lake.Toml.getSyntaxExprPos? (Lean.Syntax.atom info val) = Lake.Toml.getInfoExprPos? info
- Lake.Toml.getSyntaxExprPos? (Lean.Syntax.ident info rawVal val preresolved) = Lake.Toml.getInfoExprPos? info
- Lake.Toml.getSyntaxExprPos? Lean.Syntax.missing = none
Instances For
Instances For
def
Lake.Toml.chAtom
(c : Char)
(expected : List String := [toString "'" ++ toString c ++ toString "'"])
(trailingFn : Lean.Parser.ParserFn := Lake.Toml.skipFn)
:
Parse a single character as an atom.
Instances For
def
Lake.Toml.strAtom
(s : String)
(expected : List String := [toString "'" ++ toString s ++ toString "'"])
(trailingFn : Lean.Parser.ParserFn := Lake.Toml.skipFn)
:
Parse the trimmed string as an atom (but use the full string for formatting).
Equations
- Lake.Toml.strAtom s expected trailingFn = Lake.Toml.atom (Lake.Toml.strFn s.trim expected) trailingFn
Instances For
Instances For
def
Lake.Toml.pushLit
(kind : Lean.SyntaxNodeKind)
(startPos : String.Pos)
(trailingFn : Lean.Parser.ParserFn := Lake.Toml.skipFn)
:
Push (Syntax.node kind <new-atom>)
onto the syntax stack.
Instances For
def
Lake.Toml.litFn
(kind : Lean.SyntaxNodeKind)
(p : Lean.Parser.ParserFn)
(trailingFn : Lean.Parser.ParserFn := Lake.Toml.skipFn)
:
Equations
- Lake.Toml.litFn kind p trailingFn c s = if (p c s).hasError = true then p c s else Lake.Toml.pushLit kind s.pos trailingFn c (p c s)
Instances For
def
Lake.Toml.lit
(kind : Lean.SyntaxNodeKind)
(p : Lean.Parser.ParserFn)
(trailingFn : Lean.Parser.ParserFn := Lake.Toml.skipFn)
:
Equations
- Lake.Toml.lit kind p trailingFn = { info := { collectTokens := id, collectKinds := id, firstTokens := Lean.Parser.FirstTokens.unknown }, fn := Lake.Toml.litFn kind p trailingFn }
Instances For
Equations
- Lake.Toml.lit.formatter kind x✝ x = Lean.PrettyPrinter.Formatter.visitAtom kind
Instances For
def
Lake.Toml.litWithAntiquot
(name : String)
(kind : Lean.SyntaxNodeKind)
(p : Lean.Parser.ParserFn)
(trailingFn : Lean.Parser.ParserFn := Lake.Toml.skipFn)
(anonymous : Bool := false)
:
Instances For
Equations
Instances For
Equations
Instances For
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.Toml.dynamicNode p = { info := { collectTokens := id, collectKinds := id, firstTokens := Lean.Parser.FirstTokens.unknown }, fn := p }
Instances For
Instances For
Equations
- Lake.Toml.dynamicNode.parenthesizer x = do let __do_lift ← Lean.Syntax.MonadTraverser.getCur Lean.PrettyPrinter.Parenthesizer.parenthesizerForKind __do_lift.getKind
Instances For
@[reducible, inline]
Parser → Parser
hidden by an abbrev
.
Prevents the formatter/parenthesizer generator from transforming it.
Equations
Instances For
Equations
Instances For
def
Lake.Toml.recNodeWithAntiquot
(name : String)
(kind : Lean.SyntaxNodeKind)
(f : Lake.Toml.ParserMapFn)
(anonymous : Bool := false)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Lake.Toml.recNodeWithAntiquot.go
(name : String)
(kind : Lean.SyntaxNodeKind)
(f : Lake.Toml.ParserMapFn)
(anonymous : Bool := false)
(p : Lean.Parser.Parser)
:
Equations
- Lake.Toml.recNodeWithAntiquot.go name kind f anonymous p = Lean.Parser.withCache kind (Lean.Parser.withAntiquot (Lean.Parser.mkAntiquot name kind anonymous true) (f p))
Instances For
@[inline]
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[inline]
Equations
- One or more equations did not get rendered due to their size.