File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -3402,6 +3402,7 @@ function parse_atom(ps::ParseState, check_identifiers=true)
3402
3402
if k == K " '"
3403
3403
# '' ==> (char (error))
3404
3404
bump_invisible (ps, K " error" , error= " empty character literal" )
3405
+ bump (ps, TRIVIA_FLAG)
3405
3406
elseif k == K " EndMarker"
3406
3407
# ' ==> (char (error))
3407
3408
bump_invisible (ps, K " error" , error= " unterminated character literal" )
Original file line number Diff line number Diff line change @@ -990,15 +990,19 @@ parsestmt_test_specs = [
990
990
" x in'c'" => " (call-i x in (char 'c'))"
991
991
" 1where'c'" => " (where 1 (char 'c'))"
992
992
" :+'y'" => " (juxtapose (call-post (quote-: +) ') (call-post y '))"
993
+ # Empty character consumes trailing ' delimiter (ideally this could be
994
+ # tested above but we don't require the input stream to be consumed in the
995
+ # unit tests there.
996
+ " ''" => " (char (error))"
993
997
994
998
# The following may not be ideal error recovery! But at least the parser
995
999
# shouldn't crash
996
1000
" @(x y)" => " (macrocall (parens @x (error-t y)))"
997
1001
" |(&\n function" => " (call | (& (function (error (error)) (block (error)) (error-t))) (error-t))"
998
1002
999
- # The following are currently broken but at least the parser shouldn't
1003
+ # The following is currently broken but at least the parser shouldn't
1000
1004
# crash.
1001
- " x in' '" => " (wrapper ( call-i x in (char (error))) (error-t ' ))"
1005
+ " x in' '" => " (call-i x in (char (error)))"
1002
1006
]
1003
1007
1004
1008
@testset " Parser does not crash on broken code" begin
You can’t perform that action at this time.
0 commit comments