diff options
author | Mu Qiao <qiaomuf@gentoo.org> | 2012-03-01 14:50:19 +0800 |
---|---|---|
committer | Mu Qiao <qiaomuf@gentoo.org> | 2012-03-01 14:50:19 +0800 |
commit | 85f4b6d5d9f671ab5d51023f9734ff577d70d9ac (patch) | |
tree | 2e4d4db9b905d5f1c49c43015cf3aba72b00dca7 | |
parent | Walker: support indirect ref in runtime (diff) | |
download | libbash-85f4b6d5d9f671ab5d51023f9734ff577d70d9ac.tar.gz libbash-85f4b6d5d9f671ab5d51023f9734ff577d70d9ac.tar.bz2 libbash-85f4b6d5d9f671ab5d51023f9734ff577d70d9ac.zip |
Parser: allow ANSI C quoting in expansion values
-rw-r--r-- | bashast/bashast.g | 2 | ||||
-rw-r--r-- | bashast/gunit/expansions.gunit | 2 | ||||
-rw-r--r-- | scripts/command_execution.bash | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/bashast/bashast.g b/bashast/bashast.g index 98da5e7..700f865 100644 --- a/bashast/bashast.g +++ b/bashast/bashast.g @@ -746,6 +746,8 @@ expansion_base | (ESC TICK) => ESC TICK -> TICK | (ESC DOLLAR) => ESC DOLLAR -> DOLLAR | (brace_expansion) => brace_expansion + | (DOLLAR SINGLE_QUOTED_STRING_TOKEN) => DOLLAR SINGLE_QUOTED_STRING_TOKEN + -> ^(ANSI_C_QUOTING SINGLE_QUOTED_STRING_TOKEN) | .; all_expansions diff --git a/bashast/gunit/expansions.gunit b/bashast/gunit/expansions.gunit index 543012e..39acfa9 100644 --- a/bashast/gunit/expansions.gunit +++ b/bashast/gunit/expansions.gunit @@ -30,4 +30,4 @@ done" -> (LIST (COMMAND (for each (STRING (COMMAND_SUB `ls |grep output`)) (LIST "wc <(cat /usr/share/dict/linux.words)" -> (LIST (COMMAND (STRING wc) (PROCESS_SUBSTITUTION < (LIST (COMMAND (STRING cat) (STRING / usr / share / dict / linux . words)))))) all_expansions: -"abc $(ab) ${ab} $((ab)) `ab` \"ab\" 'ab'" -> (STRING abc (COMMAND_SUB $(ab)) (VAR_REF ab) (ARITHMETIC_EXPRESSION (ARITHMETIC (VAR_REF ab))) (COMMAND_SUB `ab`) (DOUBLE_QUOTED_STRING ab) 'ab') +"$'abc' abc $(ab) ${ab} $((ab)) `ab` \"ab\" 'ab'" -> (STRING (ANSI_C_QUOTING 'abc') abc (COMMAND_SUB $(ab)) (VAR_REF ab) (ARITHMETIC_EXPRESSION (ARITHMETIC (VAR_REF ab))) (COMMAND_SUB `ab`) (DOUBLE_QUOTED_STRING ab) 'ab') diff --git a/scripts/command_execution.bash b/scripts/command_execution.bash index 06d6676..615b13f 100644 --- a/scripts/command_execution.bash +++ b/scripts/command_execution.bash @@ -84,3 +84,4 @@ variable=a echo "${!variable// /_}" echo "${!#// /_}" echo "${!1// /_}" +echo "${!variable// /$'\n'}" |