aboutsummaryrefslogtreecommitdiff
path: root/src/parser
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-07-31 18:44:54 +0100
committerAleksey Kladov <[email protected]>2018-07-31 18:44:54 +0100
commit599ca1ad890f7b8e1e3919f1727c21dad353f595 (patch)
tree099b6ed3bd1075daa03594211f3f1246659a2467 /src/parser
parentce3462ce8fed8bb86d887643479c73908fc326a3 (diff)
dref-expr
Diffstat (limited to 'src/parser')
-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),