diff options
author | Aleksey Kladov <[email protected]> | 2018-07-31 21:59:08 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-07-31 21:59:08 +0100 |
commit | c8e59012757665649125a218416283d416e36547 (patch) | |
tree | 76676abfcbf2c258de173ff168d12b6ece40e4fb | |
parent | 5b43010083d029300230e2ea35e9cce6fd5daea3 (diff) |
number field
-rw-r--r-- | src/grammar/expressions.rs | 3 | ||||
-rw-r--r-- | tests/data/parser/inline/0052_field_expr.rs | 3 | ||||
-rw-r--r-- | tests/data/parser/inline/0052_field_expr.txt | 53 |
3 files changed, 36 insertions, 23 deletions
diff --git a/src/grammar/expressions.rs b/src/grammar/expressions.rs index 00a0ec953..e2be13a77 100644 --- a/src/grammar/expressions.rs +++ b/src/grammar/expressions.rs | |||
@@ -210,7 +210,8 @@ fn method_call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | |||
210 | 210 | ||
211 | // test field_expr | 211 | // test field_expr |
212 | // fn foo() { | 212 | // fn foo() { |
213 | // x.foo.bar; | 213 | // x.foo; |
214 | // x.0.bar; | ||
214 | // } | 215 | // } |
215 | fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { | 216 | fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { |
216 | assert!(p.at(DOT) && (p.nth(1) == IDENT || p.nth(1) == INT_NUMBER)); | 217 | assert!(p.at(DOT) && (p.nth(1) == IDENT || p.nth(1) == INT_NUMBER)); |
diff --git a/tests/data/parser/inline/0052_field_expr.rs b/tests/data/parser/inline/0052_field_expr.rs index 874887eae..3e69538e5 100644 --- a/tests/data/parser/inline/0052_field_expr.rs +++ b/tests/data/parser/inline/0052_field_expr.rs | |||
@@ -1,3 +1,4 @@ | |||
1 | fn foo() { | 1 | fn foo() { |
2 | x.foo.bar; | 2 | x.foo; |
3 | x.0.bar; | ||
3 | } | 4 | } |
diff --git a/tests/data/parser/inline/0052_field_expr.txt b/tests/data/parser/inline/0052_field_expr.txt index 78ea3a1f4..e1091728b 100644 --- a/tests/data/parser/inline/0052_field_expr.txt +++ b/tests/data/parser/inline/0052_field_expr.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | FILE@[0; 28) | 1 | FILE@[0; 37) |
2 | FN_ITEM@[0; 28) | 2 | FN_ITEM@[0; 37) |
3 | FN_KW@[0; 2) | 3 | FN_KW@[0; 2) |
4 | NAME@[2; 6) | 4 | NAME@[2; 6) |
5 | WHITESPACE@[2; 3) | 5 | WHITESPACE@[2; 3) |
@@ -8,24 +8,35 @@ FILE@[0; 28) | |||
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; 28) | 11 | BLOCK@[9; 37) |
12 | L_CURLY@[9; 10) | 12 | L_CURLY@[9; 10) |
13 | EXPR_STMT@[10; 26) | 13 | EXPR_STMT@[10; 26) |
14 | FIELD_EXPR@[10; 24) | 14 | FIELD_EXPR@[10; 20) |
15 | FIELD_EXPR@[10; 20) | 15 | PATH_EXPR@[10; 16) |
16 | PATH_EXPR@[10; 16) | 16 | PATH@[10; 16) |
17 | PATH@[10; 16) | 17 | PATH_SEGMENT@[10; 16) |
18 | PATH_SEGMENT@[10; 16) | 18 | NAME_REF@[10; 16) |
19 | NAME_REF@[10; 16) | 19 | WHITESPACE@[10; 15) |
20 | WHITESPACE@[10; 15) | 20 | IDENT@[15; 16) "x" |
21 | IDENT@[15; 16) "x" | 21 | DOT@[16; 17) |
22 | DOT@[16; 17) | 22 | NAME_REF@[17; 20) |
23 | NAME_REF@[17; 20) | 23 | IDENT@[17; 20) "foo" |
24 | IDENT@[17; 20) "foo" | 24 | SEMI@[20; 21) |
25 | DOT@[20; 21) | 25 | WHITESPACE@[21; 26) |
26 | NAME_REF@[21; 24) | 26 | EXPR_STMT@[26; 35) |
27 | IDENT@[21; 24) "bar" | 27 | FIELD_EXPR@[26; 33) |
28 | SEMI@[24; 25) | 28 | FIELD_EXPR@[26; 29) |
29 | WHITESPACE@[25; 26) | 29 | PATH_EXPR@[26; 27) |
30 | R_CURLY@[26; 27) | 30 | PATH@[26; 27) |
31 | WHITESPACE@[27; 28) | 31 | PATH_SEGMENT@[26; 27) |
32 | NAME_REF@[26; 27) | ||
33 | IDENT@[26; 27) "x" | ||
34 | DOT@[27; 28) | ||
35 | INT_NUMBER@[28; 29) | ||
36 | DOT@[29; 30) | ||
37 | NAME_REF@[30; 33) | ||
38 | IDENT@[30; 33) "bar" | ||
39 | SEMI@[33; 34) | ||
40 | WHITESPACE@[34; 35) | ||
41 | R_CURLY@[35; 36) | ||
42 | WHITESPACE@[36; 37) | ||