Extensible parsing via attributes
Equations
- Lean.Parser.registerBuiltinNodeKind k = ST.Ref.modify Lean.Parser.builtinSyntaxNodeKindSetRef fun (s : Lean.Parser.SyntaxNodeKindSet) => s.insert k
Instances For
- token: Lean.Parser.Token → Lean.Parser.ParserExtension.OLeanEntry
- kind: Lean.SyntaxNodeKind → Lean.Parser.ParserExtension.OLeanEntry
- category: Lean.Name → Lean.Name → Lean.Parser.LeadingIdentBehavior → Lean.Parser.ParserExtension.OLeanEntry
- parser: Lean.Name → Lean.Name → Nat → Lean.Parser.ParserExtension.OLeanEntry
Instances For
- token: Lean.Parser.Token → Lean.Parser.ParserExtension.Entry
- kind: Lean.SyntaxNodeKind → Lean.Parser.ParserExtension.Entry
- category: Lean.Name → Lean.Name → Lean.Parser.LeadingIdentBehavior → Lean.Parser.ParserExtension.Entry
- parser: Lean.Name → Lean.Name → Bool → Lean.Parser.Parser → Nat → Lean.Parser.ParserExtension.Entry
Instances For
Equations
- Lean.Parser.ParserExtension.instInhabitedEntry = { default := Lean.Parser.ParserExtension.Entry.token default }
Equations
- (Lean.Parser.ParserExtension.Entry.token v).toOLeanEntry = Lean.Parser.ParserExtension.OLeanEntry.token v
- (Lean.Parser.ParserExtension.Entry.kind v).toOLeanEntry = Lean.Parser.ParserExtension.OLeanEntry.kind v
- (Lean.Parser.ParserExtension.Entry.category c d b).toOLeanEntry = Lean.Parser.ParserExtension.OLeanEntry.category c d b
- (Lean.Parser.ParserExtension.Entry.parser c d leading p prio).toOLeanEntry = Lean.Parser.ParserExtension.OLeanEntry.parser c d prio
Instances For
- tokens : Lean.Parser.TokenTable
- kinds : Lean.Parser.SyntaxNodeKindSet
- categories : Lean.Parser.ParserCategories
Instances For
Equations
- Lean.Parser.ParserExtension.instInhabitedState = { default := { tokens := default, kinds := default, categories := default } }
Equations
Instances For
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
- Lean.Parser.addParser categories catName declName true p prio = Lean.Parser.addLeadingParser categories catName declName p prio
- Lean.Parser.addParser categories catName declName false p prio = Lean.Parser.addTrailingParser categories catName declName p prio
Instances For
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Lean.Parser.ParserExtension.addEntryImpl s (Lean.Parser.ParserExtension.Entry.kind v) = { tokens := s.tokens, kinds := s.kinds.insert v, categories := s.categories }
Instances For
Parser aliases for making ParserDescr
extensible
- const: {α : Type} → α → Lean.Parser.AliasValue α
- unary: {α : Type} → (α → α) → Lean.Parser.AliasValue α
- binary: {α : Type} → (α → α → α) → Lean.Parser.AliasValue α
Instances For
Equations
Instances For
Instances For
Equations
- Lean.Parser.getAlias mapRef aliasName = do let __do_lift ← ST.Ref.get mapRef pure (Lean.NameMap.find? __do_lift aliasName)
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
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
- Lean.Parser.instCoeForallParserParserAliasValue = { coe := Lean.Parser.AliasValue.unary }
Equations
- Lean.Parser.instCoeForallParserForallParserAliasValue = { coe := Lean.Parser.AliasValue.binary }
Equations
- Lean.Parser.isParserAlias aliasName = do let __do_lift ← Lean.Parser.getAlias Lean.Parser.parserAliasesRef aliasName match __do_lift with | some val => pure true | x => pure false
Instances For
Equations
- Lean.Parser.getSyntaxKindOfParserAlias? aliasName = do let __do_lift ← ST.Ref.get Lean.Parser.parserAlias2kindRef pure (__do_lift.find? aliasName)
Instances For
Instances For
Equations
- Lean.Parser.compileParserDescr categories d = Lean.Parser.compileParserDescr.visit categories d
Instances For
Instances For
- postAdd : Lean.Name → Lean.Name → Bool → Lean.AttrM Unit
Called after a parser attribute is applied to a declaration.
Instances For
Equations
- Lean.Parser.registerParserAttributeHook hook = ST.Ref.modify Lean.Parser.parserAttributeHooks fun (hooks : List Lean.Parser.ParserAttributeHook) => hook :: hooks
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
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
Instances For
Run declName
if possible and inside a quotation, or else p
. The ParserInfo
will always be taken from p
.
Instances For
Instances For
Instances For
Equations
- Lean.Parser.addBuiltinTrailingParser catName declName p prio = Lean.Parser.addBuiltinParser catName declName false p prio
Instances For
Equations
- Lean.Parser.mkCategoryAntiquotParser kind = Lean.Parser.mkAntiquot kind.toString kind true true
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Instances For
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
convenience function for testing
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
Instances For
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
The parsing tables for builtin parsers are "stored" in the extracted source code.
Instances For
Instances For
A builtin parser attribute that can be extended by users.
Equations
- Lean.Parser.registerBuiltinDynamicParserAttribute attrName catName ref = Lean.registerBuiltinAttribute (Lean.Parser.mkParserAttributeImpl attrName catName ref)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Parser.commandParser rbp = Lean.Parser.categoryParser `command rbp
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
If the parsing stack is of the form #[.., openCommand]
, we process the open command, and execute p
Instances For
If the parsing stack is of the form #[.., openDecl]
, we process the open declaration, and execute p
Instances For
Helper environment extension that gives us access to built-in aliases in pure parser functions.
Result of resolving a parser name.
- category: Lean.Name → Lean.Parser.ParserResolution
Reference to a category.
- parser: Lean.Name → Bool → Lean.Parser.ParserResolution
Reference to a parser declaration in the environment. A
(Trailing)ParserDescr
ifisDescr
is true. - alias: Lean.Parser.ParserAliasValue → Lean.Parser.ParserResolution
Reference to a parser alias. Note that as aliases are built-in, a corresponding declaration may not be in the environment (yet).
Instances For
Resolve the given parser name and return a list of candidates.
Equations
- One or more equations did not get rendered due to their size.
- Lean.Parser.resolveParserNameCore env currNamespace openDecls ident = (pure []).run
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Resolve the given parser name and return a list of candidates.
Equations
- ctx.resolveParserName id = Lean.Parser.resolveParserNameCore ctx.env ctx.currNamespace ctx.openDecls id
Instances For
Resolve the given parser name and return a list of candidates.
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.