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
Leonardo de Moura
8a6cb1842f
feat: expand doTry
...
@Kha I did not implement support for reassignments and `continue`,
`break`, `return` inside the `finally` clause. It is doable, but it
feels like unnecessary complexity. We currently don't have any
instance in our code base where this would be useful.
2020-10-08 19:39:36 -07:00
Leonardo de Moura
7f5af84660
chore: add doElem quotation parser
2020-10-08 13:45:53 -07:00
Leonardo de Moura
5d8764dd92
feat: take doElem at doLetArrow and doReassignArrow
2020-10-07 16:49:28 -07:00
Sebastian Ullrich
5d76a981b0
chore: adjust pp spacing
2020-10-07 09:44:04 +02:00
Leonardo de Moura
294a750110
feat: expand doMatch
2020-10-06 19:07:47 -07:00
Leonardo de Moura
cebadf9efd
chore: group many elements
...
TODO: the parser combinators `many` and `sepBy` should do it.
2020-10-06 06:43:19 -07:00
Leonardo de Moura
7325dcd630
feat: use do at for-in and unless notations
2020-10-05 09:43:11 -07:00
Leonardo de Moura
4e7fd4b4bf
chore: add doSeqIndent kind
2020-10-03 08:22:02 -07:00
Leonardo de Moura
a5daaee3ed
chore: do syntax adjustments
2020-10-03 07:33:18 -07:00
Leonardo de Moura
96f5c51a3e
fix: doElem issues
2020-10-02 18:58:43 -07:00
Leonardo de Moura
c40ec0128d
fix: return value is optional
2020-10-02 18:09:42 -07:00
Leonardo de Moura
35e401e915
chore: naming consistency
2020-10-02 15:47:12 -07:00
Leonardo de Moura
40640b85bd
fix: doSeqBracketed parser
...
It was failing to parse
```
def f2 (x : Nat) : IO Nat := do {
let y := 1;
if x > 0 then
y := y + 1;
IO.println y
}
```
cc @Kha
2020-10-02 15:05:22 -07:00
Leonardo de Moura
379e34a910
feat: do reassignment parsers
2020-10-02 13:16:55 -07:00
Leonardo de Moura
4e72530ce7
chore: let rec in do blocks
2020-10-01 10:40:11 -07:00
Leonardo de Moura
75cb42d8be
chore: improve try parser
2020-09-30 07:12:04 -07:00
Leonardo de Moura
0911b9bc80
feat: add missing features to do notation parser
2020-09-30 06:51:25 -07:00
Leonardo de Moura
f45fa34cba
feat: optional ; at tacticSeq1Indented
2020-09-28 17:10:59 -07:00
Leonardo de Moura
96a0fb41be
feat: optional ; in do notation
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
39f8fd8eb9
fix: trailing ';' at end of input
2020-09-27 16:58:23 -07:00
Leonardo de Moura
7dcd011be0
chore: improve notFollowedBy at doExpr
...
cc @Kha
2020-09-27 06:59:43 -07:00
Leonardo de Moura
2d4b7e7952
feat: add doMatch parser
2020-09-27 06:29:21 -07:00
Leonardo de Moura
8f27848d82
chore: preparing for "reassignment" notation
2020-09-26 18:16:35 -07:00
Leonardo de Moura
5fa8d9105e
feat: add if and for for do blocks
2020-09-26 18:03:53 -07:00
Leonardo de Moura
ee4dc452ac
chore: remove leftover
2020-09-26 16:10:29 -07:00
Leonardo de Moura
6892a957d6
feat: trailing ; in indented "do" sequences
...
cc @Kha
2020-09-26 16:08:30 -07:00
Leonardo de Moura
3f4499be08
feat: allow trailing ; at doSeqBracketed
2020-09-26 14:20:47 -07:00
Leonardo de Moura
13ded3f964
chore: use doElem category
2020-09-26 12:51:24 -07:00
Leonardo de Moura
2d8506b7c6
feat: add doElem parser category
2020-09-26 06:18:44 -07:00