aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Penttinen <[email protected]>2019-03-30 11:44:58 +0000
committerVille Penttinen <[email protected]>2019-03-30 11:52:47 +0000
commit444a119220b8fe2c5ddf996b2a00cb67e375587d (patch)
treefe4ac6c30c35da765b91eb94f552c18278c35459
parentc4dfced1f85a68c77e65ac6753603c6d14c49599 (diff)
Fix parsing <= in type_args
-rw-r--r--crates/ra_parser/src/grammar/expressions.rs1
-rw-r--r--crates/ra_parser/src/grammar/type_args.rs1
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0029_cast_expr.rs1
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0029_cast_expr.txt32
4 files changed, 29 insertions, 6 deletions
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs
index 73e1acd5a..bf5d6544d 100644
--- a/crates/ra_parser/src/grammar/expressions.rs
+++ b/crates/ra_parser/src/grammar/expressions.rs
@@ -410,6 +410,7 @@ fn try_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
410// 82 as i32; 410// 82 as i32;
411// 81 as i8 + 1; 411// 81 as i8 + 1;
412// 79 as i16 - 1; 412// 79 as i16 - 1;
413// 0x36 as u8 <= 0x37;
413// } 414// }
414fn cast_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { 415fn cast_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
415 assert!(p.at(AS_KW)); 416 assert!(p.at(AS_KW));
diff --git a/crates/ra_parser/src/grammar/type_args.rs b/crates/ra_parser/src/grammar/type_args.rs
index f889419c5..684976b99 100644
--- a/crates/ra_parser/src/grammar/type_args.rs
+++ b/crates/ra_parser/src/grammar/type_args.rs
@@ -8,6 +8,7 @@ pub(super) fn opt_type_arg_list(p: &mut Parser, colon_colon_required: bool) {
8 p.bump(); 8 p.bump();
9 p.bump(); 9 p.bump();
10 } 10 }
11 (false, L_ANGLE, EQ) => return,
11 (false, L_ANGLE, _) => { 12 (false, L_ANGLE, _) => {
12 m = p.start(); 13 m = p.start();
13 p.bump(); 14 p.bump();
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0029_cast_expr.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0029_cast_expr.rs
index b571a5860..bfe8e4b36 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0029_cast_expr.rs
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0029_cast_expr.rs
@@ -2,4 +2,5 @@ fn foo() {
2 82 as i32; 2 82 as i32;
3 81 as i8 + 1; 3 81 as i8 + 1;
4 79 as i16 - 1; 4 79 as i16 - 1;
5 0x36 as u8 <= 0x37;
5} 6}
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0029_cast_expr.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0029_cast_expr.txt
index cb56aef0b..875ed1abd 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0029_cast_expr.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0029_cast_expr.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 65) 1SOURCE_FILE@[0; 89)
2 FN_DEF@[0; 64) 2 FN_DEF@[0; 88)
3 FN_KW@[0; 2) 3 FN_KW@[0; 2)
4 WHITESPACE@[2; 3) 4 WHITESPACE@[2; 3)
5 NAME@[3; 6) 5 NAME@[3; 6)
@@ -8,7 +8,7 @@ SOURCE_FILE@[0; 65)
8 L_PAREN@[6; 7) 8 L_PAREN@[6; 7)
9 R_PAREN@[7; 8) 9 R_PAREN@[7; 8)
10 WHITESPACE@[8; 9) 10 WHITESPACE@[8; 9)
11 BLOCK@[9; 64) 11 BLOCK@[9; 88)
12 L_CURLY@[9; 10) 12 L_CURLY@[9; 10)
13 WHITESPACE@[10; 15) 13 WHITESPACE@[10; 15)
14 EXPR_STMT@[15; 25) 14 EXPR_STMT@[15; 25)
@@ -64,6 +64,26 @@ SOURCE_FILE@[0; 65)
64 LITERAL@[60; 61) 64 LITERAL@[60; 61)
65 INT_NUMBER@[60; 61) "1" 65 INT_NUMBER@[60; 61) "1"
66 SEMI@[61; 62) 66 SEMI@[61; 62)
67 WHITESPACE@[62; 63) 67 WHITESPACE@[62; 67)
68 R_CURLY@[63; 64) 68 EXPR_STMT@[67; 86)
69 WHITESPACE@[64; 65) 69 BIN_EXPR@[67; 85)
70 CAST_EXPR@[67; 77)
71 LITERAL@[67; 71)
72 INT_NUMBER@[67; 71) "0x36"
73 WHITESPACE@[71; 72)
74 AS_KW@[72; 74)
75 WHITESPACE@[74; 75)
76 PATH_TYPE@[75; 77)
77 PATH@[75; 77)
78 PATH_SEGMENT@[75; 77)
79 NAME_REF@[75; 77)
80 IDENT@[75; 77) "u8"
81 WHITESPACE@[77; 78)
82 LTEQ@[78; 80)
83 WHITESPACE@[80; 81)
84 LITERAL@[81; 85)
85 INT_NUMBER@[81; 85) "0x37"
86 SEMI@[85; 86)
87 WHITESPACE@[86; 87)
88 R_CURLY@[87; 88)
89 WHITESPACE@[88; 89)