File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -220,6 +220,10 @@ function is_closing_token(ps::ParseState, k)
220
220
(k == K " end" && ! ps. end_symbol)
221
221
end
222
222
223
+ function is_block_continuation_keyword (ps:: ParseState , k)
224
+ is_block_continuation_keyword (k) && ! (ps. end_symbol && k == K " end" )
225
+ end
226
+
223
227
function is_closer_or_newline (ps:: ParseState , k)
224
228
is_closing_token (ps,k) || k == K " NewlineWs"
225
229
end
@@ -658,7 +662,7 @@ function parse_cond(ps::ParseState)
658
662
659
663
# FIXME : This is a very specific case. Error recovery should be handled more
660
664
# generally elsewhere.
661
- if is_block_continuation_keyword (kind (t))
665
+ if is_block_continuation_keyword (ps, kind (t))
662
666
# a "continuaton keyword" is likely to belong to the surrounding code, so
663
667
# we abort early
664
668
@@ -669,6 +673,8 @@ function parse_cond(ps::ParseState)
669
673
bump_invisible (ps, K " error" , TRIVIA_FLAG, error= " unexpected `$(kind (t)) `" )
670
674
emit (ps, mark, K " if" )
671
675
return
676
+ else
677
+ # A[x ? y : end] ==> (ref A (? x y end))
672
678
end
673
679
parse_eq_star (ps)
674
680
emit (ps, mark, K " ?" )
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ tests = [
66
66
" a ? b: c" => " (? a b (error-t) c)"
67
67
" a ? b :c" => " (? a b (error-t) c)"
68
68
" a ? b c" => " (? a b (error-t) c)"
69
+ " A[x ? y : end]" => " (ref A (? x y end))"
69
70
],
70
71
JuliaSyntax. parse_arrow => [
71
72
" x → y" => " (call-i x → y)"
You can’t perform that action at this time.
0 commit comments