diff options
author | Edwin Cheng <[email protected]> | 2019-04-18 19:47:29 +0100 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2019-04-18 19:47:29 +0100 |
commit | 3ff5440a503f090032136c37c3d44375d6107db1 (patch) | |
tree | 6da9635a94f8fe11c74eb06ceec89cf215dbe78c /crates/ra_parser | |
parent | 403cd78baee7e9c2410d04ca0304575e7bbab16d (diff) |
Add MacroItems and MacroStmts in grammer.ron
Diffstat (limited to 'crates/ra_parser')
-rw-r--r-- | crates/ra_parser/src/grammar.rs | 6 | ||||
-rw-r--r-- | crates/ra_parser/src/lib.rs | 4 | ||||
-rw-r--r-- | crates/ra_parser/src/syntax_kind/generated.rs | 4 |
3 files changed, 14 insertions, 0 deletions
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index f8ed1299a..1adc27b80 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs | |||
@@ -49,6 +49,12 @@ 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 | |||
52 | pub(crate) fn path(p: &mut Parser) { | 58 | pub(crate) fn path(p: &mut Parser) { |
53 | paths::type_path(p); | 59 | paths::type_path(p); |
54 | } | 60 | } |
diff --git a/crates/ra_parser/src/lib.rs b/crates/ra_parser/src/lib.rs index 11b5b9a75..d6bcc4d8c 100644 --- a/crates/ra_parser/src/lib.rs +++ b/crates/ra_parser/src/lib.rs | |||
@@ -98,6 +98,10 @@ pub fn parse_item(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink) | |||
98 | parse_from_tokens(token_source, tree_sink, grammar::item); | 98 | parse_from_tokens(token_source, tree_sink, grammar::item); |
99 | } | 99 | } |
100 | 100 | ||
101 | pub fn parse_macro_items(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink) { | ||
102 | parse_from_tokens(token_source, tree_sink, grammar::macro_items); | ||
103 | } | ||
104 | |||
101 | /// A parsing function for a specific braced-block. | 105 | /// A parsing function for a specific braced-block. |
102 | pub struct Reparser(fn(&mut parser::Parser)); | 106 | pub struct Reparser(fn(&mut parser::Parser)); |
103 | 107 | ||
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index 498b0e164..6f984aea1 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs | |||
@@ -233,6 +233,8 @@ pub enum SyntaxKind { | |||
233 | ARG_LIST, | 233 | ARG_LIST, |
234 | TYPE_BOUND, | 234 | TYPE_BOUND, |
235 | TYPE_BOUND_LIST, | 235 | TYPE_BOUND_LIST, |
236 | MACRO_ITEMS, | ||
237 | MACRO_STMTS, | ||
236 | // Technical kind so that we can cast from u16 safely | 238 | // Technical kind so that we can cast from u16 safely |
237 | #[doc(hidden)] | 239 | #[doc(hidden)] |
238 | __LAST, | 240 | __LAST, |
@@ -592,6 +594,8 @@ impl SyntaxKind { | |||
592 | ARG_LIST => &SyntaxInfo { name: "ARG_LIST" }, | 594 | ARG_LIST => &SyntaxInfo { name: "ARG_LIST" }, |
593 | TYPE_BOUND => &SyntaxInfo { name: "TYPE_BOUND" }, | 595 | TYPE_BOUND => &SyntaxInfo { name: "TYPE_BOUND" }, |
594 | TYPE_BOUND_LIST => &SyntaxInfo { name: "TYPE_BOUND_LIST" }, | 596 | TYPE_BOUND_LIST => &SyntaxInfo { name: "TYPE_BOUND_LIST" }, |
597 | MACRO_ITEMS => &SyntaxInfo { name: "MACRO_ITEMS" }, | ||
598 | MACRO_STMTS => &SyntaxInfo { name: "MACRO_STMTS" }, | ||
595 | TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, | 599 | TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, |
596 | EOF => &SyntaxInfo { name: "EOF" }, | 600 | EOF => &SyntaxInfo { name: "EOF" }, |
597 | __LAST => &SyntaxInfo { name: "__LAST" }, | 601 | __LAST => &SyntaxInfo { name: "__LAST" }, |