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
Edwin Cheng
bb84fce1a4
Remove unused print out
2019-04-22 20:21:14 +08:00
Edwin Cheng
1cdfc38066
Add a test for #1178 case
2019-04-22 20:14:46 +08:00
Edwin Cheng
b177813f3b
Add mbe expand limit and poision macro set
2019-04-22 15:33:55 +08:00
Edwin Cheng
120bfde3c2
Add tests
2019-04-22 05:04:37 +08:00
Edwin Cheng
3d1cdc834d
Fix offset bug in SourceWalker
2019-04-22 05:04:37 +08:00
Edwin Cheng
49c9686c3c
Handle *+
case and single token case
2019-04-22 05:04:37 +08:00
Edwin Cheng
bcf5cf8ac6
fix mbe_parser rhs colon parsing
2019-04-22 05:04:37 +08:00
Edwin Cheng
da05bbcfb1
Fix lifetime in tt to syntax node conversion
2019-04-22 05:04:36 +08:00
Edwin Cheng
9e35bf91b8
Fix bugs
2019-04-20 23:53:39 +08:00
Edwin Cheng
210c762fe6
Disable test_tt_xx
2019-04-20 02:41:13 +08:00
Edwin Cheng
41c1a639c3
Disable tt matcher
2019-04-20 02:19:46 +08:00
Edwin Cheng
1afde29adb
Add back missing assert
2019-04-19 21:52:54 +08:00
Edwin Cheng
763569017a
Fix bug for ident to lifetime
2019-04-19 21:43:41 +08:00
Edwin Cheng
87ff908135
Add vis matcher
2019-04-19 21:38:26 +08:00
Edwin Cheng
c5983b85fc
Add literal matcher
2019-04-19 21:21:47 +08:00
Edwin Cheng
313854c728
Add lifetime matcher
2019-04-19 21:15:19 +08:00
Edwin Cheng
59b6cc780b
add tt matcher
2019-04-19 19:41:59 +08:00
Edwin Cheng
762819864f
add block matcher
2019-04-19 19:33:29 +08:00
Edwin Cheng
8092b6487f
Add block matcher
2019-04-19 18:30:43 +08:00
bors[bot]
ab0a96586f
Merge #1148
...
1148: Add token_tree_to_xxx functions r=matklad a=edwin0cheng
<del>As discus in PR #1147 , this PR added a `mbe::MacroKind` .
Currently only 2 kind of macro are supported, `SourceFile` and `Block`.</del>
Added following functions for `tt::TokenTree` and `ast::Node` conversion:
* token_tree_to_expr
* token_tree_to_pat
* token_tree_to_ty
* token_tree_to_macro_stmts
* token_tree_to_macro_items
And added two new syntax kind:
* MACRO_ITEMS
* MACRO_STMTS
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-04-19 08:56:39 +00:00
Edwin Cheng
a6d51e0961
Return Result for token_tree_to_xx functions
2019-04-19 04:03:22 +08:00
Edwin Cheng
c0f19d7005
Add expr, pat, ty and macro_stmts
2019-04-19 03:49:56 +08:00
Edwin Cheng
3ff5440a50
Add MacroItems and MacroStmts in grammer.ron
2019-04-19 02:47:29 +08:00
Edwin Cheng
e8ddeb869d
Fix missing last token in mbe $repeat parsing
2019-04-18 23:33:54 +08:00
Edwin Cheng
e944fd059d
Add item
matcher in mbe
2019-04-18 10:21:36 +08:00
Edwin Cheng
57e4122b89
Add mbe stmt matcher
2019-04-17 12:34:43 +08:00
Edwin Cheng
6646d49f23
Fix bug and add expr , pat , ty matcher
2019-04-14 11:42:20 +08:00
Edwin Cheng
f66300ccd1
Remove skip Delimiter::None and handle Dollars
2019-04-13 01:50:05 +08:00
Edwin Cheng
8ed7104578
Refactoring and add some docs
2019-04-08 20:32:21 +08:00
Edwin Cheng
c785c7312d
Fixed infintite loop bug
2019-04-08 19:21:07 +08:00
Edwin Cheng
184e9ea230
Fixed empty node bug
2019-04-08 18:21:48 +08:00
Edwin Cheng
2697ecaa64
Use SubtreeWalker instread of flatten TtToken
2019-04-08 15:58:02 +08:00
Edwin Cheng
a7254201df
Combine all tokensource to one and refactoring
2019-04-08 00:12:07 +08:00
Edwin Cheng
7f1e93a3c9
Refactoring subtree_source
2019-04-07 21:42:53 +08:00
Edwin Cheng
aac9dfa464
Add TtCursorTokenSource and TtCursorTokenSink
2019-04-06 20:14:28 +08:00
Edwin Cheng
1d7735fbc6
Add path test and empty eat_path handling
2019-04-06 12:12:32 +08:00
Edwin Cheng
7abc06bd57
Add proper test for literals and fixed typo bug
2019-04-05 20:58:24 +08:00
Edwin Cheng
1ea0238e53
Add classify_literal and undo expose next_token
2019-04-05 18:45:19 +08:00
Edwin Cheng
1ab78d6056
Fix literal support in token tree to ast item list
2019-04-05 18:23:01 +08:00
Edwin Cheng
6ff16c7ad9
Clean up
2019-04-05 03:54:18 +08:00
Edwin Cheng
c23408751c
Add multi-byte token support in tkn tree to ast
2019-04-05 03:39:54 +08:00
Aleksey Kladov
7d6bd5d137
always show token text
2019-04-02 14:49:46 +03:00
Aleksey Kladov
9e213385c9
switch to new rowan
2019-04-01 12:06:24 +03:00
Aleksey Kladov
d4449945a0
hack around non-terminating macro expansion
2019-03-17 12:52:52 +03:00
Aleksey Kladov
182c05a96c
add name resolution from the old impl
...
unlike the old impl, this also handles macro imports across crates
2019-03-17 12:46:13 +03:00
Wilco Kusee
c9d6efc468
Add expander unit tests
2019-03-03 20:33:50 +01:00
Wilco Kusee
d149bb885b
Add parser unit tests
2019-03-03 12:45:30 +01:00
Wilco Kusee
725805dc79
Split parse and expand errors
2019-03-03 10:40:03 +01:00
Wilco Kusee
dffe318701
Formatting
2019-03-02 20:49:13 +01:00
Wilco Kusee
d3a252b559
Replace option with result in mbe
2019-03-02 20:30:13 +01:00
Dale Wijnand
ffca2c1fe4
Fix a typo
2019-02-26 17:59:32 +00:00
Aleksey Kladov
81bca78349
rename
2019-02-24 13:14:14 +03:00
Aleksey Kladov
8cf156d85b
Add a test for macro parsing
2019-02-23 17:51:23 +03:00
Aleksey Kladov
8eac450f41
implement tt -> ast
2019-02-23 17:21:56 +03:00
Aleksey Kladov
83d6be6cec
keep-text
2019-02-23 16:55:18 +03:00
Aleksey Kladov
71b8a874e7
flatten tt
2019-02-23 16:55:18 +03:00
Aleksey Kladov
10deefd371
token source scaffold
2019-02-23 16:55:18 +03:00
Aleksey Kladov
e9cafafbc2
add dependency on the parser
2019-02-23 16:55:18 +03:00
Aleksey Kladov
60373aa504
add interface
2019-02-23 16:55:18 +03:00
Pascal Hertleif
4fd3613434
Fix some typos
2019-02-12 15:02:57 +01:00
Aleksey Kladov
ae312680d6
docs
2019-02-11 21:31:54 +03:00
Aleksey Kladov
0d34a256de
assign ids when converting tt
2019-02-11 21:12:06 +03:00
Aleksey Kladov
58897dd8dd
assign ids to tokens
2019-02-11 21:02:19 +03:00
bors[bot]
77ccac74f9
Merge #790
...
790: make macro-rules eq r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-02-11 16:24:39 +00:00
Aleksey Kladov
e7b370226c
make macro-rules eq
2019-02-11 19:19:23 +03:00
Aleksey Kladov
dc951098f6
typo
2019-02-11 19:09:53 +03:00
Ville Penttinen
710975ecd8
Fix typo in Cargo.toml authors
...
Fixes typo introduced in #782
2019-02-11 10:20:04 +02:00
Ville Penttinen
ab3d231b1d
Update authors field in Cargo.tomls to "rust-analyzer developers"
...
This closes #777
2019-02-11 08:55:35 +02:00
Aleksey Kladov
12e3b4c70b
reformat the world
2019-02-08 14:49:43 +03:00
Aleksey Kladov
f5bb704568
avoid 'ignored' in test output
2019-02-08 14:34:30 +03:00
Jeff Muizelaar
a4b473226b
mbe: Ensure repetition separator matches
2019-02-04 20:19:23 -05:00
Jeff Muizelaar
0000f00787
mbe: Add support matching for matching idents
2019-02-03 19:43:37 -05:00