Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,9 @@ function _string_to_Expr(k, args)
# If there's a single string remaining after joining, we unwrap
# to give a string literal.
# """\n a\n b""" ==> "a\nb"
# k == K"cmdstring" follows this branch
return only(args2)
else
@check k == K"string"
# This only happens when k == K"string" or when an error has occurred.
return Expr(:string, args2...)
end
end
Expand Down
6 changes: 2 additions & 4 deletions src/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,8 @@ end
# Parser
#
# The definitions and top-level comments here were copied to match the
# structure of Julia's official flisp-based parser.
#
# This is to make both codebases mutually understandable and make porting
# changes simple.
# structure of Julia's previous flisp-based parser to make both codebases
# mutually understandable and make porting changes simple.
#
# The `parse_*` functions are listed here roughly in order of increasing
# precedence (lowest to highest binding power). A few helper functions are
Expand Down
7 changes: 7 additions & 0 deletions test/expr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,13 @@
"a\nb")
@test parsestmt("\"\"\"\n a\n \$x\n b\n c\"\"\"") ==
Expr(:string, "a\n", :x, "\nb\nc")
# Incomplete cases
@test parsestmt("`x", ignore_errors=true) ==
Expr(:macrocall, GlobalRef(Core, Symbol("@cmd")), LineNumberNode(1),
Expr(:string, "x", Expr(:error)))
@test parsestmt("`", ignore_errors=true) ==
Expr(:macrocall, GlobalRef(Core, Symbol("@cmd")), LineNumberNode(1),
Expr(:string, Expr(:error)))
end

@testset "Char conversions" begin
Expand Down