Skip to content

Commit 3153015

Browse files
committed
Add parser test for raw triple quoted string with backslash
1 parent f51ac2a commit 3153015

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/parser.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1601,7 +1601,8 @@ function parse_call_chain(ps::ParseState, mark, is_macrocall=false)
16011601
# Triple quoted procesing for custom strings
16021602
# r"""\nx""" ==> (macrocall @r_str "x")
16031603
# r"""\n x\n y""" ==> (macrocall @r_str (string-sr "x\n" "y"))
1604-
1604+
# r"""\n x\\n y""" ==> (macrocall @r_str (string-sr "x\\\n" "y"))
1605+
#
16051606
# Use a special token kind for string and cmd macro names so the
16061607
# names can be expanded later as necessary.
16071608
outk = is_string_delim(k) ? K"StringMacroName" : K"CmdMacroName"

test/parser.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,9 @@ tests = [
301301
"x\"\"" => """(macrocall @x_str "")"""
302302
"x``" => """(macrocall @x_cmd "")"""
303303
# Triple quoted procesing for custom strings
304-
"r\"\"\"\nx\"\"\"" => raw"""(macrocall @r_str "x")"""
305-
"r\"\"\"\n x\n y\"\"\"" => raw"""(macrocall @r_str (string-sr "x\n" "y"))"""
304+
"r\"\"\"\nx\"\"\"" => raw"""(macrocall @r_str "x")"""
305+
"r\"\"\"\n x\n y\"\"\"" => raw"""(macrocall @r_str (string-sr "x\n" "y"))"""
306+
"r\"\"\"\n x\\\n y\"\"\"" => raw"""(macrocall @r_str (string-sr "x\\\n" "y"))"""
306307
# Macro sufficies can include keywords and numbers
307308
"x\"s\"y" => """(macrocall @x_str "s" "y")"""
308309
"x\"s\"end" => """(macrocall @x_str "s" "end")"""

0 commit comments

Comments
 (0)