Leonardo de Moura
31ebccea58
chore: remove ParserDescr.pushLeading
2020-01-30 19:04:07 -08:00
Leonardo de Moura
410d295429
refactor: remove unnecessary pushLeading, add ParserDescr.trailingNode
2020-01-30 18:32:28 -08:00
Leonardo de Moura
72ff3da6cd
refactor: preparing to remove ParserKind
2020-01-30 17:31:53 -08:00
Sebastian Ullrich
470e1623de
chore: hide "expected '$'"
2020-01-30 08:56:14 -08:00
Leonardo de Moura
8525584a78
refactor: naming consistency ensure List and Array have similar find* methods
...
`find?` -> takes predicate
`findSome?` -> takes a function (A -> Option B)
2020-01-26 15:13:05 -08:00
Leonardo de Moura
74bac15c6f
chore: make sure letDecl is a node
...
This is useful when defining notation such as `where`.
Moreover, it allows us to write `$d:letDecl`, but `$d` never matches
a `letDecl`
2020-01-25 19:56:53 -08:00
Leonardo de Moura
9f816277fc
feat: make sure letSimpleDecl and letPatDecl have the same #args
2020-01-25 19:08:16 -08:00
Leonardo de Moura
7b6caba457
feat: add `ident as a valid elaboration kind
2020-01-25 14:55:32 -08:00
Leonardo de Moura
6d5de9f965
feat: handle raw identifiers as binders in fun
...
@Kha I am adding this kind of feature to improve the user experience.
For example, the macro
```
syntax "[" ident "↦" term "]" : term
macro_rules
| `([$x ↦ $v]) => `(fun $x => $v)
```
is accepted and looks perfectly reasonable.
However, before this commit, we would get a nasty error when
elaborating
```lean
check [x ↦ x + 1]
```
2020-01-25 14:55:21 -08:00
Leonardo de Moura
364bb7bdf7
fix: proper Name literals
...
cc @kha
2020-01-24 12:38:15 -08:00
Leonardo de Moura
954c69de35
feat: use macroscopes for creating fresh kinds
2020-01-23 12:38:31 -08:00
Leonardo de Moura
764b854742
fix: bug at longestMatchStep
...
@Kha I found the bug by accident when I was playing with the
bigop.lean
2020-01-22 17:31:54 -08:00
Leonardo de Moura
3f24b31286
chore: remove leftover
2020-01-22 16:50:05 -08:00
Leonardo de Moura
a5bcebb07f
feat: add antiquotation support for strLit, numLit and charLit
2020-01-22 12:57:28 -08:00
Leonardo de Moura
0be31c14ec
fix: workaround for term parser antiquotation issue
...
@Kha this is a temporary workaround. We should discuss how to cleanup
in the next Dev meeting.
2020-01-22 12:05:12 -08:00
Leonardo de Moura
642850efb2
fix: antiquotation for all categories
2020-01-22 11:52:08 -08:00
Leonardo de Moura
e8c54ad1bf
fix: use nonReservedSymbol when defining tactic new syntax
2020-01-21 14:37:29 -08:00
Leonardo de Moura
8fb710c31e
chore: remove simple parser kind
...
Now, the previous commit makes sure pratt's parsers subsume simple parsers
2020-01-21 09:16:38 -08:00
Leonardo de Moura
f3c1928d2d
feat: improve prattParser tables
...
We can delete the simple category after this change
cc @Kha
2020-01-21 09:16:38 -08:00
Leonardo de Moura
b279433236
feat: improve checkNoWsBefore (skip None nodes)
2020-01-20 22:24:01 -08:00
Leonardo de Moura
47c85cc351
fix: bug at ParserDescr.ident
2020-01-20 21:55:16 -08:00
Leonardo de Moura
1dbfc4b337
fix: add checkNoWsBefore before option * in mkAntiquot
...
@kha we need it, otherwise we can't process rules such as
```
| `(FOO $t >>> $r) => `($t * $r)
```
without adding parenthesis at `(($t) * $r)
2020-01-20 21:48:40 -08:00
Leonardo de Moura
98033f298f
feat: add support for simple category
2020-01-20 20:55:54 -08:00
Leonardo de Moura
4ff001fa04
feat: add new kind of parser category
2020-01-20 20:06:04 -08:00
Leonardo de Moura
4d57790cc5
fix: add workaround for setting correct LBP for $ in antiquotations
2020-01-20 10:42:58 -08:00
Leonardo de Moura
f20d4aaa83
fix: avoid termParser at mkAntiquot
...
@kha `mkAntiquot` is used in all categories. I removed
`termParser (appPrec + 1)` to avoid nasty interactions between
`termParser` and the surrounding category.
This commity ensures the antiquotation prefix is one of the following
forms `$<id>` or `$(<term>)`.
I made the two cases look like term syntax because I didn't want to
change your expander. We should fix this next week.
2020-01-20 10:19:16 -08:00
Sebastian Ullrich
15bed7c95c
chore: support old notation syntax
2020-01-19 18:45:08 +01:00
Leonardo de Moura
58b21fe0c9
feat: mark literals as valid kinds
2020-01-18 19:41:40 -08:00
Leonardo de Moura
98d9022321
chore: cleanup and new test
2020-01-17 18:07:58 -08:00
Sebastian Ullrich
ec8227cfd4
fix: antiquotation kinds :term should not be new tokens
2020-01-17 09:42:34 -08:00
Leonardo de Moura
f2231ebbc0
feat: improve macro command parser
2020-01-17 09:37:36 -08:00
Leonardo de Moura
14ae1166b1
feat: add unboxSingleton trick to sepBy1
2020-01-16 20:57:18 -08:00
Leonardo de Moura
d9c6624a0a
feat: add support for trailing syntax
2020-01-15 20:53:23 -08:00
Leonardo de Moura
570ae2ff0e
feat: add mkFreshKind
2020-01-14 18:07:14 -08:00
Leonardo de Moura
c889d0ce48
fix: infixR helper only works for termParsers
2020-01-14 18:06:57 -08:00
Leonardo de Moura
ab8cbdc7e0
feat: improve syntax rules
2020-01-14 14:15:48 -08:00
Leonardo de Moura
dd2936d28e
chore: move helper functions to Parser.lean
2020-01-14 13:33:20 -08:00
Leonardo de Moura
15a2d7d8ca
chore: tacticSymbol ==> nonReservedSymbol
2020-01-14 13:08:38 -08:00
Leonardo de Moura
e9d1014d63
feat: add ParserDescrCore.tacticSymbol constructor
2020-01-13 16:54:52 -08:00
Leonardo de Moura
2f5f00ed4f
feat: improve leadingIdentAsSymbol trick
2020-01-13 16:42:49 -08:00
Leonardo de Moura
397addb958
doc: leadingIdentAsSymbol trick
2020-01-13 16:38:12 -08:00
Leonardo de Moura
b8146cc235
feat: add leadingIdentAsSymbol to ParserCategory
2020-01-13 16:07:21 -08:00
Leonardo de Moura
340d5f01f5
chore: symbolOrIdent ==> nonReservedSymbol
2020-01-13 14:32:34 -08:00
Sebastian Ullrich
c6100ed25f
feat: antiquoting rawIdent
2020-01-12 10:32:27 -08:00
Simon Hudon
92c8773137
feat: file IO using handles
2020-01-12 08:02:48 -08:00
Leonardo de Moura
82a36fbfe2
feat: declare_syntax_cat without importing Init.Lean
...
cc @Kha
2020-01-11 09:02:50 -08:00
Leonardo de Moura
e817257922
feat: elaborate declare_syntax_cat
...
TODO: `registerParserCategory` uses `registerAttribute` which relies
on the environment having a declaration of type `AttributeImpl`.
This is bad since forces users to import `Init.Lean`.
@Kha The key problem is that we cannot serialize `AttributeImpl`.
I will try to address this issue tomorrow. I am considering different
workarounds.
2020-01-10 21:10:02 -08:00
Leonardo de Moura
799914daf2
feat: registerParserCategory
2020-01-10 20:32:16 -08:00
Leonardo de Moura
48600dbbfc
refactor: registerAttribute ==> registerBuiltinAttribute
2020-01-10 17:08:12 -08:00
Leonardo de Moura
a76b104f61
chore: move Message to Lean
2020-01-10 10:58:50 -08:00