File: Mathlib/Util/Superscript.lean

full_name: Mathlib.Tactic.Superscript.instHashableChar_mathlib
code: instance : Hashable Char 
goal: Hashable Char

full_name: Mathlib.Tactic.Superscript.Mapping.toSpecial
code: /-- A bidirectional character mapping. -/
structure Mapping where
  /-- Map from "special" (e.g. superscript) characters to "normal" characters. -/
  toNormal : HashMap Char Char := {}
  /-- Map from "normal" text to "special" (e.g. superscript) characters. -/
  toSpecial : HashMap Char Char := {}
  deriving Inhabited
goal: Lean.HashMap Char Char

full_name: Mathlib.Tactic.Superscript.Mapping
code: /-- A bidirectional character mapping. -/
structure Mapping where
  /-- Map from "special" (e.g. superscript) characters to "normal" characters. -/
  toNormal : HashMap Char Char := {}
  /-- Map from "normal" text to "special" (e.g. superscript) characters. -/
  toSpecial : HashMap Char Char := {}
  deriving Inhabited
goal: Type

full_name: Mathlib.Tactic.Superscript.instInhabitedMapping
code: /-- A bidirectional character mapping. -/
structure Mapping where
  /-- Map from "special" (e.g. superscript) characters to "normal" characters. -/
  toNormal : HashMap Char Char := {}
  /-- Map from "normal" text to "special" (e.g. superscript) characters. -/
  toSpecial : HashMap Char Char := {}
  deriving Inhabited
goal: Inhabited Mathlib.Tactic.Superscript.Mapping

full_name: Mathlib.Tactic.Superscript.Mapping.toNormal
code: /-- A bidirectional character mapping. -/
structure Mapping where
  /-- Map from "special" (e.g. superscript) characters to "normal" characters. -/
  toNormal : HashMap Char Char := {}
  /-- Map from "normal" text to "special" (e.g. superscript) characters. -/
  toSpecial : HashMap Char Char := {}
  deriving Inhabited
goal: Lean.HashMap Char Char

full_name: Mathlib.Tactic.Superscript.mkMapping
code: /-- Constructs a mapping (intended for compile time use). Panics on violated invariants. -/
def mkMapping (s₁ s₂ : String) : Mapping 
goal: Mathlib.Tactic.Superscript.Mapping

full_name: Mathlib.Tactic.Superscript.Mapping.superscript
code: /-- A mapping from superscripts to and from regular text. -/
def Mapping.superscript 
goal: Mathlib.Tactic.Superscript.Mapping

full_name: Mathlib.Tactic.Superscript.Mapping.subscript
code: /-- A mapping from subscripts to and from regular text. -/
def Mapping.subscript 
goal: Mathlib.Tactic.Superscript.Mapping

full_name: Mathlib.Tactic.Superscript.satisfyTokensFn.loop
code: /-- Collects runs of text satisfying `p` followed by whitespace. Fails if the first character does
not satisfy `p`. If `many` is true, it will parse 1 or more many whitespace-separated runs,
otherwise it will parse only 1. If successful, it passes the result to `k` as an array `(a, b, c)`
where `a..b` is a token and `b..c` is whitespace.
-/
partial def satisfyTokensFn (p : Char → Bool) (errorMsg : String) (many := true)
    (k : Array (String.Pos × String.Pos × String.Pos) → ParserState → ParserState) :
    ParserFn 
goal: Lean.Parser.ParserState

full_name: Mathlib.Tactic.Superscript.satisfyTokensFn
code: /-- Collects runs of text satisfying `p` followed by whitespace. Fails if the first character does
not satisfy `p`. If `many` is true, it will parse 1 or more many whitespace-separated runs,
otherwise it will parse only 1. If successful, it passes the result to `k` as an array `(a, b, c)`
where `a..b` is a token and `b..c` is whitespace.
-/
partial def satisfyTokensFn (p : Char → Bool) (errorMsg : String) (many := true)
    (k : Array (String.Pos × String.Pos × String.Pos) → ParserState → ParserState) :
    ParserFn 
goal: Lean.Parser.ParserFn

full_name: Mathlib.Tactic.Superscript.partitionPoint
code: /-- Given a predicate `leftOfPartition` which is true for indexes `< i` and false for `≥ i`,
returns `i`, by binary search. -/
@[specialize] partial def partitionPoint (lo := 0) (hi := as.size) : Nat 
goal: Nat

full_name: Mathlib.Tactic.Superscript.scriptFnNoAntiquot.alignInfo
code: /-- The core function for super/subscript parsing. It consists of three stages:

1. Parse a run of superscripted characters, skipping whitespace and stopping when we hit a
   non-superscript character.
2. Un-superscript the text and pass the body to the inner parser (usually `term`).
3. Take the resulting `Syntax` object and align all the positions to fit back into the original
   text (which as a side effect also rewrites all the substrings to be in subscript text).

If `many` is false, then whitespace (and comments) are not allowed inside the superscript.
-/
partial def scriptFnNoAntiquot (m : Mapping) (errorMsg : String) (p : ParserFn)
    (many := true) : ParserFn 
goal: Lean.SourceInfo → Lean.SourceInfo

full_name: Mathlib.Tactic.Superscript.scriptFnNoAntiquot.alignSubstr
code: /-- The core function for super/subscript parsing. It consists of three stages:

1. Parse a run of superscripted characters, skipping whitespace and stopping when we hit a
   non-superscript character.
2. Un-superscript the text and pass the body to the inner parser (usually `term`).
3. Take the resulting `Syntax` object and align all the positions to fit back into the original
   text (which as a side effect also rewrites all the substrings to be in subscript text).

If `many` is false, then whitespace (and comments) are not allowed inside the superscript.
-/
partial def scriptFnNoAntiquot (m : Mapping) (errorMsg : String) (p : ParserFn)
    (many := true) : ParserFn 
goal: Substring → Substring

full_name: Mathlib.Tactic.Superscript.scriptFnNoAntiquot.alignSyntax
code: /-- The core function for super/subscript parsing. It consists of three stages:

1. Parse a run of superscripted characters, skipping whitespace and stopping when we hit a
   non-superscript character.
2. Un-superscript the text and pass the body to the inner parser (usually `term`).
3. Take the resulting `Syntax` object and align all the positions to fit back into the original
   text (which as a side effect also rewrites all the substrings to be in subscript text).

If `many` is false, then whitespace (and comments) are not allowed inside the superscript.
-/
partial def scriptFnNoAntiquot (m : Mapping) (errorMsg : String) (p : ParserFn)
    (many := true) : ParserFn 
goal: Lean.Syntax → Lean.Syntax

full_name: Mathlib.Tactic.Superscript.scriptFnNoAntiquot
code: /-- The core function for super/subscript parsing. It consists of three stages:

1. Parse a run of superscripted characters, skipping whitespace and stopping when we hit a
   non-superscript character.
2. Un-superscript the text and pass the body to the inner parser (usually `term`).
3. Take the resulting `Syntax` object and align all the positions to fit back into the original
   text (which as a side effect also rewrites all the substrings to be in subscript text).

If `many` is false, then whitespace (and comments) are not allowed inside the superscript.
-/
partial def scriptFnNoAntiquot (m : Mapping) (errorMsg : String) (p : ParserFn)
    (many := true) : ParserFn 
goal: Lean.Parser.ParserFn

full_name: Mathlib.Tactic.Superscript.scriptFnNoAntiquot.align
code: /-- The core function for super/subscript parsing. It consists of three stages:

1. Parse a run of superscripted characters, skipping whitespace and stopping when we hit a
   non-superscript character.
2. Un-superscript the text and pass the body to the inner parser (usually `term`).
3. Take the resulting `Syntax` object and align all the positions to fit back into the original
   text (which as a side effect also rewrites all the substrings to be in subscript text).

If `many` is false, then whitespace (and comments) are not allowed inside the superscript.
-/
partial def scriptFnNoAntiquot (m : Mapping) (errorMsg : String) (p : ParserFn)
    (many := true) : ParserFn 
goal: String.Pos

full_name: Mathlib.Tactic.Superscript.scriptParser
code: /-- The super/subscript parser.

* `m`: the character mapping
* `antiquotName`: the name to use for antiquotation bindings `$a:antiquotName`.
  Note that the actual syntax kind bound will be the body kind (parsed by `p`), not `kind`.
* `errorMsg`: shown when the parser does not match
* `p`: the inner parser (usually `term`), to be called on the body of the superscript
* `many`: if false, whitespace is not allowed inside the superscript
* `kind`: the term will be wrapped in a node with this kind
-/
def scriptParser (m : Mapping) (antiquotName errorMsg : String) (p : Parser)
    (many := true) (kind : SyntaxNodeKind := by exact decl_name%) : Parser 
goal: Lean.Parser.Parser

full_name: Mathlib.Tactic.Superscript.scriptParser.parenthesizer
code: /-- Parenthesizer for the script parser. -/
def scriptParser.parenthesizer (k : SyntaxNodeKind) (p : Parenthesizer) : Parenthesizer 
goal: Lean.PrettyPrinter.Parenthesizer

full_name: Std.Format.mapStringsM
code: /-- Map over the strings in a `Format`. -/
def _root_.Std.Format.mapStringsM {m} [Monad m] (f : Format) (f' : String → m String) : m Format 
goal: m Lean.Format

full_name: Mathlib.Tactic.Superscript.scriptParser.formatter
code: /-- Formatter for the script parser. -/
def scriptParser.formatter (name : String) (m : Mapping) (k : SyntaxNodeKind) (p : Formatter) :
    Formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Mathlib.Tactic.superscript
code: /--
The parser `superscript(term)` parses a superscript. Basic usage is:
```
local syntax:arg term:max superscript(term) : term
local macro_rules | `($a:term $b:superscript) => `($a ^ $b)
```
Given a notation like this, the expression `2⁶⁴` parses and expands to `2 ^ 64`.

Note that because of Unicode limitations, not many characters can actually be typed inside the
superscript, so this should not be used for complex expressions. Legal superscript characters:
```
⁰¹²³⁴⁵⁶⁷⁸⁹ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖ𐞥ʳˢᵗᵘᵛʷˣʸᶻᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾꟴᴿᵀᵁⱽᵂᵝᵞᵟᵋᶿᶥᶹᵠᵡ⁺⁻⁼⁽⁾
```
-/
def superscript (p : Parser) : Parser 
goal: Lean.Parser.Parser

full_name: Mathlib.Tactic.superscript.parenthesizer
code: /-- Formatter for the superscript parser. -/
@[combinator_parenthesizer superscript]
def superscript.parenthesizer 
goal: Lean.PrettyPrinter.Parenthesizer

full_name: Mathlib.Tactic.superscript.formatter
code: /-- Formatter for the superscript parser. -/
@[combinator_formatter superscript]
def superscript.formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Mathlib.Tactic.subscript
code: /--
The parser `subscript(term)` parses a subscript. Basic usage is:
```
local syntax:arg term:max subscript(term) : term
local macro_rules | `($a:term $i:subscript) => `($a $i)
```
Given a notation like this, the expression `(a)ᵢ` parses and expands to `a i`. (Either parentheses
or a whitespace as in `a ᵢ` is required, because `aᵢ` is considered as an identifier.)

Note that because of Unicode limitations, not many characters can actually be typed inside the
subscript, so this should not be used for complex expressions. Legal subscript characters:
```
₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘꞯʀꜱᴛᴜᴠᴡʏᴢᵦᵧᵨᵩᵪ₊₋₌₍₎
```
-/
def subscript (p : Parser) : Parser 
goal: Lean.Parser.Parser

full_name: Mathlib.Tactic.subscript.parenthesizer
code: /-- Formatter for the subscript parser. -/
@[combinator_parenthesizer subscript]
def subscript.parenthesizer 
goal: Lean.PrettyPrinter.Parenthesizer

full_name: Mathlib.Tactic.subscript.formatter
code: /-- Formatter for the subscript parser. -/
@[combinator_formatter subscript]
def subscript.formatter 
goal: Lean.PrettyPrinter.Formatter

full_name: Mathlib.Tactic.initFn._@.Mathlib.Util.Superscript._hyg.2067
code: initialize
  registerAlias `superscript ``superscript superscript
  registerAliasCore Formatter.formatterAliasesRef `superscript superscript.formatter
  registerAliasCore Parenthesizer.parenthesizerAliasesRef `superscript superscript.parenthesizer
  registerAlias `subscript ``subscript subscript
  registerAliasCore Formatter.formatterAliasesRef `subscript subscript.formatter
  registerAliasCore Parenthesizer.parenthesizerAliasesRef `subscript subscript.parenthesizer
goal: IO Unit