mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Add MacroItems and MacroStmts in grammer.ron
This commit is contained in:
parent
403cd78bae
commit
3ff5440a50
7 changed files with 132 additions and 8 deletions
|
@ -49,6 +49,12 @@ pub(crate) fn root(p: &mut Parser) {
|
|||
m.complete(p, SOURCE_FILE);
|
||||
}
|
||||
|
||||
pub(crate) fn macro_items(p: &mut Parser) {
|
||||
let m = p.start();
|
||||
items::mod_contents(p, false);
|
||||
m.complete(p, MACRO_ITEMS);
|
||||
}
|
||||
|
||||
pub(crate) fn path(p: &mut Parser) {
|
||||
paths::type_path(p);
|
||||
}
|
||||
|
|
|
@ -98,6 +98,10 @@ pub fn parse_item(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink)
|
|||
parse_from_tokens(token_source, tree_sink, grammar::item);
|
||||
}
|
||||
|
||||
pub fn parse_macro_items(token_source: &dyn TokenSource, tree_sink: &mut dyn TreeSink) {
|
||||
parse_from_tokens(token_source, tree_sink, grammar::macro_items);
|
||||
}
|
||||
|
||||
/// A parsing function for a specific braced-block.
|
||||
pub struct Reparser(fn(&mut parser::Parser));
|
||||
|
||||
|
|
|
@ -233,6 +233,8 @@ pub enum SyntaxKind {
|
|||
ARG_LIST,
|
||||
TYPE_BOUND,
|
||||
TYPE_BOUND_LIST,
|
||||
MACRO_ITEMS,
|
||||
MACRO_STMTS,
|
||||
// Technical kind so that we can cast from u16 safely
|
||||
#[doc(hidden)]
|
||||
__LAST,
|
||||
|
@ -592,6 +594,8 @@ impl SyntaxKind {
|
|||
ARG_LIST => &SyntaxInfo { name: "ARG_LIST" },
|
||||
TYPE_BOUND => &SyntaxInfo { name: "TYPE_BOUND" },
|
||||
TYPE_BOUND_LIST => &SyntaxInfo { name: "TYPE_BOUND_LIST" },
|
||||
MACRO_ITEMS => &SyntaxInfo { name: "MACRO_ITEMS" },
|
||||
MACRO_STMTS => &SyntaxInfo { name: "MACRO_STMTS" },
|
||||
TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" },
|
||||
EOF => &SyntaxInfo { name: "EOF" },
|
||||
__LAST => &SyntaxInfo { name: "__LAST" },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue