Commit graph

47 commits

Author SHA1 Message Date
Leonardo de Moura
c93982d10c chore: disable pp.analyze for now
see #651
2021-09-07 07:51:43 -07:00
Sebastian Ullrich
3b43ab47f1 fix: formatter: check for comment tokens
Fixes #624
2021-08-11 17:37:18 +02:00
Daniel Selsam
0118c47117 refactor: separate pp.funBinderTypes and pp.piBinderTypes 2021-08-09 16:13:40 +02:00
Leonardo de Moura
75872189cc chore: fix test 2021-08-06 13:10:58 -07:00
Sebastian Ullrich
1dfacb5f84 fix: parenthesizer: respect lhsPrec
Fixes #595
2021-08-03 15:22:08 +02:00
Daniel Selsam
aefd31b2a2 feat: better bottom-up/structure-type heuristics 2021-08-03 09:13:18 +02:00
Daniel Selsam
e6b90dde8f fix: pp.analyze mvars can bottom-up 2021-08-03 09:13:18 +02:00
Daniel Selsam
7576b1dad1 chore: fix test hardcoding position offset 2021-08-03 09:13:18 +02:00
Daniel Selsam
c3d62c1076 chore: patch tests for pp.analyze default 2021-08-03 09:13:18 +02:00
Daniel Selsam
ded51882a0
feat: pp motives and misc delab fixes 2021-06-13 00:06:27 +02:00
Sebastian Ullrich
1490d095a8 fix: delaborator: bind without lambda 2021-02-16 12:07:46 +01:00
Leonardo de Moura
ac51d3e621 feat: eager coe expansion 2021-02-14 11:34:08 -08:00
Sebastian Ullrich
4772fb5849 feat: delaborator: use if prop 2021-02-02 13:54:34 +01:00
Leonardo de Moura
c524bcf2d3 feat: improve universe level pretty printer 2020-12-21 07:34:48 -08:00
Leonardo de Moura
06ad52575a feat: force users to use discard when action result is not being bound and it is not PUnit
After this commit, we have to use an explicit `discard` in code such as
```
def g (x : Nat) : IO Nat := ...
def f (x : Nat) : IO Unit := do
  discard <| g x   -- type error without the `discard`
  IO.println x
```

Motivation: prevent users from making mistakes such as
```
def f (xs : Array Nat) : IO Unit := do
  xs.set! 0 1
  IO.println xs
```
when they meant to write
```
def f (xs : Array Nat) : IO Unit := do
  let xs := xs.set! 0 1
  IO.println xs
```
2020-12-08 06:14:48 -08:00
Sebastian Ullrich
de20b14366 feat: delaborate basic do
/cc @leodemoura
2020-11-25 16:00:56 +01:00
Sebastian Ullrich
0731d3f080 fix: double indentation inside parentheses
Ideally we would skip the indentation after any leading token without trailing
whitespace, but it's not quite clear how to do that in general
2020-10-30 19:10:08 +01:00
Leonardo de Moura
10c32fcf94 chore: HasToString => ToString 2020-10-27 16:11:48 -07:00
Sebastian Ullrich
7e5cd0d171 fix: Format.be: respect indent when trying to fit fill item in a new line 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
88af639346 feat: Formatter: default to Format.fill instead of Format.group 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
3030c1ef7a fix: Format.merge 2020-10-07 09:44:04 +02:00
Sebastian Ullrich
c3ebb6ad1f fix: Format.group ignored preceding content on line 2020-10-07 09:43:05 +02:00
Sebastian Ullrich
eae32b08a6 fix: pretty printing multiple universe levels
Fixes #190
2020-09-25 20:06:18 +02:00
Sebastian Ullrich
68568e78d3 feat: formatter: use hard space after opening structure instance brace 2020-09-18 13:15:40 -07:00
Sebastian Ullrich
519eda2459 feat: formatter: interpret checkWsBefore as soft space 2020-09-18 13:15:40 -07:00
Sebastian Ullrich
95007171a8 feat: formatter: group+indent binders and structure instance fields 2020-09-18 13:15:40 -07:00
Sebastian Ullrich
97a2198fe0 feat: change default indent width from 4 to 2 spaces 2020-09-18 13:15:40 -07:00
Sebastian Ullrich
ec3682ce15 feat: formatter: automatically group+indent syntax categories 2020-09-18 13:15:40 -07:00
Sebastian Ullrich
ac6c2b7a8e feat: formatter: interpret space after token as soft space 2020-09-18 13:15:40 -07:00
Sebastian Ullrich
0b9e46eee5 chore: universe-+ spacing 2020-09-17 08:12:28 -07:00
Sebastian Ullrich
fad4660135 feat: pretty print space between binders 2020-09-17 08:12:28 -07:00
Sebastian Ullrich
131f30f7a9 feat: pretty print tuples 2020-09-17 08:12:28 -07:00
Sebastian Ullrich
bacc77efa1 feat: delaborate builtin operators 2020-09-17 08:12:28 -07:00
Sebastian Ullrich
4f5b59ad02 feat: pretty print shortened names (export/open/namespace/private) 2020-09-17 08:12:28 -07:00
Leonardo de Moura
b8d90d77db feat: macro scope as the single mechanism for creating fresh names
cc @Kha
2020-09-14 20:09:07 -07:00
Sebastian Ullrich
ea266e48ab feat: unicodeSymbol.formatter: prefer symbol used in syntax tree 2020-08-20 18:57:08 +02:00
Sebastian Ullrich
19563961e2 feat: more whitespace in term parsers 2020-08-06 09:27:12 -07:00
Sebastian Ullrich
e6442d3177 feat: force whitespace in sort applications 2020-08-06 09:27:12 -07:00
Sebastian Ullrich
01456b1b00 fix: Term.app: force whitespace in front of each argument 2020-08-06 09:27:12 -07:00
Sebastian Ullrich
e8ca2e3f62 feat: formatter: push space at checkWsBefore 2020-08-06 09:27:12 -07:00
Sebastian Ullrich
07928f301f feat: formatter: separate tokens where necessary 2020-08-06 09:27:12 -07:00
Sebastian Ullrich
37d890b950 fix: atoms might need backtracking as well, e.g. in fieldIdx <|> ident 2020-08-06 09:27:12 -07:00
Sebastian Ullrich
1fe192802b fix: parenthesizer 2020-07-29 15:18:00 +02:00
Sebastian Ullrich
43caef0130 fix: parenthesizer 2020-06-13 11:13:37 +02:00
Leonardo de Moura
947369b4ce chore: Parenthesizer issues after removing sortApp
@Kha Could you please double check these modifications.

I added a no-op for `checkRbpLt`. It is used at the `Sort` and `Type`
parsers.
As I described in previous commits, the `checkRBPGreater` comment and
implementation were misleading. It was actually succeeding when the
rbp was less than or equal to the given parameter. So, it was renamed
to `checkRbpLe`. So, is the depArrow parenthesizer ok? I did not check.

I updated the PPRoundtrip.lean.expected.out to make sure the tests
succeed, but we should revise it if there is a problem with the
modifications at Parenthesizer.lean
2020-06-03 15:46:33 -07:00
Sebastian Ullrich
9247911e09 fix: basic parenthesizer approach, document 2020-05-26 11:26:57 +02:00
Sebastian Ullrich
386c706f3e feat: basic parenthesizer 2020-05-04 14:28:36 -07:00
Renamed from tests/lean/Delaborator.lean.expected.out (Browse further)