Leonardo de Moura
0911b9bc80
feat: add missing features to do notation parser
2020-09-30 06:51:25 -07:00
Leonardo de Moura
e10edde5cd
feat: optional ; in terms
2020-09-28 17:10:59 -07:00
Leonardo de Moura
d4c1432574
fix: tacticSeqBracketed
2020-09-28 17:10:59 -07:00
Leonardo de Moura
f45fa34cba
feat: optional ; at tacticSeq1Indented
2020-09-28 17:10:59 -07:00
Leonardo de Moura
7f9013e496
fix: seq1Unbox
2020-09-28 17:10:59 -07:00
Leonardo de Moura
85d8c4fa85
chore: add proper kind for tacticSeq1Indented
2020-09-28 17:10:59 -07:00
Leonardo de Moura
aa410283c6
fix: we don't want antiquotation for seq1
2020-09-28 17:10:59 -07:00
Leonardo de Moura
cb55ffae94
chore: add new tactic syntax kind
2020-09-28 17:10:58 -07:00
Leonardo de Moura
861fd11a57
chore: add tacticSeq node
...
We use `$tac:tacticSeq` in many places, and we want them to match
the bracketed and indented cases.
2020-09-28 17:10:58 -07:00
Leonardo de Moura
6f211d3449
chore: adjust tactic parser
2020-09-28 17:10:57 -07:00
Leonardo de Moura
93090baa82
chore: cleanup tactic syntax
2020-09-28 17:10:57 -07:00
Leonardo de Moura
08d54b6043
feat: add checkColGt at app
...
@Kha Only one example broke :)
2020-09-28 17:10:57 -07:00
Leonardo de Moura
6ddec22763
refactor: simplify withPosition combinator
...
Add `checkColGt`
2020-09-28 17:10:56 -07:00
Leonardo de Moura
2d8506b7c6
feat: add doElem parser category
2020-09-26 06:18:44 -07:00
Leonardo de Moura
dc9626ceab
feat: try to improve weird error message
...
@Kha Before this commit, we were producing the error "expected command" at the `let` token
```lean
check id let x := 1; x
```
The new error is "expected command, but found term; this error may be
due to parsing precedence levels, consider parenthesizing the term".
The example above looks artificial, but it will happen all the time as
users start to define their own notation.
2020-09-21 18:29:01 -07:00
Sebastian Ullrich
68568e78d3
feat: formatter: use hard space after opening structure instance brace
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
Leonardo de Moura
d1c3ab3797
feat: many1Unbox and nodeSepBy1Unbox parser combinators
...
@Kha I removed the dummy parenthesizer/formatter for `withResultOf`,
and add proper ones for `many1Unbox` and `nodeSepBy1Unbox`.
2020-09-17 13:17:46 -07:00
Leonardo de Moura
2dafdec000
feat: use withResultOf combinator instead of unboxSingleton parameter
2020-09-17 12:12:12 -07:00
Sebastian Ullrich
fad4660135
feat: pretty print space between binders
2020-09-17 08:12:28 -07:00
Leonardo de Moura
c49ccda46a
feat: add antiquotation for indentedNonEmptySeq
2020-09-14 14:57:38 -07:00
Leonardo de Moura
05e6a779ba
fix: can't use maxPrec at by
...
If `by` uses `maxPrec`, then `have A by B ...` is parsed as
`have (A by B) ...` :(
cc @Kha
2020-09-14 14:57:14 -07:00
Leonardo de Moura
f95675dc22
feat: add have-by and show-by syntax
2020-09-14 14:25:35 -07:00
Leonardo de Moura
fc4ab139b5
feat: indented by
...
@Kha This one is not as useful as the indented `do`. When writing
interactive proofs I like the error message at the `}` showing the
resulting tactic state. We can simulate it using a `skip` in the end of the sequence :)
We remove the `skip` when the proof is done. Note that, the last `;`
is usually not part of the `by`. Example:
```lean
theorem ex (x y z : Nat) : y = z → y = x → x = z :=
fun _ _ =>
have x = y by apply Eq.symm; assumption; -- <<< the last `;` is part of the `have`
Eq.trans this (by assumption)
```
2020-09-14 14:20:02 -07:00
Leonardo de Moura
4c6a589e6c
feat: indented do blocks
...
@Kha it is soooooo much nicer :)
2020-09-14 13:44:51 -07:00
Leonardo de Moura
151012cb39
feat: remove emptyc elaboration hack
...
@Kha I removed the hack. We know get a nice error message.
2020-09-11 14:41:44 -07:00
Leonardo de Moura
ba4fdce508
feat: expand helper macros
2020-09-10 14:25:07 -07:00
Leonardo de Moura
d77dc5efb8
feat: add helper syntax
2020-09-10 13:31:45 -07:00
Leonardo de Moura
232fe8cadd
doc: document parser trick
2020-09-10 11:20:09 -07:00
Leonardo de Moura
20152c1192
chore: change by precedence
...
@Kha it now uses the same precedence of `fun`.
The main motivation is to allow us to write `@by { ... }` instead of
`@(by { ... })`.
BTW, I am considering disabling implicit lambdas for `by ...` expressions.
It is automatically "intro"ducing the implicit variables without
giving an opportunity for users to pick their names.
2020-09-10 11:17:42 -07:00
Leonardo de Moura
b24d1c2d90
feat: add .. syntax for pattern applications
2020-09-09 09:55:29 -07:00
Leonardo de Moura
7dc1b461fa
chore: give a proper node to matchAlts
2020-09-04 18:42:09 -07:00
Leonardo de Moura
ef64e1c25a
feat: fun+match macro
...
Example:
```
fun
| 0 => true
| _ => false
```
2020-09-04 16:23:01 -07:00
Leonardo de Moura
0883f96da0
chore: remove optional partial from 'let rec'
...
It will inherit the parent declaration annotation.
2020-09-02 17:02:22 -07:00
Leonardo de Moura
095e07d52d
chore: letrec => let rec
...
cc @Kha
2020-09-01 13:27:41 -07:00
Leonardo de Moura
6f0e9452b2
chore: remove begin ... end syntax
...
We should use `by { ... }` from now on.
cc @Kha
2020-08-30 14:15:33 -07:00
Leonardo de Moura
0a0ca9f930
fix: funImplicitBinder
2020-08-30 08:10:58 -07:00
Leonardo de Moura
b4f938d859
chore: namedHole => syntheticHole
2020-08-30 08:04:15 -07:00
Leonardo de Moura
89e0fa1488
chore: allow ?_
...
Note that `?_` is not equivalent to `_`. Both do not have a name, but
`?_` is a synthetic metavariable which **cannot** be assigned by typing
constraints, and `_` is a regular metavariable.
We use `?_` to mark an anonymous hole that must be filled using tactics.
@Kha I will rename `namedHole` to `syntheticHole`
2020-08-30 07:54:34 -07:00
Leonardo de Moura
825d9643cd
feat: allow structure instances as fun binder without ()
...
The issue is that `{ x := ... }` was being parsed as an implicit
binder, and we were getting an error at `:=`.
2020-08-30 07:35:41 -07:00
Leonardo de Moura
546c108497
chore: revise letrec syntax
2020-08-26 10:50:32 -07:00
Leonardo de Moura
effaf64a07
feat: allow user to specify attributes letrec declarations
2020-08-26 09:57:46 -07:00
Leonardo de Moura
6a83577703
feat: letrec syntax
2020-08-26 09:33:52 -07:00
Sebastian Ullrich
1840b4b1ff
fix: pretty printer with new syntax
2020-08-19 09:56:23 -07:00
Sebastian Ullrich
6cbfe2359b
chore: remove old syntax
2020-08-19 09:56:23 -07:00
Sebastian Ullrich
3091bd71e7
feat: unwrap basic token parsers
2020-08-19 09:56:23 -07:00
Sebastian Ullrich
d4952dc40b
feat: use insideQuot parsers
2020-08-19 09:56:23 -07:00
Leonardo de Moura
1ba3925740
feat: new let-expression syntax
...
see 0064f7d2b9
2020-08-17 07:51:08 -07:00
Sebastian Ullrich
129b60022d
refactor: use distinct syntax kinds for quotations
2020-08-14 17:18:09 +02:00
Sebastian Ullrich
46f5670ba3
chore: Lean.Parser.Parser ~> Lean.Parser.Basic
2020-08-13 18:44:13 +02:00