mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-27 12:25:05 +00:00
Merge #5582
5582: Finish Module grammar r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
74864d560b
47 changed files with 172 additions and 129 deletions
|
@ -112,7 +112,7 @@ fn add_missing_impl_members_inner(
|
||||||
) -> Option<()> {
|
) -> Option<()> {
|
||||||
let _p = ra_prof::profile("add_missing_impl_members_inner");
|
let _p = ra_prof::profile("add_missing_impl_members_inner");
|
||||||
let impl_def = ctx.find_node_at_offset::<ast::ImplDef>()?;
|
let impl_def = ctx.find_node_at_offset::<ast::ImplDef>()?;
|
||||||
let impl_item_list = impl_def.item_list()?;
|
let impl_item_list = impl_def.assoc_item_list()?;
|
||||||
|
|
||||||
let trait_ = resolve_target_trait(&ctx.sema, &impl_def)?;
|
let trait_ = resolve_target_trait(&ctx.sema, &impl_def)?;
|
||||||
|
|
||||||
|
@ -121,6 +121,7 @@ fn add_missing_impl_members_inner(
|
||||||
ast::AssocItem::FnDef(def) => def.name(),
|
ast::AssocItem::FnDef(def) => def.name(),
|
||||||
ast::AssocItem::TypeAliasDef(def) => def.name(),
|
ast::AssocItem::TypeAliasDef(def) => def.name(),
|
||||||
ast::AssocItem::ConstDef(def) => def.name(),
|
ast::AssocItem::ConstDef(def) => def.name(),
|
||||||
|
ast::AssocItem::MacroCall(_) => None,
|
||||||
}
|
}
|
||||||
.map(|it| it.text().clone())
|
.map(|it| it.text().clone())
|
||||||
};
|
};
|
||||||
|
|
|
@ -158,7 +158,7 @@ fn find_struct_impl(ctx: &AssistContext, strukt: &ast::StructDef) -> Option<Opti
|
||||||
}
|
}
|
||||||
|
|
||||||
fn has_new_fn(imp: &ast::ImplDef) -> bool {
|
fn has_new_fn(imp: &ast::ImplDef) -> bool {
|
||||||
if let Some(il) = imp.item_list() {
|
if let Some(il) = imp.assoc_item_list() {
|
||||||
for item in il.assoc_items() {
|
for item in il.assoc_items() {
|
||||||
if let ast::AssocItem::FnDef(f) = item {
|
if let ast::AssocItem::FnDef(f) = item {
|
||||||
if let Some(name) = f.name() {
|
if let Some(name) = f.name() {
|
||||||
|
|
|
@ -38,8 +38,8 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext
|
||||||
let anchor = match_ast! {
|
let anchor = match_ast! {
|
||||||
match parent {
|
match parent {
|
||||||
ast::FnDef(it) => it.body()?.syntax().clone().into(),
|
ast::FnDef(it) => it.body()?.syntax().clone().into(),
|
||||||
ast::TraitDef(it) => it.item_list()?.syntax().clone().into(),
|
ast::TraitDef(it) => it.assoc_item_list()?.syntax().clone().into(),
|
||||||
ast::ImplDef(it) => it.item_list()?.syntax().clone().into(),
|
ast::ImplDef(it) => it.assoc_item_list()?.syntax().clone().into(),
|
||||||
ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(),
|
ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(),
|
||||||
ast::StructDef(it) => {
|
ast::StructDef(it) => {
|
||||||
it.syntax().children_with_tokens()
|
it.syntax().children_with_tokens()
|
||||||
|
|
|
@ -63,7 +63,7 @@ pub fn get_missing_assoc_items(
|
||||||
let mut impl_fns_consts = FxHashSet::default();
|
let mut impl_fns_consts = FxHashSet::default();
|
||||||
let mut impl_type = FxHashSet::default();
|
let mut impl_type = FxHashSet::default();
|
||||||
|
|
||||||
if let Some(item_list) = impl_def.item_list() {
|
if let Some(item_list) = impl_def.assoc_item_list() {
|
||||||
for item in item_list.assoc_items() {
|
for item in item_list.assoc_items() {
|
||||||
match item {
|
match item {
|
||||||
ast::AssocItem::FnDef(f) => {
|
ast::AssocItem::FnDef(f) => {
|
||||||
|
@ -83,6 +83,7 @@ pub fn get_missing_assoc_items(
|
||||||
impl_fns_consts.insert(n.syntax().to_string());
|
impl_fns_consts.insert(n.syntax().to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ast::AssocItem::MacroCall(_) => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,13 +153,12 @@ impl Ctx {
|
||||||
self.forced_visibility = forced_vis;
|
self.forced_visibility = forced_vis;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn lower_assoc_item(&mut self, item: &ast::Item) -> Option<AssocItem> {
|
fn lower_assoc_item(&mut self, item: &ast::AssocItem) -> Option<AssocItem> {
|
||||||
match item {
|
match item {
|
||||||
ast::Item::FnDef(ast) => self.lower_function(ast).map(Into::into),
|
ast::AssocItem::FnDef(ast) => self.lower_function(ast).map(Into::into),
|
||||||
ast::Item::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into),
|
ast::AssocItem::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into),
|
||||||
ast::Item::ConstDef(ast) => Some(self.lower_const(ast).into()),
|
ast::AssocItem::ConstDef(ast) => Some(self.lower_const(ast).into()),
|
||||||
ast::Item::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into),
|
ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into),
|
||||||
_ => None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,9 +418,9 @@ impl Ctx {
|
||||||
let generic_params =
|
let generic_params =
|
||||||
self.lower_generic_params_and_inner_items(GenericsOwner::Trait(trait_def), trait_def);
|
self.lower_generic_params_and_inner_items(GenericsOwner::Trait(trait_def), trait_def);
|
||||||
let auto = trait_def.auto_token().is_some();
|
let auto = trait_def.auto_token().is_some();
|
||||||
let items = trait_def.item_list().map(|list| {
|
let items = trait_def.assoc_item_list().map(|list| {
|
||||||
self.with_inherited_visibility(visibility, |this| {
|
self.with_inherited_visibility(visibility, |this| {
|
||||||
list.items()
|
list.assoc_items()
|
||||||
.filter_map(|item| {
|
.filter_map(|item| {
|
||||||
let attrs = Attrs::new(&item, &this.hygiene);
|
let attrs = Attrs::new(&item, &this.hygiene);
|
||||||
this.collect_inner_items(item.syntax());
|
this.collect_inner_items(item.syntax());
|
||||||
|
@ -454,9 +453,9 @@ impl Ctx {
|
||||||
|
|
||||||
// We cannot use `assoc_items()` here as that does not include macro calls.
|
// We cannot use `assoc_items()` here as that does not include macro calls.
|
||||||
let items = impl_def
|
let items = impl_def
|
||||||
.item_list()
|
.assoc_item_list()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flat_map(|it| it.items())
|
.flat_map(|it| it.assoc_items())
|
||||||
.filter_map(|item| {
|
.filter_map(|item| {
|
||||||
self.collect_inner_items(item.syntax());
|
self.collect_inner_items(item.syntax());
|
||||||
let assoc = self.lower_assoc_item(&item)?;
|
let assoc = self.lower_assoc_item(&item)?;
|
||||||
|
|
|
@ -18,26 +18,36 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut params = FxHashMap::default();
|
let mut params = FxHashMap::default();
|
||||||
|
|
||||||
let me = ctx.token.ancestors().find_map(ast::FnDef::cast);
|
let me = ctx.token.ancestors().find_map(ast::FnDef::cast);
|
||||||
for node in ctx.token.parent().ancestors() {
|
let mut process_fn = |func: ast::FnDef| {
|
||||||
let items = match_ast! {
|
|
||||||
match node {
|
|
||||||
ast::SourceFile(it) => it.items(),
|
|
||||||
ast::ItemList(it) => it.items(),
|
|
||||||
_ => continue,
|
|
||||||
}
|
|
||||||
};
|
|
||||||
for item in items {
|
|
||||||
if let ast::Item::FnDef(func) = item {
|
|
||||||
if Some(&func) == me.as_ref() {
|
if Some(&func) == me.as_ref() {
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
func.param_list().into_iter().flat_map(|it| it.params()).for_each(|param| {
|
func.param_list().into_iter().flat_map(|it| it.params()).for_each(|param| {
|
||||||
let text = param.syntax().text().to_string();
|
let text = param.syntax().text().to_string();
|
||||||
params.entry(text).or_insert(param);
|
params.entry(text).or_insert(param);
|
||||||
})
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
for node in ctx.token.parent().ancestors() {
|
||||||
|
match_ast! {
|
||||||
|
match node {
|
||||||
|
ast::SourceFile(it) => it.items().filter_map(|item| match item {
|
||||||
|
ast::Item::FnDef(it) => Some(it),
|
||||||
|
_ => None,
|
||||||
|
}).for_each(&mut process_fn),
|
||||||
|
ast::ItemList(it) => it.items().filter_map(|item| match item {
|
||||||
|
ast::Item::FnDef(it) => Some(it),
|
||||||
|
_ => None,
|
||||||
|
}).for_each(&mut process_fn),
|
||||||
|
ast::AssocItemList(it) => it.assoc_items().filter_map(|item| match item {
|
||||||
|
ast::AssocItem::FnDef(it) => Some(it),
|
||||||
|
_ => None,
|
||||||
|
}).for_each(&mut process_fn),
|
||||||
|
_ => continue,
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
params
|
params
|
||||||
|
|
|
@ -66,27 +66,24 @@ pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
|
||||||
add_keyword(ctx, acc, "fn", "fn $0() {}")
|
add_keyword(ctx, acc, "fn", "fn $0() {}")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.has_item_list_or_source_file_parent && !has_trait_or_impl_parent)
|
if (ctx.has_item_list_or_source_file_parent) || ctx.block_expr_parent {
|
||||||
|| ctx.block_expr_parent
|
|
||||||
{
|
|
||||||
add_keyword(ctx, acc, "trait", "trait $0 {}");
|
add_keyword(ctx, acc, "trait", "trait $0 {}");
|
||||||
add_keyword(ctx, acc, "impl", "impl $0 {}");
|
add_keyword(ctx, acc, "impl", "impl $0 {}");
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ctx.has_item_list_or_source_file_parent || ctx.block_expr_parent {
|
if ctx.has_item_list_or_source_file_parent || has_trait_or_impl_parent || ctx.block_expr_parent
|
||||||
|
{
|
||||||
add_keyword(ctx, acc, "fn", "fn $0() {}");
|
add_keyword(ctx, acc, "fn", "fn $0() {}");
|
||||||
}
|
}
|
||||||
if (ctx.has_item_list_or_source_file_parent && !has_trait_or_impl_parent)
|
if (ctx.has_item_list_or_source_file_parent) || ctx.block_expr_parent {
|
||||||
|| ctx.block_expr_parent
|
|
||||||
{
|
|
||||||
add_keyword(ctx, acc, "use", "use ");
|
add_keyword(ctx, acc, "use", "use ");
|
||||||
add_keyword(ctx, acc, "impl", "impl $0 {}");
|
add_keyword(ctx, acc, "impl", "impl $0 {}");
|
||||||
add_keyword(ctx, acc, "trait", "trait $0 {}");
|
add_keyword(ctx, acc, "trait", "trait $0 {}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.has_item_list_or_source_file_parent && !has_trait_or_impl_parent {
|
if ctx.has_item_list_or_source_file_parent {
|
||||||
add_keyword(ctx, acc, "enum", "enum $0 {}");
|
add_keyword(ctx, acc, "enum", "enum $0 {}");
|
||||||
add_keyword(ctx, acc, "struct", "struct $0");
|
add_keyword(ctx, acc, "struct", "struct $0");
|
||||||
add_keyword(ctx, acc, "union", "union $0 {}");
|
add_keyword(ctx, acc, "union", "union $0 {}");
|
||||||
|
@ -108,29 +105,28 @@ pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
|
||||||
add_keyword(ctx, acc, "else", "else {$0}");
|
add_keyword(ctx, acc, "else", "else {$0}");
|
||||||
add_keyword(ctx, acc, "else if", "else if $0 {}");
|
add_keyword(ctx, acc, "else if", "else if $0 {}");
|
||||||
}
|
}
|
||||||
if (ctx.has_item_list_or_source_file_parent && !has_trait_or_impl_parent)
|
if (ctx.has_item_list_or_source_file_parent) || ctx.block_expr_parent {
|
||||||
|| ctx.block_expr_parent
|
|
||||||
{
|
|
||||||
add_keyword(ctx, acc, "mod", "mod $0 {}");
|
add_keyword(ctx, acc, "mod", "mod $0 {}");
|
||||||
}
|
}
|
||||||
if ctx.bind_pat_parent || ctx.ref_pat_parent {
|
if ctx.bind_pat_parent || ctx.ref_pat_parent {
|
||||||
add_keyword(ctx, acc, "mut", "mut ");
|
add_keyword(ctx, acc, "mut", "mut ");
|
||||||
}
|
}
|
||||||
if ctx.has_item_list_or_source_file_parent || ctx.block_expr_parent {
|
if ctx.has_item_list_or_source_file_parent || has_trait_or_impl_parent || ctx.block_expr_parent
|
||||||
|
{
|
||||||
add_keyword(ctx, acc, "const", "const ");
|
add_keyword(ctx, acc, "const", "const ");
|
||||||
add_keyword(ctx, acc, "type", "type ");
|
add_keyword(ctx, acc, "type", "type ");
|
||||||
}
|
}
|
||||||
if (ctx.has_item_list_or_source_file_parent && !has_trait_or_impl_parent)
|
if (ctx.has_item_list_or_source_file_parent) || ctx.block_expr_parent {
|
||||||
|| ctx.block_expr_parent
|
|
||||||
{
|
|
||||||
add_keyword(ctx, acc, "static", "static ");
|
add_keyword(ctx, acc, "static", "static ");
|
||||||
};
|
};
|
||||||
if (ctx.has_item_list_or_source_file_parent && !has_trait_or_impl_parent)
|
if (ctx.has_item_list_or_source_file_parent) || ctx.block_expr_parent {
|
||||||
|| ctx.block_expr_parent
|
|
||||||
{
|
|
||||||
add_keyword(ctx, acc, "extern", "extern ");
|
add_keyword(ctx, acc, "extern", "extern ");
|
||||||
}
|
}
|
||||||
if ctx.has_item_list_or_source_file_parent || ctx.block_expr_parent || ctx.is_match_arm {
|
if ctx.has_item_list_or_source_file_parent
|
||||||
|
|| has_trait_or_impl_parent
|
||||||
|
|| ctx.block_expr_parent
|
||||||
|
|| ctx.is_match_arm
|
||||||
|
{
|
||||||
add_keyword(ctx, acc, "unsafe", "unsafe ");
|
add_keyword(ctx, acc, "unsafe", "unsafe ");
|
||||||
}
|
}
|
||||||
if ctx.in_loop_body {
|
if ctx.in_loop_body {
|
||||||
|
@ -142,7 +138,7 @@ pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
|
||||||
add_keyword(ctx, acc, "break", "break");
|
add_keyword(ctx, acc, "break", "break");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ctx.has_item_list_or_source_file_parent && !ctx.has_trait_parent {
|
if ctx.has_item_list_or_source_file_parent || ctx.has_impl_parent {
|
||||||
add_keyword(ctx, acc, "pub", "pub ")
|
add_keyword(ctx, acc, "pub", "pub ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ use crate::completion::test_utils::check_pattern_is_applicable;
|
||||||
|
|
||||||
pub(crate) fn has_trait_parent(element: SyntaxElement) -> bool {
|
pub(crate) fn has_trait_parent(element: SyntaxElement) -> bool {
|
||||||
not_same_range_ancestor(element)
|
not_same_range_ancestor(element)
|
||||||
.filter(|it| it.kind() == ITEM_LIST)
|
.filter(|it| it.kind() == ASSOC_ITEM_LIST)
|
||||||
.and_then(|it| it.parent())
|
.and_then(|it| it.parent())
|
||||||
.filter(|it| it.kind() == TRAIT_DEF)
|
.filter(|it| it.kind() == TRAIT_DEF)
|
||||||
.is_some()
|
.is_some()
|
||||||
|
@ -25,7 +25,7 @@ fn test_has_trait_parent() {
|
||||||
|
|
||||||
pub(crate) fn has_impl_parent(element: SyntaxElement) -> bool {
|
pub(crate) fn has_impl_parent(element: SyntaxElement) -> bool {
|
||||||
not_same_range_ancestor(element)
|
not_same_range_ancestor(element)
|
||||||
.filter(|it| it.kind() == ITEM_LIST)
|
.filter(|it| it.kind() == ASSOC_ITEM_LIST)
|
||||||
.and_then(|it| it.parent())
|
.and_then(|it| it.parent())
|
||||||
.filter(|it| it.kind() == IMPL_DEF)
|
.filter(|it| it.kind() == IMPL_DEF)
|
||||||
.is_some()
|
.is_some()
|
||||||
|
@ -73,7 +73,7 @@ pub(crate) fn has_item_list_or_source_file_parent(element: SyntaxElement) -> boo
|
||||||
#[test]
|
#[test]
|
||||||
fn test_has_item_list_or_source_file_parent() {
|
fn test_has_item_list_or_source_file_parent() {
|
||||||
check_pattern_is_applicable(r"i<|>", has_item_list_or_source_file_parent);
|
check_pattern_is_applicable(r"i<|>", has_item_list_or_source_file_parent);
|
||||||
check_pattern_is_applicable(r"impl { f<|> }", has_item_list_or_source_file_parent);
|
check_pattern_is_applicable(r"mod foo { f<|> }", has_item_list_or_source_file_parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn is_match_arm(element: SyntaxElement) -> bool {
|
pub(crate) fn is_match_arm(element: SyntaxElement) -> bool {
|
||||||
|
|
|
@ -149,12 +149,12 @@ pub(crate) fn reparser(
|
||||||
USE_TREE_LIST => items::use_tree_list,
|
USE_TREE_LIST => items::use_tree_list,
|
||||||
EXTERN_ITEM_LIST => items::extern_item_list,
|
EXTERN_ITEM_LIST => items::extern_item_list,
|
||||||
TOKEN_TREE if first_child? == T!['{'] => items::token_tree,
|
TOKEN_TREE if first_child? == T!['{'] => items::token_tree,
|
||||||
ITEM_LIST => match parent? {
|
ASSOC_ITEM_LIST => match parent? {
|
||||||
IMPL_DEF => items::impl_item_list,
|
IMPL_DEF => items::impl_item_list,
|
||||||
TRAIT_DEF => items::trait_item_list,
|
TRAIT_DEF => items::trait_item_list,
|
||||||
MODULE => items::mod_item_list,
|
|
||||||
_ => return None,
|
_ => return None,
|
||||||
},
|
},
|
||||||
|
ITEM_LIST => items::mod_item_list,
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
Some(res)
|
Some(res)
|
||||||
|
|
|
@ -50,7 +50,7 @@ pub(crate) fn trait_item_list(p: &mut Parser) {
|
||||||
item_or_macro(p, true, ItemFlavor::Trait);
|
item_or_macro(p, true, ItemFlavor::Trait);
|
||||||
}
|
}
|
||||||
p.expect(T!['}']);
|
p.expect(T!['}']);
|
||||||
m.complete(p, ITEM_LIST);
|
m.complete(p, ASSOC_ITEM_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
// test impl_def
|
// test impl_def
|
||||||
|
@ -107,7 +107,7 @@ pub(crate) fn impl_item_list(p: &mut Parser) {
|
||||||
item_or_macro(p, true, ItemFlavor::Mod);
|
item_or_macro(p, true, ItemFlavor::Mod);
|
||||||
}
|
}
|
||||||
p.expect(T!['}']);
|
p.expect(T!['}']);
|
||||||
m.complete(p, ITEM_LIST);
|
m.complete(p, ASSOC_ITEM_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
// test impl_type_params
|
// test impl_type_params
|
||||||
|
|
|
@ -213,6 +213,7 @@ pub enum SyntaxKind {
|
||||||
TUPLE_FIELD_DEF,
|
TUPLE_FIELD_DEF,
|
||||||
ENUM_VARIANT_LIST,
|
ENUM_VARIANT_LIST,
|
||||||
ITEM_LIST,
|
ITEM_LIST,
|
||||||
|
ASSOC_ITEM_LIST,
|
||||||
ATTR,
|
ATTR,
|
||||||
META_ITEM,
|
META_ITEM,
|
||||||
USE_TREE,
|
USE_TREE,
|
||||||
|
|
|
@ -80,9 +80,12 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ast::ItemList {
|
impl ast::AssocItemList {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn append_items(&self, items: impl IntoIterator<Item = ast::AssocItem>) -> ast::ItemList {
|
pub fn append_items(
|
||||||
|
&self,
|
||||||
|
items: impl IntoIterator<Item = ast::AssocItem>,
|
||||||
|
) -> ast::AssocItemList {
|
||||||
let mut res = self.clone();
|
let mut res = self.clone();
|
||||||
if !self.syntax().text().contains_char('\n') {
|
if !self.syntax().text().contains_char('\n') {
|
||||||
res = make_multiline(res);
|
res = make_multiline(res);
|
||||||
|
@ -92,7 +95,7 @@ impl ast::ItemList {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn append_item(&self, item: ast::AssocItem) -> ast::ItemList {
|
pub fn append_item(&self, item: ast::AssocItem) -> ast::AssocItemList {
|
||||||
let (indent, position) = match self.assoc_items().last() {
|
let (indent, position) = match self.assoc_items().last() {
|
||||||
Some(it) => (
|
Some(it) => (
|
||||||
leading_indent(it.syntax()).unwrap_or_default().to_string(),
|
leading_indent(it.syntax()).unwrap_or_default().to_string(),
|
||||||
|
|
|
@ -112,7 +112,7 @@ impl ImplDef {
|
||||||
pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
|
pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
|
||||||
pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
|
pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
|
||||||
pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
|
pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
|
||||||
pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
|
pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) }
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct MacroCall {
|
pub struct MacroCall {
|
||||||
|
@ -180,7 +180,7 @@ impl TraitDef {
|
||||||
pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
|
pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
|
||||||
pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) }
|
pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) }
|
||||||
pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) }
|
pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) }
|
||||||
pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) }
|
pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) }
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct TypeAliasDef {
|
pub struct TypeAliasDef {
|
||||||
|
@ -238,11 +238,6 @@ impl Visibility {
|
||||||
pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
|
pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct Abi {
|
|
||||||
pub(crate) syntax: SyntaxNode,
|
|
||||||
}
|
|
||||||
impl Abi {}
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
||||||
pub struct Name {
|
pub struct Name {
|
||||||
pub(crate) syntax: SyntaxNode,
|
pub(crate) syntax: SyntaxNode,
|
||||||
}
|
}
|
||||||
|
@ -250,6 +245,21 @@ impl Name {
|
||||||
pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
|
pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) }
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
|
pub struct ItemList {
|
||||||
|
pub(crate) syntax: SyntaxNode,
|
||||||
|
}
|
||||||
|
impl ast::AttrsOwner for ItemList {}
|
||||||
|
impl ast::ModuleItemOwner for ItemList {}
|
||||||
|
impl ItemList {
|
||||||
|
pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
|
||||||
|
pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
|
||||||
|
}
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
|
pub struct Abi {
|
||||||
|
pub(crate) syntax: SyntaxNode,
|
||||||
|
}
|
||||||
|
impl Abi {}
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct TypeParamList {
|
pub struct TypeParamList {
|
||||||
pub(crate) syntax: SyntaxNode,
|
pub(crate) syntax: SyntaxNode,
|
||||||
}
|
}
|
||||||
|
@ -367,11 +377,10 @@ impl TypeBoundList {
|
||||||
pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
|
pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) }
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub struct ItemList {
|
pub struct AssocItemList {
|
||||||
pub(crate) syntax: SyntaxNode,
|
pub(crate) syntax: SyntaxNode,
|
||||||
}
|
}
|
||||||
impl ast::ModuleItemOwner for ItemList {}
|
impl AssocItemList {
|
||||||
impl ItemList {
|
|
||||||
pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
|
pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
|
||||||
pub fn assoc_items(&self) -> AstChildren<AssocItem> { support::children(&self.syntax) }
|
pub fn assoc_items(&self) -> AstChildren<AssocItem> { support::children(&self.syntax) }
|
||||||
pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
|
pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
|
||||||
|
@ -1336,10 +1345,10 @@ pub enum AssocItem {
|
||||||
FnDef(FnDef),
|
FnDef(FnDef),
|
||||||
TypeAliasDef(TypeAliasDef),
|
TypeAliasDef(TypeAliasDef),
|
||||||
ConstDef(ConstDef),
|
ConstDef(ConstDef),
|
||||||
|
MacroCall(MacroCall),
|
||||||
}
|
}
|
||||||
impl ast::AttrsOwner for AssocItem {}
|
impl ast::AttrsOwner for AssocItem {}
|
||||||
impl ast::NameOwner for AssocItem {}
|
impl ast::NameOwner for AssocItem {}
|
||||||
impl ast::VisibilityOwner for AssocItem {}
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum Pat {
|
pub enum Pat {
|
||||||
OrPat(OrPat),
|
OrPat(OrPat),
|
||||||
|
@ -1574,8 +1583,8 @@ impl AstNode for Visibility {
|
||||||
}
|
}
|
||||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||||
}
|
}
|
||||||
impl AstNode for Abi {
|
impl AstNode for Name {
|
||||||
fn can_cast(kind: SyntaxKind) -> bool { kind == ABI }
|
fn can_cast(kind: SyntaxKind) -> bool { kind == NAME }
|
||||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||||
if Self::can_cast(syntax.kind()) {
|
if Self::can_cast(syntax.kind()) {
|
||||||
Some(Self { syntax })
|
Some(Self { syntax })
|
||||||
|
@ -1585,8 +1594,19 @@ impl AstNode for Abi {
|
||||||
}
|
}
|
||||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||||
}
|
}
|
||||||
impl AstNode for Name {
|
impl AstNode for ItemList {
|
||||||
fn can_cast(kind: SyntaxKind) -> bool { kind == NAME }
|
fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST }
|
||||||
|
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||||
|
if Self::can_cast(syntax.kind()) {
|
||||||
|
Some(Self { syntax })
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||||
|
}
|
||||||
|
impl AstNode for Abi {
|
||||||
|
fn can_cast(kind: SyntaxKind) -> bool { kind == ABI }
|
||||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||||
if Self::can_cast(syntax.kind()) {
|
if Self::can_cast(syntax.kind()) {
|
||||||
Some(Self { syntax })
|
Some(Self { syntax })
|
||||||
|
@ -1728,8 +1748,8 @@ impl AstNode for TypeBoundList {
|
||||||
}
|
}
|
||||||
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
fn syntax(&self) -> &SyntaxNode { &self.syntax }
|
||||||
}
|
}
|
||||||
impl AstNode for ItemList {
|
impl AstNode for AssocItemList {
|
||||||
fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST }
|
fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST }
|
||||||
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
fn cast(syntax: SyntaxNode) -> Option<Self> {
|
||||||
if Self::can_cast(syntax.kind()) {
|
if Self::can_cast(syntax.kind()) {
|
||||||
Some(Self { syntax })
|
Some(Self { syntax })
|
||||||
|
@ -3144,10 +3164,13 @@ impl From<TypeAliasDef> for AssocItem {
|
||||||
impl From<ConstDef> for AssocItem {
|
impl From<ConstDef> for AssocItem {
|
||||||
fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) }
|
fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) }
|
||||||
}
|
}
|
||||||
|
impl From<MacroCall> for AssocItem {
|
||||||
|
fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) }
|
||||||
|
}
|
||||||
impl AstNode for AssocItem {
|
impl AstNode for AssocItem {
|
||||||
fn can_cast(kind: SyntaxKind) -> bool {
|
fn can_cast(kind: SyntaxKind) -> bool {
|
||||||
match kind {
|
match kind {
|
||||||
FN_DEF | TYPE_ALIAS_DEF | CONST_DEF => true,
|
FN_DEF | TYPE_ALIAS_DEF | CONST_DEF | MACRO_CALL => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3156,6 +3179,7 @@ impl AstNode for AssocItem {
|
||||||
FN_DEF => AssocItem::FnDef(FnDef { syntax }),
|
FN_DEF => AssocItem::FnDef(FnDef { syntax }),
|
||||||
TYPE_ALIAS_DEF => AssocItem::TypeAliasDef(TypeAliasDef { syntax }),
|
TYPE_ALIAS_DEF => AssocItem::TypeAliasDef(TypeAliasDef { syntax }),
|
||||||
CONST_DEF => AssocItem::ConstDef(ConstDef { syntax }),
|
CONST_DEF => AssocItem::ConstDef(ConstDef { syntax }),
|
||||||
|
MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }),
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
Some(res)
|
Some(res)
|
||||||
|
@ -3165,6 +3189,7 @@ impl AstNode for AssocItem {
|
||||||
AssocItem::FnDef(it) => &it.syntax,
|
AssocItem::FnDef(it) => &it.syntax,
|
||||||
AssocItem::TypeAliasDef(it) => &it.syntax,
|
AssocItem::TypeAliasDef(it) => &it.syntax,
|
||||||
AssocItem::ConstDef(it) => &it.syntax,
|
AssocItem::ConstDef(it) => &it.syntax,
|
||||||
|
AssocItem::MacroCall(it) => &it.syntax,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3515,12 +3540,17 @@ impl std::fmt::Display for Visibility {
|
||||||
std::fmt::Display::fmt(self.syntax(), f)
|
std::fmt::Display::fmt(self.syntax(), f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl std::fmt::Display for Abi {
|
impl std::fmt::Display for Name {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
std::fmt::Display::fmt(self.syntax(), f)
|
std::fmt::Display::fmt(self.syntax(), f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl std::fmt::Display for Name {
|
impl std::fmt::Display for ItemList {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
std::fmt::Display::fmt(self.syntax(), f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl std::fmt::Display for Abi {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
std::fmt::Display::fmt(self.syntax(), f)
|
std::fmt::Display::fmt(self.syntax(), f)
|
||||||
}
|
}
|
||||||
|
@ -3585,7 +3615,7 @@ impl std::fmt::Display for TypeBoundList {
|
||||||
std::fmt::Display::fmt(self.syntax(), f)
|
std::fmt::Display::fmt(self.syntax(), f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl std::fmt::Display for ItemList {
|
impl std::fmt::Display for AssocItemList {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
std::fmt::Display::fmt(self.syntax(), f)
|
std::fmt::Display::fmt(self.syntax(), f)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ SOURCE_FILE@0..183
|
||||||
NAME_REF@5..13
|
NAME_REF@5..13
|
||||||
IDENT@5..13 "FnScopes"
|
IDENT@5..13 "FnScopes"
|
||||||
WHITESPACE@13..14 " "
|
WHITESPACE@13..14 " "
|
||||||
ITEM_LIST@14..182
|
ASSOC_ITEM_LIST@14..182
|
||||||
L_CURLY@14..15 "{"
|
L_CURLY@14..15 "{"
|
||||||
WHITESPACE@15..20 "\n "
|
WHITESPACE@15..20 "\n "
|
||||||
FN_DEF@20..161
|
FN_DEF@20..161
|
||||||
|
|
|
@ -41,7 +41,7 @@ SOURCE_FILE@0..38
|
||||||
IDENT@32..33 "T"
|
IDENT@32..33 "T"
|
||||||
R_ANGLE@33..34 ">"
|
R_ANGLE@33..34 ">"
|
||||||
WHITESPACE@34..35 " "
|
WHITESPACE@34..35 " "
|
||||||
ITEM_LIST@35..37
|
ASSOC_ITEM_LIST@35..37
|
||||||
L_CURLY@35..36 "{"
|
L_CURLY@35..36 "{"
|
||||||
R_CURLY@36..37 "}"
|
R_CURLY@36..37 "}"
|
||||||
WHITESPACE@37..38 "\n"
|
WHITESPACE@37..38 "\n"
|
||||||
|
|
|
@ -14,7 +14,7 @@ SOURCE_FILE@0..118
|
||||||
L_PAREN@11..12 "("
|
L_PAREN@11..12 "("
|
||||||
R_PAREN@12..13 ")"
|
R_PAREN@12..13 ")"
|
||||||
WHITESPACE@13..14 " "
|
WHITESPACE@13..14 " "
|
||||||
ITEM_LIST@14..117
|
ASSOC_ITEM_LIST@14..117
|
||||||
L_CURLY@14..15 "{"
|
L_CURLY@14..15 "{"
|
||||||
WHITESPACE@15..20 "\n "
|
WHITESPACE@15..20 "\n "
|
||||||
FN_DEF@20..31
|
FN_DEF@20..31
|
||||||
|
|
|
@ -5,7 +5,7 @@ SOURCE_FILE@0..39
|
||||||
NAME@6..7
|
NAME@6..7
|
||||||
IDENT@6..7 "T"
|
IDENT@6..7 "T"
|
||||||
WHITESPACE@7..8 " "
|
WHITESPACE@7..8 " "
|
||||||
ITEM_LIST@8..38
|
ASSOC_ITEM_LIST@8..38
|
||||||
L_CURLY@8..9 "{"
|
L_CURLY@8..9 "{"
|
||||||
WHITESPACE@9..12 "\n "
|
WHITESPACE@9..12 "\n "
|
||||||
MACRO_CALL@12..19
|
MACRO_CALL@12..19
|
||||||
|
|
|
@ -8,7 +8,7 @@ SOURCE_FILE@0..87
|
||||||
NAME_REF@5..9
|
NAME_REF@5..9
|
||||||
IDENT@5..9 "Type"
|
IDENT@5..9 "Type"
|
||||||
WHITESPACE@9..10 " "
|
WHITESPACE@9..10 " "
|
||||||
ITEM_LIST@10..12
|
ASSOC_ITEM_LIST@10..12
|
||||||
L_CURLY@10..11 "{"
|
L_CURLY@10..11 "{"
|
||||||
R_CURLY@11..12 "}"
|
R_CURLY@11..12 "}"
|
||||||
WHITESPACE@12..13 "\n"
|
WHITESPACE@12..13 "\n"
|
||||||
|
@ -29,7 +29,7 @@ SOURCE_FILE@0..87
|
||||||
NAME_REF@29..30
|
NAME_REF@29..30
|
||||||
IDENT@29..30 "T"
|
IDENT@29..30 "T"
|
||||||
WHITESPACE@30..31 " "
|
WHITESPACE@30..31 " "
|
||||||
ITEM_LIST@31..33
|
ASSOC_ITEM_LIST@31..33
|
||||||
L_CURLY@31..32 "{"
|
L_CURLY@31..32 "{"
|
||||||
R_CURLY@32..33 "}"
|
R_CURLY@32..33 "}"
|
||||||
WHITESPACE@33..34 "\n"
|
WHITESPACE@33..34 "\n"
|
||||||
|
@ -45,7 +45,7 @@ SOURCE_FILE@0..87
|
||||||
NAME_REF@44..51
|
NAME_REF@44..51
|
||||||
IDENT@44..51 "NotType"
|
IDENT@44..51 "NotType"
|
||||||
WHITESPACE@51..52 " "
|
WHITESPACE@51..52 " "
|
||||||
ITEM_LIST@52..54
|
ASSOC_ITEM_LIST@52..54
|
||||||
L_CURLY@52..53 "{"
|
L_CURLY@52..53 "{"
|
||||||
R_CURLY@53..54 "}"
|
R_CURLY@53..54 "}"
|
||||||
WHITESPACE@54..55 "\n"
|
WHITESPACE@54..55 "\n"
|
||||||
|
@ -69,7 +69,7 @@ SOURCE_FILE@0..87
|
||||||
NAME_REF@76..83
|
NAME_REF@76..83
|
||||||
IDENT@76..83 "NotType"
|
IDENT@76..83 "NotType"
|
||||||
WHITESPACE@83..84 " "
|
WHITESPACE@83..84 " "
|
||||||
ITEM_LIST@84..86
|
ASSOC_ITEM_LIST@84..86
|
||||||
L_CURLY@84..85 "{"
|
L_CURLY@84..85 "{"
|
||||||
R_CURLY@85..86 "}"
|
R_CURLY@85..86 "}"
|
||||||
WHITESPACE@86..87 "\n"
|
WHITESPACE@86..87 "\n"
|
||||||
|
|
|
@ -5,7 +5,7 @@ SOURCE_FILE@0..62
|
||||||
NAME@6..7
|
NAME@6..7
|
||||||
IDENT@6..7 "T"
|
IDENT@6..7 "T"
|
||||||
WHITESPACE@7..8 " "
|
WHITESPACE@7..8 " "
|
||||||
ITEM_LIST@8..61
|
ASSOC_ITEM_LIST@8..61
|
||||||
L_CURLY@8..9 "{"
|
L_CURLY@8..9 "{"
|
||||||
WHITESPACE@9..14 "\n "
|
WHITESPACE@9..14 "\n "
|
||||||
MACRO_CALL@14..21
|
MACRO_CALL@14..21
|
||||||
|
|
|
@ -8,7 +8,7 @@ SOURCE_FILE@0..83
|
||||||
NAME_REF@5..6
|
NAME_REF@5..6
|
||||||
IDENT@5..6 "F"
|
IDENT@5..6 "F"
|
||||||
WHITESPACE@6..7 " "
|
WHITESPACE@6..7 " "
|
||||||
ITEM_LIST@7..82
|
ASSOC_ITEM_LIST@7..82
|
||||||
L_CURLY@7..8 "{"
|
L_CURLY@7..8 "{"
|
||||||
WHITESPACE@8..13 "\n "
|
WHITESPACE@8..13 "\n "
|
||||||
TYPE_ALIAS_DEF@13..27
|
TYPE_ALIAS_DEF@13..27
|
||||||
|
|
|
@ -8,7 +8,7 @@ SOURCE_FILE@0..128
|
||||||
NAME_REF@5..6
|
NAME_REF@5..6
|
||||||
IDENT@5..6 "S"
|
IDENT@5..6 "S"
|
||||||
WHITESPACE@6..7 " "
|
WHITESPACE@6..7 " "
|
||||||
ITEM_LIST@7..127
|
ASSOC_ITEM_LIST@7..127
|
||||||
L_CURLY@7..8 "{"
|
L_CURLY@7..8 "{"
|
||||||
WHITESPACE@8..13 "\n "
|
WHITESPACE@8..13 "\n "
|
||||||
FN_DEF@13..26
|
FN_DEF@13..26
|
||||||
|
|
|
@ -7,7 +7,7 @@ SOURCE_FILE@0..18
|
||||||
NAME@13..14
|
NAME@13..14
|
||||||
IDENT@13..14 "T"
|
IDENT@13..14 "T"
|
||||||
WHITESPACE@14..15 " "
|
WHITESPACE@14..15 " "
|
||||||
ITEM_LIST@15..17
|
ASSOC_ITEM_LIST@15..17
|
||||||
L_CURLY@15..16 "{"
|
L_CURLY@15..16 "{"
|
||||||
R_CURLY@16..17 "}"
|
R_CURLY@16..17 "}"
|
||||||
WHITESPACE@17..18 "\n"
|
WHITESPACE@17..18 "\n"
|
||||||
|
|
|
@ -8,7 +8,7 @@ SOURCE_FILE@0..69
|
||||||
NAME_REF@5..6
|
NAME_REF@5..6
|
||||||
IDENT@5..6 "S"
|
IDENT@5..6 "S"
|
||||||
WHITESPACE@6..7 " "
|
WHITESPACE@6..7 " "
|
||||||
ITEM_LIST@7..68
|
ASSOC_ITEM_LIST@7..68
|
||||||
L_CURLY@7..8 "{"
|
L_CURLY@7..8 "{"
|
||||||
WHITESPACE@8..13 "\n "
|
WHITESPACE@8..13 "\n "
|
||||||
FN_DEF@13..33
|
FN_DEF@13..33
|
||||||
|
|
|
@ -8,7 +8,7 @@ SOURCE_FILE@0..89
|
||||||
NAME_REF@5..6
|
NAME_REF@5..6
|
||||||
IDENT@5..6 "F"
|
IDENT@5..6 "F"
|
||||||
WHITESPACE@6..7 " "
|
WHITESPACE@6..7 " "
|
||||||
ITEM_LIST@7..88
|
ASSOC_ITEM_LIST@7..88
|
||||||
L_CURLY@7..8 "{"
|
L_CURLY@7..8 "{"
|
||||||
WHITESPACE@8..13 "\n "
|
WHITESPACE@8..13 "\n "
|
||||||
TYPE_ALIAS_DEF@13..26
|
TYPE_ALIAS_DEF@13..26
|
||||||
|
|
|
@ -48,7 +48,7 @@ SOURCE_FILE@0..101
|
||||||
NAME_REF@34..38
|
NAME_REF@34..38
|
||||||
IDENT@34..38 "Copy"
|
IDENT@34..38 "Copy"
|
||||||
WHITESPACE@38..39 " "
|
WHITESPACE@38..39 " "
|
||||||
ITEM_LIST@39..41
|
ASSOC_ITEM_LIST@39..41
|
||||||
L_CURLY@39..40 "{"
|
L_CURLY@39..40 "{"
|
||||||
R_CURLY@40..41 "}"
|
R_CURLY@40..41 "}"
|
||||||
WHITESPACE@41..42 "\n"
|
WHITESPACE@41..42 "\n"
|
||||||
|
@ -119,7 +119,7 @@ SOURCE_FILE@0..101
|
||||||
NAME_REF@93..97
|
NAME_REF@93..97
|
||||||
IDENT@93..97 "Copy"
|
IDENT@93..97 "Copy"
|
||||||
WHITESPACE@97..98 " "
|
WHITESPACE@97..98 " "
|
||||||
ITEM_LIST@98..100
|
ASSOC_ITEM_LIST@98..100
|
||||||
L_CURLY@98..99 "{"
|
L_CURLY@98..99 "{"
|
||||||
R_CURLY@99..100 "}"
|
R_CURLY@99..100 "}"
|
||||||
WHITESPACE@100..101 "\n"
|
WHITESPACE@100..101 "\n"
|
||||||
|
|
|
@ -12,7 +12,7 @@ SOURCE_FILE@0..27
|
||||||
NAME_REF@20..23
|
NAME_REF@20..23
|
||||||
IDENT@20..23 "Foo"
|
IDENT@20..23 "Foo"
|
||||||
WHITESPACE@23..24 " "
|
WHITESPACE@23..24 " "
|
||||||
ITEM_LIST@24..26
|
ASSOC_ITEM_LIST@24..26
|
||||||
L_CURLY@24..25 "{"
|
L_CURLY@24..25 "{"
|
||||||
R_CURLY@25..26 "}"
|
R_CURLY@25..26 "}"
|
||||||
WHITESPACE@26..27 "\n"
|
WHITESPACE@26..27 "\n"
|
||||||
|
|
|
@ -5,7 +5,7 @@ SOURCE_FILE@0..22
|
||||||
NAME@6..7
|
NAME@6..7
|
||||||
IDENT@6..7 "T"
|
IDENT@6..7 "T"
|
||||||
WHITESPACE@7..8 " "
|
WHITESPACE@7..8 " "
|
||||||
ITEM_LIST@8..21
|
ASSOC_ITEM_LIST@8..21
|
||||||
L_CURLY@8..9 "{"
|
L_CURLY@8..9 "{"
|
||||||
WHITESPACE@9..10 " "
|
WHITESPACE@9..10 " "
|
||||||
FN_DEF@10..19
|
FN_DEF@10..19
|
||||||
|
|
|
@ -17,7 +17,7 @@ SOURCE_FILE@0..20
|
||||||
NAME_REF@15..16
|
NAME_REF@15..16
|
||||||
IDENT@15..16 "X"
|
IDENT@15..16 "X"
|
||||||
WHITESPACE@16..17 " "
|
WHITESPACE@16..17 " "
|
||||||
ITEM_LIST@17..19
|
ASSOC_ITEM_LIST@17..19
|
||||||
L_CURLY@17..18 "{"
|
L_CURLY@17..18 "{"
|
||||||
R_CURLY@18..19 "}"
|
R_CURLY@18..19 "}"
|
||||||
WHITESPACE@19..20 "\n"
|
WHITESPACE@19..20 "\n"
|
||||||
|
|
|
@ -8,7 +8,7 @@ SOURCE_FILE@0..12
|
||||||
NAME_REF@5..8
|
NAME_REF@5..8
|
||||||
IDENT@5..8 "Foo"
|
IDENT@5..8 "Foo"
|
||||||
WHITESPACE@8..9 " "
|
WHITESPACE@8..9 " "
|
||||||
ITEM_LIST@9..11
|
ASSOC_ITEM_LIST@9..11
|
||||||
L_CURLY@9..10 "{"
|
L_CURLY@9..10 "{"
|
||||||
R_CURLY@10..11 "}"
|
R_CURLY@10..11 "}"
|
||||||
WHITESPACE@11..12 "\n"
|
WHITESPACE@11..12 "\n"
|
||||||
|
|
|
@ -10,7 +10,7 @@ SOURCE_FILE@0..19
|
||||||
NAME_REF@12..15
|
NAME_REF@12..15
|
||||||
IDENT@12..15 "Foo"
|
IDENT@12..15 "Foo"
|
||||||
WHITESPACE@15..16 " "
|
WHITESPACE@15..16 " "
|
||||||
ITEM_LIST@16..18
|
ASSOC_ITEM_LIST@16..18
|
||||||
L_CURLY@16..17 "{"
|
L_CURLY@16..17 "{"
|
||||||
R_CURLY@17..18 "}"
|
R_CURLY@17..18 "}"
|
||||||
WHITESPACE@18..19 "\n"
|
WHITESPACE@18..19 "\n"
|
||||||
|
|
|
@ -7,7 +7,7 @@ SOURCE_FILE@0..16
|
||||||
NAME@11..12
|
NAME@11..12
|
||||||
IDENT@11..12 "T"
|
IDENT@11..12 "T"
|
||||||
WHITESPACE@12..13 " "
|
WHITESPACE@12..13 " "
|
||||||
ITEM_LIST@13..15
|
ASSOC_ITEM_LIST@13..15
|
||||||
L_CURLY@13..14 "{"
|
L_CURLY@13..14 "{"
|
||||||
R_CURLY@14..15 "}"
|
R_CURLY@14..15 "}"
|
||||||
WHITESPACE@15..16 "\n"
|
WHITESPACE@15..16 "\n"
|
||||||
|
|
|
@ -9,7 +9,7 @@ SOURCE_FILE@0..23
|
||||||
NAME@18..19
|
NAME@18..19
|
||||||
IDENT@18..19 "T"
|
IDENT@18..19 "T"
|
||||||
WHITESPACE@19..20 " "
|
WHITESPACE@19..20 " "
|
||||||
ITEM_LIST@20..22
|
ASSOC_ITEM_LIST@20..22
|
||||||
L_CURLY@20..21 "{"
|
L_CURLY@20..21 "{"
|
||||||
R_CURLY@21..22 "}"
|
R_CURLY@21..22 "}"
|
||||||
WHITESPACE@22..23 "\n"
|
WHITESPACE@22..23 "\n"
|
||||||
|
|
|
@ -10,7 +10,7 @@ SOURCE_FILE@0..20
|
||||||
NAME_REF@13..16
|
NAME_REF@13..16
|
||||||
IDENT@13..16 "Foo"
|
IDENT@13..16 "Foo"
|
||||||
WHITESPACE@16..17 " "
|
WHITESPACE@16..17 " "
|
||||||
ITEM_LIST@17..19
|
ASSOC_ITEM_LIST@17..19
|
||||||
L_CURLY@17..18 "{"
|
L_CURLY@17..18 "{"
|
||||||
R_CURLY@18..19 "}"
|
R_CURLY@18..19 "}"
|
||||||
WHITESPACE@19..20 "\n"
|
WHITESPACE@19..20 "\n"
|
||||||
|
|
|
@ -17,7 +17,7 @@ SOURCE_FILE@0..94
|
||||||
NAME_REF@14..15
|
NAME_REF@14..15
|
||||||
IDENT@14..15 "F"
|
IDENT@14..15 "F"
|
||||||
WHITESPACE@15..16 " "
|
WHITESPACE@15..16 " "
|
||||||
ITEM_LIST@16..93
|
ASSOC_ITEM_LIST@16..93
|
||||||
L_CURLY@16..17 "{"
|
L_CURLY@16..17 "{"
|
||||||
WHITESPACE@17..23 "\n "
|
WHITESPACE@17..23 "\n "
|
||||||
COMMENT@23..48 "//! This is a doc com ..."
|
COMMENT@23..48 "//! This is a doc com ..."
|
||||||
|
|
|
@ -16,7 +16,7 @@ SOURCE_FILE@0..69
|
||||||
NAME_REF@11..14
|
NAME_REF@11..14
|
||||||
IDENT@11..14 "Foo"
|
IDENT@11..14 "Foo"
|
||||||
WHITESPACE@14..15 " "
|
WHITESPACE@14..15 " "
|
||||||
ITEM_LIST@15..68
|
ASSOC_ITEM_LIST@15..68
|
||||||
L_CURLY@15..16 "{"
|
L_CURLY@15..16 "{"
|
||||||
WHITESPACE@16..21 "\n "
|
WHITESPACE@16..21 "\n "
|
||||||
TYPE_ALIAS_DEF@21..42
|
TYPE_ALIAS_DEF@21..42
|
||||||
|
|
|
@ -32,7 +32,7 @@ SOURCE_FILE@0..29
|
||||||
IDENT@23..24 "N"
|
IDENT@23..24 "N"
|
||||||
R_ANGLE@24..25 ">"
|
R_ANGLE@24..25 ">"
|
||||||
WHITESPACE@25..26 " "
|
WHITESPACE@25..26 " "
|
||||||
ITEM_LIST@26..28
|
ASSOC_ITEM_LIST@26..28
|
||||||
L_CURLY@26..27 "{"
|
L_CURLY@26..27 "{"
|
||||||
R_CURLY@27..28 "}"
|
R_CURLY@27..28 "}"
|
||||||
WHITESPACE@28..29 "\n"
|
WHITESPACE@28..29 "\n"
|
||||||
|
|
|
@ -16,7 +16,7 @@ SOURCE_FILE@0..50
|
||||||
NAME_REF@11..14
|
NAME_REF@11..14
|
||||||
IDENT@11..14 "Foo"
|
IDENT@11..14 "Foo"
|
||||||
WHITESPACE@14..15 " "
|
WHITESPACE@14..15 " "
|
||||||
ITEM_LIST@15..49
|
ASSOC_ITEM_LIST@15..49
|
||||||
L_CURLY@15..16 "{"
|
L_CURLY@15..16 "{"
|
||||||
WHITESPACE@16..21 "\n "
|
WHITESPACE@16..21 "\n "
|
||||||
FN_DEF@21..47
|
FN_DEF@21..47
|
||||||
|
|
|
@ -12,7 +12,7 @@ SOURCE_FILE@0..27
|
||||||
NAME_REF@20..23
|
NAME_REF@20..23
|
||||||
IDENT@20..23 "Foo"
|
IDENT@20..23 "Foo"
|
||||||
WHITESPACE@23..24 " "
|
WHITESPACE@23..24 " "
|
||||||
ITEM_LIST@24..26
|
ASSOC_ITEM_LIST@24..26
|
||||||
L_CURLY@24..25 "{"
|
L_CURLY@24..25 "{"
|
||||||
R_CURLY@25..26 "}"
|
R_CURLY@25..26 "}"
|
||||||
WHITESPACE@26..27 "\n"
|
WHITESPACE@26..27 "\n"
|
||||||
|
|
|
@ -5,7 +5,7 @@ SOURCE_FILE@0..96
|
||||||
NAME@6..14
|
NAME@6..14
|
||||||
IDENT@6..14 "Runnable"
|
IDENT@6..14 "Runnable"
|
||||||
WHITESPACE@14..15 " "
|
WHITESPACE@14..15 " "
|
||||||
ITEM_LIST@15..36
|
ASSOC_ITEM_LIST@15..36
|
||||||
L_CURLY@15..16 "{"
|
L_CURLY@15..16 "{"
|
||||||
WHITESPACE@16..21 "\n "
|
WHITESPACE@16..21 "\n "
|
||||||
FN_DEF@21..34
|
FN_DEF@21..34
|
||||||
|
@ -26,7 +26,7 @@ SOURCE_FILE@0..96
|
||||||
NAME@44..57
|
NAME@44..57
|
||||||
IDENT@44..57 "TraitWithExpr"
|
IDENT@44..57 "TraitWithExpr"
|
||||||
WHITESPACE@57..58 " "
|
WHITESPACE@57..58 " "
|
||||||
ITEM_LIST@58..95
|
ASSOC_ITEM_LIST@58..95
|
||||||
L_CURLY@58..59 "{"
|
L_CURLY@58..59 "{"
|
||||||
WHITESPACE@59..64 "\n "
|
WHITESPACE@59..64 "\n "
|
||||||
FN_DEF@64..93
|
FN_DEF@64..93
|
||||||
|
|
|
@ -17,7 +17,7 @@ SOURCE_FILE@0..199
|
||||||
NAME_REF@80..83
|
NAME_REF@80..83
|
||||||
IDENT@80..83 "Foo"
|
IDENT@80..83 "Foo"
|
||||||
WHITESPACE@83..84 " "
|
WHITESPACE@83..84 " "
|
||||||
ITEM_LIST@84..141
|
ASSOC_ITEM_LIST@84..141
|
||||||
L_CURLY@84..85 "{"
|
L_CURLY@84..85 "{"
|
||||||
WHITESPACE@85..90 "\n "
|
WHITESPACE@85..90 "\n "
|
||||||
FN_DEF@90..139
|
FN_DEF@90..139
|
||||||
|
|
|
@ -98,7 +98,7 @@ SOURCE_FILE@0..686
|
||||||
NAME_REF@529..537
|
NAME_REF@529..537
|
||||||
IDENT@529..537 "Whatever"
|
IDENT@529..537 "Whatever"
|
||||||
WHITESPACE@537..538 " "
|
WHITESPACE@537..538 " "
|
||||||
ITEM_LIST@538..685
|
ASSOC_ITEM_LIST@538..685
|
||||||
L_CURLY@538..539 "{"
|
L_CURLY@538..539 "{"
|
||||||
WHITESPACE@539..544 "\n "
|
WHITESPACE@539..544 "\n "
|
||||||
FN_DEF@544..683
|
FN_DEF@544..683
|
||||||
|
|
|
@ -192,7 +192,7 @@ SOURCE_FILE@0..519
|
||||||
NAME@180..183
|
NAME@180..183
|
||||||
IDENT@180..183 "Foo"
|
IDENT@180..183 "Foo"
|
||||||
WHITESPACE@183..184 " "
|
WHITESPACE@183..184 " "
|
||||||
ITEM_LIST@184..236
|
ASSOC_ITEM_LIST@184..236
|
||||||
L_CURLY@184..185 "{"
|
L_CURLY@184..185 "{"
|
||||||
WHITESPACE@185..190 "\n "
|
WHITESPACE@185..190 "\n "
|
||||||
FN_DEF@190..234
|
FN_DEF@190..234
|
||||||
|
@ -260,7 +260,7 @@ SOURCE_FILE@0..519
|
||||||
NAME_REF@243..244
|
NAME_REF@243..244
|
||||||
IDENT@243..244 "S"
|
IDENT@243..244 "S"
|
||||||
WHITESPACE@244..245 " "
|
WHITESPACE@244..245 " "
|
||||||
ITEM_LIST@245..519
|
ASSOC_ITEM_LIST@245..519
|
||||||
L_CURLY@245..246 "{"
|
L_CURLY@245..246 "{"
|
||||||
WHITESPACE@246..252 "\n "
|
WHITESPACE@246..252 "\n "
|
||||||
FN_DEF@252..277
|
FN_DEF@252..277
|
||||||
|
|
|
@ -5,7 +5,7 @@ SOURCE_FILE@0..170
|
||||||
NAME@6..7
|
NAME@6..7
|
||||||
IDENT@6..7 "T"
|
IDENT@6..7 "T"
|
||||||
WHITESPACE@7..8 " "
|
WHITESPACE@7..8 " "
|
||||||
ITEM_LIST@8..169
|
ASSOC_ITEM_LIST@8..169
|
||||||
L_CURLY@8..9 "{"
|
L_CURLY@8..9 "{"
|
||||||
WHITESPACE@9..14 "\n "
|
WHITESPACE@9..14 "\n "
|
||||||
FN_DEF@14..46
|
FN_DEF@14..46
|
||||||
|
|
|
@ -8,7 +8,7 @@ SOURCE_FILE@0..137
|
||||||
NAME_REF@5..6
|
NAME_REF@5..6
|
||||||
IDENT@5..6 "U"
|
IDENT@5..6 "U"
|
||||||
WHITESPACE@6..7 " "
|
WHITESPACE@6..7 " "
|
||||||
ITEM_LIST@7..136
|
ASSOC_ITEM_LIST@7..136
|
||||||
L_CURLY@7..8 "{"
|
L_CURLY@7..8 "{"
|
||||||
WHITESPACE@8..13 "\n "
|
WHITESPACE@8..13 "\n "
|
||||||
FN_DEF@13..45
|
FN_DEF@13..45
|
||||||
|
|
|
@ -16,7 +16,7 @@ SOURCE_FILE@0..46
|
||||||
NAME_REF@11..14
|
NAME_REF@11..14
|
||||||
IDENT@11..14 "Foo"
|
IDENT@11..14 "Foo"
|
||||||
WHITESPACE@14..15 " "
|
WHITESPACE@14..15 " "
|
||||||
ITEM_LIST@15..45
|
ASSOC_ITEM_LIST@15..45
|
||||||
L_CURLY@15..16 "{"
|
L_CURLY@15..16 "{"
|
||||||
WHITESPACE@16..19 "\n "
|
WHITESPACE@16..19 "\n "
|
||||||
CONST_DEF@19..43
|
CONST_DEF@19..43
|
||||||
|
|
|
@ -186,6 +186,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
|
||||||
"TUPLE_FIELD_DEF",
|
"TUPLE_FIELD_DEF",
|
||||||
"ENUM_VARIANT_LIST",
|
"ENUM_VARIANT_LIST",
|
||||||
"ITEM_LIST",
|
"ITEM_LIST",
|
||||||
|
"ASSOC_ITEM_LIST",
|
||||||
"ATTR",
|
"ATTR",
|
||||||
"META_ITEM", // not an item actually
|
"META_ITEM", // not an item actually
|
||||||
"USE_TREE",
|
"USE_TREE",
|
||||||
|
|
|
@ -19,6 +19,13 @@ Item =
|
||||||
| UnionDef
|
| UnionDef
|
||||||
| UseItem
|
| UseItem
|
||||||
|
|
||||||
|
Module =
|
||||||
|
Attr* Visibility? 'mod' Name
|
||||||
|
(ItemList | ';')
|
||||||
|
|
||||||
|
ItemList =
|
||||||
|
'{' Attr* Item* '}'
|
||||||
|
|
||||||
FnDef =
|
FnDef =
|
||||||
Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList?
|
Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList?
|
||||||
ParamList RetType?
|
ParamList RetType?
|
||||||
|
@ -67,17 +74,10 @@ EnumVariant =
|
||||||
TraitDef =
|
TraitDef =
|
||||||
Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name TypeParamList
|
Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name TypeParamList
|
||||||
(':' TypeBoundList?)? WhereClause
|
(':' TypeBoundList?)? WhereClause
|
||||||
ItemList
|
AssocItemList
|
||||||
|
|
||||||
Module =
|
AssocItemList =
|
||||||
Attr* Visibility? 'mod' Name
|
'{' AssocItem* '}'
|
||||||
(ItemList | ';')
|
|
||||||
|
|
||||||
ItemList =
|
|
||||||
'{'
|
|
||||||
AssocItem*
|
|
||||||
Item*
|
|
||||||
'}'
|
|
||||||
|
|
||||||
ConstDef =
|
ConstDef =
|
||||||
Attr* Visibility? 'default'? 'const' Name ':' ascribed_type:TypeRef
|
Attr* Visibility? 'default'? 'const' Name ':' ascribed_type:TypeRef
|
||||||
|
@ -94,7 +94,7 @@ TypeAliasDef =
|
||||||
ImplDef =
|
ImplDef =
|
||||||
Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' TypeParamList? '!'? 'for'
|
Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' TypeParamList? '!'? 'for'
|
||||||
WhereClause?
|
WhereClause?
|
||||||
ItemList
|
AssocItemList
|
||||||
|
|
||||||
ParenType =
|
ParenType =
|
||||||
'(' TypeRef ')'
|
'(' TypeRef ')'
|
||||||
|
@ -467,6 +467,7 @@ AssocItem =
|
||||||
FnDef
|
FnDef
|
||||||
| TypeAliasDef
|
| TypeAliasDef
|
||||||
| ConstDef
|
| ConstDef
|
||||||
|
| MacroCall
|
||||||
|
|
||||||
ExternItem =
|
ExternItem =
|
||||||
FnDef | StaticDef
|
FnDef | StaticDef
|
||||||
|
|
Loading…
Reference in a new issue