diff options
author | Aleksey Kladov <[email protected]> | 2018-08-13 16:23:14 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-13 16:24:17 +0100 |
commit | 9149fd2c0ca3d23719082852a2cddd8ba5804ce6 (patch) | |
tree | f15d90dc80b6fd4d8e1bb966a171cb06a64cf9c0 /crates/libsyntax2/tests/data/parser/ok | |
parent | d1eceefeb8b683da3f64b89446f04f01803962e1 (diff) |
Fix some parser bugs
Diffstat (limited to 'crates/libsyntax2/tests/data/parser/ok')
-rw-r--r-- | crates/libsyntax2/tests/data/parser/ok/0030_traits.rs | 11 | ||||
-rw-r--r-- | crates/libsyntax2/tests/data/parser/ok/0030_traits.txt | 147 |
2 files changed, 158 insertions, 0 deletions
diff --git a/crates/libsyntax2/tests/data/parser/ok/0030_traits.rs b/crates/libsyntax2/tests/data/parser/ok/0030_traits.rs new file mode 100644 index 000000000..23c4be0e1 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/ok/0030_traits.rs | |||
@@ -0,0 +1,11 @@ | |||
1 | pub trait WriteMessage { | ||
2 | fn write_message(&FrontendMessage); | ||
3 | } | ||
4 | |||
5 | trait Runnable { | ||
6 | fn handler(); | ||
7 | } | ||
8 | |||
9 | trait TraitWithExpr { | ||
10 | fn fn_with_expr(x: [i32; 1]); | ||
11 | } | ||
diff --git a/crates/libsyntax2/tests/data/parser/ok/0030_traits.txt b/crates/libsyntax2/tests/data/parser/ok/0030_traits.txt new file mode 100644 index 000000000..8abcb01e0 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/ok/0030_traits.txt | |||
@@ -0,0 +1,147 @@ | |||
1 | FILE@[0; 164) | ||
2 | TRAIT@[0; 164) | ||
3 | VISIBILITY@[0; 3) | ||
4 | PUB_KW@[0; 3) | ||
5 | WHITESPACE@[3; 4) | ||
6 | TRAIT_KW@[4; 9) | ||
7 | WHITESPACE@[9; 10) | ||
8 | NAME@[10; 22) | ||
9 | IDENT@[10; 22) "WriteMessage" | ||
10 | WHITESPACE@[22; 23) | ||
11 | L_CURLY@[23; 24) | ||
12 | WHITESPACE@[24; 29) | ||
13 | FUNCTION@[29; 164) | ||
14 | FN_KW@[29; 31) | ||
15 | WHITESPACE@[31; 32) | ||
16 | NAME@[32; 45) | ||
17 | IDENT@[32; 45) "write_message" | ||
18 | PARAM_LIST@[45; 164) | ||
19 | L_PAREN@[45; 46) | ||
20 | PARAM@[46; 63) | ||
21 | REF_PAT@[46; 62) | ||
22 | AMP@[46; 47) | ||
23 | BIND_PAT@[47; 62) | ||
24 | NAME@[47; 62) | ||
25 | IDENT@[47; 62) "FrontendMessage" | ||
26 | err: `expected COLON` | ||
27 | err: `expected type` | ||
28 | ERROR@[62; 63) | ||
29 | R_PAREN@[62; 63) | ||
30 | err: `expected COMMA` | ||
31 | err: `expected pattern` | ||
32 | PARAM@[63; 66) | ||
33 | ERROR@[63; 64) | ||
34 | SEMI@[63; 64) | ||
35 | err: `expected COLON` | ||
36 | WHITESPACE@[64; 65) | ||
37 | err: `expected type` | ||
38 | ERROR@[65; 66) | ||
39 | R_CURLY@[65; 66) | ||
40 | err: `expected COMMA` | ||
41 | WHITESPACE@[66; 68) | ||
42 | err: `expected pattern` | ||
43 | PARAM@[68; 82) | ||
44 | ERROR@[68; 73) | ||
45 | TRAIT_KW@[68; 73) | ||
46 | err: `expected COLON` | ||
47 | WHITESPACE@[73; 74) | ||
48 | PATH_TYPE@[74; 82) | ||
49 | PATH@[74; 82) | ||
50 | PATH_SEGMENT@[74; 82) | ||
51 | NAME_REF@[74; 82) | ||
52 | IDENT@[74; 82) "Runnable" | ||
53 | err: `expected COMMA` | ||
54 | WHITESPACE@[82; 83) | ||
55 | err: `expected pattern` | ||
56 | PARAM@[83; 91) | ||
57 | ERROR@[83; 84) | ||
58 | L_CURLY@[83; 84) | ||
59 | err: `expected COLON` | ||
60 | WHITESPACE@[84; 89) | ||
61 | FN_POINTER_TYPE@[89; 91) | ||
62 | FN_KW@[89; 91) | ||
63 | err: `expected parameters` | ||
64 | err: `expected COMMA` | ||
65 | WHITESPACE@[91; 92) | ||
66 | PARAM@[92; 102) | ||
67 | TUPLE_STRUCT_PAT@[92; 101) | ||
68 | PATH@[92; 99) | ||
69 | PATH_SEGMENT@[92; 99) | ||
70 | NAME_REF@[92; 99) | ||
71 | IDENT@[92; 99) "handler" | ||
72 | L_PAREN@[99; 100) | ||
73 | R_PAREN@[100; 101) | ||
74 | err: `expected COLON` | ||
75 | err: `expected type` | ||
76 | ERROR@[101; 102) | ||
77 | SEMI@[101; 102) | ||
78 | err: `expected COMMA` | ||
79 | WHITESPACE@[102; 103) | ||
80 | err: `expected pattern` | ||
81 | PARAM@[103; 111) | ||
82 | ERROR@[103; 104) | ||
83 | R_CURLY@[103; 104) | ||
84 | err: `expected COLON` | ||
85 | WHITESPACE@[104; 106) | ||
86 | err: `expected type` | ||
87 | ERROR@[106; 111) | ||
88 | TRAIT_KW@[106; 111) | ||
89 | err: `expected COMMA` | ||
90 | WHITESPACE@[111; 112) | ||
91 | PARAM@[112; 164) | ||
92 | STRUCT_PAT@[112; 163) | ||
93 | PATH@[112; 125) | ||
94 | PATH_SEGMENT@[112; 125) | ||
95 | NAME_REF@[112; 125) | ||
96 | IDENT@[112; 125) "TraitWithExpr" | ||
97 | WHITESPACE@[125; 126) | ||
98 | L_CURLY@[126; 127) | ||
99 | WHITESPACE@[127; 132) | ||
100 | err: `expected ident` | ||
101 | ERROR@[132; 134) | ||
102 | FN_KW@[132; 134) | ||
103 | err: `expected COMMA` | ||
104 | WHITESPACE@[134; 135) | ||
105 | BIND_PAT@[135; 147) | ||
106 | NAME@[135; 147) | ||
107 | IDENT@[135; 147) "fn_with_expr" | ||
108 | err: `expected COMMA` | ||
109 | err: `expected ident` | ||
110 | ERROR@[147; 148) | ||
111 | L_PAREN@[147; 148) | ||
112 | err: `expected COMMA` | ||
113 | IDENT@[148; 149) "x" | ||
114 | COLON@[149; 150) | ||
115 | WHITESPACE@[150; 151) | ||
116 | SLICE_PAT@[151; 159) | ||
117 | L_BRACK@[151; 152) | ||
118 | BIND_PAT@[152; 155) | ||
119 | NAME@[152; 155) | ||
120 | IDENT@[152; 155) "i32" | ||
121 | err: `expected COMMA` | ||
122 | err: `expected pattern` | ||
123 | ERROR@[155; 156) | ||
124 | SEMI@[155; 156) | ||
125 | err: `expected COMMA` | ||
126 | WHITESPACE@[156; 157) | ||
127 | LITERAL@[157; 158) | ||
128 | INT_NUMBER@[157; 158) "1" | ||
129 | R_BRACK@[158; 159) | ||
130 | err: `expected COMMA` | ||
131 | err: `expected ident` | ||
132 | ERROR@[159; 160) | ||
133 | R_PAREN@[159; 160) | ||
134 | err: `expected COMMA` | ||
135 | err: `expected ident` | ||
136 | ERROR@[160; 161) | ||
137 | SEMI@[160; 161) | ||
138 | WHITESPACE@[161; 162) | ||
139 | R_CURLY@[162; 163) | ||
140 | err: `expected COLON` | ||
141 | WHITESPACE@[163; 164) | ||
142 | err: `expected type` | ||
143 | err: `expected COMMA` | ||
144 | err: `expected R_PAREN` | ||
145 | err: `expected block` | ||
146 | err: `expected R_CURLY` | ||
147 | ERROR@[164; 164) | ||