TOML Grammar #
A Lean encoding of the v1.0.0 TOML grammar (en, [abnf]]2)
using Lean.Parser
objects. The current encoding elides the use of
tokens entirely, relying purely on custom parser functions.
Trailing Functions #
Consume optional horizontal whitespace (i.e., tab or space).
Equations
- Lake.Toml.wsFn = Lean.Parser.takeWhileFn fun (c : Char) => decide (c = ' ') || decide (c = '\t')
Instances For
Consumes the LF following a CR in a CRLF newline.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Consume a newline.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Consumes the body of a comment.
Instances For
Consumes a line comment.
Equations
- Lake.Toml.commentFn = Lake.Toml.chFn '#' ["comment"] >> Lake.Toml.commentBodyFn
Instances For
Consume optional whitespace (space, tab, or newline).
Consume optional sequence of whitespace / newline(s) / comment (s).
Strings #
Consumes a TOML string escape sequence after a \
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.Toml.basicStringFn = Lake.Toml.usePosFn fun (startPos : String.Pos) => Lake.Toml.chFn '\"' ["basic string"] >> Lake.Toml.basicStringAuxFn startPos
Instances For
Equations
- Lake.Toml.literalStringFn = Lake.Toml.usePosFn fun (startPos : String.Pos) => Lake.Toml.chFn ''' ["literal string"] >> Lake.Toml.literalStringAuxFn startPos
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Numerals (Date-Times, Floats, and Integers) #
Equations
- Lake.Toml.hourMinFn = Lake.Toml.digitPairFn ["hour digit"] >> Lake.Toml.chFn ':' >> Lake.Toml.digitPairFn ["minute digit"]
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[inline]
def
Lake.Toml.timeTailFn.timeOffsetFn
(allowOffset : Bool)
(curr : Char)
(nextPos : String.Pos)
(c : Lean.Parser.ParserContext)
(s : Lean.Parser.ParserState)
:
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.Toml.timeAuxFn allowOffset = Lake.Toml.digitPairFn ["minute digit"] >> Lake.Toml.chFn ':' >> Lake.Toml.digitPairFn ["second digit"] >> Lake.Toml.timeTailFn allowOffset
Instances For
Equations
- Lake.Toml.timeFn allowOffset = Lake.Toml.digitPairFn ["hour"] >> Lake.Toml.chFn ':' >> Lake.Toml.timeAuxFn allowOffset
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.Toml.dateTimeAuxFn = Lake.Toml.digitPairFn ["month digit"] >> Lake.Toml.chFn '-' >> Lake.Toml.digitPairFn ["day digit"] >> Lake.Toml.optTimeFn
Instances For
Equations
- Lake.Toml.dateTimeFn = Lake.Toml.repeatFn 4 (Lake.Toml.digitFn ["year digit"]) >> Lake.Toml.chFn '-' >> Lake.Toml.dateTimeAuxFn
Instances For
Equations
- Lake.Toml.dateTimeLitFn = Lake.Toml.litFn `Lake.Toml.dateTime Lake.Toml.dateTimeFn
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.Toml.infAuxFn startPos = Lake.Toml.strFn "nf" ["'inf'"] >> Lake.Toml.pushLit `Lake.Toml.float startPos
Instances For
Equations
- Lake.Toml.nanAuxFn startPos = Lake.Toml.strFn "an" ["'nan'"] >> Lake.Toml.pushLit `Lake.Toml.float startPos
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parsers #
Instances For
Instances For
Equations
- Lake.Toml.unquotedKeyFn = Lake.Toml.takeWhile1Fn (fun (c : Char) => c.isAlphanum || c == '_' || c == '-') ["unquoted key"]
Instances For
Equations
- Lake.Toml.unquotedKey = Lake.Toml.litWithAntiquot "unquotedKey" `Lake.Toml.unquotedKey Lake.Toml.unquotedKeyFn
Instances For
Equations
- Lake.Toml.basicString = Lake.Toml.litWithAntiquot "basicString" `Lake.Toml.basicString Lake.Toml.basicStringFn
Instances For
Equations
- Lake.Toml.literalString = Lake.Toml.litWithAntiquot "literalString" `Lake.Toml.literalString Lake.Toml.literalStringFn
Instances For
Equations
- Lake.Toml.mlBasicString = Lake.Toml.litWithAntiquot "mlBasicString" `Lake.Toml.mlBasicString Lake.Toml.mlBasicStringFn
Instances For
Equations
- Lake.Toml.mlLiteralString = Lake.Toml.litWithAntiquot "mlLiteralString" `Lake.Toml.mlLiteralString Lake.Toml.mlLiteralStringFn
Instances For
Equations
Instances For
Equations
- Lake.Toml.simpleKey = Lean.Parser.nodeWithAntiquot "simpleKey" `Lake.Toml.simpleKey (Lake.Toml.unquotedKey <|> Lake.Toml.quotedKey) true
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- Lake.Toml.keyvalCore val = Lean.Parser.nodeWithAntiquot "keyval" `Lake.Toml.keyval (Lake.Toml.key >> Lake.Toml.trailingWs >> Lake.Toml.chAtom '=' >> Lake.Toml.trailingWs >> val) true
Instances For
Equations
- Lake.Toml.expressionCore val = Lean.Parser.withAntiquot (Lean.Parser.mkAntiquot "expression" `Lake.Toml.expression true true) (Lake.Toml.keyvalCore val <|> Lake.Toml.table)
Instances For
Equations
- Lake.Toml.header = Lake.Toml.litWithAntiquot "header" `Lake.Toml.header Lake.Toml.skipFn Lake.Toml.trailingFn
Instances For
Equations
- Lake.Toml.tomlCore val = Lean.Parser.nodeWithAntiquot "toml" `Lake.Toml.toml (Lake.Toml.header >> Lake.Toml.sepByLinebreak (Lake.Toml.expressionCore val >> Lake.Toml.trailingSep)) true
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.Toml.true = Lake.Toml.lit `Lake.Toml.true (Lake.Toml.strFn "true")
Instances For
Equations
- Lake.Toml.false = Lake.Toml.lit `Lake.Toml.false (Lake.Toml.strFn "false")
Instances For
Equations
- Lake.Toml.boolean = Lean.Parser.nodeWithAntiquot "boolean" `Lake.Toml.boolean (Lake.Toml.true <|> Lake.Toml.false)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lake.Toml.numeralOfKind name kind = Lake.Toml.numeral >> Lean.Parser.setExpected [name] (Lean.Parser.checkStackTop (fun (x : Lean.Syntax) => x.isOfKind kind) "illegal numeral kind")
Instances For
Equations
- Lake.Toml.float = Lake.Toml.numeralOfKind "float" `Lake.Toml.float
Instances For
Equations
- Lake.Toml.decInt = Lake.Toml.numeralOfKind "decimal integer" `Lake.Toml.decInt
Instances For
Equations
- Lake.Toml.binNum = Lake.Toml.numeralOfKind "binary number" `Lake.Toml.binNum
Instances For
Equations
- Lake.Toml.octNum = Lake.Toml.numeralOfKind "octal number" `Lake.Toml.octNum
Instances For
Equations
- Lake.Toml.hexNum = Lake.Toml.numeralOfKind "hexadecimal number" `Lake.Toml.hexNum
Instances For
Equations
- Lake.Toml.dateTime = Lake.Toml.numeralOfKind "date-time" `Lake.Toml.dateTime
Instances For
Equations
- Lake.Toml.valCore val = (Lake.Toml.string <|> Lake.Toml.boolean <|> Lake.Toml.numeral <|> Lake.Toml.arrayCore val <|> Lake.Toml.inlineTableCore val)
Instances For
Equations
- Lake.Toml.val = Lake.Toml.recNodeWithAntiquot "val" `Lake.Toml.val Lake.Toml.valCore true
Instances For
Equations
Instances For
Instances For
Instances For
Instances For
Equations
- Lake.Toml.toml = Lean.Parser.withCache `Lake.Toml.toml (Lake.Toml.tomlCore Lake.Toml.val)