diff options
author | Aleksey Kladov <[email protected]> | 2018-08-05 16:16:52 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-05 16:16:52 +0100 |
commit | 720861bcff4b9f67ca4def66e2996015811fa90b (patch) | |
tree | 9bed19490f802860e0c17532eaed853dfeb548bb /src/grammar/expressions/atom.rs | |
parent | b0291cd8c2ec1d6d164caaa743f7484416e9b3f5 (diff) |
Lopps && logical ops
Diffstat (limited to 'src/grammar/expressions/atom.rs')
-rw-r--r-- | src/grammar/expressions/atom.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/grammar/expressions/atom.rs b/src/grammar/expressions/atom.rs index 4eb638c3c..65b9e5ef0 100644 --- a/src/grammar/expressions/atom.rs +++ b/src/grammar/expressions/atom.rs | |||
@@ -48,6 +48,7 @@ pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<CompletedMark | |||
48 | MOVE_KW if la == PIPE => lambda_expr(p), | 48 | MOVE_KW if la == PIPE => lambda_expr(p), |
49 | IF_KW => if_expr(p), | 49 | IF_KW => if_expr(p), |
50 | WHILE_KW => while_expr(p), | 50 | WHILE_KW => while_expr(p), |
51 | LOOP_KW => loop_expr(p), | ||
51 | MATCH_KW => match_expr(p), | 52 | MATCH_KW => match_expr(p), |
52 | UNSAFE_KW if la == L_CURLY => block_expr(p), | 53 | UNSAFE_KW if la == L_CURLY => block_expr(p), |
53 | L_CURLY => block_expr(p), | 54 | L_CURLY => block_expr(p), |
@@ -143,6 +144,18 @@ fn while_expr(p: &mut Parser) -> CompletedMarker { | |||
143 | m.complete(p, WHILE_EXPR) | 144 | m.complete(p, WHILE_EXPR) |
144 | } | 145 | } |
145 | 146 | ||
147 | // test loop_expr | ||
148 | // fn foo() { | ||
149 | // loop {}; | ||
150 | // } | ||
151 | fn loop_expr(p: &mut Parser) -> CompletedMarker { | ||
152 | assert!(p.at(LOOP_KW)); | ||
153 | let m = p.start(); | ||
154 | p.bump(); | ||
155 | block(p); | ||
156 | m.complete(p, LOOP_EXPR) | ||
157 | } | ||
158 | |||
146 | // test cond | 159 | // test cond |
147 | // fn foo() { if let Some(_) = None {} } | 160 | // fn foo() { if let Some(_) = None {} } |
148 | fn cond(p: &mut Parser) { | 161 | fn cond(p: &mut Parser) { |