Extensible parsing via attributes
Equations
Instances For
- token (val : Token) : OLeanEntry
- kind (val : SyntaxNodeKind) : OLeanEntry
- category (catName declName : Name) (behavior : LeadingIdentBehavior) : OLeanEntry
- parser (catName declName : Name) (prio : Nat) : OLeanEntry
Instances For
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 : TokenTable
- kinds : SyntaxNodeKindSet
- categories : ParserCategories
Instances For
Equations
Instances For
Equations
- Lean.Parser.getCategory categories catName = Lean.PersistentHashMap.find? categories catName
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
Equations
- Lean.Parser.addParserTokens tokenTable info = List.foldlM Lean.Parser.addTokenConfig✝ tokenTable (info.collectTokens [])
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} (p : α) : AliasValue α
- unary {α : Type} (p : α → α) : AliasValue α
- binary {α : Type} (p : α → α → α) : AliasValue α
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
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
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Equations
- Lean.Parser.getParserAliasInfo aliasName = do let __do_lift ← ST.Ref.get Lean.Parser.parserAliases2infoRef pure (Std.TreeMap.getD __do_lift aliasName { })
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
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
Equations
- Lean.Parser.ensureUnaryParserAlias aliasName = discard (Lean.Parser.getUnaryAlias Lean.Parser.parserAliasesRef aliasName)
Instances For
Equations
- Lean.Parser.ensureBinaryParserAlias aliasName = discard (Lean.Parser.getBinaryAlias Lean.Parser.parserAliasesRef aliasName)
Instances For
Equations
- Lean.Parser.ensureConstantParserAlias aliasName = discard (Lean.Parser.getConstAlias Lean.Parser.parserAliasesRef aliasName)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Parser.compileParserDescr categories d = Lean.Parser.compileParserDescr.visit✝ categories d
Instances For
Equations
- Lean.Parser.mkParserOfConstant categories constName = Lean.Parser.mkParserOfConstantAux constName (Lean.Parser.compileParserDescr categories)
Instances For
Equations
- Lean.Parser.registerParserAttributeHook hook = ST.Ref.modify Lean.Parser.parserAttributeHooks fun (hooks : List Lean.Parser.ParserAttributeHook) => hook :: hooks
Instances For
Equations
Instances For
Equations
- Lean.Parser.isParserCategory env catName = (Lean.Parser.getParserCategory? env catName).isSome
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.addBuiltinLeadingParser catName declName p prio = Lean.Parser.addBuiltinParser catName declName true p prio
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
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
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
Equations
- Lean.Parser.mkParserState input = { cache := Lean.Parser.initCacheForInput input }
Instances For
convenience function for testing
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Parser.declareLeadingBuiltinParser catName declName prio = Lean.Parser.declareBuiltinParser `Lean.Parser.addBuiltinLeadingParser catName declName prio
Instances For
Equations
- Lean.Parser.declareTrailingBuiltinParser catName declName prio = Lean.Parser.declareBuiltinParser `Lean.Parser.addBuiltinTrailingParser catName declName prio
Instances For
The parsing tables for builtin parsers are "stored" in the extracted source code.
Equations
- One or more equations did not get rendered due to their size.
- Lean.Parser.registerBuiltinParserAttribute attrName declName behavior ref = throw (IO.userError "`declName` should be in Lean.Parser.Category")
Instances For
Equations
- One or more equations did not get rendered due to their size.
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
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
If the parsing stack is of the form #[.., openDecl], we process the open declaration, and execute p
Equations
Instances For
Instances For
If the parsing stack's last element is a set_option command, then its value is set in the context
while parsing p.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
If the parsing stack ends with an the option name and value, then the option is set in the context
while parsing p. The value is the top of the stack and the name is the identifier two entries
below it.
Equations
Instances For
Instances For
Helper environment extension that gives us access to built-in aliases in pure parser functions.
Result of resolving a parser name.
- category
(cat : Name)
: ParserResolution
Reference to a category.
- parser
(decl : Name)
(isDescr : Bool)
: ParserResolution
Reference to a parser declaration in the environment. A
(Trailing)ParserDescrifisDescris true. - alias
(p : ParserAliasValue)
: 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.
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.
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.