aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir_ty/src/infer/expr.rs4
-rw-r--r--crates/ra_hir_ty/src/op.rs15
-rw-r--r--crates/ra_hir_ty/src/tests/simple.rs21
-rw-r--r--crates/ra_ide/src/display/function_signature.rs19
-rw-r--r--crates/ra_ide/src/inlay_hints.rs23
-rw-r--r--crates/ra_parser/src/grammar.rs2
-rw-r--r--crates/ra_parser/src/grammar/expressions.rs28
-rw-r--r--crates/ra_parser/src/grammar/expressions/atom.rs15
-rw-r--r--crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt54
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.rs3
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.txt37
11 files changed, 154 insertions, 67 deletions
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs
index d6a17e469..31259a01d 100644
--- a/crates/ra_hir_ty/src/infer/expr.rs
+++ b/crates/ra_hir_ty/src/infer/expr.rs
@@ -386,11 +386,11 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
386 let lhs_ty = self.infer_expr(*lhs, &lhs_expectation); 386 let lhs_ty = self.infer_expr(*lhs, &lhs_expectation);
387 // FIXME: find implementation of trait corresponding to operation 387 // FIXME: find implementation of trait corresponding to operation
388 // symbol and resolve associated `Output` type 388 // symbol and resolve associated `Output` type
389 let rhs_expectation = op::binary_op_rhs_expectation(*op, lhs_ty); 389 let rhs_expectation = op::binary_op_rhs_expectation(*op, lhs_ty.clone());
390 let rhs_ty = self.infer_expr(*rhs, &Expectation::has_type(rhs_expectation)); 390 let rhs_ty = self.infer_expr(*rhs, &Expectation::has_type(rhs_expectation));
391 391
392 // FIXME: similar as above, return ty is often associated trait type 392 // FIXME: similar as above, return ty is often associated trait type
393 op::binary_op_return_ty(*op, rhs_ty) 393 op::binary_op_return_ty(*op, lhs_ty, rhs_ty)
394 } 394 }
395 _ => Ty::Unknown, 395 _ => Ty::Unknown,
396 }, 396 },
diff --git a/crates/ra_hir_ty/src/op.rs b/crates/ra_hir_ty/src/op.rs
index 09c47a76d..ae253ca04 100644
--- a/crates/ra_hir_ty/src/op.rs
+++ b/crates/ra_hir_ty/src/op.rs
@@ -1,13 +1,21 @@
1//! FIXME: write short doc here 1//! Helper functions for binary operator type inference.
2use hir_def::expr::{BinaryOp, CmpOp}; 2use hir_def::expr::{ArithOp, BinaryOp, CmpOp};
3 3
4use super::{InferTy, Ty, TypeCtor}; 4use super::{InferTy, Ty, TypeCtor};
5use crate::ApplicationTy; 5use crate::ApplicationTy;
6 6
7pub(super) fn binary_op_return_ty(op: BinaryOp, rhs_ty: Ty) -> Ty { 7pub(super) fn binary_op_return_ty(op: BinaryOp, lhs_ty: Ty, rhs_ty: Ty) -> Ty {
8 match op { 8 match op {
9 BinaryOp::LogicOp(_) | BinaryOp::CmpOp(_) => Ty::simple(TypeCtor::Bool), 9 BinaryOp::LogicOp(_) | BinaryOp::CmpOp(_) => Ty::simple(TypeCtor::Bool),
10 BinaryOp::Assignment { .. } => Ty::unit(), 10 BinaryOp::Assignment { .. } => Ty::unit(),
11 BinaryOp::ArithOp(ArithOp::Shl) | BinaryOp::ArithOp(ArithOp::Shr) => match lhs_ty {
12 Ty::Apply(ApplicationTy { ctor, .. }) => match ctor {
13 TypeCtor::Int(..) | TypeCtor::Float(..) => lhs_ty,
14 _ => Ty::Unknown,
15 },
16 Ty::Infer(InferTy::IntVar(..)) | Ty::Infer(InferTy::FloatVar(..)) => lhs_ty,
17 _ => Ty::Unknown,
18 },
11 BinaryOp::ArithOp(_) => match rhs_ty { 19 BinaryOp::ArithOp(_) => match rhs_ty {
12 Ty::Apply(ApplicationTy { ctor, .. }) => match ctor { 20 Ty::Apply(ApplicationTy { ctor, .. }) => match ctor {
13 TypeCtor::Int(..) | TypeCtor::Float(..) => rhs_ty, 21 TypeCtor::Int(..) | TypeCtor::Float(..) => rhs_ty,
@@ -36,6 +44,7 @@ pub(super) fn binary_op_rhs_expectation(op: BinaryOp, lhs_ty: Ty) -> Ty {
36 _ => Ty::Unknown, 44 _ => Ty::Unknown,
37 } 45 }
38 } 46 }
47 BinaryOp::ArithOp(ArithOp::Shl) | BinaryOp::ArithOp(ArithOp::Shr) => Ty::Unknown,
39 BinaryOp::CmpOp(CmpOp::Ord { .. }) 48 BinaryOp::CmpOp(CmpOp::Ord { .. })
40 | BinaryOp::Assignment { op: Some(_) } 49 | BinaryOp::Assignment { op: Some(_) }
41 | BinaryOp::ArithOp(_) => match lhs_ty { 50 | BinaryOp::ArithOp(_) => match lhs_ty {
diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/ra_hir_ty/src/tests/simple.rs
index f7e042c12..b7204ec00 100644
--- a/crates/ra_hir_ty/src/tests/simple.rs
+++ b/crates/ra_hir_ty/src/tests/simple.rs
@@ -614,6 +614,27 @@ fn test() -> bool {
614} 614}
615 615
616#[test] 616#[test]
617fn infer_shift_op() {
618 assert_snapshot!(
619 infer(r#"
620fn test() {
621 1u32 << 5u8;
622 1u32 >> 5u8;
623}
624"#),
625 @r###"
626 [11; 48) '{ ...5u8; }': ()
627 [17; 21) '1u32': u32
628 [17; 28) '1u32 << 5u8': u32
629 [25; 28) '5u8': u8
630 [34; 38) '1u32': u32
631 [34; 45) '1u32 >> 5u8': u32
632 [42; 45) '5u8': u8
633 "###
634 );
635}
636
637#[test]
617fn infer_field_autoderef() { 638fn infer_field_autoderef() {
618 assert_snapshot!( 639 assert_snapshot!(
619 infer(r#" 640 infer(r#"
diff --git a/crates/ra_ide/src/display/function_signature.rs b/crates/ra_ide/src/display/function_signature.rs
index ddc53a52b..1e4a472b4 100644
--- a/crates/ra_ide/src/display/function_signature.rs
+++ b/crates/ra_ide/src/display/function_signature.rs
@@ -169,9 +169,22 @@ impl From<&'_ ast::FnDef> for FunctionSignature {
169 res.push(self_param.syntax().text().to_string()) 169 res.push(self_param.syntax().text().to_string())
170 } 170 }
171 171
172 res.extend(param_list.params().map(|param| { 172 res.extend(
173 param.pat().map(|pat| pat.syntax().text().to_string()).unwrap_or_default() 173 param_list
174 })); 174 .params()
175 .map(|param| {
176 Some(
177 param
178 .pat()?
179 .syntax()
180 .descendants()
181 .find_map(ast::Name::cast)?
182 .text()
183 .to_string(),
184 )
185 })
186 .map(|param| param.unwrap_or_default()),
187 );
175 } 188 }
176 res 189 res
177 } 190 }
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs
index 1b631c7cd..236557541 100644
--- a/crates/ra_ide/src/inlay_hints.rs
+++ b/crates/ra_ide/src/inlay_hints.rs
@@ -116,7 +116,7 @@ fn get_param_name_hints(
116 let hints = parameters 116 let hints = parameters
117 .zip(args) 117 .zip(args)
118 .filter_map(|(param, arg)| { 118 .filter_map(|(param, arg)| {
119 if arg.syntax().kind() == SyntaxKind::LITERAL { 119 if arg.syntax().kind() == SyntaxKind::LITERAL && !param.is_empty() {
120 Some((arg.syntax().text_range(), param)) 120 Some((arg.syntax().text_range(), param))
121 } else { 121 } else {
122 None 122 None
@@ -683,12 +683,12 @@ fn main() {
683struct Test {} 683struct Test {}
684 684
685impl Test { 685impl Test {
686 fn method(&self, param: i32) -> i32 { 686 fn method(&self, mut param: i32) -> i32 {
687 param * 2 687 param * 2
688 } 688 }
689} 689}
690 690
691fn test_func(foo: i32, bar: i32, msg: &str, _: i32, last: i32) -> i32 { 691fn test_func(mut foo: i32, bar: i32, msg: &str, _: i32, last: i32) -> i32 {
692 foo + bar 692 foo + bar
693} 693}
694 694
@@ -704,37 +704,32 @@ fn main() {
704 assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###" 704 assert_debug_snapshot!(analysis.inlay_hints(file_id, None).unwrap(), @r###"
705 [ 705 [
706 InlayHint { 706 InlayHint {
707 range: [207; 218), 707 range: [215; 226),
708 kind: TypeHint, 708 kind: TypeHint,
709 label: "i32", 709 label: "i32",
710 }, 710 },
711 InlayHint { 711 InlayHint {
712 range: [251; 252), 712 range: [259; 260),
713 kind: ParameterHint, 713 kind: ParameterHint,
714 label: "foo", 714 label: "foo",
715 }, 715 },
716 InlayHint { 716 InlayHint {
717 range: [254; 255), 717 range: [262; 263),
718 kind: ParameterHint, 718 kind: ParameterHint,
719 label: "bar", 719 label: "bar",
720 }, 720 },
721 InlayHint { 721 InlayHint {
722 range: [257; 264), 722 range: [265; 272),
723 kind: ParameterHint, 723 kind: ParameterHint,
724 label: "msg", 724 label: "msg",
725 }, 725 },
726 InlayHint { 726 InlayHint {
727 range: [266; 267), 727 range: [331; 334),
728 kind: ParameterHint,
729 label: "_",
730 },
731 InlayHint {
732 range: [323; 326),
733 kind: ParameterHint, 728 kind: ParameterHint,
734 label: "param", 729 label: "param",
735 }, 730 },
736 InlayHint { 731 InlayHint {
737 range: [350; 354), 732 range: [358; 362),
738 kind: ParameterHint, 733 kind: ParameterHint,
739 label: "param", 734 label: "param",
740 }, 735 },
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs
index 22f64a9f4..a46e11e1d 100644
--- a/crates/ra_parser/src/grammar.rs
+++ b/crates/ra_parser/src/grammar.rs
@@ -1,7 +1,7 @@
1//! This is the actual "grammar" of the Rust language. 1//! This is the actual "grammar" of the Rust language.
2//! 2//!
3//! Each function in this module and its children corresponds 3//! Each function in this module and its children corresponds
4//! to a production of the format grammar. Submodules roughly 4//! to a production of the formal grammar. Submodules roughly
5//! correspond to different *areas* of the grammar. By convention, 5//! correspond to different *areas* of the grammar. By convention,
6//! each submodule starts with `use super::*` import and exports 6//! each submodule starts with `use super::*` import and exports
7//! "public" productions via `pub(super)`. 7//! "public" productions via `pub(super)`.
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs
index d733499d1..06c92645e 100644
--- a/crates/ra_parser/src/grammar/expressions.rs
+++ b/crates/ra_parser/src/grammar/expressions.rs
@@ -19,6 +19,26 @@ pub(super) fn expr(p: &mut Parser) -> (Option<CompletedMarker>, BlockLike) {
19 expr_bp(p, r, 1) 19 expr_bp(p, r, 1)
20} 20}
21 21
22pub(super) fn expr_with_attrs(p: &mut Parser) -> bool {
23 let m = p.start();
24 let has_attrs = p.at(T![#]);
25 attributes::outer_attributes(p);
26
27 let (cm, _block_like) = expr(p);
28 let success = cm.is_some();
29
30 match (has_attrs, cm) {
31 (true, Some(cm)) => {
32 let kind = cm.kind();
33 cm.undo_completion(p).abandon(p);
34 m.complete(p, kind);
35 }
36 _ => m.abandon(p),
37 }
38
39 success
40}
41
22pub(super) fn expr_stmt(p: &mut Parser) -> (Option<CompletedMarker>, BlockLike) { 42pub(super) fn expr_stmt(p: &mut Parser) -> (Option<CompletedMarker>, BlockLike) {
23 let r = Restrictions { forbid_structs: false, prefer_stmt: true }; 43 let r = Restrictions { forbid_structs: false, prefer_stmt: true };
24 expr_bp(p, r, 1) 44 expr_bp(p, r, 1)
@@ -540,11 +560,13 @@ fn arg_list(p: &mut Parser) {
540 let m = p.start(); 560 let m = p.start();
541 p.bump(T!['(']); 561 p.bump(T!['(']);
542 while !p.at(T![')']) && !p.at(EOF) { 562 while !p.at(T![')']) && !p.at(EOF) {
543 if !p.at_ts(EXPR_FIRST) { 563 // test arg_with_attr
544 p.error("expected expression"); 564 // fn main() {
565 // foo(#[attr] 92)
566 // }
567 if !expr_with_attrs(p) {
545 break; 568 break;
546 } 569 }
547 expr(p);
548 if !p.at(T![')']) && !p.expect(T![,]) { 570 if !p.at(T![')']) && !p.expect(T![,]) {
549 break; 571 break;
550 } 572 }
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs
index a98a2a3ef..2cc321473 100644
--- a/crates/ra_parser/src/grammar/expressions/atom.rs
+++ b/crates/ra_parser/src/grammar/expressions/atom.rs
@@ -191,19 +191,8 @@ fn array_expr(p: &mut Parser) -> CompletedMarker {
191 191
192 // test array_attrs 192 // test array_attrs
193 // const A: &[i64] = &[1, #[cfg(test)] 2]; 193 // const A: &[i64] = &[1, #[cfg(test)] 2];
194 let m = p.start(); 194 if !expr_with_attrs(p) {
195 let has_attrs = p.at(T![#]); 195 break;
196 attributes::outer_attributes(p);
197
198 let cm = expr(p).0;
199
200 match (has_attrs, cm) {
201 (true, Some(cm)) => {
202 let kind = cm.kind();
203 cm.undo_completion(p).abandon(p);
204 m.complete(p, kind);
205 }
206 _ => m.abandon(p),
207 } 196 }
208 197
209 if n_exprs == 1 && p.eat(T![;]) { 198 if n_exprs == 1 && p.eat(T![;]) {
diff --git a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt
index 310a82464..cb45eb2fc 100644
--- a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt
+++ b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt
@@ -12,8 +12,8 @@ SOURCE_FILE@[0; 112)
12 BLOCK@[7; 33) 12 BLOCK@[7; 33)
13 L_CURLY@[7; 8) "{" 13 L_CURLY@[7; 8) "{"
14 WHITESPACE@[8; 9) " " 14 WHITESPACE@[8; 9) " "
15 EXPR_STMT@[9; 26) 15 EXPR_STMT@[9; 17)
16 ARRAY_EXPR@[9; 26) 16 ARRAY_EXPR@[9; 17)
17 L_BRACK@[9; 10) "[" 17 L_BRACK@[9; 10) "["
18 LITERAL@[10; 11) 18 LITERAL@[10; 11)
19 INT_NUMBER@[10; 11) "1" 19 INT_NUMBER@[10; 11) "1"
@@ -25,10 +25,13 @@ SOURCE_FILE@[0; 112)
25 WHITESPACE@[15; 16) " " 25 WHITESPACE@[15; 16) " "
26 ERROR@[16; 17) 26 ERROR@[16; 17)
27 AT@[16; 17) "@" 27 AT@[16; 17) "@"
28 EXPR_STMT@[17; 18)
29 ERROR@[17; 18)
28 COMMA@[17; 18) "," 30 COMMA@[17; 18) ","
29 WHITESPACE@[18; 19) " " 31 WHITESPACE@[18; 19) " "
30 ERROR@[19; 25) 32 STRUCT_DEF@[19; 26)
31 STRUCT_KW@[19; 25) "struct" 33 STRUCT_KW@[19; 25) "struct"
34 ERROR@[25; 26)
32 COMMA@[25; 26) "," 35 COMMA@[25; 26) ","
33 WHITESPACE@[26; 27) " " 36 WHITESPACE@[26; 27) " "
34 LET_STMT@[27; 31) 37 LET_STMT@[27; 31)
@@ -51,14 +54,14 @@ SOURCE_FILE@[0; 112)
51 BLOCK@[41; 68) 54 BLOCK@[41; 68)
52 L_CURLY@[41; 42) "{" 55 L_CURLY@[41; 42) "{"
53 WHITESPACE@[42; 43) " " 56 WHITESPACE@[42; 43) " "
54 EXPR_STMT@[43; 52) 57 EXPR_STMT@[43; 54)
55 CALL_EXPR@[43; 52) 58 CALL_EXPR@[43; 54)
56 PATH_EXPR@[43; 46) 59 PATH_EXPR@[43; 46)
57 PATH@[43; 46) 60 PATH@[43; 46)
58 PATH_SEGMENT@[43; 46) 61 PATH_SEGMENT@[43; 46)
59 NAME_REF@[43; 46) 62 NAME_REF@[43; 46)
60 IDENT@[43; 46) "foo" 63 IDENT@[43; 46) "foo"
61 ARG_LIST@[46; 52) 64 ARG_LIST@[46; 54)
62 L_PAREN@[46; 47) "(" 65 L_PAREN@[46; 47) "("
63 LITERAL@[47; 48) 66 LITERAL@[47; 48)
64 INT_NUMBER@[47; 48) "1" 67 INT_NUMBER@[47; 48) "1"
@@ -67,10 +70,9 @@ SOURCE_FILE@[0; 112)
67 LITERAL@[50; 51) 70 LITERAL@[50; 51)
68 INT_NUMBER@[50; 51) "2" 71 INT_NUMBER@[50; 51) "2"
69 COMMA@[51; 52) "," 72 COMMA@[51; 52) ","
70 WHITESPACE@[52; 53) " " 73 WHITESPACE@[52; 53) " "
71 EXPR_STMT@[53; 54) 74 ERROR@[53; 54)
72 ERROR@[53; 54) 75 AT@[53; 54) "@"
73 AT@[53; 54) "@"
74 EXPR_STMT@[54; 55) 76 EXPR_STMT@[54; 55)
75 ERROR@[54; 55) 77 ERROR@[54; 55)
76 COMMA@[54; 55) "," 78 COMMA@[54; 55) ","
@@ -101,8 +103,8 @@ SOURCE_FILE@[0; 112)
101 BLOCK@[76; 111) 103 BLOCK@[76; 111)
102 L_CURLY@[76; 77) "{" 104 L_CURLY@[76; 77) "{"
103 WHITESPACE@[77; 78) " " 105 WHITESPACE@[77; 78) " "
104 EXPR_STMT@[78; 91) 106 EXPR_STMT@[78; 93)
105 METHOD_CALL_EXPR@[78; 91) 107 METHOD_CALL_EXPR@[78; 93)
106 PATH_EXPR@[78; 81) 108 PATH_EXPR@[78; 81)
107 PATH@[78; 81) 109 PATH@[78; 81)
108 PATH_SEGMENT@[78; 81) 110 PATH_SEGMENT@[78; 81)
@@ -111,7 +113,7 @@ SOURCE_FILE@[0; 112)
111 DOT@[81; 82) "." 113 DOT@[81; 82) "."
112 NAME_REF@[82; 85) 114 NAME_REF@[82; 85)
113 IDENT@[82; 85) "bar" 115 IDENT@[82; 85) "bar"
114 ARG_LIST@[85; 91) 116 ARG_LIST@[85; 93)
115 L_PAREN@[85; 86) "(" 117 L_PAREN@[85; 86) "("
116 LITERAL@[86; 87) 118 LITERAL@[86; 87)
117 INT_NUMBER@[86; 87) "1" 119 INT_NUMBER@[86; 87) "1"
@@ -120,10 +122,9 @@ SOURCE_FILE@[0; 112)
120 LITERAL@[89; 90) 122 LITERAL@[89; 90)
121 INT_NUMBER@[89; 90) "2" 123 INT_NUMBER@[89; 90) "2"
122 COMMA@[90; 91) "," 124 COMMA@[90; 91) ","
123 WHITESPACE@[91; 92) " " 125 WHITESPACE@[91; 92) " "
124 EXPR_STMT@[92; 93) 126 ERROR@[92; 93)
125 ERROR@[92; 93) 127 AT@[92; 93) "@"
126 AT@[92; 93) "@"
127 EXPR_STMT@[93; 94) 128 EXPR_STMT@[93; 94)
128 ERROR@[93; 94) 129 ERROR@[93; 94)
129 COMMA@[93; 94) "," 130 COMMA@[93; 94) ","
@@ -148,15 +149,14 @@ SOURCE_FILE@[0; 112)
148 R_CURLY@[110; 111) "}" 149 R_CURLY@[110; 111) "}"
149 WHITESPACE@[111; 112) "\n" 150 WHITESPACE@[111; 112) "\n"
150error 16: expected expression 151error 16: expected expression
151error 19: expected expression 152error 17: expected R_BRACK
152error 26: expected expression 153error 17: expected SEMI
153error 26: expected COMMA 154error 17: expected expression
154error 26: expected R_BRACK 155error 18: expected SEMI
155error 26: expected SEMI 156error 25: expected a name
157error 26: expected `;`, `{`, or `(`
156error 30: expected pattern 158error 30: expected pattern
157error 31: expected SEMI 159error 31: expected SEMI
158error 52: expected expression
159error 52: expected SEMI
160error 53: expected expression 160error 53: expected expression
161error 54: expected SEMI 161error 54: expected SEMI
162error 54: expected expression 162error 54: expected expression
@@ -168,8 +168,6 @@ error 61: expected SEMI
168error 65: expected pattern 168error 65: expected pattern
169error 65: expected SEMI 169error 65: expected SEMI
170error 65: expected expression 170error 65: expected expression
171error 91: expected expression
172error 91: expected SEMI
173error 92: expected expression 171error 92: expected expression
174error 93: expected SEMI 172error 93: expected SEMI
175error 93: expected expression 173error 93: expected expression
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.rs b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.rs
new file mode 100644
index 000000000..5daf1d7b0
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.rs
@@ -0,0 +1,3 @@
1fn main() {
2 foo(#[attr] 92)
3}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.txt b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.txt
new file mode 100644
index 000000000..8092d7009
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.txt
@@ -0,0 +1,37 @@
1SOURCE_FILE@[0; 34)
2 FN_DEF@[0; 33)
3 FN_KW@[0; 2) "fn"
4 WHITESPACE@[2; 3) " "
5 NAME@[3; 7)
6 IDENT@[3; 7) "main"
7 PARAM_LIST@[7; 9)
8 L_PAREN@[7; 8) "("
9 R_PAREN@[8; 9) ")"
10 WHITESPACE@[9; 10) " "
11 BLOCK_EXPR@[10; 33)
12 BLOCK@[10; 33)
13 L_CURLY@[10; 11) "{"
14 WHITESPACE@[11; 16) "\n "
15 CALL_EXPR@[16; 31)
16 PATH_EXPR@[16; 19)
17 PATH@[16; 19)
18 PATH_SEGMENT@[16; 19)
19 NAME_REF@[16; 19)
20 IDENT@[16; 19) "foo"
21 ARG_LIST@[19; 31)
22 L_PAREN@[19; 20) "("
23 LITERAL@[20; 30)
24 ATTR@[20; 27)
25 POUND@[20; 21) "#"
26 L_BRACK@[21; 22) "["
27 PATH@[22; 26)
28 PATH_SEGMENT@[22; 26)
29 NAME_REF@[22; 26)
30 IDENT@[22; 26) "attr"
31 R_BRACK@[26; 27) "]"
32 WHITESPACE@[27; 28) " "
33 INT_NUMBER@[28; 30) "92"
34 R_PAREN@[30; 31) ")"
35 WHITESPACE@[31; 32) "\n"
36 R_CURLY@[32; 33) "}"
37 WHITESPACE@[33; 34) "\n"