The #find_syntax command #
The #find_syntax command takes as input a string str and retrieves from the environment
all the candidates for syntax terms that contain the string str.
It also makes a very crude effort at regenerating what the syntax looks like, by inspecting the
ParserDescriptor of the corresponding parser.
extractSymbols descr acc takes as input a ParserDescriptor descr and an accumulator array
acc. It accumulates all symbols in descr corresponding to Lean.ParserDescr.symbol,
Lean.ParserDescr.nonReservedSymbol or Lean.ParserDescr.unicodeSymbol.
The output array serves as a way of regenerating what the syntax tree of the input parser is.
Equations
- Mathlib.FindSyntax.extractSymbols (Lean.ParserDescr.symbol s) x✝ = x✝.push s
- Mathlib.FindSyntax.extractSymbols (Lean.ParserDescr.nonReservedSymbol s includeIdent) x✝ = x✝.push s
- Mathlib.FindSyntax.extractSymbols (Lean.ParserDescr.unicodeSymbol s asciiVal preserveForPP) x✝ = x✝.push s
- Mathlib.FindSyntax.extractSymbols (Lean.ParserDescr.parser declName) x✝ = x✝
- Mathlib.FindSyntax.extractSymbols (Lean.ParserDescr.const name) x✝ = x✝
- Mathlib.FindSyntax.extractSymbols (Lean.ParserDescr.cat catName rbp) x✝ = x✝
- Mathlib.FindSyntax.extractSymbols (Lean.ParserDescr.node kind prec descr) x✝ = Mathlib.FindSyntax.extractSymbols descr x✝
- Mathlib.FindSyntax.extractSymbols (Lean.ParserDescr.trailingNode kind prec lhsPrec descr) x✝ = Mathlib.FindSyntax.extractSymbols descr x✝
- Mathlib.FindSyntax.extractSymbols (Lean.ParserDescr.nodeWithAntiquot name kind descr) x✝ = Mathlib.FindSyntax.extractSymbols descr x✝
- Mathlib.FindSyntax.extractSymbols (Lean.ParserDescr.unary name descr) x✝ = Mathlib.FindSyntax.extractSymbols descr x✝
- Mathlib.FindSyntax.extractSymbols (Lean.ParserDescr.binary name l r) x✝ = Mathlib.FindSyntax.extractSymbols r (Mathlib.FindSyntax.extractSymbols l x✝)
- Mathlib.FindSyntax.extractSymbols (p.sepBy sep psep allowTrailingSep) x✝ = Mathlib.FindSyntax.extractSymbols psep (Mathlib.FindSyntax.extractSymbols p x✝)
- Mathlib.FindSyntax.extractSymbols (p.sepBy1 sep psep allowTrailingSep) x✝ = Mathlib.FindSyntax.extractSymbols psep (Mathlib.FindSyntax.extractSymbols p x✝)
Instances For
The #find_syntax command takes as input a string str and retrieves from the environment
all the candidates for syntax terms that contain the string str.
It also makes a very crude effort at regenerating what the syntax looks like: this is supposed to be just indicative of what the syntax may look like, but there is no guarantee or expectation of correctness.
The optional trailing approx, as in #find_syntax "∘" approx, is only intended to make tests
more stable: rather than outputting the exact count of the overall number of existing syntax
declarations, it returns its round-down to the previous multiple of 100.
Equations
- One or more equations did not get rendered due to their size.