aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-07-31 21:57:14 +0100
committerAleksey Kladov <[email protected]>2018-07-31 21:57:14 +0100
commit5b43010083d029300230e2ea35e9cce6fd5daea3 (patch)
tree484bb1f6df0c2f941295e3057bbe9ebe0f02fa30 /src
parenta26390b06b425230b2d269516ccdbc7dc259ede7 (diff)
Namerefs in methods&fields
Diffstat (limited to 'src')
-rw-r--r--src/grammar/expressions.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/grammar/expressions.rs b/src/grammar/expressions.rs
index 06f9105c6..00a0ec953 100644
--- a/src/grammar/expressions.rs
+++ b/src/grammar/expressions.rs
@@ -39,6 +39,7 @@ pub(super) fn expr(p: &mut Parser) {
39 } else { 39 } else {
40 field_expr(p, lhs) 40 field_expr(p, lhs)
41 }, 41 },
42 DOT if p.nth(1) == INT_NUMBER => field_expr(p, lhs),
42 _ => break, 43 _ => break,
43 } 44 }
44 } 45 }
@@ -202,7 +203,7 @@ fn method_call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
202 assert!(p.at(DOT) && p.nth(1) == IDENT && p.nth(2) == L_PAREN); 203 assert!(p.at(DOT) && p.nth(1) == IDENT && p.nth(2) == L_PAREN);
203 let m = lhs.precede(p); 204 let m = lhs.precede(p);
204 p.bump(); 205 p.bump();
205 p.bump(); 206 name_ref(p);
206 arg_list(p); 207 arg_list(p);
207 m.complete(p, METHOD_CALL_EXPR) 208 m.complete(p, METHOD_CALL_EXPR)
208} 209}
@@ -212,10 +213,14 @@ fn method_call_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
212// x.foo.bar; 213// x.foo.bar;
213// } 214// }
214fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker { 215fn field_expr(p: &mut Parser, lhs: CompletedMarker) -> CompletedMarker {
215 assert!(p.at(DOT) && p.nth(1) == IDENT); 216 assert!(p.at(DOT) && (p.nth(1) == IDENT || p.nth(1) == INT_NUMBER));
216 let m = lhs.precede(p); 217 let m = lhs.precede(p);
217 p.bump(); 218 p.bump();
218 p.bump(); 219 if p.at(IDENT) {
220 name_ref(p)
221 } else {
222 p.bump()
223 }
219 m.complete(p, FIELD_EXPR) 224 m.complete(p, FIELD_EXPR)
220} 225}
221 226