diff options
author | P. J. McDermott <pj@pehjota.net> | 2016-02-21 20:33:22 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2016-02-21 20:33:22 (EST) |
commit | 5649a9aa1ce56c0cfdcab088983f2d3a4cb32a4c (patch) | |
tree | bcd4bd4e0578d0a13e0074758fffb1f563159315 /eshtrans | |
parent | f6e7120e281cf7d26d1e1afb956414c55b21c644 (diff) | |
download | eggshell-5649a9aa1ce56c0cfdcab088983f2d3a4cb32a4c.zip eggshell-5649a9aa1ce56c0cfdcab088983f2d3a4cb32a4c.tar.gz eggshell-5649a9aa1ce56c0cfdcab088983f2d3a4cb32a4c.tar.bz2 |
eshtrans/frontend: Fix line numbers
Diffstat (limited to 'eshtrans')
-rw-r--r-- | eshtrans/frontend/lexer.esh | 4 | ||||
-rw-r--r-- | eshtrans/main.esh | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/eshtrans/frontend/lexer.esh b/eshtrans/frontend/lexer.esh index 46ba310..92c806c 100644 --- a/eshtrans/frontend/lexer.esh +++ b/eshtrans/frontend/lexer.esh @@ -458,6 +458,7 @@ scan_word() # We must advance lineno because scan_wordexp() # was run in a subshell. lineno=$((${lineno} + ${ln_off})) + lines=$((${lines} + ${ln_off})) word="${word}${res}" # scan_wordexp() leaves behind an unused # character, so we should skip the lgetc() call @@ -583,7 +584,8 @@ scan_wordexp() res="${res#*${RS}}" c="${res%%${RS}*}" res="${res#*${RS}}" - lineno=${ln_off} + ln_off=$((${ln_off} - ${lineno})) + lineno=$((${lineno} + ${ln_off})) wordexp="\$(${SOH}C${STX}${res}" wordexp="${wordexp}${ETX})" # ")" is recognized in run_sublexer(). diff --git a/eshtrans/main.esh b/eshtrans/main.esh index b0bcf53..0a0b929 100644 --- a/eshtrans/main.esh +++ b/eshtrans/main.esh @@ -116,6 +116,8 @@ main() #try 'foo 2>bar' #try '2>bar' #try '2 foo' +dbg=true +try 'foo $(bar \' 'baz \' 'qux) &&' # Line number testing - sh_codegen "$(esh_parse "${1}" <"${1}")" +# sh_codegen "$(esh_parse "${1}" <"${1}")" } |