fix: make omission syntax be a builtin syntax (part 2)
Re-enables `⋯` processing that was disabled during the move to a builtin. Adds tests.
This commit is contained in:
parent
37fd128f9f
commit
08e149de15
5 changed files with 17 additions and 9 deletions
|
|
@ -181,7 +181,7 @@ syntax (name := calcTactic) "calc" calcSteps : tactic
|
|||
match tail with
|
||||
| `([]) => `([$x])
|
||||
| `([$xs,*]) => `([$x, $xs,*])
|
||||
--| `(⋯) => `([$x, $tail]) -- Unexpands to `[x, y, z, ⋯]` for `⋯ : List α`
|
||||
| `(⋯) => `([$x, $tail]) -- Unexpands to `[x, y, z, ⋯]` for `⋯ : List α`
|
||||
| _ => throw ()
|
||||
| _ => throw ()
|
||||
|
||||
|
|
|
|||
|
|
@ -328,8 +328,7 @@ Delaborates the current expression as `⋯` and attaches `Elab.OmissionInfo`, wh
|
|||
subterm omitted by `⋯` is delaborated when hovered over.
|
||||
-/
|
||||
def omission : Delab := do
|
||||
--let stx ← `(⋯)
|
||||
let stx : Term := ⟨mkNode ``Lean.Parser.Term.omission #[]⟩
|
||||
let stx ← `(⋯)
|
||||
let stx ← annotateCurPos stx
|
||||
addOmissionInfo (← getPos) stx (← getExpr)
|
||||
pure stx
|
||||
|
|
|
|||
|
|
@ -32,3 +32,8 @@ Nothing is omitted in short lists
|
|||
In longer lists, the tail is omitted
|
||||
-/
|
||||
#check [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
|
||||
/-!
|
||||
Checking the message when an omission is copied from the Infoview
|
||||
-/
|
||||
#check [1, 2, 3, 4, 5, 6, 7, 8, ⋯]
|
||||
10
tests/lean/ppDeepTerms.lean.expected.out
Normal file
10
tests/lean/ppDeepTerms.lean.expected.out
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ Nat.zero))))))) : Nat
|
||||
Nat.succ
|
||||
(Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ Nat.zero))))))))) : Nat
|
||||
Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ ⋯)))))))) : Nat
|
||||
[1, 2, 3, 4, 5, 6, 7, 8] : List Nat
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, ⋯] : List Nat
|
||||
ppDeepTerms.lean:39:32-39:33: warning: The '⋯' token is used by the pretty printer to indicate omitted terms, and it should not be used directly. It logs this warning and then elaborates like `_`.
|
||||
|
||||
The presence of `⋯` in pretty printing output is controlled by the 'pp.deepTerms' and `pp.proofs` options. These options can be further adjusted using `pp.deepTerms.threshold` and `pp.proofs.threshold`.
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, ?m] : List Nat
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ Nat.zero))))))) : Nat
|
||||
Nat.succ
|
||||
(Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ Nat.zero))))))))) : Nat
|
||||
Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ (Nat.succ ⋯)))))))) : Nat
|
||||
[1, 2, 3, 4, 5, 6, 7, 8] : List Nat
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, ⋯] : List Nat
|
||||
Loading…
Add table
Reference in a new issue