diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-25 19:59:34 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-25 19:59:34 +0100 |
commit | 42c4e0f378faeabd425392d4a7a7839bd7e8ac2f (patch) | |
tree | f48081403383b7a00a3c297b2ff24a7c11ddd07e /crates/ra_parser/src | |
parent | 5bbd9f43cc217a44445fde91b4b53ca85d78cd92 (diff) | |
parent | 1908819bf6432016527f4bd3b0f22500b85cab5f (diff) |
Merge #1209
1209: Bugs fixes And Improvements of MBE r=matklad a=edwin0cheng
This PR fixed / improve followings things:
* Add `token` `$repeat` separator support: Previously $repeat only support single punct separator.
* Fixed a bug which expand infinite pattern, see `test_match_group_in_group`
* Correctly handle +,*,? case of $repeat patterns
* Increase the limit of $repeat patterns (128 => 65536), personally i think we could remove this limit as we seem to fix all major loop bugs
* **Re-enable tt matcher**
* Better meta item parsing.
* Add related tests and add some real world test cases.
* Add more debug information.
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/ra_parser/src')
-rw-r--r-- | crates/ra_parser/src/grammar.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index 67eae749d..a538ec081 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs | |||
@@ -119,7 +119,22 @@ pub(crate) fn meta_item(p: &mut Parser) { | |||
119 | items::token_tree(p); | 119 | items::token_tree(p); |
120 | break; | 120 | break; |
121 | } else { | 121 | } else { |
122 | p.bump(); | 122 | // https://doc.rust-lang.org/reference/attributes.html |
123 | // https://doc.rust-lang.org/reference/paths.html#simple-paths | ||
124 | // The start of an meta must be a simple path | ||
125 | match p.current() { | ||
126 | IDENT | COLONCOLON | SUPER_KW | SELF_KW | CRATE_KW => p.bump(), | ||
127 | EQ => { | ||
128 | p.bump(); | ||
129 | match p.current() { | ||
130 | c if c.is_literal() => p.bump(), | ||
131 | TRUE_KW | FALSE_KW => p.bump(), | ||
132 | _ => {} | ||
133 | } | ||
134 | break; | ||
135 | } | ||
136 | _ => break, | ||
137 | } | ||
123 | } | 138 | } |
124 | } | 139 | } |
125 | 140 | ||