From 294435d11aade2f1dfd0ea6f178315e94026cad1 Mon Sep 17 00:00:00 2001 From: Coke Date: Mon, 12 Apr 2010 20:51:40 -0400 Subject: [PATCH] When constructing lists, \{ are special only when counting braces, but are still passed through literally. --- src/Partcl/Actions.pm | 4 ++-- t/cmd_list.t | 6 +++--- t/tcl_conversion.t | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Partcl/Actions.pm b/src/Partcl/Actions.pm index 10ed849..b5dd4bc 100644 --- a/src/Partcl/Actions.pm +++ b/src/Partcl/Actions.pm @@ -79,8 +79,8 @@ method word:sym($/) { make concat_atoms($); } method braced_word($/) { make concat_atoms($); } method braced_atom:sym<{ }>($/) { make '{' ~ $.ast ~ '}'; } method braced_atom:sym($/) { make ' '; } -method braced_atom:sym($/) { make '{'; } -method braced_atom:sym($/) { make '}'; } +method braced_atom:sym($/) { make "\\" ~ '{'; } +method braced_atom:sym($/) { make "\\" ~ '}'; } method braced_atom:sym($/) { make "\\"; } method braced_atom:sym($/) { make ~$/; } diff --git a/t/cmd_list.t b/t/cmd_list.t index b8e85ce..73078c6 100755 --- a/t/cmd_list.t +++ b/t/cmd_list.t @@ -12,8 +12,8 @@ is [list a b {c {d e}}] {a b {c {d e}}} {spaces with braces} is [list a b "c {d e}"] {a b {c {d e}}} {spaces with quotes} is [list {1 2} {3 4}] {{1 2} {3 4}} {spaces in two elements} -is [list "} {"] {\}\ \{} {braces with spaces} {TODO NQPRX} -is [list \{ \}] {\{ \}} {braces} {TODO NQPRX} +is [list "} {"] {\}\ \{} {braces with spaces} +is [list \{ \}] {\{ \}} {braces} is [list "\n"] "{\n}" {newline} is [list ";"] {{;}} {semicolon} @@ -36,6 +36,6 @@ is [list {"}] {{"}} {single quote} is [list "{ab}xy"] "{{ab}xy}" {braces that don't wrap exactly} is [list "{ab}\\"] "\\{ab\\}\\\\" {braces that don't wrap exactly, trailing backslash} is [list \{\r] "\\\{\\r" {use standard \foo escapes when stringifying a list} -is [list \{"] {\{\"} {escape quotes} {TODO NQP} +is [list \{"] {\{\"} {escape quotes} # vim: filetype=tcl: diff --git a/t/tcl_conversion.t b/t/tcl_conversion.t index a439f95..6876fb8 100755 --- a/t/tcl_conversion.t +++ b/t/tcl_conversion.t @@ -36,7 +36,7 @@ eval_is {lindex {"a b"3} 1} \ {non space after "} {TODO NQPRX} -is [list \{\[] {\{\[} {[ in list} {TODO NQPRX} +is [list \{\[] {\{\[} {[ in list} is [lindex {"a \" b"} 0] {a " b} {escaped quote in quotes in list} {TODO NQPRX}