aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/ast/make.rs16
-rw-r--r--crates/ra_syntax/src/parsing/lexer.rs4
-rw-r--r--crates/ra_syntax/src/tests.rs11
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.txt3
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs3
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt47
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.txt3
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.rs1
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.txt44
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt3
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rs (renamed from crates/ra_syntax/test_data/parser/inline/ok/0153_trait_fn_patterns.rs)1
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.txt (renamed from crates/ra_syntax/test_data/parser/inline/ok/0153_trait_fn_patterns.txt)47
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rs5
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.txt133
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rs (renamed from crates/ra_syntax/test_data/parser/inline/ok/0152_fn_patterns.rs)0
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.txt (renamed from crates/ra_syntax/test_data/parser/inline/ok/0152_fn_patterns.txt)0
16 files changed, 254 insertions, 67 deletions
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs
index ae8829807..9f6f1cc53 100644
--- a/crates/ra_syntax/src/ast/make.rs
+++ b/crates/ra_syntax/src/ast/make.rs
@@ -112,10 +112,14 @@ pub fn expr_prefix(op: SyntaxKind, expr: ast::Expr) -> ast::Expr {
112 let token = token(op); 112 let token = token(op);
113 expr_from_text(&format!("{}{}", token, expr.syntax())) 113 expr_from_text(&format!("{}{}", token, expr.syntax()))
114} 114}
115pub fn expr_from_text(text: &str) -> ast::Expr { 115fn expr_from_text(text: &str) -> ast::Expr {
116 ast_from_text(&format!("const C: () = {};", text)) 116 ast_from_text(&format!("const C: () = {};", text))
117} 117}
118 118
119pub fn try_expr_from_text(text: &str) -> Option<ast::Expr> {
120 try_ast_from_text(&format!("const C: () = {};", text))
121}
122
119pub fn bind_pat(name: ast::Name) -> ast::BindPat { 123pub fn bind_pat(name: ast::Name) -> ast::BindPat {
120 return from_text(name.text()); 124 return from_text(name.text());
121 125
@@ -239,6 +243,16 @@ fn ast_from_text<N: AstNode>(text: &str) -> N {
239 node 243 node
240} 244}
241 245
246fn try_ast_from_text<N: AstNode>(text: &str) -> Option<N> {
247 let parse = SourceFile::parse(text);
248 let node = parse.tree().syntax().descendants().find_map(N::cast)?;
249 let node = node.syntax().clone();
250 let node = unroot(node);
251 let node = N::cast(node).unwrap();
252 assert_eq!(node.syntax().text_range().start(), 0.into());
253 Some(node)
254}
255
242fn unroot(n: SyntaxNode) -> SyntaxNode { 256fn unroot(n: SyntaxNode) -> SyntaxNode {
243 SyntaxNode::new_root(n.green().clone()) 257 SyntaxNode::new_root(n.green().clone())
244} 258}
diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs
index f2684c852..d1baaa607 100644
--- a/crates/ra_syntax/src/parsing/lexer.rs
+++ b/crates/ra_syntax/src/parsing/lexer.rs
@@ -65,7 +65,7 @@ pub fn tokenize(text: &str) -> (Vec<Token>, Vec<SyntaxError>) {
65/// Beware that unescape errors are not checked at tokenization time. 65/// Beware that unescape errors are not checked at tokenization time.
66pub fn lex_single_syntax_kind(text: &str) -> Option<(SyntaxKind, Option<SyntaxError>)> { 66pub fn lex_single_syntax_kind(text: &str) -> Option<(SyntaxKind, Option<SyntaxError>)> {
67 lex_first_token(text) 67 lex_first_token(text)
68 .filter(|(token, _)| token.len.to_usize() == text.len()) 68 .filter(|(token, _)| token.len == TextUnit::of_str(text))
69 .map(|(token, error)| (token.kind, error)) 69 .map(|(token, error)| (token.kind, error))
70} 70}
71 71
@@ -75,7 +75,7 @@ pub fn lex_single_syntax_kind(text: &str) -> Option<(SyntaxKind, Option<SyntaxEr
75/// Beware that unescape errors are not checked at tokenization time. 75/// Beware that unescape errors are not checked at tokenization time.
76pub fn lex_single_valid_syntax_kind(text: &str) -> Option<SyntaxKind> { 76pub fn lex_single_valid_syntax_kind(text: &str) -> Option<SyntaxKind> {
77 lex_first_token(text) 77 lex_first_token(text)
78 .filter(|(token, error)| !error.is_some() && token.len.to_usize() == text.len()) 78 .filter(|(token, error)| !error.is_some() && token.len == TextUnit::of_str(text))
79 .map(|(token, _error)| token.kind) 79 .map(|(token, _error)| token.kind)
80} 80}
81 81
diff --git a/crates/ra_syntax/src/tests.rs b/crates/ra_syntax/src/tests.rs
index 912e6aec0..6a8cb6bb5 100644
--- a/crates/ra_syntax/src/tests.rs
+++ b/crates/ra_syntax/src/tests.rs
@@ -5,7 +5,7 @@ use std::{
5 5
6use test_utils::{collect_tests, dir_tests, project_dir, read_text}; 6use test_utils::{collect_tests, dir_tests, project_dir, read_text};
7 7
8use crate::{fuzz, tokenize, SourceFile, SyntaxError, Token}; 8use crate::{fuzz, tokenize, SourceFile, SyntaxError, TextRange, TextUnit, Token};
9 9
10#[test] 10#[test]
11fn lexer_tests() { 11fn lexer_tests() {
@@ -34,6 +34,7 @@ fn main() {
34 "##; 34 "##;
35 35
36 let parse = SourceFile::parse(code); 36 let parse = SourceFile::parse(code);
37 // eprintln!("{:#?}", parse.syntax_node());
37 assert!(parse.ok().is_ok()); 38 assert!(parse.ok().is_ok());
38} 39}
39 40
@@ -120,11 +121,11 @@ fn assert_errors_are_absent(errors: &[SyntaxError], path: &Path) {
120 121
121fn dump_tokens_and_errors(tokens: &[Token], errors: &[SyntaxError], text: &str) -> String { 122fn dump_tokens_and_errors(tokens: &[Token], errors: &[SyntaxError], text: &str) -> String {
122 let mut acc = String::new(); 123 let mut acc = String::new();
123 let mut offset = 0; 124 let mut offset = TextUnit::from_usize(0);
124 for token in tokens { 125 for token in tokens {
125 let token_len = token.len.to_usize(); 126 let token_len = token.len;
126 let token_text = &text[offset..offset + token_len]; 127 let token_text = &text[TextRange::offset_len(offset, token.len)];
127 offset += token_len; 128 offset += token.len;
128 writeln!(acc, "{:?} {} {:?}", token.kind, token_len, token_text).unwrap(); 129 writeln!(acc, "{:?} {} {:?}", token.kind, token_len, token_text).unwrap();
129 } 130 }
130 for err in errors { 131 for err in errors {
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.txt b/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.txt
index a0a8aea76..4c17f0db8 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.txt
@@ -81,7 +81,8 @@ SOURCE_FILE@[0; 113)
81 WHITESPACE@[97; 98) " " 81 WHITESPACE@[97; 98) " "
82 COMMA@[98; 99) "," 82 COMMA@[98; 99) ","
83 WHITESPACE@[99; 100) " " 83 WHITESPACE@[99; 100) " "
84 DOTDOTDOT@[100; 103) "..." 84 PARAM@[100; 103)
85 DOTDOTDOT@[100; 103) "..."
85 WHITESPACE@[103; 104) " " 86 WHITESPACE@[103; 104) " "
86 R_PAREN@[104; 105) ")" 87 R_PAREN@[104; 105) ")"
87 WHITESPACE@[105; 106) " " 88 WHITESPACE@[105; 106) " "
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs b/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs
deleted file mode 100644
index 472cb8803..000000000
--- a/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.rs
+++ /dev/null
@@ -1,3 +0,0 @@
1trait Foo {
2 fn bar(_: u64, mut x: i32);
3}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt b/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt
deleted file mode 100644
index 158236c5a..000000000
--- a/crates/ra_syntax/test_data/parser/inline/ok/0116_trait_fn_placeholder_parameter.txt
+++ /dev/null
@@ -1,47 +0,0 @@
1SOURCE_FILE@[0; 46)
2 TRAIT_DEF@[0; 45)
3 TRAIT_KW@[0; 5) "trait"
4 WHITESPACE@[5; 6) " "
5 NAME@[6; 9)
6 IDENT@[6; 9) "Foo"
7 WHITESPACE@[9; 10) " "
8 ITEM_LIST@[10; 45)
9 L_CURLY@[10; 11) "{"
10 WHITESPACE@[11; 16) "\n "
11 FN_DEF@[16; 43)
12 FN_KW@[16; 18) "fn"
13 WHITESPACE@[18; 19) " "
14 NAME@[19; 22)
15 IDENT@[19; 22) "bar"
16 PARAM_LIST@[22; 42)
17 L_PAREN@[22; 23) "("
18 PARAM@[23; 29)
19 PLACEHOLDER_PAT@[23; 24)
20 UNDERSCORE@[23; 24) "_"
21 COLON@[24; 25) ":"
22 WHITESPACE@[25; 26) " "
23 PATH_TYPE@[26; 29)
24 PATH@[26; 29)
25 PATH_SEGMENT@[26; 29)
26 NAME_REF@[26; 29)
27 IDENT@[26; 29) "u64"
28 COMMA@[29; 30) ","
29 WHITESPACE@[30; 31) " "
30 PARAM@[31; 41)
31 BIND_PAT@[31; 36)
32 MUT_KW@[31; 34) "mut"
33 WHITESPACE@[34; 35) " "
34 NAME@[35; 36)
35 IDENT@[35; 36) "x"
36 COLON@[36; 37) ":"
37 WHITESPACE@[37; 38) " "
38 PATH_TYPE@[38; 41)
39 PATH@[38; 41)
40 PATH_SEGMENT@[38; 41)
41 NAME_REF@[38; 41)
42 IDENT@[38; 41) "i32"
43 R_PAREN@[41; 42) ")"
44 SEMI@[42; 43) ";"
45 WHITESPACE@[43; 44) "\n"
46 R_CURLY@[44; 45) "}"
47 WHITESPACE@[45; 46) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.txt b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.txt
index 836e8e55b..6c3b17868 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.txt
@@ -32,7 +32,8 @@ SOURCE_FILE@[0; 57)
32 IDENT@[38; 40) "i8" 32 IDENT@[38; 40) "i8"
33 COMMA@[40; 41) "," 33 COMMA@[40; 41) ","
34 WHITESPACE@[41; 42) " " 34 WHITESPACE@[41; 42) " "
35 DOTDOTDOT@[42; 45) "..." 35 PARAM@[42; 45)
36 DOTDOTDOT@[42; 45) "..."
36 R_PAREN@[45; 46) ")" 37 R_PAREN@[45; 46) ")"
37 WHITESPACE@[46; 47) " " 38 WHITESPACE@[46; 47) " "
38 RET_TYPE@[47; 53) 39 RET_TYPE@[47; 53)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.rs b/crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.rs
new file mode 100644
index 000000000..7b277c16b
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.rs
@@ -0,0 +1 @@
fn foo((x, y): (i32, i32)) {}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.txt b/crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.txt
new file mode 100644
index 000000000..103e254a6
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.txt
@@ -0,0 +1,44 @@
1SOURCE_FILE@[0; 30)
2 FN_DEF@[0; 29)
3 FN_KW@[0; 2) "fn"
4 WHITESPACE@[2; 3) " "
5 NAME@[3; 6)
6 IDENT@[3; 6) "foo"
7 PARAM_LIST@[6; 26)
8 L_PAREN@[6; 7) "("
9 PARAM@[7; 25)
10 TUPLE_PAT@[7; 13)
11 L_PAREN@[7; 8) "("
12 BIND_PAT@[8; 9)
13 NAME@[8; 9)
14 IDENT@[8; 9) "x"
15 COMMA@[9; 10) ","
16 WHITESPACE@[10; 11) " "
17 BIND_PAT@[11; 12)
18 NAME@[11; 12)
19 IDENT@[11; 12) "y"
20 R_PAREN@[12; 13) ")"
21 COLON@[13; 14) ":"
22 WHITESPACE@[14; 15) " "
23 TUPLE_TYPE@[15; 25)
24 L_PAREN@[15; 16) "("
25 PATH_TYPE@[16; 19)
26 PATH@[16; 19)
27 PATH_SEGMENT@[16; 19)
28 NAME_REF@[16; 19)
29 IDENT@[16; 19) "i32"
30 COMMA@[19; 20) ","
31 WHITESPACE@[20; 21) " "
32 PATH_TYPE@[21; 24)
33 PATH@[21; 24)
34 PATH_SEGMENT@[21; 24)
35 NAME_REF@[21; 24)
36 IDENT@[21; 24) "i32"
37 R_PAREN@[24; 25) ")"
38 R_PAREN@[25; 26) ")"
39 WHITESPACE@[26; 27) " "
40 BLOCK_EXPR@[27; 29)
41 BLOCK@[27; 29)
42 L_CURLY@[27; 28) "{"
43 R_CURLY@[28; 29) "}"
44 WHITESPACE@[29; 30) "\n"
diff --git a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt
index 719c99c17..254eafc36 100644
--- a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt
+++ b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt
@@ -118,7 +118,8 @@ SOURCE_FILE@[0; 519)
118 IDENT@[108; 112) "attr" 118 IDENT@[108; 112) "attr"
119 R_BRACK@[112; 113) "]" 119 R_BRACK@[112; 113) "]"
120 WHITESPACE@[113; 114) " " 120 WHITESPACE@[113; 114) " "
121 DOTDOTDOT@[114; 117) "..." 121 PARAM@[114; 117)
122 DOTDOTDOT@[114; 117) "..."
122 R_PAREN@[117; 118) ")" 123 R_PAREN@[117; 118) ")"
123 WHITESPACE@[118; 119) " " 124 WHITESPACE@[118; 119) " "
124 RET_TYPE@[119; 125) 125 RET_TYPE@[119; 125)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0153_trait_fn_patterns.rs b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rs
index a94bf378a..3b666af8e 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0153_trait_fn_patterns.rs
+++ b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rs
@@ -3,4 +3,5 @@ trait T {
3 fn f2(S { a, b }: S) {} 3 fn f2(S { a, b }: S) {}
4 fn f3(NewType(a): NewType) {} 4 fn f3(NewType(a): NewType) {}
5 fn f4(&&a: &&usize) {} 5 fn f4(&&a: &&usize) {}
6 fn bar(_: u64, mut x: i32);
6} 7}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0153_trait_fn_patterns.txt b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.txt
index b22df8dbe..eb2e3a503 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0153_trait_fn_patterns.txt
+++ b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.txt
@@ -1,11 +1,11 @@
1SOURCE_FILE@[0; 138) 1SOURCE_FILE@[0; 170)
2 TRAIT_DEF@[0; 137) 2 TRAIT_DEF@[0; 169)
3 TRAIT_KW@[0; 5) "trait" 3 TRAIT_KW@[0; 5) "trait"
4 WHITESPACE@[5; 6) " " 4 WHITESPACE@[5; 6) " "
5 NAME@[6; 7) 5 NAME@[6; 7)
6 IDENT@[6; 7) "T" 6 IDENT@[6; 7) "T"
7 WHITESPACE@[7; 8) " " 7 WHITESPACE@[7; 8) " "
8 ITEM_LIST@[8; 137) 8 ITEM_LIST@[8; 169)
9 L_CURLY@[8; 9) "{" 9 L_CURLY@[8; 9) "{"
10 WHITESPACE@[9; 14) "\n " 10 WHITESPACE@[9; 14) "\n "
11 FN_DEF@[14; 46) 11 FN_DEF@[14; 46)
@@ -156,6 +156,41 @@ SOURCE_FILE@[0; 138)
156 BLOCK@[133; 135) 156 BLOCK@[133; 135)
157 L_CURLY@[133; 134) "{" 157 L_CURLY@[133; 134) "{"
158 R_CURLY@[134; 135) "}" 158 R_CURLY@[134; 135) "}"
159 WHITESPACE@[135; 136) "\n" 159 WHITESPACE@[135; 140) "\n "
160 R_CURLY@[136; 137) "}" 160 FN_DEF@[140; 167)
161 WHITESPACE@[137; 138) "\n" 161 FN_KW@[140; 142) "fn"
162 WHITESPACE@[142; 143) " "
163 NAME@[143; 146)
164 IDENT@[143; 146) "bar"
165 PARAM_LIST@[146; 166)
166 L_PAREN@[146; 147) "("
167 PARAM@[147; 153)
168 PLACEHOLDER_PAT@[147; 148)
169 UNDERSCORE@[147; 148) "_"
170 COLON@[148; 149) ":"
171 WHITESPACE@[149; 150) " "
172 PATH_TYPE@[150; 153)
173 PATH@[150; 153)
174 PATH_SEGMENT@[150; 153)
175 NAME_REF@[150; 153)
176 IDENT@[150; 153) "u64"
177 COMMA@[153; 154) ","
178 WHITESPACE@[154; 155) " "
179 PARAM@[155; 165)
180 BIND_PAT@[155; 160)
181 MUT_KW@[155; 158) "mut"
182 WHITESPACE@[158; 159) " "
183 NAME@[159; 160)
184 IDENT@[159; 160) "x"
185 COLON@[160; 161) ":"
186 WHITESPACE@[161; 162) " "
187 PATH_TYPE@[162; 165)
188 PATH@[162; 165)
189 PATH_SEGMENT@[162; 165)
190 NAME_REF@[162; 165)
191 IDENT@[162; 165) "i32"
192 R_PAREN@[165; 166) ")"
193 SEMI@[166; 167) ";"
194 WHITESPACE@[167; 168) "\n"
195 R_CURLY@[168; 169) "}"
196 WHITESPACE@[169; 170) "\n"
diff --git a/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rs b/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rs
new file mode 100644
index 000000000..a16afbaf3
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rs
@@ -0,0 +1,5 @@
1extern "C" {
2 fn a(_: *mut u8, ...,);
3 fn b(_: *mut u8, _: ...);
4 fn c(_: *mut u8, #[cfg(never)] [w, t, f]: ...,);
5}
diff --git a/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.txt b/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.txt
new file mode 100644
index 000000000..186f03626
--- /dev/null
+++ b/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.txt
@@ -0,0 +1,133 @@
1SOURCE_FILE@[0; 126)
2 EXTERN_BLOCK@[0; 125)
3 ABI@[0; 10)
4 EXTERN_KW@[0; 6) "extern"
5 WHITESPACE@[6; 7) " "
6 STRING@[7; 10) "\"C\""
7 WHITESPACE@[10; 11) " "
8 EXTERN_ITEM_LIST@[11; 125)
9 L_CURLY@[11; 12) "{"
10 WHITESPACE@[12; 17) "\n "
11 FN_DEF@[17; 40)
12 FN_KW@[17; 19) "fn"
13 WHITESPACE@[19; 20) " "
14 NAME@[20; 21)
15 IDENT@[20; 21) "a"
16 PARAM_LIST@[21; 39)
17 L_PAREN@[21; 22) "("
18 PARAM@[22; 32)
19 PLACEHOLDER_PAT@[22; 23)
20 UNDERSCORE@[22; 23) "_"
21 COLON@[23; 24) ":"
22 WHITESPACE@[24; 25) " "
23 POINTER_TYPE@[25; 32)
24 STAR@[25; 26) "*"
25 MUT_KW@[26; 29) "mut"
26 WHITESPACE@[29; 30) " "
27 PATH_TYPE@[30; 32)
28 PATH@[30; 32)
29 PATH_SEGMENT@[30; 32)
30 NAME_REF@[30; 32)
31 IDENT@[30; 32) "u8"
32 COMMA@[32; 33) ","
33 WHITESPACE@[33; 34) " "
34 PARAM@[34; 37)
35 DOTDOTDOT@[34; 37) "..."
36 COMMA@[37; 38) ","
37 R_PAREN@[38; 39) ")"
38 SEMI@[39; 40) ";"
39 WHITESPACE@[40; 45) "\n "
40 FN_DEF@[45; 70)
41 FN_KW@[45; 47) "fn"
42 WHITESPACE@[47; 48) " "
43 NAME@[48; 49)
44 IDENT@[48; 49) "b"
45 PARAM_LIST@[49; 69)
46 L_PAREN@[49; 50) "("
47 PARAM@[50; 60)
48 PLACEHOLDER_PAT@[50; 51)
49 UNDERSCORE@[50; 51) "_"
50 COLON@[51; 52) ":"
51 WHITESPACE@[52; 53) " "
52 POINTER_TYPE@[53; 60)
53 STAR@[53; 54) "*"
54 MUT_KW@[54; 57) "mut"
55 WHITESPACE@[57; 58) " "
56 PATH_TYPE@[58; 60)
57 PATH@[58; 60)
58 PATH_SEGMENT@[58; 60)
59 NAME_REF@[58; 60)
60 IDENT@[58; 60) "u8"
61 COMMA@[60; 61) ","
62 WHITESPACE@[61; 62) " "
63 PARAM@[62; 68)
64 PLACEHOLDER_PAT@[62; 63)
65 UNDERSCORE@[62; 63) "_"
66 COLON@[63; 64) ":"
67 WHITESPACE@[64; 65) " "
68 DOTDOTDOT@[65; 68) "..."
69 R_PAREN@[68; 69) ")"
70 SEMI@[69; 70) ";"
71 WHITESPACE@[70; 75) "\n "
72 FN_DEF@[75; 123)
73 FN_KW@[75; 77) "fn"
74 WHITESPACE@[77; 78) " "
75 NAME@[78; 79)
76 IDENT@[78; 79) "c"
77 PARAM_LIST@[79; 122)
78 L_PAREN@[79; 80) "("
79 PARAM@[80; 90)
80 PLACEHOLDER_PAT@[80; 81)
81 UNDERSCORE@[80; 81) "_"
82 COLON@[81; 82) ":"
83 WHITESPACE@[82; 83) " "
84 POINTER_TYPE@[83; 90)
85 STAR@[83; 84) "*"
86 MUT_KW@[84; 87) "mut"
87 WHITESPACE@[87; 88) " "
88 PATH_TYPE@[88; 90)
89 PATH@[88; 90)
90 PATH_SEGMENT@[88; 90)
91 NAME_REF@[88; 90)
92 IDENT@[88; 90) "u8"
93 COMMA@[90; 91) ","
94 WHITESPACE@[91; 92) " "
95 ATTR@[92; 105)
96 POUND@[92; 93) "#"
97 L_BRACK@[93; 94) "["
98 PATH@[94; 97)
99 PATH_SEGMENT@[94; 97)
100 NAME_REF@[94; 97)
101 IDENT@[94; 97) "cfg"
102 TOKEN_TREE@[97; 104)
103 L_PAREN@[97; 98) "("
104 IDENT@[98; 103) "never"
105 R_PAREN@[103; 104) ")"
106 R_BRACK@[104; 105) "]"
107 WHITESPACE@[105; 106) " "
108 PARAM@[106; 120)
109 SLICE_PAT@[106; 115)
110 L_BRACK@[106; 107) "["
111 BIND_PAT@[107; 108)
112 NAME@[107; 108)
113 IDENT@[107; 108) "w"
114 COMMA@[108; 109) ","
115 WHITESPACE@[109; 110) " "
116 BIND_PAT@[110; 111)
117 NAME@[110; 111)
118 IDENT@[110; 111) "t"
119 COMMA@[111; 112) ","
120 WHITESPACE@[112; 113) " "
121 BIND_PAT@[113; 114)
122 NAME@[113; 114)
123 IDENT@[113; 114) "f"
124 R_BRACK@[114; 115) "]"
125 COLON@[115; 116) ":"
126 WHITESPACE@[116; 117) " "
127 DOTDOTDOT@[117; 120) "..."
128 COMMA@[120; 121) ","
129 R_PAREN@[121; 122) ")"
130 SEMI@[122; 123) ";"
131 WHITESPACE@[123; 124) "\n"
132 R_CURLY@[124; 125) "}"
133 WHITESPACE@[125; 126) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0152_fn_patterns.rs b/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rs
index b49e872d7..b49e872d7 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0152_fn_patterns.rs
+++ b/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rs
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0152_fn_patterns.txt b/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.txt
index b30030de3..b30030de3 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0152_fn_patterns.txt
+++ b/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.txt