Commit Graph

231 Commits

Author SHA1 Message Date
Florian Diebold
ab4ecca210 Don't wrap most syntax trees in invisible delimiters when converting to token tree
Otherwise parsing them again doesn't work.
2019-12-05 19:29:39 +01:00
Florian Diebold
18f6a995d0 Add expansion infrastructure for derive macros 2019-12-05 17:23:09 +01:00
Edwin Cheng
bf537eefb5 Fixed mbe trival subtree 2019-11-22 01:02:07 +08:00
Aleksey Kladov
2b6f1ab0e2 Collapse TokenMap and RevTokenMap 2019-11-18 16:08:41 +03:00
Aleksey Kladov
b79d678923 Token-based reverse-mapping 2019-11-18 15:08:39 +03:00
Aleksey Kladov
fd52d721e1 More correct expansion mapping
We can't really map arbitrary ranges, we only can map tokens
2019-11-17 20:15:55 +03:00
Aleksey Kladov
c8f858d043 Make shift an implementation detail of mbe 2019-11-17 19:11:43 +03:00
Aleksey Kladov
7e2f4b30db Disable doctests 2019-11-17 18:35:05 +03:00
Aleksey Kladov
2eaa8c94a8 Goto definition works inside macros 2019-11-16 17:00:54 +03:00
memoryruins
5476c4faa3 Update smallvec dep to 1.0 2019-11-15 07:18:10 -05:00
Aleksey Kladov
70f2a21b55 Remove typed macro parsing API
We do type-erasure on every path anyway, so it doesn't make much sense
to duplicate this function for every type
2019-11-09 13:14:10 +03:00
Edwin Cheng
0a5ec69404 Remove map_ranges in RevTokenMap 2019-11-09 12:00:46 +08:00
Edwin Cheng
d01e0abdb5 Refactor and simpfily 2019-11-09 04:26:28 +08:00
Edwin Cheng
62ed93db13 Refactor and add more comments 2019-11-08 10:19:41 +08:00
Edwin Cheng
568f3cff41 Fix formatting 2019-11-05 09:43:59 +08:00
Edwin Cheng
2a76bb5a0b Refactor a bit 2019-11-05 03:20:54 +08:00
Edwin Cheng
604bdc6ffe Use macro_rules shift to map text ranges 2019-11-05 02:09:16 +08:00
Edwin Cheng
e6709f64af Rename and fix typos 2019-11-05 01:38:20 +08:00
Edwin Cheng
67226ebc82 Remove dbg! 2019-11-05 01:38:20 +08:00
Edwin Cheng
d560219d06 Fixed bug in ExpandedRangeMap 2019-11-05 01:38:20 +08:00
Edwin Cheng
159da285e9 Add macro_expansion_info in hir_expand 2019-11-05 01:38:20 +08:00
Edwin Cheng
9fd546bec2 Add map_id to TokenId 2019-11-05 01:38:20 +08:00
Edwin Cheng
a5839662f4 Change to add 1 if non zero shift 2019-11-05 01:16:06 +08:00
Edwin Cheng
188a1412b9 Refactor and rename 2019-11-05 01:01:05 +08:00
Edwin Cheng
42661a3b27 Change Option<u32> to u32 for shift value 2019-11-05 00:33:19 +08:00
Edwin Cheng
63e42bb5bd Change to better naming 2019-11-05 00:16:03 +08:00
Edwin Cheng
04af290d4e Add TokenId Shif in macro_rules 2019-11-04 23:22:18 +08:00
kjeremy
b441b4e8ef Some clippy fixes 2019-10-30 13:36:37 -04:00
Shotaro Yamada
5ca6281164 Remove unused dependencies 2019-10-12 08:00:54 +09:00
Alexander Andreev
fdbd6bb11a Added test for check doc strings in crates.
#1856
2019-09-30 11:58:53 +03:00
uHOOCCOOHu
2ecb126f5c
Support $crate in item and expr place. 2019-09-27 02:05:06 +08:00
Aleksey Kladov
66101e931c simplify 2019-09-24 09:28:16 +03:00
Aleksey Kladov
43da23401d remove obsolete TOOD
I have no idea what I've meant to fix here :-(
2019-09-22 23:43:37 +03:00
Aleksey Kladov
76290afa9a minor cleanup 2019-09-22 23:39:29 +03:00
Aleksey Kladov
b31b7ab238 slightly cleanup macro tests 2019-09-19 13:44:51 +03:00
Aleksey Kladov
4551182f94 use usual token tree for macro expansion 2019-09-17 15:51:48 +03:00
Aleksey Kladov
37ef8927c3 split mbe expander code into two modules 2019-09-17 02:06:14 +03:00
Aleksey Kladov
9eb14e1170 cleanup expansion to item list 2019-09-10 22:22:57 +03:00
Aleksey Kladov
4fdaec99c0 simiplify 2019-09-10 20:28:50 +03:00
Aleksey Kladov
6e5198cd6d add fragmets to expansion 2019-09-10 20:26:41 +03:00
Aleksey Kladov
1c5800dee8 "Fix" mbe to work with decomposed tokens
We regressed $i * 2 where $i = 1 + 1, need to fix that!
2019-09-10 15:56:05 +03:00
Aleksey Kladov
e94587e315 fix assists 2019-09-02 21:52:06 +03:00
Aleksey Kladov
e2b3844493 remove needless clone 2019-09-02 19:21:28 +03:00
Aleksey Kladov
c89abd4262 simplify 2019-09-02 18:58:21 +03:00
Aleksey Kladov
5b18a4eef9 rename struct -> record, pos -> tuple 2019-08-23 16:59:50 +03:00
Laurențiu Nicola
f52437371f Return a Ref from SubtreeTokenSource::get 2019-08-03 22:49:47 +03:00
Laurențiu Nicola
e58baaa5a1 Avoid cloning a TtToken in SubtreeTokenSource::mk_token 2019-08-03 21:21:09 +03:00
Aleksey Kladov
c9cfd57eea switch to upstream rowan's API 2019-07-20 20:12:06 +03:00
Aleksey Kladov
f3bdbec1b6 rename range -> text_range 2019-07-20 12:58:27 +03:00
Aleksey Kladov
6d5d82e412 move debug_dump to fmt::Debug 2019-07-20 12:48:24 +03:00
Aleksey Kladov
08fd402ef2 migrate mbe to the new rowan 2019-07-19 13:16:24 +03:00
Aleksey Kladov
df33e7685b use Parse in mbe 2019-07-18 23:19:04 +03:00
Aleksey Kladov
deab4caa7b make Parse fields private
this is in preparation for the new rowan API
2019-07-12 19:41:13 +03:00
Jeremy Kolb
001e34e6e3 Clippy trivially_copy_pass_by_ref 2019-07-05 12:02:32 -04:00
Jeremy Kolb
4ad9e986ad Some clippy fixes for 1.36 2019-07-04 17:43:00 -04:00
Aleksey Kladov
1834bae5b8 allow rustfmt to reorder imports
This wasn't a right decision in the first place, the feature flag was
broken in the last rustfmt release, and syntax highlighting of imports
is more important anyway
2019-07-04 23:09:09 +03:00
csmoe
44363cd5d2 fix: clean up warnings
Change-Id: I91a468f6e846ac28574825b8ee7aa02fbff68f63
2019-06-06 10:06:46 +08:00
Alan Du
b28ca32db2 Fix clippy::or_fun_call 2019-06-04 18:05:07 -04:00
Alan Du
40424d4222 Fix clippy::identity_conversion 2019-06-04 18:05:07 -04:00
Alan Du
619a615298 Fix clippy::len_zero 2019-06-04 18:05:07 -04:00
Edwin Cheng
54ea251bd4 Store referece in tokenbuffer 2019-06-03 00:54:33 +08:00
Aleksey Kladov
61e1474ab3 fix typos in mbe tests 2019-05-28 18:46:11 +03:00
Aleksey Kladov
2e3f5af9d4 move mbe to the new API 2019-05-28 17:39:01 +03:00
Aleksey Kladov
1cece9f219 return errors from tree builder 2019-05-28 16:26:14 +03:00
Edwin Cheng
464a00814c Use cfg(test) instead of allow(unused) 2019-05-28 10:55:08 +08:00
Edwin Cheng
a3b9aecc9b Minor use module 2019-05-28 00:54:32 +08:00
Edwin Cheng
98aac6b751 Simpliy how collecting token from src 2019-05-28 00:38:55 +08:00
Edwin Cheng
d833ded3b4 Remove Queier and SubtreeWalk 2019-05-27 23:20:43 +08:00
Edwin Cheng
90764fc54b Remove duplicated code 2019-05-26 02:41:00 +08:00
Edwin Cheng
816147c4b5 Simplify token_tree_to_xxx 2019-05-25 21:55:46 +08:00
Edwin Cheng
fcb1eef323 Change TokenSource to iteration based 2019-05-25 20:41:03 +08:00
Edwin Cheng
27ae626cfb Formatting 2019-05-23 09:31:36 +08:00
Edwin Cheng
dd50ca7c5e Refactor SubtreeSource 2019-05-23 02:23:56 +08:00
Edwin Cheng
ad9d2012de Fix match literal 2019-05-20 18:29:02 +08:00
Sergey Parilin
993abedd77 apply T! macro where it is possible 2019-05-15 15:35:47 +03:00
Edwin Cheng
10ecb11ff5 Error out non single root token tree conversion 2019-05-14 07:59:28 +08:00
Edwin Cheng
a48e33f139 Fixed missing empty vars 2019-05-05 10:32:57 +08:00
Edwin Cheng
1a3800df60 Fix $true and $false as $var name error 2019-05-05 00:49:50 +08:00
Edwin Cheng
50f288db92 Add test 2019-05-04 22:32:48 +08:00
Edwin Cheng
0c4efbb2b6 Error out when parse_subtree is not a subtree 2019-05-04 21:57:20 +08:00
Edwin Cheng
036141663b Quote the quoted comment 2019-05-04 19:34:02 +08:00
Edwin Cheng
048f12d9f0 Use explict escape_default instead of dbg print 2019-05-04 17:03:22 +08:00
Edwin Cheng
e7e896170a Convert doc comment to attr 2019-05-04 15:00:16 +08:00
Edwin Cheng
4ba4747578 Mark unused mbe variable as Binding::Empty 2019-05-04 01:14:25 +08:00
Edwin Cheng
31909cc7d7 By pass unbind $var while mbe expanding 2019-05-03 23:23:21 +08:00
Edwin Cheng
e8e46100d6 Refactor out tests module and remove empty subtree 2019-05-03 21:38:00 +08:00
Edwin Cheng
11d6a1449d Fixed old incorrect test 2019-05-03 00:20:27 +08:00
Edwin Cheng
ab91050d49 Fix typo 2019-05-03 00:01:48 +08:00
Edwin Cheng
91745c62f8 Compare text instead 2019-05-02 23:59:13 +08:00
Edwin Cheng
1446d620c5 Add empty bindings and some refactoring 2019-05-02 23:23:14 +08:00
Edwin Cheng
35c4633150 Make vis matcher optional and fix typo 2019-05-02 21:24:51 +08:00
Edwin Cheng
779676f782 Remove unused code in subtree_source 2019-05-02 10:19:12 +08:00
Edwin Cheng
a7ef9bac4e Formating 2019-05-02 10:08:11 +08:00
Edwin Cheng
6b2985ebc7 Remove unused code and add space bewteen tt 2019-05-02 10:02:17 +08:00
Edwin Cheng
d436ab0581 Refactor parser handle mult-char punct internally 2019-04-28 23:46:03 +08:00
Edwin Cheng
1908819bf6 Use panic instead of unwrap 2019-04-26 02:56:44 +08:00
Edwin Cheng
c55a2dbc1d Fix more bugs 2019-04-26 02:03:56 +08:00
Edwin Cheng
299d97b6d9 Add handling token seperator in mbe 2019-04-26 02:03:55 +08:00
Edwin Cheng
e4e2338f97 Fix incorrect repeat sep eating 2019-04-26 02:03:55 +08:00
Edwin Cheng
fccd045229 Add cached for SubtreeSource 2019-04-22 22:46:39 +08:00