diff options
Diffstat (limited to 'crates/ra_parser/src/grammar.rs')
-rw-r--r-- | crates/ra_parser/src/grammar.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index f8ed1299a..e1762633e 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs | |||
@@ -49,6 +49,27 @@ pub(crate) fn root(p: &mut Parser) { | |||
49 | m.complete(p, SOURCE_FILE); | 49 | m.complete(p, SOURCE_FILE); |
50 | } | 50 | } |
51 | 51 | ||
52 | pub(crate) fn macro_items(p: &mut Parser) { | ||
53 | let m = p.start(); | ||
54 | items::mod_contents(p, false); | ||
55 | m.complete(p, MACRO_ITEMS); | ||
56 | } | ||
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 | |||
52 | pub(crate) fn path(p: &mut Parser) { | 73 | pub(crate) fn path(p: &mut Parser) { |
53 | paths::type_path(p); | 74 | paths::type_path(p); |
54 | } | 75 | } |
@@ -66,6 +87,11 @@ pub(crate) fn pattern(p: &mut Parser) { | |||
66 | } | 87 | } |
67 | 88 | ||
68 | 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 | |||
69 | expressions::stmt(p, with_semi) | 95 | expressions::stmt(p, with_semi) |
70 | } | 96 | } |
71 | 97 | ||