summaryrefslogtreecommitdiffstats
path: root/eshtrans/frontend
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-21 12:19:00 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-21 12:21:44 (EST)
commit38730b344f7027fa89097ca660300802842a18aa (patch)
treed26a177d24bfd92e69a5085e7c32029d950d83fd /eshtrans/frontend
parent506a0723291b4abc4b707a6353a840ef51f95ee8 (diff)
downloadeggshell-38730b344f7027fa89097ca660300802842a18aa.zip
eggshell-38730b344f7027fa89097ca660300802842a18aa.tar.gz
eggshell-38730b344f7027fa89097ca660300802842a18aa.tar.bz2
eshtrans/frontend: Don't eat char after wordexp in arithmetic
Before: Trying script: $(($foo + 1)) Tokens: T_FNAME<US>$(($foo+ 1))<RS>T_NEWLINE<RS>T_EOF<RS> Token: function name "$(($foo+ 1))" Token: newline Token: end of file Generated code: $(($foo+ 1)) Trying script: $((1 + $foo)) stdin:1: Syntax error: Arithmetic expansion: ")" unexpected FAIL After: Trying script: $(($foo + 1)) Tokens: T_FNAME<US>$(($foo + 1))<RS>T_NEWLINE<RS>T_EOF<RS> Token: function name "$(($foo + 1))" Token: newline Token: end of file Generated code: $(($foo + 1)) Trying script: $((1 + $foo)) Tokens: T_FNAME<US>$((1 + $foo))<RS>T_NEWLINE<RS>T_EOF<RS> Token: function name "$((1 + $foo))" Token: newline Token: end of file Generated code: $((1 + $foo))
Diffstat (limited to 'eshtrans/frontend')
-rw-r--r--eshtrans/frontend/lexer.esh4
1 files changed, 3 insertions, 1 deletions
diff --git a/eshtrans/frontend/lexer.esh b/eshtrans/frontend/lexer.esh
index d904aa0..6775bbc 100644
--- a/eshtrans/frontend/lexer.esh
+++ b/eshtrans/frontend/lexer.esh
@@ -783,8 +783,8 @@ scan_wordexp_arith()
arith=''
paren_lvl=0
+ lgetc
while :; do
- lgetc
case "${c}" in
'')
synerr 'end of file unexpected (%s)' \
@@ -823,11 +823,13 @@ scan_wordexp_arith()
# was run in a subshell.
lineno=$((${lineno} + ${ln_off}))
arith="${arith}${sub_wordexp}"
+ continue
;;
*)
arith="${arith}${c}"
;;
esac
+ lgetc
done
}