diff options
Diffstat (limited to 'crates/ra_parser/src/grammar.rs')
-rw-r--r-- | crates/ra_parser/src/grammar.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index 1adc27b80..e1762633e 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs | |||
@@ -55,6 +55,21 @@ pub(crate) fn macro_items(p: &mut Parser) { | |||
55 | m.complete(p, MACRO_ITEMS); | 55 | m.complete(p, MACRO_ITEMS); |
56 | } | 56 | } |
57 | 57 | ||
58 | pub(crate) fn macro_stmts(p: &mut Parser) { | ||
59 | let m = p.start(); | ||
60 | |||
61 | while !p.at(EOF) { | ||
62 | if p.current() == SEMI { | ||
63 | p.bump(); | ||
64 | continue; | ||
65 | } | ||
66 | |||
67 | expressions::stmt(p, expressions::StmtWithSemi::Optional); | ||
68 | } | ||
69 | |||
70 | m.complete(p, MACRO_STMTS); | ||
71 | } | ||
72 | |||
58 | pub(crate) fn path(p: &mut Parser) { | 73 | pub(crate) fn path(p: &mut Parser) { |
59 | paths::type_path(p); | 74 | paths::type_path(p); |
60 | } | 75 | } |
@@ -72,6 +87,11 @@ pub(crate) fn pattern(p: &mut Parser) { | |||
72 | } | 87 | } |
73 | 88 | ||
74 | pub(crate) fn stmt(p: &mut Parser, with_semi: bool) { | 89 | pub(crate) fn stmt(p: &mut Parser, with_semi: bool) { |
90 | let with_semi = match with_semi { | ||
91 | true => expressions::StmtWithSemi::Yes, | ||
92 | false => expressions::StmtWithSemi::No, | ||
93 | }; | ||
94 | |||
75 | expressions::stmt(p, with_semi) | 95 | expressions::stmt(p, with_semi) |
76 | } | 96 | } |
77 | 97 | ||