diff options
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r-- | crates/ra_syntax/src/ast.rs | 8 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/edit.rs | 14 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/extensions.rs | 48 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 552 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/generated/tokens.rs | 1829 | ||||
-rw-r--r-- | crates/ra_syntax/src/ast/traits.rs | 5 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/lexer.rs | 77 |
7 files changed, 434 insertions, 2099 deletions
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index 1ee60e74c..99c6b7219 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -80,7 +80,7 @@ impl<N: AstNode> Iterator for AstChildren<N> { | |||
80 | } | 80 | } |
81 | 81 | ||
82 | mod support { | 82 | mod support { |
83 | use super::{AstChildren, AstNode, AstToken, SyntaxKind, SyntaxNode, SyntaxToken}; | 83 | use super::{AstChildren, AstNode, SyntaxKind, SyntaxNode, SyntaxToken}; |
84 | 84 | ||
85 | pub(super) fn child<N: AstNode>(parent: &SyntaxNode) -> Option<N> { | 85 | pub(super) fn child<N: AstNode>(parent: &SyntaxNode) -> Option<N> { |
86 | parent.children().find_map(N::cast) | 86 | parent.children().find_map(N::cast) |
@@ -90,11 +90,7 @@ mod support { | |||
90 | AstChildren::new(parent) | 90 | AstChildren::new(parent) |
91 | } | 91 | } |
92 | 92 | ||
93 | pub(super) fn token<T: AstToken>(parent: &SyntaxNode) -> Option<T> { | 93 | pub(super) fn token(parent: &SyntaxNode, kind: SyntaxKind) -> Option<SyntaxToken> { |
94 | parent.children_with_tokens().filter_map(|it| it.into_token()).find_map(T::cast) | ||
95 | } | ||
96 | |||
97 | pub(super) fn token2(parent: &SyntaxNode, kind: SyntaxKind) -> Option<SyntaxToken> { | ||
98 | parent.children_with_tokens().filter_map(|it| it.into_token()).find(|it| it.kind() == kind) | 94 | parent.children_with_tokens().filter_map(|it| it.into_token()).find(|it| it.kind() == kind) |
99 | } | 95 | } |
100 | } | 96 | } |
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index 3d428fab3..9e5411ee5 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs | |||
@@ -32,9 +32,9 @@ impl ast::FnDef { | |||
32 | let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new(); | 32 | let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new(); |
33 | let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() { | 33 | let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() { |
34 | old_body.syntax().clone().into() | 34 | old_body.syntax().clone().into() |
35 | } else if let Some(semi) = self.semi_token() { | 35 | } else if let Some(semi) = self.semicolon_token() { |
36 | to_insert.push(make::tokens::single_space().into()); | 36 | to_insert.push(make::tokens::single_space().into()); |
37 | semi.syntax.clone().into() | 37 | semi.into() |
38 | } else { | 38 | } else { |
39 | to_insert.push(make::tokens::single_space().into()); | 39 | to_insert.push(make::tokens::single_space().into()); |
40 | to_insert.push(body.syntax().clone().into()); | 40 | to_insert.push(body.syntax().clone().into()); |
@@ -98,7 +98,7 @@ impl ast::ItemList { | |||
98 | None => match self.l_curly_token() { | 98 | None => match self.l_curly_token() { |
99 | Some(it) => ( | 99 | Some(it) => ( |
100 | " ".to_string() + &leading_indent(self.syntax()).unwrap_or_default(), | 100 | " ".to_string() + &leading_indent(self.syntax()).unwrap_or_default(), |
101 | InsertPosition::After(it.syntax().clone().into()), | 101 | InsertPosition::After(it.into()), |
102 | ), | 102 | ), |
103 | None => return self.clone(), | 103 | None => return self.clone(), |
104 | }, | 104 | }, |
@@ -142,7 +142,7 @@ impl ast::RecordFieldList { | |||
142 | macro_rules! after_l_curly { | 142 | macro_rules! after_l_curly { |
143 | () => {{ | 143 | () => {{ |
144 | let anchor = match self.l_curly_token() { | 144 | let anchor = match self.l_curly_token() { |
145 | Some(it) => it.syntax().clone().into(), | 145 | Some(it) => it.into(), |
146 | None => return self.clone(), | 146 | None => return self.clone(), |
147 | }; | 147 | }; |
148 | InsertPosition::After(anchor) | 148 | InsertPosition::After(anchor) |
@@ -189,15 +189,15 @@ impl ast::RecordFieldList { | |||
189 | impl ast::TypeParam { | 189 | impl ast::TypeParam { |
190 | #[must_use] | 190 | #[must_use] |
191 | pub fn remove_bounds(&self) -> ast::TypeParam { | 191 | pub fn remove_bounds(&self) -> ast::TypeParam { |
192 | let colon = match self.colon() { | 192 | let colon = match self.colon_token() { |
193 | Some(it) => it, | 193 | Some(it) => it, |
194 | None => return self.clone(), | 194 | None => return self.clone(), |
195 | }; | 195 | }; |
196 | let end = match self.type_bound_list() { | 196 | let end = match self.type_bound_list() { |
197 | Some(it) => it.syntax().clone().into(), | 197 | Some(it) => it.syntax().clone().into(), |
198 | None => colon.syntax().clone().into(), | 198 | None => colon.clone().into(), |
199 | }; | 199 | }; |
200 | self.replace_children(colon.syntax().clone().into()..=end, iter::empty()) | 200 | self.replace_children(colon.into()..=end, iter::empty()) |
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index 11ec70bc0..1aacb0676 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs | |||
@@ -5,7 +5,7 @@ use itertools::Itertools; | |||
5 | use ra_parser::SyntaxKind; | 5 | use ra_parser::SyntaxKind; |
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
8 | ast::{self, support, AstNode, AstToken, AttrInput, NameOwner, SyntaxNode}, | 8 | ast::{self, support, AstNode, AttrInput, NameOwner, SyntaxNode}, |
9 | SmolStr, SyntaxElement, SyntaxToken, T, | 9 | SmolStr, SyntaxElement, SyntaxToken, T, |
10 | }; | 10 | }; |
11 | 11 | ||
@@ -21,11 +21,7 @@ impl ast::NameRef { | |||
21 | } | 21 | } |
22 | 22 | ||
23 | pub fn as_tuple_field(&self) -> Option<usize> { | 23 | pub fn as_tuple_field(&self) -> Option<usize> { |
24 | if let Some(ast::NameRefToken::IntNumber(token)) = self.name_ref_token_token() { | 24 | self.text().parse().ok() |
25 | token.text().as_str().parse().ok() | ||
26 | } else { | ||
27 | None | ||
28 | } | ||
29 | } | 25 | } |
30 | } | 26 | } |
31 | 27 | ||
@@ -81,7 +77,7 @@ impl ast::Attr { | |||
81 | first_token.and_then(|token| token.next_token()).as_ref().map(SyntaxToken::kind); | 77 | first_token.and_then(|token| token.next_token()).as_ref().map(SyntaxToken::kind); |
82 | 78 | ||
83 | match (first_token_kind, second_token_kind) { | 79 | match (first_token_kind, second_token_kind) { |
84 | (Some(SyntaxKind::POUND), Some(SyntaxKind::EXCL)) => AttrKind::Inner, | 80 | (Some(SyntaxKind::POUND), Some(T![!])) => AttrKind::Inner, |
85 | _ => AttrKind::Outer, | 81 | _ => AttrKind::Outer, |
86 | } | 82 | } |
87 | } | 83 | } |
@@ -315,7 +311,7 @@ pub enum TypeBoundKind { | |||
315 | /// for<'a> ... | 311 | /// for<'a> ... |
316 | ForType(ast::ForType), | 312 | ForType(ast::ForType), |
317 | /// 'a | 313 | /// 'a |
318 | Lifetime(ast::Lifetime), | 314 | Lifetime(SyntaxToken), |
319 | } | 315 | } |
320 | 316 | ||
321 | impl ast::TypeBound { | 317 | impl ast::TypeBound { |
@@ -331,23 +327,23 @@ impl ast::TypeBound { | |||
331 | } | 327 | } |
332 | } | 328 | } |
333 | 329 | ||
334 | pub fn const_question_token(&self) -> Option<ast::Question> { | 330 | pub fn const_question_token(&self) -> Option<SyntaxToken> { |
335 | self.syntax() | 331 | self.syntax() |
336 | .children_with_tokens() | 332 | .children_with_tokens() |
337 | .filter_map(|it| it.into_token()) | 333 | .filter_map(|it| it.into_token()) |
338 | .take_while(|it| it.kind() != T![const]) | 334 | .take_while(|it| it.kind() != T![const]) |
339 | .find_map(ast::Question::cast) | 335 | .find(|it| it.kind() == T![?]) |
340 | } | 336 | } |
341 | 337 | ||
342 | pub fn question_token(&self) -> Option<ast::Question> { | 338 | pub fn question_token(&self) -> Option<SyntaxToken> { |
343 | if self.const_token().is_some() { | 339 | if self.const_token().is_some() { |
344 | self.syntax() | 340 | self.syntax() |
345 | .children_with_tokens() | 341 | .children_with_tokens() |
346 | .filter_map(|it| it.into_token()) | 342 | .filter_map(|it| it.into_token()) |
347 | .skip_while(|it| it.kind() != T![const]) | 343 | .skip_while(|it| it.kind() != T![const]) |
348 | .find_map(ast::Question::cast) | 344 | .find(|it| it.kind() == T![?]) |
349 | } else { | 345 | } else { |
350 | support::token(&self.syntax) | 346 | support::token(&self.syntax, T![?]) |
351 | } | 347 | } |
352 | } | 348 | } |
353 | } | 349 | } |
@@ -388,12 +384,12 @@ impl ast::MacroCall { | |||
388 | } | 384 | } |
389 | 385 | ||
390 | impl ast::LifetimeParam { | 386 | impl ast::LifetimeParam { |
391 | pub fn lifetime_bounds(&self) -> impl Iterator<Item = ast::Lifetime> { | 387 | pub fn lifetime_bounds(&self) -> impl Iterator<Item = SyntaxToken> { |
392 | self.syntax() | 388 | self.syntax() |
393 | .children_with_tokens() | 389 | .children_with_tokens() |
394 | .filter_map(|it| it.into_token()) | 390 | .filter_map(|it| it.into_token()) |
395 | .skip_while(|x| x.kind() != T![:]) | 391 | .skip_while(|x| x.kind() != T![:]) |
396 | .filter_map(ast::Lifetime::cast) | 392 | .filter(|it| it.kind() == T![lifetime]) |
397 | } | 393 | } |
398 | } | 394 | } |
399 | 395 | ||
@@ -401,7 +397,7 @@ impl ast::RangePat { | |||
401 | pub fn start(&self) -> Option<ast::Pat> { | 397 | pub fn start(&self) -> Option<ast::Pat> { |
402 | self.syntax() | 398 | self.syntax() |
403 | .children_with_tokens() | 399 | .children_with_tokens() |
404 | .take_while(|it| !ast::RangeSeparator::can_cast(it.kind())) | 400 | .take_while(|it| !(it.kind() == T![..] || it.kind() == T![..=])) |
405 | .filter_map(|it| it.into_node()) | 401 | .filter_map(|it| it.into_node()) |
406 | .find_map(ast::Pat::cast) | 402 | .find_map(ast::Pat::cast) |
407 | } | 403 | } |
@@ -409,18 +405,24 @@ impl ast::RangePat { | |||
409 | pub fn end(&self) -> Option<ast::Pat> { | 405 | pub fn end(&self) -> Option<ast::Pat> { |
410 | self.syntax() | 406 | self.syntax() |
411 | .children_with_tokens() | 407 | .children_with_tokens() |
412 | .skip_while(|it| !ast::RangeSeparator::can_cast(it.kind())) | 408 | .skip_while(|it| !(it.kind() == T![..] || it.kind() == T![..=])) |
413 | .filter_map(|it| it.into_node()) | 409 | .filter_map(|it| it.into_node()) |
414 | .find_map(ast::Pat::cast) | 410 | .find_map(ast::Pat::cast) |
415 | } | 411 | } |
416 | } | 412 | } |
417 | 413 | ||
418 | impl ast::TokenTree { | 414 | impl ast::TokenTree { |
419 | pub fn left_delimiter(&self) -> Option<ast::LeftDelimiter> { | 415 | pub fn left_delimiter_token(&self) -> Option<SyntaxToken> { |
420 | self.syntax().first_child_or_token()?.into_token().and_then(ast::LeftDelimiter::cast) | 416 | self.syntax().first_child_or_token()?.into_token().filter(|it| match it.kind() { |
421 | } | 417 | T!['{'] | T!['('] | T!['['] => true, |
422 | 418 | _ => false, | |
423 | pub fn right_delimiter(&self) -> Option<ast::RightDelimiter> { | 419 | }) |
424 | self.syntax().last_child_or_token()?.into_token().and_then(ast::RightDelimiter::cast) | 420 | } |
421 | |||
422 | pub fn right_delimiter_token(&self) -> Option<SyntaxToken> { | ||
423 | self.syntax().last_child_or_token()?.into_token().filter(|it| match it.kind() { | ||
424 | T!['{'] | T!['('] | T!['['] => true, | ||
425 | _ => false, | ||
426 | }) | ||
425 | } | 427 | } |
426 | } | 428 | } |
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 20f663046..0df7cfe52 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -1,11 +1,11 @@ | |||
1 | //! Generated file, do not edit by hand, see `xtask/src/codegen` | 1 | //! Generated file, do not edit by hand, see `xtask/src/codegen` |
2 | 2 | ||
3 | use super::tokens::*; | ||
4 | use crate::{ | 3 | use crate::{ |
5 | ast::{self, support, AstChildren, AstNode}, | 4 | ast::{self, support, AstChildren, AstNode}, |
6 | SyntaxKind::{self, *}, | 5 | SyntaxKind::{self, *}, |
7 | SyntaxNode, SyntaxToken, | 6 | SyntaxNode, SyntaxToken, T, |
8 | }; | 7 | }; |
8 | |||
9 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 9 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
10 | pub struct SourceFile { | 10 | pub struct SourceFile { |
11 | pub(crate) syntax: SyntaxNode, | 11 | pub(crate) syntax: SyntaxNode, |
@@ -26,6 +26,7 @@ impl ast::AttrsOwner for SourceFile {} | |||
26 | impl SourceFile { | 26 | impl SourceFile { |
27 | pub fn modules(&self) -> AstChildren<Module> { support::children(&self.syntax) } | 27 | pub fn modules(&self) -> AstChildren<Module> { support::children(&self.syntax) } |
28 | } | 28 | } |
29 | |||
29 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 30 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
30 | pub struct FnDef { | 31 | pub struct FnDef { |
31 | pub(crate) syntax: SyntaxNode, | 32 | pub(crate) syntax: SyntaxNode, |
@@ -48,16 +49,17 @@ impl ast::DocCommentsOwner for FnDef {} | |||
48 | impl ast::AttrsOwner for FnDef {} | 49 | impl ast::AttrsOwner for FnDef {} |
49 | impl FnDef { | 50 | impl FnDef { |
50 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | 51 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } |
51 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) } | 52 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
52 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DEFAULT_KW) } | 53 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
53 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, ASYNC_KW) } | 54 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } |
54 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) } | 55 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
55 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FN_KW) } | 56 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } |
56 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | 57 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } |
57 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | 58 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } |
58 | pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | 59 | pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } |
59 | pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } | 60 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
60 | } | 61 | } |
62 | |||
61 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 63 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
62 | pub struct RetType { | 64 | pub struct RetType { |
63 | pub(crate) syntax: SyntaxNode, | 65 | pub(crate) syntax: SyntaxNode, |
@@ -74,9 +76,10 @@ impl AstNode for RetType { | |||
74 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 76 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
75 | } | 77 | } |
76 | impl RetType { | 78 | impl RetType { |
77 | pub fn thin_arrow_token(&self) -> Option<ThinArrow> { support::token(&self.syntax) } | 79 | pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) } |
78 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 80 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
79 | } | 81 | } |
82 | |||
80 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 83 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
81 | pub struct StructDef { | 84 | pub struct StructDef { |
82 | pub(crate) syntax: SyntaxNode, | 85 | pub(crate) syntax: SyntaxNode, |
@@ -98,10 +101,11 @@ impl ast::TypeParamsOwner for StructDef {} | |||
98 | impl ast::AttrsOwner for StructDef {} | 101 | impl ast::AttrsOwner for StructDef {} |
99 | impl ast::DocCommentsOwner for StructDef {} | 102 | impl ast::DocCommentsOwner for StructDef {} |
100 | impl StructDef { | 103 | impl StructDef { |
101 | pub fn struct_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, STRUCT_KW) } | 104 | pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) } |
102 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } | 105 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } |
103 | pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } | 106 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
104 | } | 107 | } |
108 | |||
105 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 109 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
106 | pub struct UnionDef { | 110 | pub struct UnionDef { |
107 | pub(crate) syntax: SyntaxNode, | 111 | pub(crate) syntax: SyntaxNode, |
@@ -123,11 +127,12 @@ impl ast::TypeParamsOwner for UnionDef {} | |||
123 | impl ast::AttrsOwner for UnionDef {} | 127 | impl ast::AttrsOwner for UnionDef {} |
124 | impl ast::DocCommentsOwner for UnionDef {} | 128 | impl ast::DocCommentsOwner for UnionDef {} |
125 | impl UnionDef { | 129 | impl UnionDef { |
126 | pub fn union_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNION_KW) } | 130 | pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } |
127 | pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> { | 131 | pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> { |
128 | support::child(&self.syntax) | 132 | support::child(&self.syntax) |
129 | } | 133 | } |
130 | } | 134 | } |
135 | |||
131 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 136 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
132 | pub struct RecordFieldDefList { | 137 | pub struct RecordFieldDefList { |
133 | pub(crate) syntax: SyntaxNode, | 138 | pub(crate) syntax: SyntaxNode, |
@@ -144,10 +149,11 @@ impl AstNode for RecordFieldDefList { | |||
144 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 149 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
145 | } | 150 | } |
146 | impl RecordFieldDefList { | 151 | impl RecordFieldDefList { |
147 | pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } | 152 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
148 | pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) } | 153 | pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) } |
149 | pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } | 154 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
150 | } | 155 | } |
156 | |||
151 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 157 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
152 | pub struct RecordFieldDef { | 158 | pub struct RecordFieldDef { |
153 | pub(crate) syntax: SyntaxNode, | 159 | pub(crate) syntax: SyntaxNode, |
@@ -169,6 +175,7 @@ impl ast::AttrsOwner for RecordFieldDef {} | |||
169 | impl ast::DocCommentsOwner for RecordFieldDef {} | 175 | impl ast::DocCommentsOwner for RecordFieldDef {} |
170 | impl ast::TypeAscriptionOwner for RecordFieldDef {} | 176 | impl ast::TypeAscriptionOwner for RecordFieldDef {} |
171 | impl RecordFieldDef {} | 177 | impl RecordFieldDef {} |
178 | |||
172 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 179 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
173 | pub struct TupleFieldDefList { | 180 | pub struct TupleFieldDefList { |
174 | pub(crate) syntax: SyntaxNode, | 181 | pub(crate) syntax: SyntaxNode, |
@@ -185,10 +192,11 @@ impl AstNode for TupleFieldDefList { | |||
185 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 192 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
186 | } | 193 | } |
187 | impl TupleFieldDefList { | 194 | impl TupleFieldDefList { |
188 | pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } | 195 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
189 | pub fn fields(&self) -> AstChildren<TupleFieldDef> { support::children(&self.syntax) } | 196 | pub fn fields(&self) -> AstChildren<TupleFieldDef> { support::children(&self.syntax) } |
190 | pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } | 197 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
191 | } | 198 | } |
199 | |||
192 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 200 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
193 | pub struct TupleFieldDef { | 201 | pub struct TupleFieldDef { |
194 | pub(crate) syntax: SyntaxNode, | 202 | pub(crate) syntax: SyntaxNode, |
@@ -209,6 +217,7 @@ impl ast::AttrsOwner for TupleFieldDef {} | |||
209 | impl TupleFieldDef { | 217 | impl TupleFieldDef { |
210 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 218 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
211 | } | 219 | } |
220 | |||
212 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 221 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
213 | pub struct EnumDef { | 222 | pub struct EnumDef { |
214 | pub(crate) syntax: SyntaxNode, | 223 | pub(crate) syntax: SyntaxNode, |
@@ -230,9 +239,10 @@ impl ast::TypeParamsOwner for EnumDef {} | |||
230 | impl ast::AttrsOwner for EnumDef {} | 239 | impl ast::AttrsOwner for EnumDef {} |
231 | impl ast::DocCommentsOwner for EnumDef {} | 240 | impl ast::DocCommentsOwner for EnumDef {} |
232 | impl EnumDef { | 241 | impl EnumDef { |
233 | pub fn enum_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, ENUM_KW) } | 242 | pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) } |
234 | pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) } | 243 | pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) } |
235 | } | 244 | } |
245 | |||
236 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 246 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
237 | pub struct EnumVariantList { | 247 | pub struct EnumVariantList { |
238 | pub(crate) syntax: SyntaxNode, | 248 | pub(crate) syntax: SyntaxNode, |
@@ -249,10 +259,11 @@ impl AstNode for EnumVariantList { | |||
249 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 259 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
250 | } | 260 | } |
251 | impl EnumVariantList { | 261 | impl EnumVariantList { |
252 | pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } | 262 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
253 | pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) } | 263 | pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) } |
254 | pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } | 264 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
255 | } | 265 | } |
266 | |||
256 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 267 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
257 | pub struct EnumVariant { | 268 | pub struct EnumVariant { |
258 | pub(crate) syntax: SyntaxNode, | 269 | pub(crate) syntax: SyntaxNode, |
@@ -274,9 +285,10 @@ impl ast::DocCommentsOwner for EnumVariant {} | |||
274 | impl ast::AttrsOwner for EnumVariant {} | 285 | impl ast::AttrsOwner for EnumVariant {} |
275 | impl EnumVariant { | 286 | impl EnumVariant { |
276 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } | 287 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } |
277 | pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } | 288 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
278 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 289 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
279 | } | 290 | } |
291 | |||
280 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 292 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
281 | pub struct TraitDef { | 293 | pub struct TraitDef { |
282 | pub(crate) syntax: SyntaxNode, | 294 | pub(crate) syntax: SyntaxNode, |
@@ -299,11 +311,12 @@ impl ast::DocCommentsOwner for TraitDef {} | |||
299 | impl ast::TypeParamsOwner for TraitDef {} | 311 | impl ast::TypeParamsOwner for TraitDef {} |
300 | impl ast::TypeBoundsOwner for TraitDef {} | 312 | impl ast::TypeBoundsOwner for TraitDef {} |
301 | impl TraitDef { | 313 | impl TraitDef { |
302 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) } | 314 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
303 | pub fn auto_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, AUTO_KW) } | 315 | pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) } |
304 | pub fn trait_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, TRAIT_KW) } | 316 | pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } |
305 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | 317 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } |
306 | } | 318 | } |
319 | |||
307 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 320 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
308 | pub struct Module { | 321 | pub struct Module { |
309 | pub(crate) syntax: SyntaxNode, | 322 | pub(crate) syntax: SyntaxNode, |
@@ -324,10 +337,11 @@ impl ast::NameOwner for Module {} | |||
324 | impl ast::AttrsOwner for Module {} | 337 | impl ast::AttrsOwner for Module {} |
325 | impl ast::DocCommentsOwner for Module {} | 338 | impl ast::DocCommentsOwner for Module {} |
326 | impl Module { | 339 | impl Module { |
327 | pub fn mod_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MOD_KW) } | 340 | pub fn mod_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mod]) } |
328 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | 341 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } |
329 | pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } | 342 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
330 | } | 343 | } |
344 | |||
331 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 345 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
332 | pub struct ItemList { | 346 | pub struct ItemList { |
333 | pub(crate) syntax: SyntaxNode, | 347 | pub(crate) syntax: SyntaxNode, |
@@ -345,10 +359,11 @@ impl AstNode for ItemList { | |||
345 | } | 359 | } |
346 | impl ast::ModuleItemOwner for ItemList {} | 360 | impl ast::ModuleItemOwner for ItemList {} |
347 | impl ItemList { | 361 | impl ItemList { |
348 | pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } | 362 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
349 | pub fn impl_items(&self) -> AstChildren<ImplItem> { support::children(&self.syntax) } | 363 | pub fn impl_items(&self) -> AstChildren<ImplItem> { support::children(&self.syntax) } |
350 | pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } | 364 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
351 | } | 365 | } |
366 | |||
352 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 367 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
353 | pub struct ConstDef { | 368 | pub struct ConstDef { |
354 | pub(crate) syntax: SyntaxNode, | 369 | pub(crate) syntax: SyntaxNode, |
@@ -371,12 +386,13 @@ impl ast::AttrsOwner for ConstDef {} | |||
371 | impl ast::DocCommentsOwner for ConstDef {} | 386 | impl ast::DocCommentsOwner for ConstDef {} |
372 | impl ast::TypeAscriptionOwner for ConstDef {} | 387 | impl ast::TypeAscriptionOwner for ConstDef {} |
373 | impl ConstDef { | 388 | impl ConstDef { |
374 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DEFAULT_KW) } | 389 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
375 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) } | 390 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
376 | pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } | 391 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
377 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | 392 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } |
378 | pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } | 393 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
379 | } | 394 | } |
395 | |||
380 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 396 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
381 | pub struct StaticDef { | 397 | pub struct StaticDef { |
382 | pub(crate) syntax: SyntaxNode, | 398 | pub(crate) syntax: SyntaxNode, |
@@ -399,12 +415,13 @@ impl ast::AttrsOwner for StaticDef {} | |||
399 | impl ast::DocCommentsOwner for StaticDef {} | 415 | impl ast::DocCommentsOwner for StaticDef {} |
400 | impl ast::TypeAscriptionOwner for StaticDef {} | 416 | impl ast::TypeAscriptionOwner for StaticDef {} |
401 | impl StaticDef { | 417 | impl StaticDef { |
402 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, STATIC_KW) } | 418 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } |
403 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) } | 419 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
404 | pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } | 420 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
405 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | 421 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } |
406 | pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } | 422 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
407 | } | 423 | } |
424 | |||
408 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 425 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
409 | pub struct TypeAliasDef { | 426 | pub struct TypeAliasDef { |
410 | pub(crate) syntax: SyntaxNode, | 427 | pub(crate) syntax: SyntaxNode, |
@@ -427,12 +444,13 @@ impl ast::AttrsOwner for TypeAliasDef {} | |||
427 | impl ast::DocCommentsOwner for TypeAliasDef {} | 444 | impl ast::DocCommentsOwner for TypeAliasDef {} |
428 | impl ast::TypeBoundsOwner for TypeAliasDef {} | 445 | impl ast::TypeBoundsOwner for TypeAliasDef {} |
429 | impl TypeAliasDef { | 446 | impl TypeAliasDef { |
430 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DEFAULT_KW) } | 447 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
431 | pub fn type_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, TYPE_KW) } | 448 | pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) } |
432 | pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } | 449 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
433 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 450 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
434 | pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } | 451 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
435 | } | 452 | } |
453 | |||
436 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 454 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
437 | pub struct ImplDef { | 455 | pub struct ImplDef { |
438 | pub(crate) syntax: SyntaxNode, | 456 | pub(crate) syntax: SyntaxNode, |
@@ -451,14 +469,15 @@ impl AstNode for ImplDef { | |||
451 | impl ast::TypeParamsOwner for ImplDef {} | 469 | impl ast::TypeParamsOwner for ImplDef {} |
452 | impl ast::AttrsOwner for ImplDef {} | 470 | impl ast::AttrsOwner for ImplDef {} |
453 | impl ImplDef { | 471 | impl ImplDef { |
454 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DEFAULT_KW) } | 472 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
455 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) } | 473 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
456 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) } | 474 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
457 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IMPL_KW) } | 475 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } |
458 | pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) } | 476 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
459 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FOR_KW) } | 477 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
460 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | 478 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } |
461 | } | 479 | } |
480 | |||
462 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 481 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
463 | pub struct ParenType { | 482 | pub struct ParenType { |
464 | pub(crate) syntax: SyntaxNode, | 483 | pub(crate) syntax: SyntaxNode, |
@@ -475,10 +494,11 @@ impl AstNode for ParenType { | |||
475 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 494 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
476 | } | 495 | } |
477 | impl ParenType { | 496 | impl ParenType { |
478 | pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } | 497 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
479 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 498 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
480 | pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } | 499 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
481 | } | 500 | } |
501 | |||
482 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 502 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
483 | pub struct TupleType { | 503 | pub struct TupleType { |
484 | pub(crate) syntax: SyntaxNode, | 504 | pub(crate) syntax: SyntaxNode, |
@@ -495,10 +515,11 @@ impl AstNode for TupleType { | |||
495 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 515 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
496 | } | 516 | } |
497 | impl TupleType { | 517 | impl TupleType { |
498 | pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } | 518 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
499 | pub fn fields(&self) -> AstChildren<TypeRef> { support::children(&self.syntax) } | 519 | pub fn fields(&self) -> AstChildren<TypeRef> { support::children(&self.syntax) } |
500 | pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } | 520 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
501 | } | 521 | } |
522 | |||
502 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 523 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
503 | pub struct NeverType { | 524 | pub struct NeverType { |
504 | pub(crate) syntax: SyntaxNode, | 525 | pub(crate) syntax: SyntaxNode, |
@@ -515,8 +536,9 @@ impl AstNode for NeverType { | |||
515 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 536 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
516 | } | 537 | } |
517 | impl NeverType { | 538 | impl NeverType { |
518 | pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) } | 539 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
519 | } | 540 | } |
541 | |||
520 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 542 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
521 | pub struct PathType { | 543 | pub struct PathType { |
522 | pub(crate) syntax: SyntaxNode, | 544 | pub(crate) syntax: SyntaxNode, |
@@ -535,6 +557,7 @@ impl AstNode for PathType { | |||
535 | impl PathType { | 557 | impl PathType { |
536 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 558 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
537 | } | 559 | } |
560 | |||
538 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 561 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
539 | pub struct PointerType { | 562 | pub struct PointerType { |
540 | pub(crate) syntax: SyntaxNode, | 563 | pub(crate) syntax: SyntaxNode, |
@@ -551,11 +574,12 @@ impl AstNode for PointerType { | |||
551 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 574 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
552 | } | 575 | } |
553 | impl PointerType { | 576 | impl PointerType { |
554 | pub fn star_token(&self) -> Option<Star> { support::token(&self.syntax) } | 577 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } |
555 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) } | 578 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
556 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) } | 579 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
557 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 580 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
558 | } | 581 | } |
582 | |||
559 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 583 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
560 | pub struct ArrayType { | 584 | pub struct ArrayType { |
561 | pub(crate) syntax: SyntaxNode, | 585 | pub(crate) syntax: SyntaxNode, |
@@ -572,12 +596,13 @@ impl AstNode for ArrayType { | |||
572 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 596 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
573 | } | 597 | } |
574 | impl ArrayType { | 598 | impl ArrayType { |
575 | pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } | 599 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
576 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 600 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
577 | pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } | 601 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
578 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 602 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
579 | pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } | 603 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
580 | } | 604 | } |
605 | |||
581 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 606 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
582 | pub struct SliceType { | 607 | pub struct SliceType { |
583 | pub(crate) syntax: SyntaxNode, | 608 | pub(crate) syntax: SyntaxNode, |
@@ -594,10 +619,11 @@ impl AstNode for SliceType { | |||
594 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 619 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
595 | } | 620 | } |
596 | impl SliceType { | 621 | impl SliceType { |
597 | pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } | 622 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
598 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 623 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
599 | pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } | 624 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
600 | } | 625 | } |
626 | |||
601 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 627 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
602 | pub struct ReferenceType { | 628 | pub struct ReferenceType { |
603 | pub(crate) syntax: SyntaxNode, | 629 | pub(crate) syntax: SyntaxNode, |
@@ -614,11 +640,14 @@ impl AstNode for ReferenceType { | |||
614 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 640 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
615 | } | 641 | } |
616 | impl ReferenceType { | 642 | impl ReferenceType { |
617 | pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) } | 643 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
618 | pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 644 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
619 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) } | 645 | support::token(&self.syntax, T![lifetime]) |
646 | } | ||
647 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
620 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 648 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
621 | } | 649 | } |
650 | |||
622 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 651 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
623 | pub struct PlaceholderType { | 652 | pub struct PlaceholderType { |
624 | pub(crate) syntax: SyntaxNode, | 653 | pub(crate) syntax: SyntaxNode, |
@@ -635,8 +664,9 @@ impl AstNode for PlaceholderType { | |||
635 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 664 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
636 | } | 665 | } |
637 | impl PlaceholderType { | 666 | impl PlaceholderType { |
638 | pub fn underscore_token(&self) -> Option<Underscore> { support::token(&self.syntax) } | 667 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } |
639 | } | 668 | } |
669 | |||
640 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 670 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
641 | pub struct FnPointerType { | 671 | pub struct FnPointerType { |
642 | pub(crate) syntax: SyntaxNode, | 672 | pub(crate) syntax: SyntaxNode, |
@@ -654,11 +684,12 @@ impl AstNode for FnPointerType { | |||
654 | } | 684 | } |
655 | impl FnPointerType { | 685 | impl FnPointerType { |
656 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | 686 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } |
657 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) } | 687 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
658 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FN_KW) } | 688 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } |
659 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | 689 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } |
660 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | 690 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } |
661 | } | 691 | } |
692 | |||
662 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 693 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
663 | pub struct ForType { | 694 | pub struct ForType { |
664 | pub(crate) syntax: SyntaxNode, | 695 | pub(crate) syntax: SyntaxNode, |
@@ -675,10 +706,11 @@ impl AstNode for ForType { | |||
675 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 706 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
676 | } | 707 | } |
677 | impl ForType { | 708 | impl ForType { |
678 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FOR_KW) } | 709 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
679 | pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) } | 710 | pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) } |
680 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 711 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
681 | } | 712 | } |
713 | |||
682 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 714 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
683 | pub struct ImplTraitType { | 715 | pub struct ImplTraitType { |
684 | pub(crate) syntax: SyntaxNode, | 716 | pub(crate) syntax: SyntaxNode, |
@@ -696,8 +728,9 @@ impl AstNode for ImplTraitType { | |||
696 | } | 728 | } |
697 | impl ast::TypeBoundsOwner for ImplTraitType {} | 729 | impl ast::TypeBoundsOwner for ImplTraitType {} |
698 | impl ImplTraitType { | 730 | impl ImplTraitType { |
699 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IMPL_KW) } | 731 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } |
700 | } | 732 | } |
733 | |||
701 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 734 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
702 | pub struct DynTraitType { | 735 | pub struct DynTraitType { |
703 | pub(crate) syntax: SyntaxNode, | 736 | pub(crate) syntax: SyntaxNode, |
@@ -715,8 +748,9 @@ impl AstNode for DynTraitType { | |||
715 | } | 748 | } |
716 | impl ast::TypeBoundsOwner for DynTraitType {} | 749 | impl ast::TypeBoundsOwner for DynTraitType {} |
717 | impl DynTraitType { | 750 | impl DynTraitType { |
718 | pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, DYN_KW) } | 751 | pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) } |
719 | } | 752 | } |
753 | |||
720 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 754 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
721 | pub struct TupleExpr { | 755 | pub struct TupleExpr { |
722 | pub(crate) syntax: SyntaxNode, | 756 | pub(crate) syntax: SyntaxNode, |
@@ -734,10 +768,11 @@ impl AstNode for TupleExpr { | |||
734 | } | 768 | } |
735 | impl ast::AttrsOwner for TupleExpr {} | 769 | impl ast::AttrsOwner for TupleExpr {} |
736 | impl TupleExpr { | 770 | impl TupleExpr { |
737 | pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } | 771 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
738 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | 772 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } |
739 | pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } | 773 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
740 | } | 774 | } |
775 | |||
741 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 776 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
742 | pub struct ArrayExpr { | 777 | pub struct ArrayExpr { |
743 | pub(crate) syntax: SyntaxNode, | 778 | pub(crate) syntax: SyntaxNode, |
@@ -755,11 +790,12 @@ impl AstNode for ArrayExpr { | |||
755 | } | 790 | } |
756 | impl ast::AttrsOwner for ArrayExpr {} | 791 | impl ast::AttrsOwner for ArrayExpr {} |
757 | impl ArrayExpr { | 792 | impl ArrayExpr { |
758 | pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } | 793 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
759 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | 794 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } |
760 | pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } | 795 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
761 | pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } | 796 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
762 | } | 797 | } |
798 | |||
763 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 799 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
764 | pub struct ParenExpr { | 800 | pub struct ParenExpr { |
765 | pub(crate) syntax: SyntaxNode, | 801 | pub(crate) syntax: SyntaxNode, |
@@ -777,10 +813,11 @@ impl AstNode for ParenExpr { | |||
777 | } | 813 | } |
778 | impl ast::AttrsOwner for ParenExpr {} | 814 | impl ast::AttrsOwner for ParenExpr {} |
779 | impl ParenExpr { | 815 | impl ParenExpr { |
780 | pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } | 816 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
781 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 817 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
782 | pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } | 818 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
783 | } | 819 | } |
820 | |||
784 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 821 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
785 | pub struct PathExpr { | 822 | pub struct PathExpr { |
786 | pub(crate) syntax: SyntaxNode, | 823 | pub(crate) syntax: SyntaxNode, |
@@ -799,6 +836,7 @@ impl AstNode for PathExpr { | |||
799 | impl PathExpr { | 836 | impl PathExpr { |
800 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 837 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
801 | } | 838 | } |
839 | |||
802 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 840 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
803 | pub struct LambdaExpr { | 841 | pub struct LambdaExpr { |
804 | pub(crate) syntax: SyntaxNode, | 842 | pub(crate) syntax: SyntaxNode, |
@@ -816,13 +854,14 @@ impl AstNode for LambdaExpr { | |||
816 | } | 854 | } |
817 | impl ast::AttrsOwner for LambdaExpr {} | 855 | impl ast::AttrsOwner for LambdaExpr {} |
818 | impl LambdaExpr { | 856 | impl LambdaExpr { |
819 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, STATIC_KW) } | 857 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } |
820 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, ASYNC_KW) } | 858 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } |
821 | pub fn move_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MOVE_KW) } | 859 | pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } |
822 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | 860 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } |
823 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | 861 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } |
824 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | 862 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } |
825 | } | 863 | } |
864 | |||
826 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 865 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
827 | pub struct IfExpr { | 866 | pub struct IfExpr { |
828 | pub(crate) syntax: SyntaxNode, | 867 | pub(crate) syntax: SyntaxNode, |
@@ -840,9 +879,10 @@ impl AstNode for IfExpr { | |||
840 | } | 879 | } |
841 | impl ast::AttrsOwner for IfExpr {} | 880 | impl ast::AttrsOwner for IfExpr {} |
842 | impl IfExpr { | 881 | impl IfExpr { |
843 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IF_KW) } | 882 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } |
844 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | 883 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } |
845 | } | 884 | } |
885 | |||
846 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 886 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
847 | pub struct LoopExpr { | 887 | pub struct LoopExpr { |
848 | pub(crate) syntax: SyntaxNode, | 888 | pub(crate) syntax: SyntaxNode, |
@@ -861,8 +901,9 @@ impl AstNode for LoopExpr { | |||
861 | impl ast::AttrsOwner for LoopExpr {} | 901 | impl ast::AttrsOwner for LoopExpr {} |
862 | impl ast::LoopBodyOwner for LoopExpr {} | 902 | impl ast::LoopBodyOwner for LoopExpr {} |
863 | impl LoopExpr { | 903 | impl LoopExpr { |
864 | pub fn loop_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, LOOP_KW) } | 904 | pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } |
865 | } | 905 | } |
906 | |||
866 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 907 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
867 | pub struct TryBlockExpr { | 908 | pub struct TryBlockExpr { |
868 | pub(crate) syntax: SyntaxNode, | 909 | pub(crate) syntax: SyntaxNode, |
@@ -880,9 +921,10 @@ impl AstNode for TryBlockExpr { | |||
880 | } | 921 | } |
881 | impl ast::AttrsOwner for TryBlockExpr {} | 922 | impl ast::AttrsOwner for TryBlockExpr {} |
882 | impl TryBlockExpr { | 923 | impl TryBlockExpr { |
883 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, TRY_KW) } | 924 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } |
884 | pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | 925 | pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } |
885 | } | 926 | } |
927 | |||
886 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 928 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
887 | pub struct ForExpr { | 929 | pub struct ForExpr { |
888 | pub(crate) syntax: SyntaxNode, | 930 | pub(crate) syntax: SyntaxNode, |
@@ -901,11 +943,12 @@ impl AstNode for ForExpr { | |||
901 | impl ast::AttrsOwner for ForExpr {} | 943 | impl ast::AttrsOwner for ForExpr {} |
902 | impl ast::LoopBodyOwner for ForExpr {} | 944 | impl ast::LoopBodyOwner for ForExpr {} |
903 | impl ForExpr { | 945 | impl ForExpr { |
904 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, FOR_KW) } | 946 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
905 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 947 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
906 | pub fn in_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IN_KW) } | 948 | pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } |
907 | pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) } | 949 | pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) } |
908 | } | 950 | } |
951 | |||
909 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 952 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
910 | pub struct WhileExpr { | 953 | pub struct WhileExpr { |
911 | pub(crate) syntax: SyntaxNode, | 954 | pub(crate) syntax: SyntaxNode, |
@@ -924,9 +967,10 @@ impl AstNode for WhileExpr { | |||
924 | impl ast::AttrsOwner for WhileExpr {} | 967 | impl ast::AttrsOwner for WhileExpr {} |
925 | impl ast::LoopBodyOwner for WhileExpr {} | 968 | impl ast::LoopBodyOwner for WhileExpr {} |
926 | impl WhileExpr { | 969 | impl WhileExpr { |
927 | pub fn while_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, WHILE_KW) } | 970 | pub fn while_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![while]) } |
928 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | 971 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } |
929 | } | 972 | } |
973 | |||
930 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 974 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
931 | pub struct ContinueExpr { | 975 | pub struct ContinueExpr { |
932 | pub(crate) syntax: SyntaxNode, | 976 | pub(crate) syntax: SyntaxNode, |
@@ -945,10 +989,13 @@ impl AstNode for ContinueExpr { | |||
945 | impl ast::AttrsOwner for ContinueExpr {} | 989 | impl ast::AttrsOwner for ContinueExpr {} |
946 | impl ContinueExpr { | 990 | impl ContinueExpr { |
947 | pub fn continue_token(&self) -> Option<SyntaxToken> { | 991 | pub fn continue_token(&self) -> Option<SyntaxToken> { |
948 | support::token2(&self.syntax, CONTINUE_KW) | 992 | support::token(&self.syntax, T![continue]) |
993 | } | ||
994 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
995 | support::token(&self.syntax, T![lifetime]) | ||
949 | } | 996 | } |
950 | pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } | ||
951 | } | 997 | } |
998 | |||
952 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 999 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
953 | pub struct BreakExpr { | 1000 | pub struct BreakExpr { |
954 | pub(crate) syntax: SyntaxNode, | 1001 | pub(crate) syntax: SyntaxNode, |
@@ -966,10 +1013,13 @@ impl AstNode for BreakExpr { | |||
966 | } | 1013 | } |
967 | impl ast::AttrsOwner for BreakExpr {} | 1014 | impl ast::AttrsOwner for BreakExpr {} |
968 | impl BreakExpr { | 1015 | impl BreakExpr { |
969 | pub fn break_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, BREAK_KW) } | 1016 | pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } |
970 | pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 1017 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
1018 | support::token(&self.syntax, T![lifetime]) | ||
1019 | } | ||
971 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1020 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
972 | } | 1021 | } |
1022 | |||
973 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1023 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
974 | pub struct Label { | 1024 | pub struct Label { |
975 | pub(crate) syntax: SyntaxNode, | 1025 | pub(crate) syntax: SyntaxNode, |
@@ -986,8 +1036,11 @@ impl AstNode for Label { | |||
986 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1036 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
987 | } | 1037 | } |
988 | impl Label { | 1038 | impl Label { |
989 | pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 1039 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
1040 | support::token(&self.syntax, T![lifetime]) | ||
1041 | } | ||
990 | } | 1042 | } |
1043 | |||
991 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1044 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
992 | pub struct BlockExpr { | 1045 | pub struct BlockExpr { |
993 | pub(crate) syntax: SyntaxNode, | 1046 | pub(crate) syntax: SyntaxNode, |
@@ -1006,9 +1059,10 @@ impl AstNode for BlockExpr { | |||
1006 | impl ast::AttrsOwner for BlockExpr {} | 1059 | impl ast::AttrsOwner for BlockExpr {} |
1007 | impl BlockExpr { | 1060 | impl BlockExpr { |
1008 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | 1061 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } |
1009 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, UNSAFE_KW) } | 1062 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
1010 | pub fn block(&self) -> Option<Block> { support::child(&self.syntax) } | 1063 | pub fn block(&self) -> Option<Block> { support::child(&self.syntax) } |
1011 | } | 1064 | } |
1065 | |||
1012 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1066 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1013 | pub struct ReturnExpr { | 1067 | pub struct ReturnExpr { |
1014 | pub(crate) syntax: SyntaxNode, | 1068 | pub(crate) syntax: SyntaxNode, |
@@ -1028,6 +1082,7 @@ impl ast::AttrsOwner for ReturnExpr {} | |||
1028 | impl ReturnExpr { | 1082 | impl ReturnExpr { |
1029 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1083 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1030 | } | 1084 | } |
1085 | |||
1031 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1086 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1032 | pub struct CallExpr { | 1087 | pub struct CallExpr { |
1033 | pub(crate) syntax: SyntaxNode, | 1088 | pub(crate) syntax: SyntaxNode, |
@@ -1047,6 +1102,7 @@ impl ast::ArgListOwner for CallExpr {} | |||
1047 | impl CallExpr { | 1102 | impl CallExpr { |
1048 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1103 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1049 | } | 1104 | } |
1105 | |||
1050 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1106 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1051 | pub struct MethodCallExpr { | 1107 | pub struct MethodCallExpr { |
1052 | pub(crate) syntax: SyntaxNode, | 1108 | pub(crate) syntax: SyntaxNode, |
@@ -1066,10 +1122,11 @@ impl ast::AttrsOwner for MethodCallExpr {} | |||
1066 | impl ast::ArgListOwner for MethodCallExpr {} | 1122 | impl ast::ArgListOwner for MethodCallExpr {} |
1067 | impl MethodCallExpr { | 1123 | impl MethodCallExpr { |
1068 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1124 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1069 | pub fn dot_token(&self) -> Option<Dot> { support::token(&self.syntax) } | 1125 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } |
1070 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 1126 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
1071 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | 1127 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } |
1072 | } | 1128 | } |
1129 | |||
1073 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1130 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1074 | pub struct IndexExpr { | 1131 | pub struct IndexExpr { |
1075 | pub(crate) syntax: SyntaxNode, | 1132 | pub(crate) syntax: SyntaxNode, |
@@ -1087,9 +1144,10 @@ impl AstNode for IndexExpr { | |||
1087 | } | 1144 | } |
1088 | impl ast::AttrsOwner for IndexExpr {} | 1145 | impl ast::AttrsOwner for IndexExpr {} |
1089 | impl IndexExpr { | 1146 | impl IndexExpr { |
1090 | pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } | 1147 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
1091 | pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } | 1148 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
1092 | } | 1149 | } |
1150 | |||
1093 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1151 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1094 | pub struct FieldExpr { | 1152 | pub struct FieldExpr { |
1095 | pub(crate) syntax: SyntaxNode, | 1153 | pub(crate) syntax: SyntaxNode, |
@@ -1108,9 +1166,10 @@ impl AstNode for FieldExpr { | |||
1108 | impl ast::AttrsOwner for FieldExpr {} | 1166 | impl ast::AttrsOwner for FieldExpr {} |
1109 | impl FieldExpr { | 1167 | impl FieldExpr { |
1110 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1168 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1111 | pub fn dot_token(&self) -> Option<Dot> { support::token(&self.syntax) } | 1169 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } |
1112 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 1170 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
1113 | } | 1171 | } |
1172 | |||
1114 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1173 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1115 | pub struct AwaitExpr { | 1174 | pub struct AwaitExpr { |
1116 | pub(crate) syntax: SyntaxNode, | 1175 | pub(crate) syntax: SyntaxNode, |
@@ -1129,9 +1188,10 @@ impl AstNode for AwaitExpr { | |||
1129 | impl ast::AttrsOwner for AwaitExpr {} | 1188 | impl ast::AttrsOwner for AwaitExpr {} |
1130 | impl AwaitExpr { | 1189 | impl AwaitExpr { |
1131 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1190 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1132 | pub fn dot_token(&self) -> Option<Dot> { support::token(&self.syntax) } | 1191 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } |
1133 | pub fn await_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, AWAIT_KW) } | 1192 | pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) } |
1134 | } | 1193 | } |
1194 | |||
1135 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1195 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1136 | pub struct TryExpr { | 1196 | pub struct TryExpr { |
1137 | pub(crate) syntax: SyntaxNode, | 1197 | pub(crate) syntax: SyntaxNode, |
@@ -1149,9 +1209,10 @@ impl AstNode for TryExpr { | |||
1149 | } | 1209 | } |
1150 | impl ast::AttrsOwner for TryExpr {} | 1210 | impl ast::AttrsOwner for TryExpr {} |
1151 | impl TryExpr { | 1211 | impl TryExpr { |
1152 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, TRY_KW) } | 1212 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } |
1153 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1213 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1154 | } | 1214 | } |
1215 | |||
1155 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1216 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1156 | pub struct CastExpr { | 1217 | pub struct CastExpr { |
1157 | pub(crate) syntax: SyntaxNode, | 1218 | pub(crate) syntax: SyntaxNode, |
@@ -1170,9 +1231,10 @@ impl AstNode for CastExpr { | |||
1170 | impl ast::AttrsOwner for CastExpr {} | 1231 | impl ast::AttrsOwner for CastExpr {} |
1171 | impl CastExpr { | 1232 | impl CastExpr { |
1172 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1233 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1173 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, AS_KW) } | 1234 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } |
1174 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 1235 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
1175 | } | 1236 | } |
1237 | |||
1176 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1238 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1177 | pub struct RefExpr { | 1239 | pub struct RefExpr { |
1178 | pub(crate) syntax: SyntaxNode, | 1240 | pub(crate) syntax: SyntaxNode, |
@@ -1190,11 +1252,12 @@ impl AstNode for RefExpr { | |||
1190 | } | 1252 | } |
1191 | impl ast::AttrsOwner for RefExpr {} | 1253 | impl ast::AttrsOwner for RefExpr {} |
1192 | impl RefExpr { | 1254 | impl RefExpr { |
1193 | pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) } | 1255 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
1194 | pub fn raw_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, RAW_KW) } | 1256 | pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } |
1195 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) } | 1257 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
1196 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1258 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1197 | } | 1259 | } |
1260 | |||
1198 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1261 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1199 | pub struct PrefixExpr { | 1262 | pub struct PrefixExpr { |
1200 | pub(crate) syntax: SyntaxNode, | 1263 | pub(crate) syntax: SyntaxNode, |
@@ -1212,9 +1275,9 @@ impl AstNode for PrefixExpr { | |||
1212 | } | 1275 | } |
1213 | impl ast::AttrsOwner for PrefixExpr {} | 1276 | impl ast::AttrsOwner for PrefixExpr {} |
1214 | impl PrefixExpr { | 1277 | impl PrefixExpr { |
1215 | pub fn prefix_op_token(&self) -> Option<PrefixOp> { support::token(&self.syntax) } | ||
1216 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1278 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1217 | } | 1279 | } |
1280 | |||
1218 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1281 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1219 | pub struct BoxExpr { | 1282 | pub struct BoxExpr { |
1220 | pub(crate) syntax: SyntaxNode, | 1283 | pub(crate) syntax: SyntaxNode, |
@@ -1232,9 +1295,10 @@ impl AstNode for BoxExpr { | |||
1232 | } | 1295 | } |
1233 | impl ast::AttrsOwner for BoxExpr {} | 1296 | impl ast::AttrsOwner for BoxExpr {} |
1234 | impl BoxExpr { | 1297 | impl BoxExpr { |
1235 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, BOX_KW) } | 1298 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } |
1236 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1299 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1237 | } | 1300 | } |
1301 | |||
1238 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1302 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1239 | pub struct RangeExpr { | 1303 | pub struct RangeExpr { |
1240 | pub(crate) syntax: SyntaxNode, | 1304 | pub(crate) syntax: SyntaxNode, |
@@ -1251,9 +1315,8 @@ impl AstNode for RangeExpr { | |||
1251 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1315 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1252 | } | 1316 | } |
1253 | impl ast::AttrsOwner for RangeExpr {} | 1317 | impl ast::AttrsOwner for RangeExpr {} |
1254 | impl RangeExpr { | 1318 | impl RangeExpr {} |
1255 | pub fn range_op_token(&self) -> Option<RangeOp> { support::token(&self.syntax) } | 1319 | |
1256 | } | ||
1257 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1320 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1258 | pub struct BinExpr { | 1321 | pub struct BinExpr { |
1259 | pub(crate) syntax: SyntaxNode, | 1322 | pub(crate) syntax: SyntaxNode, |
@@ -1270,9 +1333,8 @@ impl AstNode for BinExpr { | |||
1270 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1333 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1271 | } | 1334 | } |
1272 | impl ast::AttrsOwner for BinExpr {} | 1335 | impl ast::AttrsOwner for BinExpr {} |
1273 | impl BinExpr { | 1336 | impl BinExpr {} |
1274 | pub fn bin_op_token(&self) -> Option<BinOp> { support::token(&self.syntax) } | 1337 | |
1275 | } | ||
1276 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1338 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1277 | pub struct Literal { | 1339 | pub struct Literal { |
1278 | pub(crate) syntax: SyntaxNode, | 1340 | pub(crate) syntax: SyntaxNode, |
@@ -1288,9 +1350,8 @@ impl AstNode for Literal { | |||
1288 | } | 1350 | } |
1289 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1351 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1290 | } | 1352 | } |
1291 | impl Literal { | 1353 | impl Literal {} |
1292 | pub fn literal_token_token(&self) -> Option<LiteralToken> { support::token(&self.syntax) } | 1354 | |
1293 | } | ||
1294 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1355 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1295 | pub struct MatchExpr { | 1356 | pub struct MatchExpr { |
1296 | pub(crate) syntax: SyntaxNode, | 1357 | pub(crate) syntax: SyntaxNode, |
@@ -1308,10 +1369,11 @@ impl AstNode for MatchExpr { | |||
1308 | } | 1369 | } |
1309 | impl ast::AttrsOwner for MatchExpr {} | 1370 | impl ast::AttrsOwner for MatchExpr {} |
1310 | impl MatchExpr { | 1371 | impl MatchExpr { |
1311 | pub fn match_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MATCH_KW) } | 1372 | pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) } |
1312 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1373 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1313 | pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } | 1374 | pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } |
1314 | } | 1375 | } |
1376 | |||
1315 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1377 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1316 | pub struct MatchArmList { | 1378 | pub struct MatchArmList { |
1317 | pub(crate) syntax: SyntaxNode, | 1379 | pub(crate) syntax: SyntaxNode, |
@@ -1329,10 +1391,11 @@ impl AstNode for MatchArmList { | |||
1329 | } | 1391 | } |
1330 | impl ast::AttrsOwner for MatchArmList {} | 1392 | impl ast::AttrsOwner for MatchArmList {} |
1331 | impl MatchArmList { | 1393 | impl MatchArmList { |
1332 | pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } | 1394 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
1333 | pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } | 1395 | pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } |
1334 | pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } | 1396 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
1335 | } | 1397 | } |
1398 | |||
1336 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1399 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1337 | pub struct MatchArm { | 1400 | pub struct MatchArm { |
1338 | pub(crate) syntax: SyntaxNode, | 1401 | pub(crate) syntax: SyntaxNode, |
@@ -1352,9 +1415,10 @@ impl ast::AttrsOwner for MatchArm {} | |||
1352 | impl MatchArm { | 1415 | impl MatchArm { |
1353 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1416 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1354 | pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } | 1417 | pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } |
1355 | pub fn fat_arrow_token(&self) -> Option<FatArrow> { support::token(&self.syntax) } | 1418 | pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } |
1356 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1419 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1357 | } | 1420 | } |
1421 | |||
1358 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1422 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1359 | pub struct MatchGuard { | 1423 | pub struct MatchGuard { |
1360 | pub(crate) syntax: SyntaxNode, | 1424 | pub(crate) syntax: SyntaxNode, |
@@ -1371,9 +1435,10 @@ impl AstNode for MatchGuard { | |||
1371 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1435 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1372 | } | 1436 | } |
1373 | impl MatchGuard { | 1437 | impl MatchGuard { |
1374 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, IF_KW) } | 1438 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } |
1375 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1439 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1376 | } | 1440 | } |
1441 | |||
1377 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1442 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1378 | pub struct RecordLit { | 1443 | pub struct RecordLit { |
1379 | pub(crate) syntax: SyntaxNode, | 1444 | pub(crate) syntax: SyntaxNode, |
@@ -1393,6 +1458,7 @@ impl RecordLit { | |||
1393 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1458 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1394 | pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } | 1459 | pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } |
1395 | } | 1460 | } |
1461 | |||
1396 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1462 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1397 | pub struct RecordFieldList { | 1463 | pub struct RecordFieldList { |
1398 | pub(crate) syntax: SyntaxNode, | 1464 | pub(crate) syntax: SyntaxNode, |
@@ -1409,12 +1475,13 @@ impl AstNode for RecordFieldList { | |||
1409 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1475 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1410 | } | 1476 | } |
1411 | impl RecordFieldList { | 1477 | impl RecordFieldList { |
1412 | pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } | 1478 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
1413 | pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) } | 1479 | pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) } |
1414 | pub fn dotdot_token(&self) -> Option<Dotdot> { support::token(&self.syntax) } | 1480 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } |
1415 | pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } | 1481 | pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } |
1416 | pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } | 1482 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
1417 | } | 1483 | } |
1484 | |||
1418 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1485 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1419 | pub struct RecordField { | 1486 | pub struct RecordField { |
1420 | pub(crate) syntax: SyntaxNode, | 1487 | pub(crate) syntax: SyntaxNode, |
@@ -1433,9 +1500,10 @@ impl AstNode for RecordField { | |||
1433 | impl ast::AttrsOwner for RecordField {} | 1500 | impl ast::AttrsOwner for RecordField {} |
1434 | impl RecordField { | 1501 | impl RecordField { |
1435 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 1502 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
1436 | pub fn colon_token(&self) -> Option<Colon> { support::token(&self.syntax) } | 1503 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
1437 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1504 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1438 | } | 1505 | } |
1506 | |||
1439 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1507 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1440 | pub struct OrPat { | 1508 | pub struct OrPat { |
1441 | pub(crate) syntax: SyntaxNode, | 1509 | pub(crate) syntax: SyntaxNode, |
@@ -1454,6 +1522,7 @@ impl AstNode for OrPat { | |||
1454 | impl OrPat { | 1522 | impl OrPat { |
1455 | pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | 1523 | pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1456 | } | 1524 | } |
1525 | |||
1457 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1526 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1458 | pub struct ParenPat { | 1527 | pub struct ParenPat { |
1459 | pub(crate) syntax: SyntaxNode, | 1528 | pub(crate) syntax: SyntaxNode, |
@@ -1470,10 +1539,11 @@ impl AstNode for ParenPat { | |||
1470 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1539 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1471 | } | 1540 | } |
1472 | impl ParenPat { | 1541 | impl ParenPat { |
1473 | pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } | 1542 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1474 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1543 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1475 | pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } | 1544 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
1476 | } | 1545 | } |
1546 | |||
1477 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1547 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1478 | pub struct RefPat { | 1548 | pub struct RefPat { |
1479 | pub(crate) syntax: SyntaxNode, | 1549 | pub(crate) syntax: SyntaxNode, |
@@ -1490,10 +1560,11 @@ impl AstNode for RefPat { | |||
1490 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1560 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1491 | } | 1561 | } |
1492 | impl RefPat { | 1562 | impl RefPat { |
1493 | pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) } | 1563 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
1494 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) } | 1564 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
1495 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1565 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1496 | } | 1566 | } |
1567 | |||
1497 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1568 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1498 | pub struct BoxPat { | 1569 | pub struct BoxPat { |
1499 | pub(crate) syntax: SyntaxNode, | 1570 | pub(crate) syntax: SyntaxNode, |
@@ -1510,9 +1581,10 @@ impl AstNode for BoxPat { | |||
1510 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1581 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1511 | } | 1582 | } |
1512 | impl BoxPat { | 1583 | impl BoxPat { |
1513 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, BOX_KW) } | 1584 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } |
1514 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1585 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1515 | } | 1586 | } |
1587 | |||
1516 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1588 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1517 | pub struct BindPat { | 1589 | pub struct BindPat { |
1518 | pub(crate) syntax: SyntaxNode, | 1590 | pub(crate) syntax: SyntaxNode, |
@@ -1531,11 +1603,12 @@ impl AstNode for BindPat { | |||
1531 | impl ast::AttrsOwner for BindPat {} | 1603 | impl ast::AttrsOwner for BindPat {} |
1532 | impl ast::NameOwner for BindPat {} | 1604 | impl ast::NameOwner for BindPat {} |
1533 | impl BindPat { | 1605 | impl BindPat { |
1534 | pub fn ref_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, REF_KW) } | 1606 | pub fn ref_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ref]) } |
1535 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, MUT_KW) } | 1607 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
1536 | pub fn at_token(&self) -> Option<At> { support::token(&self.syntax) } | 1608 | pub fn at_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![@]) } |
1537 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1609 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1538 | } | 1610 | } |
1611 | |||
1539 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1612 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1540 | pub struct PlaceholderPat { | 1613 | pub struct PlaceholderPat { |
1541 | pub(crate) syntax: SyntaxNode, | 1614 | pub(crate) syntax: SyntaxNode, |
@@ -1552,8 +1625,9 @@ impl AstNode for PlaceholderPat { | |||
1552 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1625 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1553 | } | 1626 | } |
1554 | impl PlaceholderPat { | 1627 | impl PlaceholderPat { |
1555 | pub fn underscore_token(&self) -> Option<Underscore> { support::token(&self.syntax) } | 1628 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } |
1556 | } | 1629 | } |
1630 | |||
1557 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1631 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1558 | pub struct DotDotPat { | 1632 | pub struct DotDotPat { |
1559 | pub(crate) syntax: SyntaxNode, | 1633 | pub(crate) syntax: SyntaxNode, |
@@ -1570,8 +1644,9 @@ impl AstNode for DotDotPat { | |||
1570 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1644 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1571 | } | 1645 | } |
1572 | impl DotDotPat { | 1646 | impl DotDotPat { |
1573 | pub fn dotdot_token(&self) -> Option<Dotdot> { support::token(&self.syntax) } | 1647 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } |
1574 | } | 1648 | } |
1649 | |||
1575 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1650 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1576 | pub struct PathPat { | 1651 | pub struct PathPat { |
1577 | pub(crate) syntax: SyntaxNode, | 1652 | pub(crate) syntax: SyntaxNode, |
@@ -1590,6 +1665,7 @@ impl AstNode for PathPat { | |||
1590 | impl PathPat { | 1665 | impl PathPat { |
1591 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1666 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1592 | } | 1667 | } |
1668 | |||
1593 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1669 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1594 | pub struct SlicePat { | 1670 | pub struct SlicePat { |
1595 | pub(crate) syntax: SyntaxNode, | 1671 | pub(crate) syntax: SyntaxNode, |
@@ -1606,10 +1682,11 @@ impl AstNode for SlicePat { | |||
1606 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1682 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1607 | } | 1683 | } |
1608 | impl SlicePat { | 1684 | impl SlicePat { |
1609 | pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } | 1685 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
1610 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | 1686 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1611 | pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } | 1687 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
1612 | } | 1688 | } |
1689 | |||
1613 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1690 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1614 | pub struct RangePat { | 1691 | pub struct RangePat { |
1615 | pub(crate) syntax: SyntaxNode, | 1692 | pub(crate) syntax: SyntaxNode, |
@@ -1625,9 +1702,8 @@ impl AstNode for RangePat { | |||
1625 | } | 1702 | } |
1626 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1703 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1627 | } | 1704 | } |
1628 | impl RangePat { | 1705 | impl RangePat {} |
1629 | pub fn range_separator_token(&self) -> Option<RangeSeparator> { support::token(&self.syntax) } | 1706 | |
1630 | } | ||
1631 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1707 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1632 | pub struct LiteralPat { | 1708 | pub struct LiteralPat { |
1633 | pub(crate) syntax: SyntaxNode, | 1709 | pub(crate) syntax: SyntaxNode, |
@@ -1646,6 +1722,7 @@ impl AstNode for LiteralPat { | |||
1646 | impl LiteralPat { | 1722 | impl LiteralPat { |
1647 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } | 1723 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } |
1648 | } | 1724 | } |
1725 | |||
1649 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1726 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1650 | pub struct MacroPat { | 1727 | pub struct MacroPat { |
1651 | pub(crate) syntax: SyntaxNode, | 1728 | pub(crate) syntax: SyntaxNode, |
@@ -1664,6 +1741,7 @@ impl AstNode for MacroPat { | |||
1664 | impl MacroPat { | 1741 | impl MacroPat { |
1665 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } | 1742 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } |
1666 | } | 1743 | } |
1744 | |||
1667 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1745 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1668 | pub struct RecordPat { | 1746 | pub struct RecordPat { |
1669 | pub(crate) syntax: SyntaxNode, | 1747 | pub(crate) syntax: SyntaxNode, |
@@ -1685,6 +1763,7 @@ impl RecordPat { | |||
1685 | } | 1763 | } |
1686 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1764 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1687 | } | 1765 | } |
1766 | |||
1688 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1767 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1689 | pub struct RecordFieldPatList { | 1768 | pub struct RecordFieldPatList { |
1690 | pub(crate) syntax: SyntaxNode, | 1769 | pub(crate) syntax: SyntaxNode, |
@@ -1701,15 +1780,16 @@ impl AstNode for RecordFieldPatList { | |||
1701 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1780 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1702 | } | 1781 | } |
1703 | impl RecordFieldPatList { | 1782 | impl RecordFieldPatList { |
1704 | pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } | 1783 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
1705 | pub fn pats(&self) -> AstChildren<RecordInnerPat> { support::children(&self.syntax) } | 1784 | pub fn pats(&self) -> AstChildren<RecordInnerPat> { support::children(&self.syntax) } |
1706 | pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { | 1785 | pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { |
1707 | support::children(&self.syntax) | 1786 | support::children(&self.syntax) |
1708 | } | 1787 | } |
1709 | pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) } | 1788 | pub fn bind_pats(&self) -> AstChildren<BindPat> { support::children(&self.syntax) } |
1710 | pub fn dotdot_token(&self) -> Option<Dotdot> { support::token(&self.syntax) } | 1789 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } |
1711 | pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } | 1790 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
1712 | } | 1791 | } |
1792 | |||
1713 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1793 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1714 | pub struct RecordFieldPat { | 1794 | pub struct RecordFieldPat { |
1715 | pub(crate) syntax: SyntaxNode, | 1795 | pub(crate) syntax: SyntaxNode, |
@@ -1728,9 +1808,10 @@ impl AstNode for RecordFieldPat { | |||
1728 | impl ast::AttrsOwner for RecordFieldPat {} | 1808 | impl ast::AttrsOwner for RecordFieldPat {} |
1729 | impl ast::NameOwner for RecordFieldPat {} | 1809 | impl ast::NameOwner for RecordFieldPat {} |
1730 | impl RecordFieldPat { | 1810 | impl RecordFieldPat { |
1731 | pub fn colon_token(&self) -> Option<Colon> { support::token(&self.syntax) } | 1811 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
1732 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1812 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1733 | } | 1813 | } |
1814 | |||
1734 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1815 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1735 | pub struct TupleStructPat { | 1816 | pub struct TupleStructPat { |
1736 | pub(crate) syntax: SyntaxNode, | 1817 | pub(crate) syntax: SyntaxNode, |
@@ -1748,10 +1829,11 @@ impl AstNode for TupleStructPat { | |||
1748 | } | 1829 | } |
1749 | impl TupleStructPat { | 1830 | impl TupleStructPat { |
1750 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1831 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1751 | pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } | 1832 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1752 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | 1833 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1753 | pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } | 1834 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
1754 | } | 1835 | } |
1836 | |||
1755 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1837 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1756 | pub struct TuplePat { | 1838 | pub struct TuplePat { |
1757 | pub(crate) syntax: SyntaxNode, | 1839 | pub(crate) syntax: SyntaxNode, |
@@ -1768,10 +1850,11 @@ impl AstNode for TuplePat { | |||
1768 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1850 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1769 | } | 1851 | } |
1770 | impl TuplePat { | 1852 | impl TuplePat { |
1771 | pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } | 1853 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1772 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } | 1854 | pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) } |
1773 | pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } | 1855 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
1774 | } | 1856 | } |
1857 | |||
1775 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1858 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1776 | pub struct Visibility { | 1859 | pub struct Visibility { |
1777 | pub(crate) syntax: SyntaxNode, | 1860 | pub(crate) syntax: SyntaxNode, |
@@ -1788,11 +1871,12 @@ impl AstNode for Visibility { | |||
1788 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1871 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1789 | } | 1872 | } |
1790 | impl Visibility { | 1873 | impl Visibility { |
1791 | pub fn pub_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, PUB_KW) } | 1874 | pub fn pub_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![pub]) } |
1792 | pub fn super_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, SUPER_KW) } | 1875 | pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } |
1793 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, SELF_KW) } | 1876 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } |
1794 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CRATE_KW) } | 1877 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } |
1795 | } | 1878 | } |
1879 | |||
1796 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1880 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1797 | pub struct Name { | 1881 | pub struct Name { |
1798 | pub(crate) syntax: SyntaxNode, | 1882 | pub(crate) syntax: SyntaxNode, |
@@ -1809,8 +1893,9 @@ impl AstNode for Name { | |||
1809 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1893 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1810 | } | 1894 | } |
1811 | impl Name { | 1895 | impl Name { |
1812 | pub fn ident_token(&self) -> Option<Ident> { support::token(&self.syntax) } | 1896 | pub fn ident_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![ident]) } |
1813 | } | 1897 | } |
1898 | |||
1814 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1899 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1815 | pub struct NameRef { | 1900 | pub struct NameRef { |
1816 | pub(crate) syntax: SyntaxNode, | 1901 | pub(crate) syntax: SyntaxNode, |
@@ -1826,9 +1911,8 @@ impl AstNode for NameRef { | |||
1826 | } | 1911 | } |
1827 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1912 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1828 | } | 1913 | } |
1829 | impl NameRef { | 1914 | impl NameRef {} |
1830 | pub fn name_ref_token_token(&self) -> Option<NameRefToken> { support::token(&self.syntax) } | 1915 | |
1831 | } | ||
1832 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1916 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1833 | pub struct MacroCall { | 1917 | pub struct MacroCall { |
1834 | pub(crate) syntax: SyntaxNode, | 1918 | pub(crate) syntax: SyntaxNode, |
@@ -1849,10 +1933,11 @@ impl ast::AttrsOwner for MacroCall {} | |||
1849 | impl ast::DocCommentsOwner for MacroCall {} | 1933 | impl ast::DocCommentsOwner for MacroCall {} |
1850 | impl MacroCall { | 1934 | impl MacroCall { |
1851 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1935 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1852 | pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) } | 1936 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
1853 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | 1937 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } |
1854 | pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } | 1938 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
1855 | } | 1939 | } |
1940 | |||
1856 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1941 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1857 | pub struct Attr { | 1942 | pub struct Attr { |
1858 | pub(crate) syntax: SyntaxNode, | 1943 | pub(crate) syntax: SyntaxNode, |
@@ -1869,14 +1954,15 @@ impl AstNode for Attr { | |||
1869 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1954 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1870 | } | 1955 | } |
1871 | impl Attr { | 1956 | impl Attr { |
1872 | pub fn pound_token(&self) -> Option<Pound> { support::token(&self.syntax) } | 1957 | pub fn pound_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![#]) } |
1873 | pub fn excl_token(&self) -> Option<Excl> { support::token(&self.syntax) } | 1958 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
1874 | pub fn l_brack_token(&self) -> Option<LBrack> { support::token(&self.syntax) } | 1959 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
1875 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1960 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1876 | pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } | 1961 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
1877 | pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) } | 1962 | pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) } |
1878 | pub fn r_brack_token(&self) -> Option<RBrack> { support::token(&self.syntax) } | 1963 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
1879 | } | 1964 | } |
1965 | |||
1880 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1966 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1881 | pub struct TokenTree { | 1967 | pub struct TokenTree { |
1882 | pub(crate) syntax: SyntaxNode, | 1968 | pub(crate) syntax: SyntaxNode, |
@@ -1893,6 +1979,7 @@ impl AstNode for TokenTree { | |||
1893 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1979 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1894 | } | 1980 | } |
1895 | impl TokenTree {} | 1981 | impl TokenTree {} |
1982 | |||
1896 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1983 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1897 | pub struct TypeParamList { | 1984 | pub struct TypeParamList { |
1898 | pub(crate) syntax: SyntaxNode, | 1985 | pub(crate) syntax: SyntaxNode, |
@@ -1909,13 +1996,14 @@ impl AstNode for TypeParamList { | |||
1909 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1996 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1910 | } | 1997 | } |
1911 | impl TypeParamList { | 1998 | impl TypeParamList { |
1912 | pub fn l_angle_token(&self) -> Option<LAngle> { support::token(&self.syntax) } | 1999 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } |
1913 | pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } | 2000 | pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } |
1914 | pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) } | 2001 | pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) } |
1915 | pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) } | 2002 | pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) } |
1916 | pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) } | 2003 | pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) } |
1917 | pub fn r_angle_token(&self) -> Option<RAngle> { support::token(&self.syntax) } | 2004 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } |
1918 | } | 2005 | } |
2006 | |||
1919 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2007 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1920 | pub struct TypeParam { | 2008 | pub struct TypeParam { |
1921 | pub(crate) syntax: SyntaxNode, | 2009 | pub(crate) syntax: SyntaxNode, |
@@ -1935,9 +2023,10 @@ impl ast::NameOwner for TypeParam {} | |||
1935 | impl ast::AttrsOwner for TypeParam {} | 2023 | impl ast::AttrsOwner for TypeParam {} |
1936 | impl ast::TypeBoundsOwner for TypeParam {} | 2024 | impl ast::TypeBoundsOwner for TypeParam {} |
1937 | impl TypeParam { | 2025 | impl TypeParam { |
1938 | pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } | 2026 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
1939 | pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 2027 | pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
1940 | } | 2028 | } |
2029 | |||
1941 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2030 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1942 | pub struct ConstParam { | 2031 | pub struct ConstParam { |
1943 | pub(crate) syntax: SyntaxNode, | 2032 | pub(crate) syntax: SyntaxNode, |
@@ -1957,9 +2046,10 @@ impl ast::NameOwner for ConstParam {} | |||
1957 | impl ast::AttrsOwner for ConstParam {} | 2046 | impl ast::AttrsOwner for ConstParam {} |
1958 | impl ast::TypeAscriptionOwner for ConstParam {} | 2047 | impl ast::TypeAscriptionOwner for ConstParam {} |
1959 | impl ConstParam { | 2048 | impl ConstParam { |
1960 | pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } | 2049 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
1961 | pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } | 2050 | pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } |
1962 | } | 2051 | } |
2052 | |||
1963 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2053 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1964 | pub struct LifetimeParam { | 2054 | pub struct LifetimeParam { |
1965 | pub(crate) syntax: SyntaxNode, | 2055 | pub(crate) syntax: SyntaxNode, |
@@ -1977,8 +2067,11 @@ impl AstNode for LifetimeParam { | |||
1977 | } | 2067 | } |
1978 | impl ast::AttrsOwner for LifetimeParam {} | 2068 | impl ast::AttrsOwner for LifetimeParam {} |
1979 | impl LifetimeParam { | 2069 | impl LifetimeParam { |
1980 | pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 2070 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
2071 | support::token(&self.syntax, T![lifetime]) | ||
2072 | } | ||
1981 | } | 2073 | } |
2074 | |||
1982 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2075 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1983 | pub struct TypeBound { | 2076 | pub struct TypeBound { |
1984 | pub(crate) syntax: SyntaxNode, | 2077 | pub(crate) syntax: SyntaxNode, |
@@ -1995,10 +2088,13 @@ impl AstNode for TypeBound { | |||
1995 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2088 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1996 | } | 2089 | } |
1997 | impl TypeBound { | 2090 | impl TypeBound { |
1998 | pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 2091 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
1999 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CONST_KW) } | 2092 | support::token(&self.syntax, T![lifetime]) |
2093 | } | ||
2094 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
2000 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 2095 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
2001 | } | 2096 | } |
2097 | |||
2002 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2098 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2003 | pub struct TypeBoundList { | 2099 | pub struct TypeBoundList { |
2004 | pub(crate) syntax: SyntaxNode, | 2100 | pub(crate) syntax: SyntaxNode, |
@@ -2017,6 +2113,7 @@ impl AstNode for TypeBoundList { | |||
2017 | impl TypeBoundList { | 2113 | impl TypeBoundList { |
2018 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } | 2114 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } |
2019 | } | 2115 | } |
2116 | |||
2020 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2117 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2021 | pub struct WherePred { | 2118 | pub struct WherePred { |
2022 | pub(crate) syntax: SyntaxNode, | 2119 | pub(crate) syntax: SyntaxNode, |
@@ -2034,9 +2131,12 @@ impl AstNode for WherePred { | |||
2034 | } | 2131 | } |
2035 | impl ast::TypeBoundsOwner for WherePred {} | 2132 | impl ast::TypeBoundsOwner for WherePred {} |
2036 | impl WherePred { | 2133 | impl WherePred { |
2037 | pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 2134 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
2135 | support::token(&self.syntax, T![lifetime]) | ||
2136 | } | ||
2038 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 2137 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
2039 | } | 2138 | } |
2139 | |||
2040 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2140 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2041 | pub struct WhereClause { | 2141 | pub struct WhereClause { |
2042 | pub(crate) syntax: SyntaxNode, | 2142 | pub(crate) syntax: SyntaxNode, |
@@ -2053,9 +2153,10 @@ impl AstNode for WhereClause { | |||
2053 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2153 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2054 | } | 2154 | } |
2055 | impl WhereClause { | 2155 | impl WhereClause { |
2056 | pub fn where_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, WHERE_KW) } | 2156 | pub fn where_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![where]) } |
2057 | pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) } | 2157 | pub fn predicates(&self) -> AstChildren<WherePred> { support::children(&self.syntax) } |
2058 | } | 2158 | } |
2159 | |||
2059 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2160 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2060 | pub struct Abi { | 2161 | pub struct Abi { |
2061 | pub(crate) syntax: SyntaxNode, | 2162 | pub(crate) syntax: SyntaxNode, |
@@ -2071,9 +2172,8 @@ impl AstNode for Abi { | |||
2071 | } | 2172 | } |
2072 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2173 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2073 | } | 2174 | } |
2074 | impl Abi { | 2175 | impl Abi {} |
2075 | pub fn string_token(&self) -> Option<String> { support::token(&self.syntax) } | 2176 | |
2076 | } | ||
2077 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2177 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2078 | pub struct ExprStmt { | 2178 | pub struct ExprStmt { |
2079 | pub(crate) syntax: SyntaxNode, | 2179 | pub(crate) syntax: SyntaxNode, |
@@ -2092,8 +2192,9 @@ impl AstNode for ExprStmt { | |||
2092 | impl ast::AttrsOwner for ExprStmt {} | 2192 | impl ast::AttrsOwner for ExprStmt {} |
2093 | impl ExprStmt { | 2193 | impl ExprStmt { |
2094 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 2194 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
2095 | pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } | 2195 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
2096 | } | 2196 | } |
2197 | |||
2097 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2198 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2098 | pub struct LetStmt { | 2199 | pub struct LetStmt { |
2099 | pub(crate) syntax: SyntaxNode, | 2200 | pub(crate) syntax: SyntaxNode, |
@@ -2112,12 +2213,13 @@ impl AstNode for LetStmt { | |||
2112 | impl ast::AttrsOwner for LetStmt {} | 2213 | impl ast::AttrsOwner for LetStmt {} |
2113 | impl ast::TypeAscriptionOwner for LetStmt {} | 2214 | impl ast::TypeAscriptionOwner for LetStmt {} |
2114 | impl LetStmt { | 2215 | impl LetStmt { |
2115 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, LET_KW) } | 2216 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } |
2116 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 2217 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
2117 | pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } | 2218 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
2118 | pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } | 2219 | pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } |
2119 | pub fn semi_token(&self) -> Option<Semi> { support::token(&self.syntax) } | 2220 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
2120 | } | 2221 | } |
2222 | |||
2121 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2223 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2122 | pub struct Condition { | 2224 | pub struct Condition { |
2123 | pub(crate) syntax: SyntaxNode, | 2225 | pub(crate) syntax: SyntaxNode, |
@@ -2134,11 +2236,12 @@ impl AstNode for Condition { | |||
2134 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2236 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2135 | } | 2237 | } |
2136 | impl Condition { | 2238 | impl Condition { |
2137 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, LET_KW) } | 2239 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } |
2138 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 2240 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
2139 | pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } | 2241 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
2140 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 2242 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
2141 | } | 2243 | } |
2244 | |||
2142 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2245 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2143 | pub struct Block { | 2246 | pub struct Block { |
2144 | pub(crate) syntax: SyntaxNode, | 2247 | pub(crate) syntax: SyntaxNode, |
@@ -2157,11 +2260,12 @@ impl AstNode for Block { | |||
2157 | impl ast::AttrsOwner for Block {} | 2260 | impl ast::AttrsOwner for Block {} |
2158 | impl ast::ModuleItemOwner for Block {} | 2261 | impl ast::ModuleItemOwner for Block {} |
2159 | impl Block { | 2262 | impl Block { |
2160 | pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } | 2263 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
2161 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | 2264 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } |
2162 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 2265 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
2163 | pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } | 2266 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
2164 | } | 2267 | } |
2268 | |||
2165 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2269 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2166 | pub struct ParamList { | 2270 | pub struct ParamList { |
2167 | pub(crate) syntax: SyntaxNode, | 2271 | pub(crate) syntax: SyntaxNode, |
@@ -2178,11 +2282,12 @@ impl AstNode for ParamList { | |||
2178 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2282 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2179 | } | 2283 | } |
2180 | impl ParamList { | 2284 | impl ParamList { |
2181 | pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } | 2285 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
2182 | pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } | 2286 | pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } |
2183 | pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } | 2287 | pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } |
2184 | pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } | 2288 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
2185 | } | 2289 | } |
2290 | |||
2186 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2291 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2187 | pub struct SelfParam { | 2292 | pub struct SelfParam { |
2188 | pub(crate) syntax: SyntaxNode, | 2293 | pub(crate) syntax: SyntaxNode, |
@@ -2201,10 +2306,13 @@ impl AstNode for SelfParam { | |||
2201 | impl ast::TypeAscriptionOwner for SelfParam {} | 2306 | impl ast::TypeAscriptionOwner for SelfParam {} |
2202 | impl ast::AttrsOwner for SelfParam {} | 2307 | impl ast::AttrsOwner for SelfParam {} |
2203 | impl SelfParam { | 2308 | impl SelfParam { |
2204 | pub fn amp_token(&self) -> Option<Amp> { support::token(&self.syntax) } | 2309 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
2205 | pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 2310 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
2206 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, SELF_KW) } | 2311 | support::token(&self.syntax, T![lifetime]) |
2312 | } | ||
2313 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
2207 | } | 2314 | } |
2315 | |||
2208 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2316 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2209 | pub struct Param { | 2317 | pub struct Param { |
2210 | pub(crate) syntax: SyntaxNode, | 2318 | pub(crate) syntax: SyntaxNode, |
@@ -2224,8 +2332,9 @@ impl ast::TypeAscriptionOwner for Param {} | |||
2224 | impl ast::AttrsOwner for Param {} | 2332 | impl ast::AttrsOwner for Param {} |
2225 | impl Param { | 2333 | impl Param { |
2226 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 2334 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
2227 | pub fn dotdotdot_token(&self) -> Option<Dotdotdot> { support::token(&self.syntax) } | 2335 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } |
2228 | } | 2336 | } |
2337 | |||
2229 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2338 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2230 | pub struct UseItem { | 2339 | pub struct UseItem { |
2231 | pub(crate) syntax: SyntaxNode, | 2340 | pub(crate) syntax: SyntaxNode, |
@@ -2244,9 +2353,10 @@ impl AstNode for UseItem { | |||
2244 | impl ast::AttrsOwner for UseItem {} | 2353 | impl ast::AttrsOwner for UseItem {} |
2245 | impl ast::VisibilityOwner for UseItem {} | 2354 | impl ast::VisibilityOwner for UseItem {} |
2246 | impl UseItem { | 2355 | impl UseItem { |
2247 | pub fn use_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, USE_KW) } | 2356 | pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) } |
2248 | pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) } | 2357 | pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) } |
2249 | } | 2358 | } |
2359 | |||
2250 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2360 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2251 | pub struct UseTree { | 2361 | pub struct UseTree { |
2252 | pub(crate) syntax: SyntaxNode, | 2362 | pub(crate) syntax: SyntaxNode, |
@@ -2264,10 +2374,11 @@ impl AstNode for UseTree { | |||
2264 | } | 2374 | } |
2265 | impl UseTree { | 2375 | impl UseTree { |
2266 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 2376 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
2267 | pub fn star_token(&self) -> Option<Star> { support::token(&self.syntax) } | 2377 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } |
2268 | pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } | 2378 | pub fn use_tree_list(&self) -> Option<UseTreeList> { support::child(&self.syntax) } |
2269 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } | 2379 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } |
2270 | } | 2380 | } |
2381 | |||
2271 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2382 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2272 | pub struct Alias { | 2383 | pub struct Alias { |
2273 | pub(crate) syntax: SyntaxNode, | 2384 | pub(crate) syntax: SyntaxNode, |
@@ -2285,8 +2396,9 @@ impl AstNode for Alias { | |||
2285 | } | 2396 | } |
2286 | impl ast::NameOwner for Alias {} | 2397 | impl ast::NameOwner for Alias {} |
2287 | impl Alias { | 2398 | impl Alias { |
2288 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, AS_KW) } | 2399 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } |
2289 | } | 2400 | } |
2401 | |||
2290 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2402 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2291 | pub struct UseTreeList { | 2403 | pub struct UseTreeList { |
2292 | pub(crate) syntax: SyntaxNode, | 2404 | pub(crate) syntax: SyntaxNode, |
@@ -2303,10 +2415,11 @@ impl AstNode for UseTreeList { | |||
2303 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2415 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2304 | } | 2416 | } |
2305 | impl UseTreeList { | 2417 | impl UseTreeList { |
2306 | pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } | 2418 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
2307 | pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) } | 2419 | pub fn use_trees(&self) -> AstChildren<UseTree> { support::children(&self.syntax) } |
2308 | pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } | 2420 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
2309 | } | 2421 | } |
2422 | |||
2310 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2423 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2311 | pub struct ExternCrateItem { | 2424 | pub struct ExternCrateItem { |
2312 | pub(crate) syntax: SyntaxNode, | 2425 | pub(crate) syntax: SyntaxNode, |
@@ -2325,11 +2438,12 @@ impl AstNode for ExternCrateItem { | |||
2325 | impl ast::AttrsOwner for ExternCrateItem {} | 2438 | impl ast::AttrsOwner for ExternCrateItem {} |
2326 | impl ast::VisibilityOwner for ExternCrateItem {} | 2439 | impl ast::VisibilityOwner for ExternCrateItem {} |
2327 | impl ExternCrateItem { | 2440 | impl ExternCrateItem { |
2328 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, EXTERN_KW) } | 2441 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } |
2329 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token2(&self.syntax, CRATE_KW) } | 2442 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } |
2330 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 2443 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
2331 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } | 2444 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } |
2332 | } | 2445 | } |
2446 | |||
2333 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2447 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2334 | pub struct ArgList { | 2448 | pub struct ArgList { |
2335 | pub(crate) syntax: SyntaxNode, | 2449 | pub(crate) syntax: SyntaxNode, |
@@ -2346,10 +2460,11 @@ impl AstNode for ArgList { | |||
2346 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2460 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2347 | } | 2461 | } |
2348 | impl ArgList { | 2462 | impl ArgList { |
2349 | pub fn l_paren_token(&self) -> Option<LParen> { support::token(&self.syntax) } | 2463 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
2350 | pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | 2464 | pub fn args(&self) -> AstChildren<Expr> { support::children(&self.syntax) } |
2351 | pub fn r_paren_token(&self) -> Option<RParen> { support::token(&self.syntax) } | 2465 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
2352 | } | 2466 | } |
2467 | |||
2353 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2468 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2354 | pub struct Path { | 2469 | pub struct Path { |
2355 | pub(crate) syntax: SyntaxNode, | 2470 | pub(crate) syntax: SyntaxNode, |
@@ -2369,6 +2484,7 @@ impl Path { | |||
2369 | pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } | 2484 | pub fn segment(&self) -> Option<PathSegment> { support::child(&self.syntax) } |
2370 | pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) } | 2485 | pub fn qualifier(&self) -> Option<Path> { support::child(&self.syntax) } |
2371 | } | 2486 | } |
2487 | |||
2372 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2488 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2373 | pub struct PathSegment { | 2489 | pub struct PathSegment { |
2374 | pub(crate) syntax: SyntaxNode, | 2490 | pub(crate) syntax: SyntaxNode, |
@@ -2385,15 +2501,16 @@ impl AstNode for PathSegment { | |||
2385 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2501 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2386 | } | 2502 | } |
2387 | impl PathSegment { | 2503 | impl PathSegment { |
2388 | pub fn coloncolon_token(&self) -> Option<Coloncolon> { support::token(&self.syntax) } | 2504 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } |
2389 | pub fn l_angle_token(&self) -> Option<LAngle> { support::token(&self.syntax) } | 2505 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } |
2390 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 2506 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
2391 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | 2507 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } |
2392 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | 2508 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } |
2393 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | 2509 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } |
2394 | pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) } | 2510 | pub fn path_type(&self) -> Option<PathType> { support::child(&self.syntax) } |
2395 | pub fn r_angle_token(&self) -> Option<RAngle> { support::token(&self.syntax) } | 2511 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } |
2396 | } | 2512 | } |
2513 | |||
2397 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2514 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2398 | pub struct TypeArgList { | 2515 | pub struct TypeArgList { |
2399 | pub(crate) syntax: SyntaxNode, | 2516 | pub(crate) syntax: SyntaxNode, |
@@ -2410,15 +2527,16 @@ impl AstNode for TypeArgList { | |||
2410 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2527 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2411 | } | 2528 | } |
2412 | impl TypeArgList { | 2529 | impl TypeArgList { |
2413 | pub fn coloncolon_token(&self) -> Option<Coloncolon> { support::token(&self.syntax) } | 2530 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } |
2414 | pub fn l_angle_token(&self) -> Option<LAngle> { support::token(&self.syntax) } | 2531 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } |
2415 | pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) } | 2532 | pub fn generic_args(&self) -> AstChildren<GenericArg> { support::children(&self.syntax) } |
2416 | pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) } | 2533 | pub fn type_args(&self) -> AstChildren<TypeArg> { support::children(&self.syntax) } |
2417 | pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) } | 2534 | pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { support::children(&self.syntax) } |
2418 | pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) } | 2535 | pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { support::children(&self.syntax) } |
2419 | pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) } | 2536 | pub fn const_args(&self) -> AstChildren<ConstArg> { support::children(&self.syntax) } |
2420 | pub fn r_angle_token(&self) -> Option<RAngle> { support::token(&self.syntax) } | 2537 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } |
2421 | } | 2538 | } |
2539 | |||
2422 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2540 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2423 | pub struct TypeArg { | 2541 | pub struct TypeArg { |
2424 | pub(crate) syntax: SyntaxNode, | 2542 | pub(crate) syntax: SyntaxNode, |
@@ -2437,6 +2555,7 @@ impl AstNode for TypeArg { | |||
2437 | impl TypeArg { | 2555 | impl TypeArg { |
2438 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 2556 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
2439 | } | 2557 | } |
2558 | |||
2440 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2559 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2441 | pub struct AssocTypeArg { | 2560 | pub struct AssocTypeArg { |
2442 | pub(crate) syntax: SyntaxNode, | 2561 | pub(crate) syntax: SyntaxNode, |
@@ -2455,9 +2574,10 @@ impl AstNode for AssocTypeArg { | |||
2455 | impl ast::TypeBoundsOwner for AssocTypeArg {} | 2574 | impl ast::TypeBoundsOwner for AssocTypeArg {} |
2456 | impl AssocTypeArg { | 2575 | impl AssocTypeArg { |
2457 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 2576 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
2458 | pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } | 2577 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
2459 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 2578 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
2460 | } | 2579 | } |
2580 | |||
2461 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2581 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2462 | pub struct LifetimeArg { | 2582 | pub struct LifetimeArg { |
2463 | pub(crate) syntax: SyntaxNode, | 2583 | pub(crate) syntax: SyntaxNode, |
@@ -2474,8 +2594,11 @@ impl AstNode for LifetimeArg { | |||
2474 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2594 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2475 | } | 2595 | } |
2476 | impl LifetimeArg { | 2596 | impl LifetimeArg { |
2477 | pub fn lifetime_token(&self) -> Option<Lifetime> { support::token(&self.syntax) } | 2597 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
2598 | support::token(&self.syntax, T![lifetime]) | ||
2599 | } | ||
2478 | } | 2600 | } |
2601 | |||
2479 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2602 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2480 | pub struct ConstArg { | 2603 | pub struct ConstArg { |
2481 | pub(crate) syntax: SyntaxNode, | 2604 | pub(crate) syntax: SyntaxNode, |
@@ -2493,9 +2616,10 @@ impl AstNode for ConstArg { | |||
2493 | } | 2616 | } |
2494 | impl ConstArg { | 2617 | impl ConstArg { |
2495 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } | 2618 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } |
2496 | pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } | 2619 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
2497 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | 2620 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } |
2498 | } | 2621 | } |
2622 | |||
2499 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2623 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2500 | pub struct MacroItems { | 2624 | pub struct MacroItems { |
2501 | pub(crate) syntax: SyntaxNode, | 2625 | pub(crate) syntax: SyntaxNode, |
@@ -2513,6 +2637,7 @@ impl AstNode for MacroItems { | |||
2513 | } | 2637 | } |
2514 | impl ast::ModuleItemOwner for MacroItems {} | 2638 | impl ast::ModuleItemOwner for MacroItems {} |
2515 | impl MacroItems {} | 2639 | impl MacroItems {} |
2640 | |||
2516 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2641 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2517 | pub struct MacroStmts { | 2642 | pub struct MacroStmts { |
2518 | pub(crate) syntax: SyntaxNode, | 2643 | pub(crate) syntax: SyntaxNode, |
@@ -2532,6 +2657,7 @@ impl MacroStmts { | |||
2532 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | 2657 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } |
2533 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 2658 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
2534 | } | 2659 | } |
2660 | |||
2535 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2661 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2536 | pub struct ExternItemList { | 2662 | pub struct ExternItemList { |
2537 | pub(crate) syntax: SyntaxNode, | 2663 | pub(crate) syntax: SyntaxNode, |
@@ -2549,10 +2675,11 @@ impl AstNode for ExternItemList { | |||
2549 | } | 2675 | } |
2550 | impl ast::ModuleItemOwner for ExternItemList {} | 2676 | impl ast::ModuleItemOwner for ExternItemList {} |
2551 | impl ExternItemList { | 2677 | impl ExternItemList { |
2552 | pub fn l_curly_token(&self) -> Option<LCurly> { support::token(&self.syntax) } | 2678 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
2553 | pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) } | 2679 | pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) } |
2554 | pub fn r_curly_token(&self) -> Option<RCurly> { support::token(&self.syntax) } | 2680 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
2555 | } | 2681 | } |
2682 | |||
2556 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2683 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2557 | pub struct ExternBlock { | 2684 | pub struct ExternBlock { |
2558 | pub(crate) syntax: SyntaxNode, | 2685 | pub(crate) syntax: SyntaxNode, |
@@ -2572,6 +2699,7 @@ impl ExternBlock { | |||
2572 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | 2699 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } |
2573 | pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) } | 2700 | pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) } |
2574 | } | 2701 | } |
2702 | |||
2575 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2703 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2576 | pub struct MetaItem { | 2704 | pub struct MetaItem { |
2577 | pub(crate) syntax: SyntaxNode, | 2705 | pub(crate) syntax: SyntaxNode, |
@@ -2589,10 +2717,11 @@ impl AstNode for MetaItem { | |||
2589 | } | 2717 | } |
2590 | impl MetaItem { | 2718 | impl MetaItem { |
2591 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 2719 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
2592 | pub fn eq_token(&self) -> Option<Eq> { support::token(&self.syntax) } | 2720 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
2593 | pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) } | 2721 | pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) } |
2594 | pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) } | 2722 | pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) } |
2595 | } | 2723 | } |
2724 | |||
2596 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2725 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2597 | pub struct MacroDef { | 2726 | pub struct MacroDef { |
2598 | pub(crate) syntax: SyntaxNode, | 2727 | pub(crate) syntax: SyntaxNode, |
@@ -2612,6 +2741,7 @@ impl MacroDef { | |||
2612 | pub fn name(&self) -> Option<Name> { support::child(&self.syntax) } | 2741 | pub fn name(&self) -> Option<Name> { support::child(&self.syntax) } |
2613 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | 2742 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } |
2614 | } | 2743 | } |
2744 | |||
2615 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2745 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2616 | pub enum NominalDef { | 2746 | pub enum NominalDef { |
2617 | StructDef(StructDef), | 2747 | StructDef(StructDef), |
@@ -2654,6 +2784,7 @@ impl AstNode for NominalDef { | |||
2654 | impl ast::NameOwner for NominalDef {} | 2784 | impl ast::NameOwner for NominalDef {} |
2655 | impl ast::TypeParamsOwner for NominalDef {} | 2785 | impl ast::TypeParamsOwner for NominalDef {} |
2656 | impl ast::AttrsOwner for NominalDef {} | 2786 | impl ast::AttrsOwner for NominalDef {} |
2787 | |||
2657 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2788 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2658 | pub enum GenericParam { | 2789 | pub enum GenericParam { |
2659 | LifetimeParam(LifetimeParam), | 2790 | LifetimeParam(LifetimeParam), |
@@ -2693,6 +2824,7 @@ impl AstNode for GenericParam { | |||
2693 | } | 2824 | } |
2694 | } | 2825 | } |
2695 | } | 2826 | } |
2827 | |||
2696 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2828 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2697 | pub enum GenericArg { | 2829 | pub enum GenericArg { |
2698 | LifetimeArg(LifetimeArg), | 2830 | LifetimeArg(LifetimeArg), |
@@ -2738,6 +2870,7 @@ impl AstNode for GenericArg { | |||
2738 | } | 2870 | } |
2739 | } | 2871 | } |
2740 | } | 2872 | } |
2873 | |||
2741 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2874 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2742 | pub enum TypeRef { | 2875 | pub enum TypeRef { |
2743 | ParenType(ParenType), | 2876 | ParenType(ParenType), |
@@ -2839,6 +2972,7 @@ impl AstNode for TypeRef { | |||
2839 | } | 2972 | } |
2840 | } | 2973 | } |
2841 | } | 2974 | } |
2975 | |||
2842 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2976 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2843 | pub enum ModuleItem { | 2977 | pub enum ModuleItem { |
2844 | StructDef(StructDef), | 2978 | StructDef(StructDef), |
@@ -2949,6 +3083,7 @@ impl AstNode for ModuleItem { | |||
2949 | impl ast::NameOwner for ModuleItem {} | 3083 | impl ast::NameOwner for ModuleItem {} |
2950 | impl ast::AttrsOwner for ModuleItem {} | 3084 | impl ast::AttrsOwner for ModuleItem {} |
2951 | impl ast::VisibilityOwner for ModuleItem {} | 3085 | impl ast::VisibilityOwner for ModuleItem {} |
3086 | |||
2952 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3087 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2953 | pub enum ImplItem { | 3088 | pub enum ImplItem { |
2954 | FnDef(FnDef), | 3089 | FnDef(FnDef), |
@@ -2990,6 +3125,7 @@ impl AstNode for ImplItem { | |||
2990 | } | 3125 | } |
2991 | impl ast::NameOwner for ImplItem {} | 3126 | impl ast::NameOwner for ImplItem {} |
2992 | impl ast::AttrsOwner for ImplItem {} | 3127 | impl ast::AttrsOwner for ImplItem {} |
3128 | |||
2993 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3129 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2994 | pub enum ExternItem { | 3130 | pub enum ExternItem { |
2995 | FnDef(FnDef), | 3131 | FnDef(FnDef), |
@@ -3026,6 +3162,7 @@ impl AstNode for ExternItem { | |||
3026 | impl ast::NameOwner for ExternItem {} | 3162 | impl ast::NameOwner for ExternItem {} |
3027 | impl ast::AttrsOwner for ExternItem {} | 3163 | impl ast::AttrsOwner for ExternItem {} |
3028 | impl ast::VisibilityOwner for ExternItem {} | 3164 | impl ast::VisibilityOwner for ExternItem {} |
3165 | |||
3029 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3166 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3030 | pub enum Expr { | 3167 | pub enum Expr { |
3031 | TupleExpr(TupleExpr), | 3168 | TupleExpr(TupleExpr), |
@@ -3239,6 +3376,7 @@ impl AstNode for Expr { | |||
3239 | } | 3376 | } |
3240 | } | 3377 | } |
3241 | impl ast::AttrsOwner for Expr {} | 3378 | impl ast::AttrsOwner for Expr {} |
3379 | |||
3242 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3380 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3243 | pub enum Pat { | 3381 | pub enum Pat { |
3244 | OrPat(OrPat), | 3382 | OrPat(OrPat), |
@@ -3352,6 +3490,7 @@ impl AstNode for Pat { | |||
3352 | } | 3490 | } |
3353 | } | 3491 | } |
3354 | } | 3492 | } |
3493 | |||
3355 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3494 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3356 | pub enum RecordInnerPat { | 3495 | pub enum RecordInnerPat { |
3357 | RecordFieldPat(RecordFieldPat), | 3496 | RecordFieldPat(RecordFieldPat), |
@@ -3385,6 +3524,7 @@ impl AstNode for RecordInnerPat { | |||
3385 | } | 3524 | } |
3386 | } | 3525 | } |
3387 | } | 3526 | } |
3527 | |||
3388 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3528 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3389 | pub enum AttrInput { | 3529 | pub enum AttrInput { |
3390 | Literal(Literal), | 3530 | Literal(Literal), |
@@ -3418,6 +3558,7 @@ impl AstNode for AttrInput { | |||
3418 | } | 3558 | } |
3419 | } | 3559 | } |
3420 | } | 3560 | } |
3561 | |||
3421 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3562 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3422 | pub enum Stmt { | 3563 | pub enum Stmt { |
3423 | LetStmt(LetStmt), | 3564 | LetStmt(LetStmt), |
@@ -3451,6 +3592,7 @@ impl AstNode for Stmt { | |||
3451 | } | 3592 | } |
3452 | } | 3593 | } |
3453 | } | 3594 | } |
3595 | |||
3454 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3596 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3455 | pub enum FieldDefList { | 3597 | pub enum FieldDefList { |
3456 | RecordFieldDefList(RecordFieldDefList), | 3598 | RecordFieldDefList(RecordFieldDefList), |
diff --git a/crates/ra_syntax/src/ast/generated/tokens.rs b/crates/ra_syntax/src/ast/generated/tokens.rs index 7344b0e49..f91befaac 100644 --- a/crates/ra_syntax/src/ast/generated/tokens.rs +++ b/crates/ra_syntax/src/ast/generated/tokens.rs | |||
@@ -5,1246 +5,7 @@ use crate::{ | |||
5 | SyntaxKind::{self, *}, | 5 | SyntaxKind::{self, *}, |
6 | SyntaxToken, | 6 | SyntaxToken, |
7 | }; | 7 | }; |
8 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 8 | |
9 | pub struct Semi { | ||
10 | pub(crate) syntax: SyntaxToken, | ||
11 | } | ||
12 | impl std::fmt::Display for Semi { | ||
13 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
14 | std::fmt::Display::fmt(&self.syntax, f) | ||
15 | } | ||
16 | } | ||
17 | impl AstToken for Semi { | ||
18 | fn can_cast(kind: SyntaxKind) -> bool { kind == SEMI } | ||
19 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
20 | if Self::can_cast(syntax.kind()) { | ||
21 | Some(Self { syntax }) | ||
22 | } else { | ||
23 | None | ||
24 | } | ||
25 | } | ||
26 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
27 | } | ||
28 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
29 | pub struct Comma { | ||
30 | pub(crate) syntax: SyntaxToken, | ||
31 | } | ||
32 | impl std::fmt::Display for Comma { | ||
33 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
34 | std::fmt::Display::fmt(&self.syntax, f) | ||
35 | } | ||
36 | } | ||
37 | impl AstToken for Comma { | ||
38 | fn can_cast(kind: SyntaxKind) -> bool { kind == COMMA } | ||
39 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
40 | if Self::can_cast(syntax.kind()) { | ||
41 | Some(Self { syntax }) | ||
42 | } else { | ||
43 | None | ||
44 | } | ||
45 | } | ||
46 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
47 | } | ||
48 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
49 | pub struct LParen { | ||
50 | pub(crate) syntax: SyntaxToken, | ||
51 | } | ||
52 | impl std::fmt::Display for LParen { | ||
53 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
54 | std::fmt::Display::fmt(&self.syntax, f) | ||
55 | } | ||
56 | } | ||
57 | impl AstToken for LParen { | ||
58 | fn can_cast(kind: SyntaxKind) -> bool { kind == L_PAREN } | ||
59 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
60 | if Self::can_cast(syntax.kind()) { | ||
61 | Some(Self { syntax }) | ||
62 | } else { | ||
63 | None | ||
64 | } | ||
65 | } | ||
66 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
67 | } | ||
68 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
69 | pub struct RParen { | ||
70 | pub(crate) syntax: SyntaxToken, | ||
71 | } | ||
72 | impl std::fmt::Display for RParen { | ||
73 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
74 | std::fmt::Display::fmt(&self.syntax, f) | ||
75 | } | ||
76 | } | ||
77 | impl AstToken for RParen { | ||
78 | fn can_cast(kind: SyntaxKind) -> bool { kind == R_PAREN } | ||
79 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
80 | if Self::can_cast(syntax.kind()) { | ||
81 | Some(Self { syntax }) | ||
82 | } else { | ||
83 | None | ||
84 | } | ||
85 | } | ||
86 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
87 | } | ||
88 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
89 | pub struct LCurly { | ||
90 | pub(crate) syntax: SyntaxToken, | ||
91 | } | ||
92 | impl std::fmt::Display for LCurly { | ||
93 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
94 | std::fmt::Display::fmt(&self.syntax, f) | ||
95 | } | ||
96 | } | ||
97 | impl AstToken for LCurly { | ||
98 | fn can_cast(kind: SyntaxKind) -> bool { kind == L_CURLY } | ||
99 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
100 | if Self::can_cast(syntax.kind()) { | ||
101 | Some(Self { syntax }) | ||
102 | } else { | ||
103 | None | ||
104 | } | ||
105 | } | ||
106 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
107 | } | ||
108 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
109 | pub struct RCurly { | ||
110 | pub(crate) syntax: SyntaxToken, | ||
111 | } | ||
112 | impl std::fmt::Display for RCurly { | ||
113 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
114 | std::fmt::Display::fmt(&self.syntax, f) | ||
115 | } | ||
116 | } | ||
117 | impl AstToken for RCurly { | ||
118 | fn can_cast(kind: SyntaxKind) -> bool { kind == R_CURLY } | ||
119 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
120 | if Self::can_cast(syntax.kind()) { | ||
121 | Some(Self { syntax }) | ||
122 | } else { | ||
123 | None | ||
124 | } | ||
125 | } | ||
126 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
127 | } | ||
128 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
129 | pub struct LBrack { | ||
130 | pub(crate) syntax: SyntaxToken, | ||
131 | } | ||
132 | impl std::fmt::Display for LBrack { | ||
133 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
134 | std::fmt::Display::fmt(&self.syntax, f) | ||
135 | } | ||
136 | } | ||
137 | impl AstToken for LBrack { | ||
138 | fn can_cast(kind: SyntaxKind) -> bool { kind == L_BRACK } | ||
139 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
140 | if Self::can_cast(syntax.kind()) { | ||
141 | Some(Self { syntax }) | ||
142 | } else { | ||
143 | None | ||
144 | } | ||
145 | } | ||
146 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
147 | } | ||
148 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
149 | pub struct RBrack { | ||
150 | pub(crate) syntax: SyntaxToken, | ||
151 | } | ||
152 | impl std::fmt::Display for RBrack { | ||
153 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
154 | std::fmt::Display::fmt(&self.syntax, f) | ||
155 | } | ||
156 | } | ||
157 | impl AstToken for RBrack { | ||
158 | fn can_cast(kind: SyntaxKind) -> bool { kind == R_BRACK } | ||
159 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
160 | if Self::can_cast(syntax.kind()) { | ||
161 | Some(Self { syntax }) | ||
162 | } else { | ||
163 | None | ||
164 | } | ||
165 | } | ||
166 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
167 | } | ||
168 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
169 | pub struct LAngle { | ||
170 | pub(crate) syntax: SyntaxToken, | ||
171 | } | ||
172 | impl std::fmt::Display for LAngle { | ||
173 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
174 | std::fmt::Display::fmt(&self.syntax, f) | ||
175 | } | ||
176 | } | ||
177 | impl AstToken for LAngle { | ||
178 | fn can_cast(kind: SyntaxKind) -> bool { kind == L_ANGLE } | ||
179 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
180 | if Self::can_cast(syntax.kind()) { | ||
181 | Some(Self { syntax }) | ||
182 | } else { | ||
183 | None | ||
184 | } | ||
185 | } | ||
186 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
187 | } | ||
188 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
189 | pub struct RAngle { | ||
190 | pub(crate) syntax: SyntaxToken, | ||
191 | } | ||
192 | impl std::fmt::Display for RAngle { | ||
193 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
194 | std::fmt::Display::fmt(&self.syntax, f) | ||
195 | } | ||
196 | } | ||
197 | impl AstToken for RAngle { | ||
198 | fn can_cast(kind: SyntaxKind) -> bool { kind == R_ANGLE } | ||
199 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
200 | if Self::can_cast(syntax.kind()) { | ||
201 | Some(Self { syntax }) | ||
202 | } else { | ||
203 | None | ||
204 | } | ||
205 | } | ||
206 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
207 | } | ||
208 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
209 | pub struct At { | ||
210 | pub(crate) syntax: SyntaxToken, | ||
211 | } | ||
212 | impl std::fmt::Display for At { | ||
213 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
214 | std::fmt::Display::fmt(&self.syntax, f) | ||
215 | } | ||
216 | } | ||
217 | impl AstToken for At { | ||
218 | fn can_cast(kind: SyntaxKind) -> bool { kind == AT } | ||
219 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
220 | if Self::can_cast(syntax.kind()) { | ||
221 | Some(Self { syntax }) | ||
222 | } else { | ||
223 | None | ||
224 | } | ||
225 | } | ||
226 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
227 | } | ||
228 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
229 | pub struct Pound { | ||
230 | pub(crate) syntax: SyntaxToken, | ||
231 | } | ||
232 | impl std::fmt::Display for Pound { | ||
233 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
234 | std::fmt::Display::fmt(&self.syntax, f) | ||
235 | } | ||
236 | } | ||
237 | impl AstToken for Pound { | ||
238 | fn can_cast(kind: SyntaxKind) -> bool { kind == POUND } | ||
239 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
240 | if Self::can_cast(syntax.kind()) { | ||
241 | Some(Self { syntax }) | ||
242 | } else { | ||
243 | None | ||
244 | } | ||
245 | } | ||
246 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
247 | } | ||
248 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
249 | pub struct Tilde { | ||
250 | pub(crate) syntax: SyntaxToken, | ||
251 | } | ||
252 | impl std::fmt::Display for Tilde { | ||
253 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
254 | std::fmt::Display::fmt(&self.syntax, f) | ||
255 | } | ||
256 | } | ||
257 | impl AstToken for Tilde { | ||
258 | fn can_cast(kind: SyntaxKind) -> bool { kind == TILDE } | ||
259 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
260 | if Self::can_cast(syntax.kind()) { | ||
261 | Some(Self { syntax }) | ||
262 | } else { | ||
263 | None | ||
264 | } | ||
265 | } | ||
266 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
267 | } | ||
268 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
269 | pub struct Question { | ||
270 | pub(crate) syntax: SyntaxToken, | ||
271 | } | ||
272 | impl std::fmt::Display for Question { | ||
273 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
274 | std::fmt::Display::fmt(&self.syntax, f) | ||
275 | } | ||
276 | } | ||
277 | impl AstToken for Question { | ||
278 | fn can_cast(kind: SyntaxKind) -> bool { kind == QUESTION } | ||
279 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
280 | if Self::can_cast(syntax.kind()) { | ||
281 | Some(Self { syntax }) | ||
282 | } else { | ||
283 | None | ||
284 | } | ||
285 | } | ||
286 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
287 | } | ||
288 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
289 | pub struct Dollar { | ||
290 | pub(crate) syntax: SyntaxToken, | ||
291 | } | ||
292 | impl std::fmt::Display for Dollar { | ||
293 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
294 | std::fmt::Display::fmt(&self.syntax, f) | ||
295 | } | ||
296 | } | ||
297 | impl AstToken for Dollar { | ||
298 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOLLAR } | ||
299 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
300 | if Self::can_cast(syntax.kind()) { | ||
301 | Some(Self { syntax }) | ||
302 | } else { | ||
303 | None | ||
304 | } | ||
305 | } | ||
306 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
307 | } | ||
308 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
309 | pub struct Amp { | ||
310 | pub(crate) syntax: SyntaxToken, | ||
311 | } | ||
312 | impl std::fmt::Display for Amp { | ||
313 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
314 | std::fmt::Display::fmt(&self.syntax, f) | ||
315 | } | ||
316 | } | ||
317 | impl AstToken for Amp { | ||
318 | fn can_cast(kind: SyntaxKind) -> bool { kind == AMP } | ||
319 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
320 | if Self::can_cast(syntax.kind()) { | ||
321 | Some(Self { syntax }) | ||
322 | } else { | ||
323 | None | ||
324 | } | ||
325 | } | ||
326 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
327 | } | ||
328 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
329 | pub struct Pipe { | ||
330 | pub(crate) syntax: SyntaxToken, | ||
331 | } | ||
332 | impl std::fmt::Display for Pipe { | ||
333 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
334 | std::fmt::Display::fmt(&self.syntax, f) | ||
335 | } | ||
336 | } | ||
337 | impl AstToken for Pipe { | ||
338 | fn can_cast(kind: SyntaxKind) -> bool { kind == PIPE } | ||
339 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
340 | if Self::can_cast(syntax.kind()) { | ||
341 | Some(Self { syntax }) | ||
342 | } else { | ||
343 | None | ||
344 | } | ||
345 | } | ||
346 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
347 | } | ||
348 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
349 | pub struct Plus { | ||
350 | pub(crate) syntax: SyntaxToken, | ||
351 | } | ||
352 | impl std::fmt::Display for Plus { | ||
353 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
354 | std::fmt::Display::fmt(&self.syntax, f) | ||
355 | } | ||
356 | } | ||
357 | impl AstToken for Plus { | ||
358 | fn can_cast(kind: SyntaxKind) -> bool { kind == PLUS } | ||
359 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
360 | if Self::can_cast(syntax.kind()) { | ||
361 | Some(Self { syntax }) | ||
362 | } else { | ||
363 | None | ||
364 | } | ||
365 | } | ||
366 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
367 | } | ||
368 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
369 | pub struct Star { | ||
370 | pub(crate) syntax: SyntaxToken, | ||
371 | } | ||
372 | impl std::fmt::Display for Star { | ||
373 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
374 | std::fmt::Display::fmt(&self.syntax, f) | ||
375 | } | ||
376 | } | ||
377 | impl AstToken for Star { | ||
378 | fn can_cast(kind: SyntaxKind) -> bool { kind == STAR } | ||
379 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
380 | if Self::can_cast(syntax.kind()) { | ||
381 | Some(Self { syntax }) | ||
382 | } else { | ||
383 | None | ||
384 | } | ||
385 | } | ||
386 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
387 | } | ||
388 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
389 | pub struct Slash { | ||
390 | pub(crate) syntax: SyntaxToken, | ||
391 | } | ||
392 | impl std::fmt::Display for Slash { | ||
393 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
394 | std::fmt::Display::fmt(&self.syntax, f) | ||
395 | } | ||
396 | } | ||
397 | impl AstToken for Slash { | ||
398 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLASH } | ||
399 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
400 | if Self::can_cast(syntax.kind()) { | ||
401 | Some(Self { syntax }) | ||
402 | } else { | ||
403 | None | ||
404 | } | ||
405 | } | ||
406 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
407 | } | ||
408 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
409 | pub struct Caret { | ||
410 | pub(crate) syntax: SyntaxToken, | ||
411 | } | ||
412 | impl std::fmt::Display for Caret { | ||
413 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
414 | std::fmt::Display::fmt(&self.syntax, f) | ||
415 | } | ||
416 | } | ||
417 | impl AstToken for Caret { | ||
418 | fn can_cast(kind: SyntaxKind) -> bool { kind == CARET } | ||
419 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
420 | if Self::can_cast(syntax.kind()) { | ||
421 | Some(Self { syntax }) | ||
422 | } else { | ||
423 | None | ||
424 | } | ||
425 | } | ||
426 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
427 | } | ||
428 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
429 | pub struct Percent { | ||
430 | pub(crate) syntax: SyntaxToken, | ||
431 | } | ||
432 | impl std::fmt::Display for Percent { | ||
433 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
434 | std::fmt::Display::fmt(&self.syntax, f) | ||
435 | } | ||
436 | } | ||
437 | impl AstToken for Percent { | ||
438 | fn can_cast(kind: SyntaxKind) -> bool { kind == PERCENT } | ||
439 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
440 | if Self::can_cast(syntax.kind()) { | ||
441 | Some(Self { syntax }) | ||
442 | } else { | ||
443 | None | ||
444 | } | ||
445 | } | ||
446 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
447 | } | ||
448 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
449 | pub struct Underscore { | ||
450 | pub(crate) syntax: SyntaxToken, | ||
451 | } | ||
452 | impl std::fmt::Display for Underscore { | ||
453 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
454 | std::fmt::Display::fmt(&self.syntax, f) | ||
455 | } | ||
456 | } | ||
457 | impl AstToken for Underscore { | ||
458 | fn can_cast(kind: SyntaxKind) -> bool { kind == UNDERSCORE } | ||
459 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
460 | if Self::can_cast(syntax.kind()) { | ||
461 | Some(Self { syntax }) | ||
462 | } else { | ||
463 | None | ||
464 | } | ||
465 | } | ||
466 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
467 | } | ||
468 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
469 | pub struct Dot { | ||
470 | pub(crate) syntax: SyntaxToken, | ||
471 | } | ||
472 | impl std::fmt::Display for Dot { | ||
473 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
474 | std::fmt::Display::fmt(&self.syntax, f) | ||
475 | } | ||
476 | } | ||
477 | impl AstToken for Dot { | ||
478 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOT } | ||
479 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
480 | if Self::can_cast(syntax.kind()) { | ||
481 | Some(Self { syntax }) | ||
482 | } else { | ||
483 | None | ||
484 | } | ||
485 | } | ||
486 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
487 | } | ||
488 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
489 | pub struct Dotdot { | ||
490 | pub(crate) syntax: SyntaxToken, | ||
491 | } | ||
492 | impl std::fmt::Display for Dotdot { | ||
493 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
494 | std::fmt::Display::fmt(&self.syntax, f) | ||
495 | } | ||
496 | } | ||
497 | impl AstToken for Dotdot { | ||
498 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOTDOT } | ||
499 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
500 | if Self::can_cast(syntax.kind()) { | ||
501 | Some(Self { syntax }) | ||
502 | } else { | ||
503 | None | ||
504 | } | ||
505 | } | ||
506 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
507 | } | ||
508 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
509 | pub struct Dotdotdot { | ||
510 | pub(crate) syntax: SyntaxToken, | ||
511 | } | ||
512 | impl std::fmt::Display for Dotdotdot { | ||
513 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
514 | std::fmt::Display::fmt(&self.syntax, f) | ||
515 | } | ||
516 | } | ||
517 | impl AstToken for Dotdotdot { | ||
518 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOTDOTDOT } | ||
519 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
520 | if Self::can_cast(syntax.kind()) { | ||
521 | Some(Self { syntax }) | ||
522 | } else { | ||
523 | None | ||
524 | } | ||
525 | } | ||
526 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
527 | } | ||
528 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
529 | pub struct Dotdoteq { | ||
530 | pub(crate) syntax: SyntaxToken, | ||
531 | } | ||
532 | impl std::fmt::Display for Dotdoteq { | ||
533 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
534 | std::fmt::Display::fmt(&self.syntax, f) | ||
535 | } | ||
536 | } | ||
537 | impl AstToken for Dotdoteq { | ||
538 | fn can_cast(kind: SyntaxKind) -> bool { kind == DOTDOTEQ } | ||
539 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
540 | if Self::can_cast(syntax.kind()) { | ||
541 | Some(Self { syntax }) | ||
542 | } else { | ||
543 | None | ||
544 | } | ||
545 | } | ||
546 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
547 | } | ||
548 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
549 | pub struct Colon { | ||
550 | pub(crate) syntax: SyntaxToken, | ||
551 | } | ||
552 | impl std::fmt::Display for Colon { | ||
553 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
554 | std::fmt::Display::fmt(&self.syntax, f) | ||
555 | } | ||
556 | } | ||
557 | impl AstToken for Colon { | ||
558 | fn can_cast(kind: SyntaxKind) -> bool { kind == COLON } | ||
559 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
560 | if Self::can_cast(syntax.kind()) { | ||
561 | Some(Self { syntax }) | ||
562 | } else { | ||
563 | None | ||
564 | } | ||
565 | } | ||
566 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
567 | } | ||
568 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
569 | pub struct Coloncolon { | ||
570 | pub(crate) syntax: SyntaxToken, | ||
571 | } | ||
572 | impl std::fmt::Display for Coloncolon { | ||
573 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
574 | std::fmt::Display::fmt(&self.syntax, f) | ||
575 | } | ||
576 | } | ||
577 | impl AstToken for Coloncolon { | ||
578 | fn can_cast(kind: SyntaxKind) -> bool { kind == COLONCOLON } | ||
579 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
580 | if Self::can_cast(syntax.kind()) { | ||
581 | Some(Self { syntax }) | ||
582 | } else { | ||
583 | None | ||
584 | } | ||
585 | } | ||
586 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
587 | } | ||
588 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
589 | pub struct Eq { | ||
590 | pub(crate) syntax: SyntaxToken, | ||
591 | } | ||
592 | impl std::fmt::Display for Eq { | ||
593 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
594 | std::fmt::Display::fmt(&self.syntax, f) | ||
595 | } | ||
596 | } | ||
597 | impl AstToken for Eq { | ||
598 | fn can_cast(kind: SyntaxKind) -> bool { kind == EQ } | ||
599 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
600 | if Self::can_cast(syntax.kind()) { | ||
601 | Some(Self { syntax }) | ||
602 | } else { | ||
603 | None | ||
604 | } | ||
605 | } | ||
606 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
607 | } | ||
608 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
609 | pub struct Eqeq { | ||
610 | pub(crate) syntax: SyntaxToken, | ||
611 | } | ||
612 | impl std::fmt::Display for Eqeq { | ||
613 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
614 | std::fmt::Display::fmt(&self.syntax, f) | ||
615 | } | ||
616 | } | ||
617 | impl AstToken for Eqeq { | ||
618 | fn can_cast(kind: SyntaxKind) -> bool { kind == EQEQ } | ||
619 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
620 | if Self::can_cast(syntax.kind()) { | ||
621 | Some(Self { syntax }) | ||
622 | } else { | ||
623 | None | ||
624 | } | ||
625 | } | ||
626 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
627 | } | ||
628 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
629 | pub struct FatArrow { | ||
630 | pub(crate) syntax: SyntaxToken, | ||
631 | } | ||
632 | impl std::fmt::Display for FatArrow { | ||
633 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
634 | std::fmt::Display::fmt(&self.syntax, f) | ||
635 | } | ||
636 | } | ||
637 | impl AstToken for FatArrow { | ||
638 | fn can_cast(kind: SyntaxKind) -> bool { kind == FAT_ARROW } | ||
639 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
640 | if Self::can_cast(syntax.kind()) { | ||
641 | Some(Self { syntax }) | ||
642 | } else { | ||
643 | None | ||
644 | } | ||
645 | } | ||
646 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
647 | } | ||
648 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
649 | pub struct Excl { | ||
650 | pub(crate) syntax: SyntaxToken, | ||
651 | } | ||
652 | impl std::fmt::Display for Excl { | ||
653 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
654 | std::fmt::Display::fmt(&self.syntax, f) | ||
655 | } | ||
656 | } | ||
657 | impl AstToken for Excl { | ||
658 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXCL } | ||
659 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
660 | if Self::can_cast(syntax.kind()) { | ||
661 | Some(Self { syntax }) | ||
662 | } else { | ||
663 | None | ||
664 | } | ||
665 | } | ||
666 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
667 | } | ||
668 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
669 | pub struct Neq { | ||
670 | pub(crate) syntax: SyntaxToken, | ||
671 | } | ||
672 | impl std::fmt::Display for Neq { | ||
673 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
674 | std::fmt::Display::fmt(&self.syntax, f) | ||
675 | } | ||
676 | } | ||
677 | impl AstToken for Neq { | ||
678 | fn can_cast(kind: SyntaxKind) -> bool { kind == NEQ } | ||
679 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
680 | if Self::can_cast(syntax.kind()) { | ||
681 | Some(Self { syntax }) | ||
682 | } else { | ||
683 | None | ||
684 | } | ||
685 | } | ||
686 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
687 | } | ||
688 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
689 | pub struct Minus { | ||
690 | pub(crate) syntax: SyntaxToken, | ||
691 | } | ||
692 | impl std::fmt::Display for Minus { | ||
693 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
694 | std::fmt::Display::fmt(&self.syntax, f) | ||
695 | } | ||
696 | } | ||
697 | impl AstToken for Minus { | ||
698 | fn can_cast(kind: SyntaxKind) -> bool { kind == MINUS } | ||
699 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
700 | if Self::can_cast(syntax.kind()) { | ||
701 | Some(Self { syntax }) | ||
702 | } else { | ||
703 | None | ||
704 | } | ||
705 | } | ||
706 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
707 | } | ||
708 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
709 | pub struct ThinArrow { | ||
710 | pub(crate) syntax: SyntaxToken, | ||
711 | } | ||
712 | impl std::fmt::Display for ThinArrow { | ||
713 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
714 | std::fmt::Display::fmt(&self.syntax, f) | ||
715 | } | ||
716 | } | ||
717 | impl AstToken for ThinArrow { | ||
718 | fn can_cast(kind: SyntaxKind) -> bool { kind == THIN_ARROW } | ||
719 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
720 | if Self::can_cast(syntax.kind()) { | ||
721 | Some(Self { syntax }) | ||
722 | } else { | ||
723 | None | ||
724 | } | ||
725 | } | ||
726 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
727 | } | ||
728 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
729 | pub struct Lteq { | ||
730 | pub(crate) syntax: SyntaxToken, | ||
731 | } | ||
732 | impl std::fmt::Display for Lteq { | ||
733 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
734 | std::fmt::Display::fmt(&self.syntax, f) | ||
735 | } | ||
736 | } | ||
737 | impl AstToken for Lteq { | ||
738 | fn can_cast(kind: SyntaxKind) -> bool { kind == LTEQ } | ||
739 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
740 | if Self::can_cast(syntax.kind()) { | ||
741 | Some(Self { syntax }) | ||
742 | } else { | ||
743 | None | ||
744 | } | ||
745 | } | ||
746 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
747 | } | ||
748 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
749 | pub struct Gteq { | ||
750 | pub(crate) syntax: SyntaxToken, | ||
751 | } | ||
752 | impl std::fmt::Display for Gteq { | ||
753 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
754 | std::fmt::Display::fmt(&self.syntax, f) | ||
755 | } | ||
756 | } | ||
757 | impl AstToken for Gteq { | ||
758 | fn can_cast(kind: SyntaxKind) -> bool { kind == GTEQ } | ||
759 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
760 | if Self::can_cast(syntax.kind()) { | ||
761 | Some(Self { syntax }) | ||
762 | } else { | ||
763 | None | ||
764 | } | ||
765 | } | ||
766 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
767 | } | ||
768 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
769 | pub struct Pluseq { | ||
770 | pub(crate) syntax: SyntaxToken, | ||
771 | } | ||
772 | impl std::fmt::Display for Pluseq { | ||
773 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
774 | std::fmt::Display::fmt(&self.syntax, f) | ||
775 | } | ||
776 | } | ||
777 | impl AstToken for Pluseq { | ||
778 | fn can_cast(kind: SyntaxKind) -> bool { kind == PLUSEQ } | ||
779 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
780 | if Self::can_cast(syntax.kind()) { | ||
781 | Some(Self { syntax }) | ||
782 | } else { | ||
783 | None | ||
784 | } | ||
785 | } | ||
786 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
787 | } | ||
788 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
789 | pub struct Minuseq { | ||
790 | pub(crate) syntax: SyntaxToken, | ||
791 | } | ||
792 | impl std::fmt::Display for Minuseq { | ||
793 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
794 | std::fmt::Display::fmt(&self.syntax, f) | ||
795 | } | ||
796 | } | ||
797 | impl AstToken for Minuseq { | ||
798 | fn can_cast(kind: SyntaxKind) -> bool { kind == MINUSEQ } | ||
799 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
800 | if Self::can_cast(syntax.kind()) { | ||
801 | Some(Self { syntax }) | ||
802 | } else { | ||
803 | None | ||
804 | } | ||
805 | } | ||
806 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
807 | } | ||
808 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
809 | pub struct Pipeeq { | ||
810 | pub(crate) syntax: SyntaxToken, | ||
811 | } | ||
812 | impl std::fmt::Display for Pipeeq { | ||
813 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
814 | std::fmt::Display::fmt(&self.syntax, f) | ||
815 | } | ||
816 | } | ||
817 | impl AstToken for Pipeeq { | ||
818 | fn can_cast(kind: SyntaxKind) -> bool { kind == PIPEEQ } | ||
819 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
820 | if Self::can_cast(syntax.kind()) { | ||
821 | Some(Self { syntax }) | ||
822 | } else { | ||
823 | None | ||
824 | } | ||
825 | } | ||
826 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
827 | } | ||
828 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
829 | pub struct Ampeq { | ||
830 | pub(crate) syntax: SyntaxToken, | ||
831 | } | ||
832 | impl std::fmt::Display for Ampeq { | ||
833 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
834 | std::fmt::Display::fmt(&self.syntax, f) | ||
835 | } | ||
836 | } | ||
837 | impl AstToken for Ampeq { | ||
838 | fn can_cast(kind: SyntaxKind) -> bool { kind == AMPEQ } | ||
839 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
840 | if Self::can_cast(syntax.kind()) { | ||
841 | Some(Self { syntax }) | ||
842 | } else { | ||
843 | None | ||
844 | } | ||
845 | } | ||
846 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
847 | } | ||
848 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
849 | pub struct Careteq { | ||
850 | pub(crate) syntax: SyntaxToken, | ||
851 | } | ||
852 | impl std::fmt::Display for Careteq { | ||
853 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
854 | std::fmt::Display::fmt(&self.syntax, f) | ||
855 | } | ||
856 | } | ||
857 | impl AstToken for Careteq { | ||
858 | fn can_cast(kind: SyntaxKind) -> bool { kind == CARETEQ } | ||
859 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
860 | if Self::can_cast(syntax.kind()) { | ||
861 | Some(Self { syntax }) | ||
862 | } else { | ||
863 | None | ||
864 | } | ||
865 | } | ||
866 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
867 | } | ||
868 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
869 | pub struct Slasheq { | ||
870 | pub(crate) syntax: SyntaxToken, | ||
871 | } | ||
872 | impl std::fmt::Display for Slasheq { | ||
873 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
874 | std::fmt::Display::fmt(&self.syntax, f) | ||
875 | } | ||
876 | } | ||
877 | impl AstToken for Slasheq { | ||
878 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLASHEQ } | ||
879 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
880 | if Self::can_cast(syntax.kind()) { | ||
881 | Some(Self { syntax }) | ||
882 | } else { | ||
883 | None | ||
884 | } | ||
885 | } | ||
886 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
887 | } | ||
888 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
889 | pub struct Stareq { | ||
890 | pub(crate) syntax: SyntaxToken, | ||
891 | } | ||
892 | impl std::fmt::Display for Stareq { | ||
893 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
894 | std::fmt::Display::fmt(&self.syntax, f) | ||
895 | } | ||
896 | } | ||
897 | impl AstToken for Stareq { | ||
898 | fn can_cast(kind: SyntaxKind) -> bool { kind == STAREQ } | ||
899 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
900 | if Self::can_cast(syntax.kind()) { | ||
901 | Some(Self { syntax }) | ||
902 | } else { | ||
903 | None | ||
904 | } | ||
905 | } | ||
906 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
907 | } | ||
908 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
909 | pub struct Percenteq { | ||
910 | pub(crate) syntax: SyntaxToken, | ||
911 | } | ||
912 | impl std::fmt::Display for Percenteq { | ||
913 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
914 | std::fmt::Display::fmt(&self.syntax, f) | ||
915 | } | ||
916 | } | ||
917 | impl AstToken for Percenteq { | ||
918 | fn can_cast(kind: SyntaxKind) -> bool { kind == PERCENTEQ } | ||
919 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
920 | if Self::can_cast(syntax.kind()) { | ||
921 | Some(Self { syntax }) | ||
922 | } else { | ||
923 | None | ||
924 | } | ||
925 | } | ||
926 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
927 | } | ||
928 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
929 | pub struct Ampamp { | ||
930 | pub(crate) syntax: SyntaxToken, | ||
931 | } | ||
932 | impl std::fmt::Display for Ampamp { | ||
933 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
934 | std::fmt::Display::fmt(&self.syntax, f) | ||
935 | } | ||
936 | } | ||
937 | impl AstToken for Ampamp { | ||
938 | fn can_cast(kind: SyntaxKind) -> bool { kind == AMPAMP } | ||
939 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
940 | if Self::can_cast(syntax.kind()) { | ||
941 | Some(Self { syntax }) | ||
942 | } else { | ||
943 | None | ||
944 | } | ||
945 | } | ||
946 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
947 | } | ||
948 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
949 | pub struct Pipepipe { | ||
950 | pub(crate) syntax: SyntaxToken, | ||
951 | } | ||
952 | impl std::fmt::Display for Pipepipe { | ||
953 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
954 | std::fmt::Display::fmt(&self.syntax, f) | ||
955 | } | ||
956 | } | ||
957 | impl AstToken for Pipepipe { | ||
958 | fn can_cast(kind: SyntaxKind) -> bool { kind == PIPEPIPE } | ||
959 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
960 | if Self::can_cast(syntax.kind()) { | ||
961 | Some(Self { syntax }) | ||
962 | } else { | ||
963 | None | ||
964 | } | ||
965 | } | ||
966 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
967 | } | ||
968 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
969 | pub struct Shl { | ||
970 | pub(crate) syntax: SyntaxToken, | ||
971 | } | ||
972 | impl std::fmt::Display for Shl { | ||
973 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
974 | std::fmt::Display::fmt(&self.syntax, f) | ||
975 | } | ||
976 | } | ||
977 | impl AstToken for Shl { | ||
978 | fn can_cast(kind: SyntaxKind) -> bool { kind == SHL } | ||
979 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
980 | if Self::can_cast(syntax.kind()) { | ||
981 | Some(Self { syntax }) | ||
982 | } else { | ||
983 | None | ||
984 | } | ||
985 | } | ||
986 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
987 | } | ||
988 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
989 | pub struct Shr { | ||
990 | pub(crate) syntax: SyntaxToken, | ||
991 | } | ||
992 | impl std::fmt::Display for Shr { | ||
993 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
994 | std::fmt::Display::fmt(&self.syntax, f) | ||
995 | } | ||
996 | } | ||
997 | impl AstToken for Shr { | ||
998 | fn can_cast(kind: SyntaxKind) -> bool { kind == SHR } | ||
999 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1000 | if Self::can_cast(syntax.kind()) { | ||
1001 | Some(Self { syntax }) | ||
1002 | } else { | ||
1003 | None | ||
1004 | } | ||
1005 | } | ||
1006 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1007 | } | ||
1008 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1009 | pub struct Shleq { | ||
1010 | pub(crate) syntax: SyntaxToken, | ||
1011 | } | ||
1012 | impl std::fmt::Display for Shleq { | ||
1013 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1014 | std::fmt::Display::fmt(&self.syntax, f) | ||
1015 | } | ||
1016 | } | ||
1017 | impl AstToken for Shleq { | ||
1018 | fn can_cast(kind: SyntaxKind) -> bool { kind == SHLEQ } | ||
1019 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1020 | if Self::can_cast(syntax.kind()) { | ||
1021 | Some(Self { syntax }) | ||
1022 | } else { | ||
1023 | None | ||
1024 | } | ||
1025 | } | ||
1026 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1027 | } | ||
1028 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1029 | pub struct Shreq { | ||
1030 | pub(crate) syntax: SyntaxToken, | ||
1031 | } | ||
1032 | impl std::fmt::Display for Shreq { | ||
1033 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1034 | std::fmt::Display::fmt(&self.syntax, f) | ||
1035 | } | ||
1036 | } | ||
1037 | impl AstToken for Shreq { | ||
1038 | fn can_cast(kind: SyntaxKind) -> bool { kind == SHREQ } | ||
1039 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1040 | if Self::can_cast(syntax.kind()) { | ||
1041 | Some(Self { syntax }) | ||
1042 | } else { | ||
1043 | None | ||
1044 | } | ||
1045 | } | ||
1046 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1047 | } | ||
1048 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1049 | pub struct IntNumber { | ||
1050 | pub(crate) syntax: SyntaxToken, | ||
1051 | } | ||
1052 | impl std::fmt::Display for IntNumber { | ||
1053 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1054 | std::fmt::Display::fmt(&self.syntax, f) | ||
1055 | } | ||
1056 | } | ||
1057 | impl AstToken for IntNumber { | ||
1058 | fn can_cast(kind: SyntaxKind) -> bool { kind == INT_NUMBER } | ||
1059 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1060 | if Self::can_cast(syntax.kind()) { | ||
1061 | Some(Self { syntax }) | ||
1062 | } else { | ||
1063 | None | ||
1064 | } | ||
1065 | } | ||
1066 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1067 | } | ||
1068 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1069 | pub struct FloatNumber { | ||
1070 | pub(crate) syntax: SyntaxToken, | ||
1071 | } | ||
1072 | impl std::fmt::Display for FloatNumber { | ||
1073 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1074 | std::fmt::Display::fmt(&self.syntax, f) | ||
1075 | } | ||
1076 | } | ||
1077 | impl AstToken for FloatNumber { | ||
1078 | fn can_cast(kind: SyntaxKind) -> bool { kind == FLOAT_NUMBER } | ||
1079 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1080 | if Self::can_cast(syntax.kind()) { | ||
1081 | Some(Self { syntax }) | ||
1082 | } else { | ||
1083 | None | ||
1084 | } | ||
1085 | } | ||
1086 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1087 | } | ||
1088 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1089 | pub struct Char { | ||
1090 | pub(crate) syntax: SyntaxToken, | ||
1091 | } | ||
1092 | impl std::fmt::Display for Char { | ||
1093 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1094 | std::fmt::Display::fmt(&self.syntax, f) | ||
1095 | } | ||
1096 | } | ||
1097 | impl AstToken for Char { | ||
1098 | fn can_cast(kind: SyntaxKind) -> bool { kind == CHAR } | ||
1099 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1100 | if Self::can_cast(syntax.kind()) { | ||
1101 | Some(Self { syntax }) | ||
1102 | } else { | ||
1103 | None | ||
1104 | } | ||
1105 | } | ||
1106 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1107 | } | ||
1108 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1109 | pub struct Byte { | ||
1110 | pub(crate) syntax: SyntaxToken, | ||
1111 | } | ||
1112 | impl std::fmt::Display for Byte { | ||
1113 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1114 | std::fmt::Display::fmt(&self.syntax, f) | ||
1115 | } | ||
1116 | } | ||
1117 | impl AstToken for Byte { | ||
1118 | fn can_cast(kind: SyntaxKind) -> bool { kind == BYTE } | ||
1119 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1120 | if Self::can_cast(syntax.kind()) { | ||
1121 | Some(Self { syntax }) | ||
1122 | } else { | ||
1123 | None | ||
1124 | } | ||
1125 | } | ||
1126 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1127 | } | ||
1128 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1129 | pub struct String { | ||
1130 | pub(crate) syntax: SyntaxToken, | ||
1131 | } | ||
1132 | impl std::fmt::Display for String { | ||
1133 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1134 | std::fmt::Display::fmt(&self.syntax, f) | ||
1135 | } | ||
1136 | } | ||
1137 | impl AstToken for String { | ||
1138 | fn can_cast(kind: SyntaxKind) -> bool { kind == STRING } | ||
1139 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1140 | if Self::can_cast(syntax.kind()) { | ||
1141 | Some(Self { syntax }) | ||
1142 | } else { | ||
1143 | None | ||
1144 | } | ||
1145 | } | ||
1146 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1147 | } | ||
1148 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1149 | pub struct RawString { | ||
1150 | pub(crate) syntax: SyntaxToken, | ||
1151 | } | ||
1152 | impl std::fmt::Display for RawString { | ||
1153 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1154 | std::fmt::Display::fmt(&self.syntax, f) | ||
1155 | } | ||
1156 | } | ||
1157 | impl AstToken for RawString { | ||
1158 | fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_STRING } | ||
1159 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1160 | if Self::can_cast(syntax.kind()) { | ||
1161 | Some(Self { syntax }) | ||
1162 | } else { | ||
1163 | None | ||
1164 | } | ||
1165 | } | ||
1166 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1167 | } | ||
1168 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1169 | pub struct ByteString { | ||
1170 | pub(crate) syntax: SyntaxToken, | ||
1171 | } | ||
1172 | impl std::fmt::Display for ByteString { | ||
1173 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1174 | std::fmt::Display::fmt(&self.syntax, f) | ||
1175 | } | ||
1176 | } | ||
1177 | impl AstToken for ByteString { | ||
1178 | fn can_cast(kind: SyntaxKind) -> bool { kind == BYTE_STRING } | ||
1179 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1180 | if Self::can_cast(syntax.kind()) { | ||
1181 | Some(Self { syntax }) | ||
1182 | } else { | ||
1183 | None | ||
1184 | } | ||
1185 | } | ||
1186 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1187 | } | ||
1188 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1189 | pub struct RawByteString { | ||
1190 | pub(crate) syntax: SyntaxToken, | ||
1191 | } | ||
1192 | impl std::fmt::Display for RawByteString { | ||
1193 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1194 | std::fmt::Display::fmt(&self.syntax, f) | ||
1195 | } | ||
1196 | } | ||
1197 | impl AstToken for RawByteString { | ||
1198 | fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_BYTE_STRING } | ||
1199 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1200 | if Self::can_cast(syntax.kind()) { | ||
1201 | Some(Self { syntax }) | ||
1202 | } else { | ||
1203 | None | ||
1204 | } | ||
1205 | } | ||
1206 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1207 | } | ||
1208 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1209 | pub struct Error { | ||
1210 | pub(crate) syntax: SyntaxToken, | ||
1211 | } | ||
1212 | impl std::fmt::Display for Error { | ||
1213 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1214 | std::fmt::Display::fmt(&self.syntax, f) | ||
1215 | } | ||
1216 | } | ||
1217 | impl AstToken for Error { | ||
1218 | fn can_cast(kind: SyntaxKind) -> bool { kind == ERROR } | ||
1219 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1220 | if Self::can_cast(syntax.kind()) { | ||
1221 | Some(Self { syntax }) | ||
1222 | } else { | ||
1223 | None | ||
1224 | } | ||
1225 | } | ||
1226 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1227 | } | ||
1228 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1229 | pub struct Ident { | ||
1230 | pub(crate) syntax: SyntaxToken, | ||
1231 | } | ||
1232 | impl std::fmt::Display for Ident { | ||
1233 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1234 | std::fmt::Display::fmt(&self.syntax, f) | ||
1235 | } | ||
1236 | } | ||
1237 | impl AstToken for Ident { | ||
1238 | fn can_cast(kind: SyntaxKind) -> bool { kind == IDENT } | ||
1239 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1240 | if Self::can_cast(syntax.kind()) { | ||
1241 | Some(Self { syntax }) | ||
1242 | } else { | ||
1243 | None | ||
1244 | } | ||
1245 | } | ||
1246 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1247 | } | ||
1248 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 9 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1249 | pub struct Whitespace { | 10 | pub struct Whitespace { |
1250 | pub(crate) syntax: SyntaxToken, | 11 | pub(crate) syntax: SyntaxToken, |
@@ -1265,26 +26,7 @@ impl AstToken for Whitespace { | |||
1265 | } | 26 | } |
1266 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | 27 | fn syntax(&self) -> &SyntaxToken { &self.syntax } |
1267 | } | 28 | } |
1268 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 29 | |
1269 | pub struct Lifetime { | ||
1270 | pub(crate) syntax: SyntaxToken, | ||
1271 | } | ||
1272 | impl std::fmt::Display for Lifetime { | ||
1273 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1274 | std::fmt::Display::fmt(&self.syntax, f) | ||
1275 | } | ||
1276 | } | ||
1277 | impl AstToken for Lifetime { | ||
1278 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME } | ||
1279 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1280 | if Self::can_cast(syntax.kind()) { | ||
1281 | Some(Self { syntax }) | ||
1282 | } else { | ||
1283 | None | ||
1284 | } | ||
1285 | } | ||
1286 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1287 | } | ||
1288 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 30 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1289 | pub struct Comment { | 31 | pub struct Comment { |
1290 | pub(crate) syntax: SyntaxToken, | 32 | pub(crate) syntax: SyntaxToken, |
@@ -1305,37 +47,18 @@ impl AstToken for Comment { | |||
1305 | } | 47 | } |
1306 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | 48 | fn syntax(&self) -> &SyntaxToken { &self.syntax } |
1307 | } | 49 | } |
50 | |||
1308 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 51 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1309 | pub struct Shebang { | 52 | pub struct String { |
1310 | pub(crate) syntax: SyntaxToken, | ||
1311 | } | ||
1312 | impl std::fmt::Display for Shebang { | ||
1313 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1314 | std::fmt::Display::fmt(&self.syntax, f) | ||
1315 | } | ||
1316 | } | ||
1317 | impl AstToken for Shebang { | ||
1318 | fn can_cast(kind: SyntaxKind) -> bool { kind == SHEBANG } | ||
1319 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1320 | if Self::can_cast(syntax.kind()) { | ||
1321 | Some(Self { syntax }) | ||
1322 | } else { | ||
1323 | None | ||
1324 | } | ||
1325 | } | ||
1326 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | ||
1327 | } | ||
1328 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1329 | pub struct LDollar { | ||
1330 | pub(crate) syntax: SyntaxToken, | 53 | pub(crate) syntax: SyntaxToken, |
1331 | } | 54 | } |
1332 | impl std::fmt::Display for LDollar { | 55 | impl std::fmt::Display for String { |
1333 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 56 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
1334 | std::fmt::Display::fmt(&self.syntax, f) | 57 | std::fmt::Display::fmt(&self.syntax, f) |
1335 | } | 58 | } |
1336 | } | 59 | } |
1337 | impl AstToken for LDollar { | 60 | impl AstToken for String { |
1338 | fn can_cast(kind: SyntaxKind) -> bool { kind == L_DOLLAR } | 61 | fn can_cast(kind: SyntaxKind) -> bool { kind == STRING } |
1339 | fn cast(syntax: SyntaxToken) -> Option<Self> { | 62 | fn cast(syntax: SyntaxToken) -> Option<Self> { |
1340 | if Self::can_cast(syntax.kind()) { | 63 | if Self::can_cast(syntax.kind()) { |
1341 | Some(Self { syntax }) | 64 | Some(Self { syntax }) |
@@ -1345,17 +68,18 @@ impl AstToken for LDollar { | |||
1345 | } | 68 | } |
1346 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | 69 | fn syntax(&self) -> &SyntaxToken { &self.syntax } |
1347 | } | 70 | } |
71 | |||
1348 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 72 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1349 | pub struct RDollar { | 73 | pub struct RawString { |
1350 | pub(crate) syntax: SyntaxToken, | 74 | pub(crate) syntax: SyntaxToken, |
1351 | } | 75 | } |
1352 | impl std::fmt::Display for RDollar { | 76 | impl std::fmt::Display for RawString { |
1353 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 77 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
1354 | std::fmt::Display::fmt(&self.syntax, f) | 78 | std::fmt::Display::fmt(&self.syntax, f) |
1355 | } | 79 | } |
1356 | } | 80 | } |
1357 | impl AstToken for RDollar { | 81 | impl AstToken for RawString { |
1358 | fn can_cast(kind: SyntaxKind) -> bool { kind == R_DOLLAR } | 82 | fn can_cast(kind: SyntaxKind) -> bool { kind == RAW_STRING } |
1359 | fn cast(syntax: SyntaxToken) -> Option<Self> { | 83 | fn cast(syntax: SyntaxToken) -> Option<Self> { |
1360 | if Self::can_cast(syntax.kind()) { | 84 | if Self::can_cast(syntax.kind()) { |
1361 | Some(Self { syntax }) | 85 | Some(Self { syntax }) |
@@ -1365,532 +89,3 @@ impl AstToken for RDollar { | |||
1365 | } | 89 | } |
1366 | fn syntax(&self) -> &SyntaxToken { &self.syntax } | 90 | fn syntax(&self) -> &SyntaxToken { &self.syntax } |
1367 | } | 91 | } |
1368 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1369 | pub enum LeftDelimiter { | ||
1370 | LParen(LParen), | ||
1371 | LBrack(LBrack), | ||
1372 | LCurly(LCurly), | ||
1373 | } | ||
1374 | impl From<LParen> for LeftDelimiter { | ||
1375 | fn from(node: LParen) -> LeftDelimiter { LeftDelimiter::LParen(node) } | ||
1376 | } | ||
1377 | impl From<LBrack> for LeftDelimiter { | ||
1378 | fn from(node: LBrack) -> LeftDelimiter { LeftDelimiter::LBrack(node) } | ||
1379 | } | ||
1380 | impl From<LCurly> for LeftDelimiter { | ||
1381 | fn from(node: LCurly) -> LeftDelimiter { LeftDelimiter::LCurly(node) } | ||
1382 | } | ||
1383 | impl std::fmt::Display for LeftDelimiter { | ||
1384 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1385 | std::fmt::Display::fmt(self.syntax(), f) | ||
1386 | } | ||
1387 | } | ||
1388 | impl AstToken for LeftDelimiter { | ||
1389 | fn can_cast(kind: SyntaxKind) -> bool { | ||
1390 | match kind { | ||
1391 | L_PAREN | L_BRACK | L_CURLY => true, | ||
1392 | _ => false, | ||
1393 | } | ||
1394 | } | ||
1395 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1396 | let res = match syntax.kind() { | ||
1397 | L_PAREN => LeftDelimiter::LParen(LParen { syntax }), | ||
1398 | L_BRACK => LeftDelimiter::LBrack(LBrack { syntax }), | ||
1399 | L_CURLY => LeftDelimiter::LCurly(LCurly { syntax }), | ||
1400 | _ => return None, | ||
1401 | }; | ||
1402 | Some(res) | ||
1403 | } | ||
1404 | fn syntax(&self) -> &SyntaxToken { | ||
1405 | match self { | ||
1406 | LeftDelimiter::LParen(it) => &it.syntax, | ||
1407 | LeftDelimiter::LBrack(it) => &it.syntax, | ||
1408 | LeftDelimiter::LCurly(it) => &it.syntax, | ||
1409 | } | ||
1410 | } | ||
1411 | } | ||
1412 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1413 | pub enum RightDelimiter { | ||
1414 | RParen(RParen), | ||
1415 | RBrack(RBrack), | ||
1416 | RCurly(RCurly), | ||
1417 | } | ||
1418 | impl From<RParen> for RightDelimiter { | ||
1419 | fn from(node: RParen) -> RightDelimiter { RightDelimiter::RParen(node) } | ||
1420 | } | ||
1421 | impl From<RBrack> for RightDelimiter { | ||
1422 | fn from(node: RBrack) -> RightDelimiter { RightDelimiter::RBrack(node) } | ||
1423 | } | ||
1424 | impl From<RCurly> for RightDelimiter { | ||
1425 | fn from(node: RCurly) -> RightDelimiter { RightDelimiter::RCurly(node) } | ||
1426 | } | ||
1427 | impl std::fmt::Display for RightDelimiter { | ||
1428 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1429 | std::fmt::Display::fmt(self.syntax(), f) | ||
1430 | } | ||
1431 | } | ||
1432 | impl AstToken for RightDelimiter { | ||
1433 | fn can_cast(kind: SyntaxKind) -> bool { | ||
1434 | match kind { | ||
1435 | R_PAREN | R_BRACK | R_CURLY => true, | ||
1436 | _ => false, | ||
1437 | } | ||
1438 | } | ||
1439 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1440 | let res = match syntax.kind() { | ||
1441 | R_PAREN => RightDelimiter::RParen(RParen { syntax }), | ||
1442 | R_BRACK => RightDelimiter::RBrack(RBrack { syntax }), | ||
1443 | R_CURLY => RightDelimiter::RCurly(RCurly { syntax }), | ||
1444 | _ => return None, | ||
1445 | }; | ||
1446 | Some(res) | ||
1447 | } | ||
1448 | fn syntax(&self) -> &SyntaxToken { | ||
1449 | match self { | ||
1450 | RightDelimiter::RParen(it) => &it.syntax, | ||
1451 | RightDelimiter::RBrack(it) => &it.syntax, | ||
1452 | RightDelimiter::RCurly(it) => &it.syntax, | ||
1453 | } | ||
1454 | } | ||
1455 | } | ||
1456 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1457 | pub enum RangeSeparator { | ||
1458 | Dotdot(Dotdot), | ||
1459 | Dotdotdot(Dotdotdot), | ||
1460 | Dotdoteq(Dotdoteq), | ||
1461 | } | ||
1462 | impl From<Dotdot> for RangeSeparator { | ||
1463 | fn from(node: Dotdot) -> RangeSeparator { RangeSeparator::Dotdot(node) } | ||
1464 | } | ||
1465 | impl From<Dotdotdot> for RangeSeparator { | ||
1466 | fn from(node: Dotdotdot) -> RangeSeparator { RangeSeparator::Dotdotdot(node) } | ||
1467 | } | ||
1468 | impl From<Dotdoteq> for RangeSeparator { | ||
1469 | fn from(node: Dotdoteq) -> RangeSeparator { RangeSeparator::Dotdoteq(node) } | ||
1470 | } | ||
1471 | impl std::fmt::Display for RangeSeparator { | ||
1472 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1473 | std::fmt::Display::fmt(self.syntax(), f) | ||
1474 | } | ||
1475 | } | ||
1476 | impl AstToken for RangeSeparator { | ||
1477 | fn can_cast(kind: SyntaxKind) -> bool { | ||
1478 | match kind { | ||
1479 | DOTDOT | DOTDOTDOT | DOTDOTEQ => true, | ||
1480 | _ => false, | ||
1481 | } | ||
1482 | } | ||
1483 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1484 | let res = match syntax.kind() { | ||
1485 | DOTDOT => RangeSeparator::Dotdot(Dotdot { syntax }), | ||
1486 | DOTDOTDOT => RangeSeparator::Dotdotdot(Dotdotdot { syntax }), | ||
1487 | DOTDOTEQ => RangeSeparator::Dotdoteq(Dotdoteq { syntax }), | ||
1488 | _ => return None, | ||
1489 | }; | ||
1490 | Some(res) | ||
1491 | } | ||
1492 | fn syntax(&self) -> &SyntaxToken { | ||
1493 | match self { | ||
1494 | RangeSeparator::Dotdot(it) => &it.syntax, | ||
1495 | RangeSeparator::Dotdotdot(it) => &it.syntax, | ||
1496 | RangeSeparator::Dotdoteq(it) => &it.syntax, | ||
1497 | } | ||
1498 | } | ||
1499 | } | ||
1500 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1501 | pub enum BinOp { | ||
1502 | Pipepipe(Pipepipe), | ||
1503 | Ampamp(Ampamp), | ||
1504 | Eqeq(Eqeq), | ||
1505 | Neq(Neq), | ||
1506 | Lteq(Lteq), | ||
1507 | Gteq(Gteq), | ||
1508 | LAngle(LAngle), | ||
1509 | RAngle(RAngle), | ||
1510 | Plus(Plus), | ||
1511 | Star(Star), | ||
1512 | Minus(Minus), | ||
1513 | Slash(Slash), | ||
1514 | Percent(Percent), | ||
1515 | Shl(Shl), | ||
1516 | Shr(Shr), | ||
1517 | Caret(Caret), | ||
1518 | Pipe(Pipe), | ||
1519 | Amp(Amp), | ||
1520 | Eq(Eq), | ||
1521 | Pluseq(Pluseq), | ||
1522 | Slasheq(Slasheq), | ||
1523 | Stareq(Stareq), | ||
1524 | Percenteq(Percenteq), | ||
1525 | Shreq(Shreq), | ||
1526 | Shleq(Shleq), | ||
1527 | Minuseq(Minuseq), | ||
1528 | Pipeeq(Pipeeq), | ||
1529 | Ampeq(Ampeq), | ||
1530 | Careteq(Careteq), | ||
1531 | } | ||
1532 | impl From<Pipepipe> for BinOp { | ||
1533 | fn from(node: Pipepipe) -> BinOp { BinOp::Pipepipe(node) } | ||
1534 | } | ||
1535 | impl From<Ampamp> for BinOp { | ||
1536 | fn from(node: Ampamp) -> BinOp { BinOp::Ampamp(node) } | ||
1537 | } | ||
1538 | impl From<Eqeq> for BinOp { | ||
1539 | fn from(node: Eqeq) -> BinOp { BinOp::Eqeq(node) } | ||
1540 | } | ||
1541 | impl From<Neq> for BinOp { | ||
1542 | fn from(node: Neq) -> BinOp { BinOp::Neq(node) } | ||
1543 | } | ||
1544 | impl From<Lteq> for BinOp { | ||
1545 | fn from(node: Lteq) -> BinOp { BinOp::Lteq(node) } | ||
1546 | } | ||
1547 | impl From<Gteq> for BinOp { | ||
1548 | fn from(node: Gteq) -> BinOp { BinOp::Gteq(node) } | ||
1549 | } | ||
1550 | impl From<LAngle> for BinOp { | ||
1551 | fn from(node: LAngle) -> BinOp { BinOp::LAngle(node) } | ||
1552 | } | ||
1553 | impl From<RAngle> for BinOp { | ||
1554 | fn from(node: RAngle) -> BinOp { BinOp::RAngle(node) } | ||
1555 | } | ||
1556 | impl From<Plus> for BinOp { | ||
1557 | fn from(node: Plus) -> BinOp { BinOp::Plus(node) } | ||
1558 | } | ||
1559 | impl From<Star> for BinOp { | ||
1560 | fn from(node: Star) -> BinOp { BinOp::Star(node) } | ||
1561 | } | ||
1562 | impl From<Minus> for BinOp { | ||
1563 | fn from(node: Minus) -> BinOp { BinOp::Minus(node) } | ||
1564 | } | ||
1565 | impl From<Slash> for BinOp { | ||
1566 | fn from(node: Slash) -> BinOp { BinOp::Slash(node) } | ||
1567 | } | ||
1568 | impl From<Percent> for BinOp { | ||
1569 | fn from(node: Percent) -> BinOp { BinOp::Percent(node) } | ||
1570 | } | ||
1571 | impl From<Shl> for BinOp { | ||
1572 | fn from(node: Shl) -> BinOp { BinOp::Shl(node) } | ||
1573 | } | ||
1574 | impl From<Shr> for BinOp { | ||
1575 | fn from(node: Shr) -> BinOp { BinOp::Shr(node) } | ||
1576 | } | ||
1577 | impl From<Caret> for BinOp { | ||
1578 | fn from(node: Caret) -> BinOp { BinOp::Caret(node) } | ||
1579 | } | ||
1580 | impl From<Pipe> for BinOp { | ||
1581 | fn from(node: Pipe) -> BinOp { BinOp::Pipe(node) } | ||
1582 | } | ||
1583 | impl From<Amp> for BinOp { | ||
1584 | fn from(node: Amp) -> BinOp { BinOp::Amp(node) } | ||
1585 | } | ||
1586 | impl From<Eq> for BinOp { | ||
1587 | fn from(node: Eq) -> BinOp { BinOp::Eq(node) } | ||
1588 | } | ||
1589 | impl From<Pluseq> for BinOp { | ||
1590 | fn from(node: Pluseq) -> BinOp { BinOp::Pluseq(node) } | ||
1591 | } | ||
1592 | impl From<Slasheq> for BinOp { | ||
1593 | fn from(node: Slasheq) -> BinOp { BinOp::Slasheq(node) } | ||
1594 | } | ||
1595 | impl From<Stareq> for BinOp { | ||
1596 | fn from(node: Stareq) -> BinOp { BinOp::Stareq(node) } | ||
1597 | } | ||
1598 | impl From<Percenteq> for BinOp { | ||
1599 | fn from(node: Percenteq) -> BinOp { BinOp::Percenteq(node) } | ||
1600 | } | ||
1601 | impl From<Shreq> for BinOp { | ||
1602 | fn from(node: Shreq) -> BinOp { BinOp::Shreq(node) } | ||
1603 | } | ||
1604 | impl From<Shleq> for BinOp { | ||
1605 | fn from(node: Shleq) -> BinOp { BinOp::Shleq(node) } | ||
1606 | } | ||
1607 | impl From<Minuseq> for BinOp { | ||
1608 | fn from(node: Minuseq) -> BinOp { BinOp::Minuseq(node) } | ||
1609 | } | ||
1610 | impl From<Pipeeq> for BinOp { | ||
1611 | fn from(node: Pipeeq) -> BinOp { BinOp::Pipeeq(node) } | ||
1612 | } | ||
1613 | impl From<Ampeq> for BinOp { | ||
1614 | fn from(node: Ampeq) -> BinOp { BinOp::Ampeq(node) } | ||
1615 | } | ||
1616 | impl From<Careteq> for BinOp { | ||
1617 | fn from(node: Careteq) -> BinOp { BinOp::Careteq(node) } | ||
1618 | } | ||
1619 | impl std::fmt::Display for BinOp { | ||
1620 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1621 | std::fmt::Display::fmt(self.syntax(), f) | ||
1622 | } | ||
1623 | } | ||
1624 | impl AstToken for BinOp { | ||
1625 | fn can_cast(kind: SyntaxKind) -> bool { | ||
1626 | match kind { | ||
1627 | PIPEPIPE | AMPAMP | EQEQ | NEQ | LTEQ | GTEQ | L_ANGLE | R_ANGLE | PLUS | STAR | ||
1628 | | MINUS | SLASH | PERCENT | SHL | SHR | CARET | PIPE | AMP | EQ | PLUSEQ | SLASHEQ | ||
1629 | | STAREQ | PERCENTEQ | SHREQ | SHLEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ => true, | ||
1630 | _ => false, | ||
1631 | } | ||
1632 | } | ||
1633 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1634 | let res = match syntax.kind() { | ||
1635 | PIPEPIPE => BinOp::Pipepipe(Pipepipe { syntax }), | ||
1636 | AMPAMP => BinOp::Ampamp(Ampamp { syntax }), | ||
1637 | EQEQ => BinOp::Eqeq(Eqeq { syntax }), | ||
1638 | NEQ => BinOp::Neq(Neq { syntax }), | ||
1639 | LTEQ => BinOp::Lteq(Lteq { syntax }), | ||
1640 | GTEQ => BinOp::Gteq(Gteq { syntax }), | ||
1641 | L_ANGLE => BinOp::LAngle(LAngle { syntax }), | ||
1642 | R_ANGLE => BinOp::RAngle(RAngle { syntax }), | ||
1643 | PLUS => BinOp::Plus(Plus { syntax }), | ||
1644 | STAR => BinOp::Star(Star { syntax }), | ||
1645 | MINUS => BinOp::Minus(Minus { syntax }), | ||
1646 | SLASH => BinOp::Slash(Slash { syntax }), | ||
1647 | PERCENT => BinOp::Percent(Percent { syntax }), | ||
1648 | SHL => BinOp::Shl(Shl { syntax }), | ||
1649 | SHR => BinOp::Shr(Shr { syntax }), | ||
1650 | CARET => BinOp::Caret(Caret { syntax }), | ||
1651 | PIPE => BinOp::Pipe(Pipe { syntax }), | ||
1652 | AMP => BinOp::Amp(Amp { syntax }), | ||
1653 | EQ => BinOp::Eq(Eq { syntax }), | ||
1654 | PLUSEQ => BinOp::Pluseq(Pluseq { syntax }), | ||
1655 | SLASHEQ => BinOp::Slasheq(Slasheq { syntax }), | ||
1656 | STAREQ => BinOp::Stareq(Stareq { syntax }), | ||
1657 | PERCENTEQ => BinOp::Percenteq(Percenteq { syntax }), | ||
1658 | SHREQ => BinOp::Shreq(Shreq { syntax }), | ||
1659 | SHLEQ => BinOp::Shleq(Shleq { syntax }), | ||
1660 | MINUSEQ => BinOp::Minuseq(Minuseq { syntax }), | ||
1661 | PIPEEQ => BinOp::Pipeeq(Pipeeq { syntax }), | ||
1662 | AMPEQ => BinOp::Ampeq(Ampeq { syntax }), | ||
1663 | CARETEQ => BinOp::Careteq(Careteq { syntax }), | ||
1664 | _ => return None, | ||
1665 | }; | ||
1666 | Some(res) | ||
1667 | } | ||
1668 | fn syntax(&self) -> &SyntaxToken { | ||
1669 | match self { | ||
1670 | BinOp::Pipepipe(it) => &it.syntax, | ||
1671 | BinOp::Ampamp(it) => &it.syntax, | ||
1672 | BinOp::Eqeq(it) => &it.syntax, | ||
1673 | BinOp::Neq(it) => &it.syntax, | ||
1674 | BinOp::Lteq(it) => &it.syntax, | ||
1675 | BinOp::Gteq(it) => &it.syntax, | ||
1676 | BinOp::LAngle(it) => &it.syntax, | ||
1677 | BinOp::RAngle(it) => &it.syntax, | ||
1678 | BinOp::Plus(it) => &it.syntax, | ||
1679 | BinOp::Star(it) => &it.syntax, | ||
1680 | BinOp::Minus(it) => &it.syntax, | ||
1681 | BinOp::Slash(it) => &it.syntax, | ||
1682 | BinOp::Percent(it) => &it.syntax, | ||
1683 | BinOp::Shl(it) => &it.syntax, | ||
1684 | BinOp::Shr(it) => &it.syntax, | ||
1685 | BinOp::Caret(it) => &it.syntax, | ||
1686 | BinOp::Pipe(it) => &it.syntax, | ||
1687 | BinOp::Amp(it) => &it.syntax, | ||
1688 | BinOp::Eq(it) => &it.syntax, | ||
1689 | BinOp::Pluseq(it) => &it.syntax, | ||
1690 | BinOp::Slasheq(it) => &it.syntax, | ||
1691 | BinOp::Stareq(it) => &it.syntax, | ||
1692 | BinOp::Percenteq(it) => &it.syntax, | ||
1693 | BinOp::Shreq(it) => &it.syntax, | ||
1694 | BinOp::Shleq(it) => &it.syntax, | ||
1695 | BinOp::Minuseq(it) => &it.syntax, | ||
1696 | BinOp::Pipeeq(it) => &it.syntax, | ||
1697 | BinOp::Ampeq(it) => &it.syntax, | ||
1698 | BinOp::Careteq(it) => &it.syntax, | ||
1699 | } | ||
1700 | } | ||
1701 | } | ||
1702 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1703 | pub enum PrefixOp { | ||
1704 | Minus(Minus), | ||
1705 | Excl(Excl), | ||
1706 | Star(Star), | ||
1707 | } | ||
1708 | impl From<Minus> for PrefixOp { | ||
1709 | fn from(node: Minus) -> PrefixOp { PrefixOp::Minus(node) } | ||
1710 | } | ||
1711 | impl From<Excl> for PrefixOp { | ||
1712 | fn from(node: Excl) -> PrefixOp { PrefixOp::Excl(node) } | ||
1713 | } | ||
1714 | impl From<Star> for PrefixOp { | ||
1715 | fn from(node: Star) -> PrefixOp { PrefixOp::Star(node) } | ||
1716 | } | ||
1717 | impl std::fmt::Display for PrefixOp { | ||
1718 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1719 | std::fmt::Display::fmt(self.syntax(), f) | ||
1720 | } | ||
1721 | } | ||
1722 | impl AstToken for PrefixOp { | ||
1723 | fn can_cast(kind: SyntaxKind) -> bool { | ||
1724 | match kind { | ||
1725 | MINUS | EXCL | STAR => true, | ||
1726 | _ => false, | ||
1727 | } | ||
1728 | } | ||
1729 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1730 | let res = match syntax.kind() { | ||
1731 | MINUS => PrefixOp::Minus(Minus { syntax }), | ||
1732 | EXCL => PrefixOp::Excl(Excl { syntax }), | ||
1733 | STAR => PrefixOp::Star(Star { syntax }), | ||
1734 | _ => return None, | ||
1735 | }; | ||
1736 | Some(res) | ||
1737 | } | ||
1738 | fn syntax(&self) -> &SyntaxToken { | ||
1739 | match self { | ||
1740 | PrefixOp::Minus(it) => &it.syntax, | ||
1741 | PrefixOp::Excl(it) => &it.syntax, | ||
1742 | PrefixOp::Star(it) => &it.syntax, | ||
1743 | } | ||
1744 | } | ||
1745 | } | ||
1746 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1747 | pub enum RangeOp { | ||
1748 | Dotdot(Dotdot), | ||
1749 | Dotdoteq(Dotdoteq), | ||
1750 | } | ||
1751 | impl From<Dotdot> for RangeOp { | ||
1752 | fn from(node: Dotdot) -> RangeOp { RangeOp::Dotdot(node) } | ||
1753 | } | ||
1754 | impl From<Dotdoteq> for RangeOp { | ||
1755 | fn from(node: Dotdoteq) -> RangeOp { RangeOp::Dotdoteq(node) } | ||
1756 | } | ||
1757 | impl std::fmt::Display for RangeOp { | ||
1758 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1759 | std::fmt::Display::fmt(self.syntax(), f) | ||
1760 | } | ||
1761 | } | ||
1762 | impl AstToken for RangeOp { | ||
1763 | fn can_cast(kind: SyntaxKind) -> bool { | ||
1764 | match kind { | ||
1765 | DOTDOT | DOTDOTEQ => true, | ||
1766 | _ => false, | ||
1767 | } | ||
1768 | } | ||
1769 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1770 | let res = match syntax.kind() { | ||
1771 | DOTDOT => RangeOp::Dotdot(Dotdot { syntax }), | ||
1772 | DOTDOTEQ => RangeOp::Dotdoteq(Dotdoteq { syntax }), | ||
1773 | _ => return None, | ||
1774 | }; | ||
1775 | Some(res) | ||
1776 | } | ||
1777 | fn syntax(&self) -> &SyntaxToken { | ||
1778 | match self { | ||
1779 | RangeOp::Dotdot(it) => &it.syntax, | ||
1780 | RangeOp::Dotdoteq(it) => &it.syntax, | ||
1781 | } | ||
1782 | } | ||
1783 | } | ||
1784 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1785 | pub enum LiteralToken { | ||
1786 | IntNumber(IntNumber), | ||
1787 | FloatNumber(FloatNumber), | ||
1788 | String(String), | ||
1789 | RawString(RawString), | ||
1790 | ByteString(ByteString), | ||
1791 | RawByteString(RawByteString), | ||
1792 | Char(Char), | ||
1793 | Byte(Byte), | ||
1794 | } | ||
1795 | impl From<IntNumber> for LiteralToken { | ||
1796 | fn from(node: IntNumber) -> LiteralToken { LiteralToken::IntNumber(node) } | ||
1797 | } | ||
1798 | impl From<FloatNumber> for LiteralToken { | ||
1799 | fn from(node: FloatNumber) -> LiteralToken { LiteralToken::FloatNumber(node) } | ||
1800 | } | ||
1801 | impl From<String> for LiteralToken { | ||
1802 | fn from(node: String) -> LiteralToken { LiteralToken::String(node) } | ||
1803 | } | ||
1804 | impl From<RawString> for LiteralToken { | ||
1805 | fn from(node: RawString) -> LiteralToken { LiteralToken::RawString(node) } | ||
1806 | } | ||
1807 | impl From<ByteString> for LiteralToken { | ||
1808 | fn from(node: ByteString) -> LiteralToken { LiteralToken::ByteString(node) } | ||
1809 | } | ||
1810 | impl From<RawByteString> for LiteralToken { | ||
1811 | fn from(node: RawByteString) -> LiteralToken { LiteralToken::RawByteString(node) } | ||
1812 | } | ||
1813 | impl From<Char> for LiteralToken { | ||
1814 | fn from(node: Char) -> LiteralToken { LiteralToken::Char(node) } | ||
1815 | } | ||
1816 | impl From<Byte> for LiteralToken { | ||
1817 | fn from(node: Byte) -> LiteralToken { LiteralToken::Byte(node) } | ||
1818 | } | ||
1819 | impl std::fmt::Display for LiteralToken { | ||
1820 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1821 | std::fmt::Display::fmt(self.syntax(), f) | ||
1822 | } | ||
1823 | } | ||
1824 | impl AstToken for LiteralToken { | ||
1825 | fn can_cast(kind: SyntaxKind) -> bool { | ||
1826 | match kind { | ||
1827 | INT_NUMBER | FLOAT_NUMBER | STRING | RAW_STRING | BYTE_STRING | RAW_BYTE_STRING | ||
1828 | | CHAR | BYTE => true, | ||
1829 | _ => false, | ||
1830 | } | ||
1831 | } | ||
1832 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1833 | let res = match syntax.kind() { | ||
1834 | INT_NUMBER => LiteralToken::IntNumber(IntNumber { syntax }), | ||
1835 | FLOAT_NUMBER => LiteralToken::FloatNumber(FloatNumber { syntax }), | ||
1836 | STRING => LiteralToken::String(String { syntax }), | ||
1837 | RAW_STRING => LiteralToken::RawString(RawString { syntax }), | ||
1838 | BYTE_STRING => LiteralToken::ByteString(ByteString { syntax }), | ||
1839 | RAW_BYTE_STRING => LiteralToken::RawByteString(RawByteString { syntax }), | ||
1840 | CHAR => LiteralToken::Char(Char { syntax }), | ||
1841 | BYTE => LiteralToken::Byte(Byte { syntax }), | ||
1842 | _ => return None, | ||
1843 | }; | ||
1844 | Some(res) | ||
1845 | } | ||
1846 | fn syntax(&self) -> &SyntaxToken { | ||
1847 | match self { | ||
1848 | LiteralToken::IntNumber(it) => &it.syntax, | ||
1849 | LiteralToken::FloatNumber(it) => &it.syntax, | ||
1850 | LiteralToken::String(it) => &it.syntax, | ||
1851 | LiteralToken::RawString(it) => &it.syntax, | ||
1852 | LiteralToken::ByteString(it) => &it.syntax, | ||
1853 | LiteralToken::RawByteString(it) => &it.syntax, | ||
1854 | LiteralToken::Char(it) => &it.syntax, | ||
1855 | LiteralToken::Byte(it) => &it.syntax, | ||
1856 | } | ||
1857 | } | ||
1858 | } | ||
1859 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1860 | pub enum NameRefToken { | ||
1861 | Ident(Ident), | ||
1862 | IntNumber(IntNumber), | ||
1863 | } | ||
1864 | impl From<Ident> for NameRefToken { | ||
1865 | fn from(node: Ident) -> NameRefToken { NameRefToken::Ident(node) } | ||
1866 | } | ||
1867 | impl From<IntNumber> for NameRefToken { | ||
1868 | fn from(node: IntNumber) -> NameRefToken { NameRefToken::IntNumber(node) } | ||
1869 | } | ||
1870 | impl std::fmt::Display for NameRefToken { | ||
1871 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
1872 | std::fmt::Display::fmt(self.syntax(), f) | ||
1873 | } | ||
1874 | } | ||
1875 | impl AstToken for NameRefToken { | ||
1876 | fn can_cast(kind: SyntaxKind) -> bool { | ||
1877 | match kind { | ||
1878 | IDENT | INT_NUMBER => true, | ||
1879 | _ => false, | ||
1880 | } | ||
1881 | } | ||
1882 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
1883 | let res = match syntax.kind() { | ||
1884 | IDENT => NameRefToken::Ident(Ident { syntax }), | ||
1885 | INT_NUMBER => NameRefToken::IntNumber(IntNumber { syntax }), | ||
1886 | _ => return None, | ||
1887 | }; | ||
1888 | Some(res) | ||
1889 | } | ||
1890 | fn syntax(&self) -> &SyntaxToken { | ||
1891 | match self { | ||
1892 | NameRefToken::Ident(it) => &it.syntax, | ||
1893 | NameRefToken::IntNumber(it) => &it.syntax, | ||
1894 | } | ||
1895 | } | ||
1896 | } | ||
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs index 4ed7cf73b..bfc05e08b 100644 --- a/crates/ra_syntax/src/ast/traits.rs +++ b/crates/ra_syntax/src/ast/traits.rs | |||
@@ -6,6 +6,7 @@ use stdx::SepBy; | |||
6 | use crate::{ | 6 | use crate::{ |
7 | ast::{self, support, AstChildren, AstNode, AstToken}, | 7 | ast::{self, support, AstChildren, AstNode, AstToken}, |
8 | syntax_node::SyntaxElementChildren, | 8 | syntax_node::SyntaxElementChildren, |
9 | SyntaxToken, T, | ||
9 | }; | 10 | }; |
10 | 11 | ||
11 | pub trait TypeAscriptionOwner: AstNode { | 12 | pub trait TypeAscriptionOwner: AstNode { |
@@ -63,8 +64,8 @@ pub trait TypeBoundsOwner: AstNode { | |||
63 | support::child(self.syntax()) | 64 | support::child(self.syntax()) |
64 | } | 65 | } |
65 | 66 | ||
66 | fn colon(&self) -> Option<ast::Colon> { | 67 | fn colon_token(&self) -> Option<SyntaxToken> { |
67 | support::token(self.syntax()) | 68 | support::token(self.syntax(), T![:]) |
68 | } | 69 | } |
69 | } | 70 | } |
70 | 71 | ||
diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs index d1baaa607..67c1f1b48 100644 --- a/crates/ra_syntax/src/parsing/lexer.rs +++ b/crates/ra_syntax/src/parsing/lexer.rs | |||
@@ -4,7 +4,7 @@ | |||
4 | use crate::{ | 4 | use crate::{ |
5 | SyntaxError, | 5 | SyntaxError, |
6 | SyntaxKind::{self, *}, | 6 | SyntaxKind::{self, *}, |
7 | TextRange, TextUnit, | 7 | TextRange, TextUnit, T, |
8 | }; | 8 | }; |
9 | 9 | ||
10 | /// A token of Rust source. | 10 | /// A token of Rust source. |
@@ -115,21 +115,20 @@ fn rustc_token_kind_to_syntax_kind( | |||
115 | // being `u16` that come from `rowan::SyntaxKind`. | 115 | // being `u16` that come from `rowan::SyntaxKind`. |
116 | 116 | ||
117 | let syntax_kind = { | 117 | let syntax_kind = { |
118 | use rustc_lexer::TokenKind as TK; | ||
119 | match rustc_token_kind { | 118 | match rustc_token_kind { |
120 | TK::LineComment => COMMENT, | 119 | rustc_lexer::TokenKind::LineComment => COMMENT, |
121 | 120 | ||
122 | TK::BlockComment { terminated: true } => COMMENT, | 121 | rustc_lexer::TokenKind::BlockComment { terminated: true } => COMMENT, |
123 | TK::BlockComment { terminated: false } => { | 122 | rustc_lexer::TokenKind::BlockComment { terminated: false } => { |
124 | return ( | 123 | return ( |
125 | COMMENT, | 124 | COMMENT, |
126 | Some("Missing trailing `*/` symbols to terminate the block comment"), | 125 | Some("Missing trailing `*/` symbols to terminate the block comment"), |
127 | ); | 126 | ); |
128 | } | 127 | } |
129 | 128 | ||
130 | TK::Whitespace => WHITESPACE, | 129 | rustc_lexer::TokenKind::Whitespace => WHITESPACE, |
131 | 130 | ||
132 | TK::Ident => { | 131 | rustc_lexer::TokenKind::Ident => { |
133 | if token_text == "_" { | 132 | if token_text == "_" { |
134 | UNDERSCORE | 133 | UNDERSCORE |
135 | } else { | 134 | } else { |
@@ -137,42 +136,42 @@ fn rustc_token_kind_to_syntax_kind( | |||
137 | } | 136 | } |
138 | } | 137 | } |
139 | 138 | ||
140 | TK::RawIdent => IDENT, | 139 | rustc_lexer::TokenKind::RawIdent => IDENT, |
141 | TK::Literal { kind, .. } => return match_literal_kind(&kind), | 140 | rustc_lexer::TokenKind::Literal { kind, .. } => return match_literal_kind(&kind), |
142 | 141 | ||
143 | TK::Lifetime { starts_with_number: false } => LIFETIME, | 142 | rustc_lexer::TokenKind::Lifetime { starts_with_number: false } => LIFETIME, |
144 | TK::Lifetime { starts_with_number: true } => { | 143 | rustc_lexer::TokenKind::Lifetime { starts_with_number: true } => { |
145 | return (LIFETIME, Some("Lifetime name cannot start with a number")) | 144 | return (LIFETIME, Some("Lifetime name cannot start with a number")) |
146 | } | 145 | } |
147 | 146 | ||
148 | TK::Semi => SEMI, | 147 | rustc_lexer::TokenKind::Semi => T![;], |
149 | TK::Comma => COMMA, | 148 | rustc_lexer::TokenKind::Comma => T![,], |
150 | TK::Dot => DOT, | 149 | rustc_lexer::TokenKind::Dot => T![.], |
151 | TK::OpenParen => L_PAREN, | 150 | rustc_lexer::TokenKind::OpenParen => T!['('], |
152 | TK::CloseParen => R_PAREN, | 151 | rustc_lexer::TokenKind::CloseParen => T![')'], |
153 | TK::OpenBrace => L_CURLY, | 152 | rustc_lexer::TokenKind::OpenBrace => T!['{'], |
154 | TK::CloseBrace => R_CURLY, | 153 | rustc_lexer::TokenKind::CloseBrace => T!['}'], |
155 | TK::OpenBracket => L_BRACK, | 154 | rustc_lexer::TokenKind::OpenBracket => T!['['], |
156 | TK::CloseBracket => R_BRACK, | 155 | rustc_lexer::TokenKind::CloseBracket => T![']'], |
157 | TK::At => AT, | 156 | rustc_lexer::TokenKind::At => T![@], |
158 | TK::Pound => POUND, | 157 | rustc_lexer::TokenKind::Pound => T![#], |
159 | TK::Tilde => TILDE, | 158 | rustc_lexer::TokenKind::Tilde => T![~], |
160 | TK::Question => QUESTION, | 159 | rustc_lexer::TokenKind::Question => T![?], |
161 | TK::Colon => COLON, | 160 | rustc_lexer::TokenKind::Colon => T![:], |
162 | TK::Dollar => DOLLAR, | 161 | rustc_lexer::TokenKind::Dollar => T![$], |
163 | TK::Eq => EQ, | 162 | rustc_lexer::TokenKind::Eq => T![=], |
164 | TK::Not => EXCL, | 163 | rustc_lexer::TokenKind::Not => T![!], |
165 | TK::Lt => L_ANGLE, | 164 | rustc_lexer::TokenKind::Lt => T![<], |
166 | TK::Gt => R_ANGLE, | 165 | rustc_lexer::TokenKind::Gt => T![>], |
167 | TK::Minus => MINUS, | 166 | rustc_lexer::TokenKind::Minus => T![-], |
168 | TK::And => AMP, | 167 | rustc_lexer::TokenKind::And => T![&], |
169 | TK::Or => PIPE, | 168 | rustc_lexer::TokenKind::Or => T![|], |
170 | TK::Plus => PLUS, | 169 | rustc_lexer::TokenKind::Plus => T![+], |
171 | TK::Star => STAR, | 170 | rustc_lexer::TokenKind::Star => T![*], |
172 | TK::Slash => SLASH, | 171 | rustc_lexer::TokenKind::Slash => T![/], |
173 | TK::Caret => CARET, | 172 | rustc_lexer::TokenKind::Caret => T![^], |
174 | TK::Percent => PERCENT, | 173 | rustc_lexer::TokenKind::Percent => T![%], |
175 | TK::Unknown => ERROR, | 174 | rustc_lexer::TokenKind::Unknown => ERROR, |
176 | } | 175 | } |
177 | }; | 176 | }; |
178 | 177 | ||