From c55a2dbc1de8ba42df57b70f652eb6a0c0bbc9f6 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Thu, 25 Apr 2019 23:12:57 +0800 Subject: Fix more bugs --- crates/ra_parser/src/grammar.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'crates/ra_parser') 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) { items::token_tree(p); break; } else { - p.bump(); + // https://doc.rust-lang.org/reference/attributes.html + // https://doc.rust-lang.org/reference/paths.html#simple-paths + // The start of an meta must be a simple path + match p.current() { + IDENT | COLONCOLON | SUPER_KW | SELF_KW | CRATE_KW => p.bump(), + EQ => { + p.bump(); + match p.current() { + c if c.is_literal() => p.bump(), + TRUE_KW | FALSE_KW => p.bump(), + _ => {} + } + break; + } + _ => break, + } } } -- cgit v1.2.3