Commit graph

45 commits

Author SHA1 Message Date
Kyle Miller
b56ad5a7d2
fix: apply newlines before and after comments when formatting syntax (#8626)
This PR closes #3791, making sure that the Syntax formatter inserts
whitespace before and after comments in the leading and trailing text of
Syntax to avoid having comments comment out any following syntax, and to
avoid comments' lexical syntax from being interpreted as being part of
another syntax. If the text contains newlines before or after any
comments, they are formatted as hard newlines rather than soft newlines.
For example, `--` comments will have a hard newline after them. Note:
metaprograms generating Syntax with comments should be sure to include
newlines at the ends of `--` comments.
2025-06-26 19:23:35 +00:00
Mario Carneiro
5661b15e35 fix: spacing and indentation fixes 2023-05-28 18:48:36 -07:00
Mario Carneiro
dd5948d641 chore: snake-case attributes (part 1) 2022-10-19 09:28:08 -07:00
Leonardo de Moura
989d8f04e1 chore: fix tests 2022-06-14 17:27:13 -07:00
Leonardo de Moura
3b259afaf0 chore: fix tests 2022-06-14 16:43:22 -07:00
Leonardo de Moura
bcb9c2c2a3 chore: fix test 2022-04-13 10:27:59 -07:00
Leonardo de Moura
bd35e8a2be chore: remove {} from ctor parser 2022-04-13 08:47:21 -07:00
Gabriel Ebner
b905824024 chore: fix tests 2021-12-15 11:42:38 +00:00
Scott Morrison
43315f7f94
fix: correct spacing in the pretty printer 2021-11-23 09:13:31 +01:00
Leonardo de Moura
f4a7ffd8c8 chore: fix codebase and tests 2021-06-29 17:14:52 -07:00
Sebastian Ullrich
a02c6fd3eb chore: adapt stdlib & tests 2021-05-20 15:17:36 -07:00
Leonardo de Moura
f11a003526 test: add "discriminant refinement" tests 2021-03-24 19:10:50 -07:00
Sebastian Ullrich
4772fb5849 feat: delaborator: use if prop 2021-02-02 13:54:34 +01:00
Sebastian Ullrich
cf9a2ae6af feat: formatter: preserve comments 2020-11-25 11:30:24 +01:00
Sebastian Ullrich
727816e7fd test: bring back Reformat.lean on abbreviated copy of Prelude.lean
/cc @leodemoura
2020-11-25 11:30:24 +01:00
Leonardo de Moura
7daeb7fffd chore: fix test 2020-11-11 07:18:49 -08:00
Leonardo de Moura
cca3bad0bb feat: add Prelude.lean
`Prelude.lean` has no dependencies, and
at the end of `Prelude`, the `syntax` and `macro` commands are operational.
2020-11-10 18:08:18 -08:00
Leonardo de Moura
3412c06059 chore: fix tests 2020-11-10 15:45:33 -08:00
Leonardo de Moura
2daeb195b5 chore: use new names 2020-11-10 10:15:19 -08:00
Leonardo de Moura
425f45a623 chore: fix test 2020-11-09 06:43:52 -08:00
Sebastian Ullrich
f56d81de32 chore: revert "chore: avoid .."
This reverts commit 60c0e7b3d4.
2020-11-03 15:12:23 +01:00
Leonardo de Moura
425cbac0dc chore: fix tests 2020-11-02 19:33:08 -08:00
Leonardo de Moura
dfc346e76f chore: remove obsolete attribute 2020-11-02 06:47:20 -08:00
Leonardo de Moura
2367d4d122 chore: fix test 2020-11-01 09:38:39 -08: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
Sebastian Ullrich
bc8cb5edda feat: pretty printer: adapt new indentation style 2020-10-30 19:08:39 +01:00
Leonardo de Moura
520714d31d chore: fix test 2020-10-28 13:29:07 -07:00
Leonardo de Moura
898a08a0c1 chore: avoid Has prefix in type classes
closes #203
2020-10-27 18:29:19 -07:00
Sebastian Ullrich
7696f71518 Revert "chore: avoid fun | ... => notation"
This reverts commit 8c6f536367.
2020-10-27 16:50:58 +01:00
Sebastian Ullrich
6fb0ae91c7 test: fix tests 2020-10-27 16:50:58 +01:00
Sebastian Ullrich
20ed65605b fix: don't parenthesize juxtaposed tactics 2020-10-27 14:09:33 +01:00
Sebastian Ullrich
84692acd0e fix: do not introduce parentheses implied by indentation 2020-10-27 14:09:33 +01:00
Sebastian Ullrich
73323a7500 fix: remove obsolete workaround confusing the formatter
We don't generate antiquotations for `tparser!` anymore
2020-10-27 14:09:33 +01:00
Sebastian Ullrich
33c861a80e fix: parenthesizer: really make sure a trailing parser is of the same category as the continuation 2020-10-27 14:09:33 +01:00
Sebastian Ullrich
eb125c52f1 fix: never pretty-print whitespace before checkNoWsBefore 2020-10-27 14:09:33 +01:00
Sebastian Ullrich
43c875fd7a fix: tactic block indentation 2020-10-27 14:09:33 +01:00
Leonardo de Moura
98d0892910 chore: update test output
@Kha the test `Reformat.lean` is "almost" working. It produces some
reasonable output, but we get parser errors. I didn't investigate.
I am updated the test output just to make sure we don't get a failure
in the CI.
2020-10-25 09:54:05 -07:00
Leonardo de Moura
ff3d9bfbdf chore: fix test output 2020-10-23 05:43:16 -07:00
Leonardo de Moura
dc6305604b chore: fix test 2020-10-20 09:33:50 -07:00
Leonardo de Moura
7bfa39ae45 fix: for .. in .. do notation and universe constraints
We use `MProd` instead of `Prod` to group values when expanding the
`do` notation. `MProd` is a universe monomorphic product.
The motivation is to generate simpler universe constraints in code
that was not written by the user but generated by the `do` macro.
Note that we are not really restricting the macro power since the
`HasBind.bind` combinator already forces values computed by monadic
actions to be in the same universe.

The new test cannot be compiled without this modication.
2020-10-18 18:05:00 -07:00
Sebastian Ullrich
d3463ef091 fix: break grouped fill items containing hard line breaks 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
1f772aaa6c fix: Format.be: count space in front of fill item 2020-10-14 14:24:47 +02:00
Sebastian Ullrich
78ffc72150 chore: remove ppGroups beneficial only for group but not fill 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
549912bbf4 test: Reformat.lean: make output test 2020-10-14 14:24:47 +02:00