From 292939d65a7ee4ceff225cb9bea671afc837f3b4 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 20 Feb 2016 20:43:35 -0500 Subject: Reticulate splines --- (limited to 'parsing') 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 -- cgit v0.9.1