diff options
author | P. J. McDermott <pj@pehjota.net> | 2016-02-20 20:43:35 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2016-02-20 20:43:35 (EST) |
commit | 292939d65a7ee4ceff225cb9bea671afc837f3b4 (patch) | |
tree | dac240cf2925211d825c9ef86136f2ea2b1b8a5d /parsing | |
parent | 3eceb647e59b1fb324ce62092edb63a458a73545 (diff) | |
download | eggshell-292939d65a7ee4ceff225cb9bea671afc837f3b4.zip eggshell-292939d65a7ee4ceff225cb9bea671afc837f3b4.tar.gz eggshell-292939d65a7ee4ceff225cb9bea671afc837f3b4.tar.bz2 |
Reticulate splines
Diffstat (limited to 'parsing')
-rw-r--r-- | parsing/lexer.sh | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/parsing/lexer.sh b/parsing/lexer.sh index 5c3f6c5..924964e 100644 --- a/parsing/lexer.sh +++ b/parsing/lexer.sh @@ -214,20 +214,19 @@ next_io() next_word() { local res= - local lineno_offset= local word= if ! res="$(scan_word false)"; then exit 1 fi - lineno_offset=${res%%${RS}*} + ln_off=${res%%${RS}*} res="${res#*${RS}}" c="${res%%${RS}*}" res="${res#*${RS}}" word="${res%%${RS}*}" # We must advance lineno because scan_word() was run in a subshell. - lineno=$((${lineno} + ${lineno_offset})) + lineno=$((${lineno} + ${ln_off})) tok="T_WORD${US}${word}" } @@ -242,7 +241,6 @@ scan_word() local word= local quoted= local lines= - local lineno_offset= local wordexp= word='' @@ -273,14 +271,14 @@ scan_word() if ! res=$(scan_wordexp); then exit 1 fi - lineno_offset=${res%%${RS}*} + ln_off=${res%%${RS}*} res="${res#*${RS}}" c="${res%%${RS}*}" res="${res#*${RS}}" wordexp="${res%%${RS}*}" # We must advance lineno because scan_wordexp() # was run in a subshell. - lineno=$((${lineno} + ${lineno_offset})) + lineno=$((${lineno} + ${ln_off})) word="${word}${wordexp}" # scan_wordexp() leaves behind an unused # character, so we should skip the lgetc() call @@ -330,9 +328,8 @@ scan_word() scan_wordexp() { local res= - local param= - local word= local toks= + local param= wordexp='' ln_off=0 @@ -392,6 +389,7 @@ scan_wordexp_param_brace() local mod= local res= local param= + local word= ln_off=0 mod=true |