From effd399b41f6a1b8b0f515ec3901ff60fddfeced Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 21 Feb 2016 02:45:57 -0500 Subject: Improve demo output --- (limited to 'parsing') 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}//g; s/${STX}//g; s/${ETX}//g; + s/${RS}//g; s/${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 <