aboutsummaryrefslogtreecommitdiff
path: root/src/parser/grammar/expressions.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/grammar/expressions.rs')
-rw-r--r--src/parser/grammar/expressions.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/parser/grammar/expressions.rs b/src/parser/grammar/expressions.rs
index 5b18e2294..881d947ac 100644
--- a/src/parser/grammar/expressions.rs
+++ b/src/parser/grammar/expressions.rs
@@ -48,6 +48,7 @@ pub(super) fn expr(p: &mut Parser) {
48fn prefix_expr(p: &mut Parser) -> Option<CompletedMarker> { 48fn prefix_expr(p: &mut Parser) -> Option<CompletedMarker> {
49 match p.current() { 49 match p.current() {
50 AMPERSAND => Some(ref_expr(p)), 50 AMPERSAND => Some(ref_expr(p)),
51 STAR => Some(deref_expr(p)),
51 _ => atom_expr(p), 52 _ => atom_expr(p),
52 } 53 }
53} 54}
@@ -66,6 +67,18 @@ fn ref_expr(p: &mut Parser) -> CompletedMarker {
66 m.complete(p, REF_EXPR) 67 m.complete(p, REF_EXPR)
67} 68}
68 69
70// test deref_expr
71// fn foo() {
72// **&1;
73// }
74fn deref_expr(p: &mut Parser) -> CompletedMarker {
75 assert!(p.at(STAR));
76 let m = p.start();
77 p.bump();
78 expr(p);
79 m.complete(p, DEREF_EXPR)
80}
81
69fn atom_expr(p: &mut Parser) -> Option<CompletedMarker> { 82fn atom_expr(p: &mut Parser) -> Option<CompletedMarker> {
70 match literal(p) { 83 match literal(p) {
71 Some(m) => return Some(m), 84 Some(m) => return Some(m),