aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar.rs
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-04-18 20:49:56 +0100
committerEdwin Cheng <[email protected]>2019-04-18 20:49:56 +0100
commitc0f19d70056fada5f381019694d893e0ffe8360a (patch)
tree4837619368155d49c7540f035c6eb76d8d50ea6b /crates/ra_parser/src/grammar.rs
parent3ff5440a503f090032136c37c3d44375d6107db1 (diff)
Add expr, pat, ty and macro_stmts
Diffstat (limited to 'crates/ra_parser/src/grammar.rs')
-rw-r--r--crates/ra_parser/src/grammar.rs20
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
58pub(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
58pub(crate) fn path(p: &mut Parser) { 73pub(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
74pub(crate) fn stmt(p: &mut Parser, with_semi: bool) { 89pub(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