Commit graph

80 commits

Author SHA1 Message Date
Mario Carneiro
0c3383c0b0 feat: support let mut x := e | alt 2022-08-10 06:29:49 -07:00
Mario Carneiro
e816424466
chore: use Category declarations for builtin cats too (#1400) 2022-08-03 18:10:54 -07:00
Mario Carneiro
f6211b1a74
chore: convert doc/mod comments from /- to /--//-! (#1354) 2022-07-22 12:05:31 -07:00
Sebastian Ullrich
3a61cc247e chore: introduce doSeq antiquotation 2022-06-27 22:37:02 +02:00
Sebastian Ullrich
292d24ba19 feat: always store quoted kind in antiquotation kind 2022-06-27 22:37:02 +02:00
Leonardo de Moura
e52a7bdf42 feat: let/if indentation in do blocks
closes #1120
2022-06-13 16:18:49 -07:00
Sebastian Ullrich
3cf2afa42e refactor: clean up parsers using withAnonymousAntiquot := false 2022-04-06 10:21:53 +02:00
Leonardo de Moura
92937b3aba feat: add for h : x in xs do ... notation
The idea is to have `h : x \in xs`.
This commit just adds the parser.
2022-03-03 18:27:40 -08:00
Leonardo de Moura
93b5b74b36 feat: modify notation for providing motive in "match" expressions 2022-02-14 15:36:14 -08:00
Leonardo de Moura
5f74cd4968 feat: add let pat := val | elseCase do-notation 2022-02-03 15:55:03 -08:00
Gabriel Ebner
ab3e08190b feat: allow opt-out of grouping in formatter 2021-12-15 11:42:38 +00:00
Gabriel Ebner
5d25df1a69 fix: indenting of match arms in declValEqns 2021-12-15 11:42:38 +00:00
Gabriel Ebner
2b7ec7f9ef fix: spacing around (← monadic lifts) 2021-12-15 11:42:38 +00:00
Sebastian Ullrich
585fba69e8 refactor: remove redundancy from common register_parser_alias case
/cc @leodemoura
2021-09-20 13:20:23 +02:00
Sebastian Ullrich
73cf3533a1 fix: count quotation depth in parser correctly 2021-04-29 13:33:48 +02:00
Leonardo de Moura
1c23d68c6a feat: add (generalizing := true/false) optional attribute to match 2021-04-15 17:04:25 -07:00
Sebastian Ullrich
bbf6c717fc feat: introduce arg precedence 2021-03-22 16:33:37 +01:00
Leonardo de Moura
60a1b828ad fix: fixes #348 2021-03-16 17:50:40 -07:00
Leonardo de Moura
ffb57e661f chore: remove old notation 2021-03-11 11:24:52 -08:00
Leonardo de Moura
1112ab6eff chore: use new notation 2021-03-11 11:19:33 -08:00
Leonardo de Moura
ca0baf12b6 chore: avoid ! suffix in builtin notation 2021-03-11 10:58:06 -08:00
Leonardo de Moura
164577d94e chore: remove parser! and tparser!
The new macros are called "leading_parser` and `trailing_parser`.

cc @Kha
2021-03-11 09:36:58 -08:00
Leonardo de Moura
b3d83aa199 feat: set_option parser for terms and tactics 2021-03-06 15:38:02 -08:00
Leonardo de Moura
4a39201d55 fix: ambiguity
```
def f (x : Nat) : IO Unit := do
IO.println x

open Nat in
def g (x : Nat) := succ x
```

cc @Kha
2021-03-06 15:33:00 -08:00
Leonardo de Moura
7b813622c6 chore: increase precedence of |>, <|, $ parsers
@Kha Now, all parsers defined by `Init/Std/Lean` packages have
precedence >= `min` and <= `max`.
The only exception is `<|>` since it is an infix operator sharead with
the tactic DSL.
BTW, the meaning of `f $ a <|> b` changed with this commit.
It was `f (a <|> b)`, and now is `(f a) <|> b`. The problem is that
the precedence of the `$` parser is now greater than the `<|>` parser.

I will try another experiment where I make sure we do not "reuse"
term infix operators in the tactic DSL.
2020-12-22 14:10:07 -08:00
Sebastian Ullrich
bc3e9ce961 feat: if let pat ← ... 2020-12-20 23:58:29 +01:00
Sebastian Ullrich
90f747e346 fix: don't change antiquotations semantics in do if 2020-12-20 17:51:37 +01:00
Sebastian Ullrich
eeb0cad29e feat: if let
/cc @leodemoura
2020-12-20 16:46:03 +01:00
Leonardo de Moura
0911936502 feat: parallel for notation 2020-12-19 19:26:53 -08:00
Leonardo de Moura
f2ea45e68a feat: expose doSeq and termBeforeDo parsers
Users can use them to extend the `do` DSL.
2020-12-10 19:10:25 -08:00
Sebastian Ullrich
4dfa7e1187 feat: use actual separator in sepBy antiquotation scope 2020-12-09 17:48:05 +01:00
Leonardo de Moura
c476954eef feat: heterogeneous OrElse and AndThen
@Kha I had a few issues similar to the `Append` issues.
We used a similar idiom for writing builtin parsers where we may write
```
def p : Parser := "foo " >> "bla "
```
as a shorthand for
```
def p : Parser := symbol "foo " >> symbol "bla "
```
I want to support `builtin syntax` one day :)

That being said, we should decide whether we keep `HAppend`, `HOrElse`,
and `HAndThen` or not.
The only one I wish I had in the past is `HAndThen`.
2020-12-01 18:32:24 -08:00
Leonardo de Moura
2909313475 fix: doLetArrow and doReassignArrow
@Kha the new tests did not work without this fix.
The `| _ =>` was being parsed as part of the `doLetArrow` and `doReassignArrow`
2020-11-26 10:29:08 -08:00
Sebastian Ullrich
375e6232e0 chore: introduce doSeqItem kind 2020-11-25 12:10:49 +01:00
Sebastian Ullrich
bd7bb6f5b5 fix: do formatting 2020-11-25 11:30:24 +01:00
Leonardo de Moura
360fa1638f chore: rename Parser.try to Parser.atomic
Reason: `try` is a keyword.

cc @Kha
2020-11-17 08:25:01 -08:00
Leonardo de Moura
cae6aa95dc feat: support simpleBinder at letDecl 2020-11-12 13:25:38 -08:00
Leonardo de Moura
1c558d279f feat: add mut modifier to doLet 2020-11-07 17:32:13 -08:00
Leonardo de Moura
89fd299c9e chore: prepare mut 2020-11-07 17:32:12 -08:00
Leonardo de Moura
d20081c548 feat: add term version of unless, for, try, and return notations 2020-10-31 19:19:17 -07:00
Leonardo de Moura
13c2a8ff51 chore: remove #lang lean4 header 2020-10-25 09:54:07 -07:00
Leonardo de Moura
d25ec3417b chore: remove some [inline] and [specialize] annotations from Parser/Basic 2020-10-21 11:27:18 -07:00
Leonardo de Moura
702ceb7a3f fix: return optional result
cc @Kha
2020-10-20 09:33:50 -07:00
Leonardo de Moura
ef18b0ab49 chore: use [builtinInit] 2020-10-19 14:58:38 -07:00
Leonardo de Moura
c7efb1d37d fix: do notation else if
The following `do` block
```lean
if c_1 then
  action_1
else
  if cond_2 then
    action_2
  action_3
```
was being being parsed as
```lean
if c_1 then
  action_1
else if cond_2 then
  action_2
action_3
```

cc @Kha
2020-10-19 14:29:31 -07:00
Leonardo de Moura
14414e3400 feat: nested do parser 2020-10-15 17:04:35 -07:00
Leonardo de Moura
60e4f4fee1 feat: improve notFollowedBy error messages 2020-10-15 17:01:10 -07:00
Leonardo de Moura
d2e5c1c300 feat: improve dbgTrace! macro 2020-10-13 12:38:04 -07:00
Leonardo de Moura
9538772c1c chore: do not use string interpolation by default at dbgTrace!
It is nice to be able to write `dbgTrace! x` instead of `dbgTrace! "{x}"`
2020-10-09 20:49:39 -07:00
Leonardo de Moura
bca81714fe feat: println! and dbgTrace! macros with string interpolation 2020-10-09 17:19:04 -07:00