aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_parser/src/grammar/expressions.rs5
-rw-r--r--crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt30
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.txt20
3 files changed, 23 insertions, 32 deletions
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs
index 3cf619e38..06c92645e 100644
--- a/crates/ra_parser/src/grammar/expressions.rs
+++ b/crates/ra_parser/src/grammar/expressions.rs
@@ -564,12 +564,9 @@ fn arg_list(p: &mut Parser) {
564 // fn main() { 564 // fn main() {
565 // foo(#[attr] 92) 565 // foo(#[attr] 92)
566 // } 566 // }
567 attributes::outer_attributes(p); 567 if !expr_with_attrs(p) {
568 if !p.at_ts(EXPR_FIRST) {
569 p.error("expected expression");
570 break; 568 break;
571 } 569 }
572 expr(p);
573 if !p.at(T![')']) && !p.expect(T![,]) { 570 if !p.at(T![')']) && !p.expect(T![,]) {
574 break; 571 break;
575 } 572 }
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 2237eb413..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
@@ -54,14 +54,14 @@ SOURCE_FILE@[0; 112)
54 BLOCK@[41; 68) 54 BLOCK@[41; 68)
55 L_CURLY@[41; 42) "{" 55 L_CURLY@[41; 42) "{"
56 WHITESPACE@[42; 43) " " 56 WHITESPACE@[42; 43) " "
57 EXPR_STMT@[43; 52) 57 EXPR_STMT@[43; 54)
58 CALL_EXPR@[43; 52) 58 CALL_EXPR@[43; 54)
59 PATH_EXPR@[43; 46) 59 PATH_EXPR@[43; 46)
60 PATH@[43; 46) 60 PATH@[43; 46)
61 PATH_SEGMENT@[43; 46) 61 PATH_SEGMENT@[43; 46)
62 NAME_REF@[43; 46) 62 NAME_REF@[43; 46)
63 IDENT@[43; 46) "foo" 63 IDENT@[43; 46) "foo"
64 ARG_LIST@[46; 52) 64 ARG_LIST@[46; 54)
65 L_PAREN@[46; 47) "(" 65 L_PAREN@[46; 47) "("
66 LITERAL@[47; 48) 66 LITERAL@[47; 48)
67 INT_NUMBER@[47; 48) "1" 67 INT_NUMBER@[47; 48) "1"
@@ -70,10 +70,9 @@ SOURCE_FILE@[0; 112)
70 LITERAL@[50; 51) 70 LITERAL@[50; 51)
71 INT_NUMBER@[50; 51) "2" 71 INT_NUMBER@[50; 51) "2"
72 COMMA@[51; 52) "," 72 COMMA@[51; 52) ","
73 WHITESPACE@[52; 53) " " 73 WHITESPACE@[52; 53) " "
74 EXPR_STMT@[53; 54) 74 ERROR@[53; 54)
75 ERROR@[53; 54) 75 AT@[53; 54) "@"
76 AT@[53; 54) "@"
77 EXPR_STMT@[54; 55) 76 EXPR_STMT@[54; 55)
78 ERROR@[54; 55) 77 ERROR@[54; 55)
79 COMMA@[54; 55) "," 78 COMMA@[54; 55) ","
@@ -104,8 +103,8 @@ SOURCE_FILE@[0; 112)
104 BLOCK@[76; 111) 103 BLOCK@[76; 111)
105 L_CURLY@[76; 77) "{" 104 L_CURLY@[76; 77) "{"
106 WHITESPACE@[77; 78) " " 105 WHITESPACE@[77; 78) " "
107 EXPR_STMT@[78; 91) 106 EXPR_STMT@[78; 93)
108 METHOD_CALL_EXPR@[78; 91) 107 METHOD_CALL_EXPR@[78; 93)
109 PATH_EXPR@[78; 81) 108 PATH_EXPR@[78; 81)
110 PATH@[78; 81) 109 PATH@[78; 81)
111 PATH_SEGMENT@[78; 81) 110 PATH_SEGMENT@[78; 81)
@@ -114,7 +113,7 @@ SOURCE_FILE@[0; 112)
114 DOT@[81; 82) "." 113 DOT@[81; 82) "."
115 NAME_REF@[82; 85) 114 NAME_REF@[82; 85)
116 IDENT@[82; 85) "bar" 115 IDENT@[82; 85) "bar"
117 ARG_LIST@[85; 91) 116 ARG_LIST@[85; 93)
118 L_PAREN@[85; 86) "(" 117 L_PAREN@[85; 86) "("
119 LITERAL@[86; 87) 118 LITERAL@[86; 87)
120 INT_NUMBER@[86; 87) "1" 119 INT_NUMBER@[86; 87) "1"
@@ -123,10 +122,9 @@ SOURCE_FILE@[0; 112)
123 LITERAL@[89; 90) 122 LITERAL@[89; 90)
124 INT_NUMBER@[89; 90) "2" 123 INT_NUMBER@[89; 90) "2"
125 COMMA@[90; 91) "," 124 COMMA@[90; 91) ","
126 WHITESPACE@[91; 92) " " 125 WHITESPACE@[91; 92) " "
127 EXPR_STMT@[92; 93) 126 ERROR@[92; 93)
128 ERROR@[92; 93) 127 AT@[92; 93) "@"
129 AT@[92; 93) "@"
130 EXPR_STMT@[93; 94) 128 EXPR_STMT@[93; 94)
131 ERROR@[93; 94) 129 ERROR@[93; 94)
132 COMMA@[93; 94) "," 130 COMMA@[93; 94) ","
@@ -159,8 +157,6 @@ error 25: expected a name
159error 26: expected `;`, `{`, or `(` 157error 26: expected `;`, `{`, or `(`
160error 30: expected pattern 158error 30: expected pattern
161error 31: expected SEMI 159error 31: expected SEMI
162error 52: expected expression
163error 52: expected SEMI
164error 53: expected expression 160error 53: expected expression
165error 54: expected SEMI 161error 54: expected SEMI
166error 54: expected expression 162error 54: expected expression
@@ -172,8 +168,6 @@ error 61: expected SEMI
172error 65: expected pattern 168error 65: expected pattern
173error 65: expected SEMI 169error 65: expected SEMI
174error 65: expected expression 170error 65: expected expression
175error 91: expected expression
176error 91: expected SEMI
177error 92: expected expression 171error 92: expected expression
178error 93: expected SEMI 172error 93: expected SEMI
179error 93: expected expression 173error 93: expected expression
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
index 6b80ca8d0..8092d7009 100644
--- 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
@@ -20,16 +20,16 @@ SOURCE_FILE@[0; 34)
20 IDENT@[16; 19) "foo" 20 IDENT@[16; 19) "foo"
21 ARG_LIST@[19; 31) 21 ARG_LIST@[19; 31)
22 L_PAREN@[19; 20) "(" 22 L_PAREN@[19; 20) "("
23 ATTR@[20; 27) 23 LITERAL@[20; 30)
24 POUND@[20; 21) "#" 24 ATTR@[20; 27)
25 L_BRACK@[21; 22) "[" 25 POUND@[20; 21) "#"
26 PATH@[22; 26) 26 L_BRACK@[21; 22) "["
27 PATH_SEGMENT@[22; 26) 27 PATH@[22; 26)
28 NAME_REF@[22; 26) 28 PATH_SEGMENT@[22; 26)
29 IDENT@[22; 26) "attr" 29 NAME_REF@[22; 26)
30 R_BRACK@[26; 27) "]" 30 IDENT@[22; 26) "attr"
31 WHITESPACE@[27; 28) " " 31 R_BRACK@[26; 27) "]"
32 LITERAL@[28; 30) 32 WHITESPACE@[27; 28) " "
33 INT_NUMBER@[28; 30) "92" 33 INT_NUMBER@[28; 30) "92"
34 R_PAREN@[30; 31) ")" 34 R_PAREN@[30; 31) ")"
35 WHITESPACE@[31; 32) "\n" 35 WHITESPACE@[31; 32) "\n"