diff options
Diffstat (limited to 'crates/ra_syntax')
3 files changed, 66 insertions, 28 deletions
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" |
150 | error 16: expected expression | 151 | error 16: expected expression |
151 | error 19: expected expression | 152 | error 17: expected R_BRACK |
152 | error 26: expected expression | 153 | error 17: expected SEMI |
153 | error 26: expected COMMA | 154 | error 17: expected expression |
154 | error 26: expected R_BRACK | 155 | error 18: expected SEMI |
155 | error 26: expected SEMI | 156 | error 25: expected a name |
157 | error 26: expected `;`, `{`, or `(` | ||
156 | error 30: expected pattern | 158 | error 30: expected pattern |
157 | error 31: expected SEMI | 159 | error 31: expected SEMI |
158 | error 52: expected expression | ||
159 | error 52: expected SEMI | ||
160 | error 53: expected expression | 160 | error 53: expected expression |
161 | error 54: expected SEMI | 161 | error 54: expected SEMI |
162 | error 54: expected expression | 162 | error 54: expected expression |
@@ -168,8 +168,6 @@ error 61: expected SEMI | |||
168 | error 65: expected pattern | 168 | error 65: expected pattern |
169 | error 65: expected SEMI | 169 | error 65: expected SEMI |
170 | error 65: expected expression | 170 | error 65: expected expression |
171 | error 91: expected expression | ||
172 | error 91: expected SEMI | ||
173 | error 92: expected expression | 171 | error 92: expected expression |
174 | error 93: expected SEMI | 172 | error 93: expected SEMI |
175 | error 93: expected expression | 173 | error 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 @@ | |||
1 | fn 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 @@ | |||
1 | SOURCE_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" | ||