diff options
Diffstat (limited to 'crates/ra_parser')
-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 | ||