Commit graph

110 commits

Author SHA1 Message Date
Leonardo de Moura
76bda91ff8 feat: add evalMatch for tactics 2020-08-27 18:05:06 -07:00
Leonardo de Moura
d2f9f250db feat: add match tactic parser 2020-08-27 15:57:05 -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
Leonardo de Moura
5ffbada3df feat: add Lean.MonadEnv, Lean.MonadError, and Lean.MonadOptions
This is the first set of polymorphic methods. I will add more later,
and keep reducing code duplication.

cc @Kha
2020-08-22 16:00:43 -07:00
Leonardo de Moura
916b395d1b chore: cleanup 2020-08-21 09:29:09 -07:00
Sebastian Ullrich
e5de32c2dd feat: auto-generate header formatter 2020-08-21 16:43:55 +02:00
Sebastian Ullrich
5f30d62d9b feat: [runParserAttributeHooks] 2020-08-21 16:38:41 +02:00
Sebastian Ullrich
14211cc932 refactor: more core 2020-08-21 15:51:37 +02:00
Leonardo de Moura
c55376a1ba chore: more conventional MonadIO 2020-08-20 11:13:10 -07:00
Sebastian Ullrich
aa452b795d refactor: make formatter precompiled as well 2020-08-20 15:29:33 +02:00
Leonardo de Moura
68a4c145f7 refactor: implement attribute hooks using CoreM
We were using a mix of `IO` and `Except`
2020-08-19 14:44:54 -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
Sebastian Ullrich
ed7edf5661 feat: add checkInsideQuot/checkOutsideQuot/toggleInsideQuot parsers
One use case is to obtain fine-grained control over at what stage changed syntax is activated
2020-08-19 09:56:23 -07:00
Sebastian Ullrich
eeaf20080c refactor: register parenthesizer compiler as hook
/cc @leodemoura
2020-08-18 16:02:33 +02:00
Sebastian Ullrich
58e7af0d7f chore: simplify parser attribute hook registration
It is unlikely to be needed outside the stdlib
2020-08-18 15:52:23 +02:00
Sebastian Ullrich
dab53c4986 feat: add [parserAttributeHook] attribute 2020-08-18 14:41:36 +02:00
Leonardo de Moura
1ba3925740 feat: new let-expression syntax
see 0064f7d2b9
2020-08-17 07:51:08 -07:00
Sebastian Ullrich
92162ffb7f feat: check parenthesizer attribute arguments 2020-08-14 19:05:02 +02:00
Sebastian Ullrich
72310a4aee fix: parenthesizer: ParserDescr.parsers should not be assumed to be a registered parser, or even one with a kind 2020-08-14 19:05:02 +02: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
Sebastian Ullrich
a0f825f67f refactor: move Lean.PrettyPrinter.Parenthesizer in between Lean.Parser.Parser and Lean.Parser.Extension 2020-08-13 18:44:13 +02:00
Sebastian Ullrich
f7e004b44a refactor: split Lean.Parser.Parser 2020-08-13 18:44:13 +02:00
Leonardo de Moura
0e0754346b chore: fix method name 2020-08-12 10:43:26 -07:00
Leonardo de Moura
31bbc6ee6d feat: add primitive for registering syntax node kinds that are not associated with any parser
@Kha I added this feature to implement match expressions. The idea is
to be able to create a temporary `Syntax` node using an internal kind that has
no parser associated with it. That is, users cannot create them.
However, we can still associate an elaboration function to this kind.
Without this feature, I would have to create some "arbitrary parser"
for representing this temporary `Syntax` node.
2020-08-12 10:21:37 -07:00
Sebastian Ullrich
f4e59070c4 feat: support interpreting parenthesizers from ParserDescr 2020-08-12 09:15:59 -07:00
Sebastian Ullrich
1f4cc130b7 feat: precompile parenthesizers instead of interpreting them 2020-08-12 09:15:59 -07:00
Sebastian Ullrich
05cb45ca9c refactor: simplify mkCategoryAntiquotParser 2020-08-12 09:15:59 -07:00
Leonardo de Moura
25fd5d0a9a fix: ambiguity at match
```lean
match x : t with
| ...
```

Two possible intepretations for `x : t`:

1- The discriminant `t` where `x` is the name for the equality proofs `t = ...` in each alternative.

2- The discriminant `x` with a expected type `t` (aka motive) for the match.

This commit resolves the ambiguity by forcing no space before `:` in
the first interpretation.

cc @Kha
2020-08-10 13:47:09 -07:00
Leonardo de Moura
f974521783 fix: missing node 2020-08-10 11:15:44 -07:00
Leonardo de Moura
3ce794c58a feat: allow h : annotation on match discriminants 2020-08-10 10:12:24 -07:00
Sebastian Ullrich
3f6de2af06 refactor: simplify processing of antiquotations in pretty-printer 2020-08-06 09:27:12 -07: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
52b6317d3c chore: remove obsolete function 2020-08-06 09:26:49 -07:00
Sebastian Ullrich
ebe1e6d181 chore: remove misleading default for ParserCache.tokenCache 2020-08-06 09:26:48 -07:00
Leonardo de Moura
447000a797 fix: >>= associativity 2020-08-03 14:00:19 -07:00
Leonardo de Moura
7ea9a8c316 feat: add #print command parser 2020-07-28 14:56:10 -07:00
Leonardo de Moura
27c3e23c17 fix: type is optional in explicit fields
Reason: default value overriding notation.
2020-07-21 16:57:36 -07:00
Leonardo de Moura
a1fc824336 fix: field syntax 2020-07-17 10:12:43 -07:00
Leonardo de Moura
ba3f461505 chore: we decided to not support private parent structures, nor named parent structures
These are obscures features in Lean 3 that AFAIK nobody ever used.
2020-07-17 09:09:34 -07:00
Leonardo de Moura
bf88a35888 feat: add views for structure command 2020-07-16 16:35:00 -07:00
Leonardo de Moura
8a80887fb0 fix: structure command syntax 2020-07-16 16:00:31 -07:00
Leonardo de Moura
c421151e61 feat: allow users to annotate structure constructor and projections with declaration modifiers (e.g., private, protected, doc string, ...) 2020-07-16 10:27:06 -07:00