File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -2525,6 +2525,7 @@ end
2525
2525
# then reconstructing the nested flattens and generators when converting to Expr.
2526
2526
#
2527
2527
# [x for a = as for b = bs if cond1 for c = cs if cond2] ==> (comprehension (flatten x (= a as) (filter (= b bs) cond1) (filter (= c cs) cond2)))
2528
+ # [x for a = as if begin cond2 end] => (comprehension (generator x (filter (= a as) (block cond2))))
2528
2529
#
2529
2530
# flisp: parse-generator
2530
2531
function parse_generator (ps:: ParseState , mark, flatten= false )
@@ -2561,7 +2562,8 @@ end
2561
2562
# flisp: parse-comprehension
2562
2563
function parse_comprehension (ps:: ParseState , mark, closer)
2563
2564
ps = ParseState (ps, whitespace_newline= true ,
2564
- space_sensitive= false )
2565
+ space_sensitive= false ,
2566
+ end_symbol= false )
2565
2567
parse_generator (ps, mark)
2566
2568
bump_closing_token (ps, closer)
2567
2569
return (K " comprehension" , EMPTY_FLAGS)
Original file line number Diff line number Diff line change @@ -614,6 +614,7 @@ tests = [
614
614
" [x \n\n for a in as]" => " (comprehension (generator x (= a as)))"
615
615
# parse_generator
616
616
" [x for a = as for b = bs if cond1 for c = cs if cond2]" => " (comprehension (flatten x (= a as) (filter (= b bs) cond1) (filter (= c cs) cond2)))"
617
+ " [x for a = as if begin cond2 end]" => " (comprehension (generator x (filter (= a as) (block cond2))))"
617
618
" [(x)for x in xs]" => " (comprehension (generator x (error-t) (= x xs)))"
618
619
" (a for x in xs if cond)" => " (generator a (filter (= x xs) cond))"
619
620
" (xy for x in xs for y in ys)" => " (flatten xy (= x xs) (= y ys))"
You can’t perform that action at this time.
0 commit comments