summaryrefslogtreecommitdiffstats
path: root/parsing
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-21 02:45:57 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-21 02:45:57 (EST)
commiteffd399b41f6a1b8b0f515ec3901ff60fddfeced (patch)
tree09ecf3e40a62aaf02c4e95549a4a0f2c05e8476d /parsing
parente93028f9d7f47ae42733745d3de2d99bf4fe1651 (diff)
downloadeggshell-effd399b41f6a1b8b0f515ec3901ff60fddfeced.zip
eggshell-effd399b41f6a1b8b0f515ec3901ff60fddfeced.tar.gz
eggshell-effd399b41f6a1b8b0f515ec3901ff60fddfeced.tar.bz2
Improve demo output
Diffstat (limited to 'parsing')
-rw-r--r--parsing/parse.sh13
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'