diff options
-rw-r--r-- | parsing/parse.sh | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/parsing/parse.sh b/parsing/parse.sh index cbe4dd9..63b2cba 100644 --- a/parsing/parse.sh +++ b/parsing/parse.sh @@ -604,12 +604,15 @@ try() printf 'Trying script:\n' printf '\t%s\n' "${@}" if tokens="$(printf '%s\n' "${@}" | parse -)"; then - printf 'Tokens: %s\n' "${tokens}" + printf 'Tokens: %s\n' "${tokens}" | sed " + s/${SOH}/<SOH>/g; s/${STX}/<STX>/g; s/${ETX}/<ETX>/g; + s/${RS}/<RS>/g; s/${US}/<US>/g; + " IFS="${RS}" for t in ${tokens}; do printf 'Token: %s\n' "$(tokname "${t}")" - case "${t%${US}*}" in T_WORD) - printf ' "%s"\n' "${t#T_WORD${US}}" + case "${t%${US}*}" in T_NAME|T_FNAME|T_CMDNAME|T_WORD) + printf ' "%s"\n' "${t#*${US}}" ;; esac done @@ -624,7 +627,7 @@ try() } #try '"foo bar" && $baz || qux' '${quux%uux quuux' -#try '"foo bar" && $baz || qux' '${quux%uux } quuux' +try '"foo bar" && $baz || qux' '${quux%uux } quuux' #try 'foo ${bar}' #try 'foo ${#bar}' #try 'foo ${bar#baz}' @@ -657,4 +660,4 @@ try() #try 'foo <<-EOF' "${HT}bar" "${HT}EOF" #try 'foo <<EOF' '$(bar)' 'EOF' #try 'foo <<E"O"F' '$(bar)' 'E"O"F' # BUG -try 'foo <<EOF1; bar <<EOF2' 'baz' 'EOF1' 'qux' 'EOF2' +#try 'foo <<EOF1; bar <<EOF2' 'baz' 'EOF1' 'qux' 'EOF2' |