diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2020-01-12 11:59:48 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2020-01-12 11:59:48 +0300 |
commit | b59f74a7bd1f0deaa12fb0abfbf51ecc916d732c (patch) | |
tree | 088ffaecdfffd5e049739cb1d7a2eb09d0d9156d /internal/parse.zsh | |
parent | 770bf934442b1e2cefc9ce65e3da204b5ec0d170 (diff) |
fix heredocs
Diffstat (limited to 'internal/parse.zsh')
-rw-r--r-- | internal/parse.zsh | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/internal/parse.zsh b/internal/parse.zsh index 0a4a5027..7c511a44 100644 --- a/internal/parse.zsh +++ b/internal/parse.zsh @@ -198,6 +198,11 @@ function _parse_buffer() { (( ic )) && tokens[1,0]=(${(Z+C+)s}) || tokens[1,0]=(${(z)s}) done + if [[ $token == '<<'(|-) ]]; then + state=h + continue + fi + case $state in t|p*) if (( $+__pb_term[$token] )); then @@ -218,16 +223,23 @@ function _parse_buffer() { state[1]= continue;; h) - skip=${(b)token} - state=s + while (( $#tokens )); do + (( e = ${tokens[(i)$token]} )) + if [[ $tokens[e-1] == ';' && $tokens[e+1] == ';' ]]; then + tokens[1,e]=() + break + else + tokens[1,e]=() + fi + done + while (( $#alp && alp[-1] >= $#tokens )); do + aln[-1]=() + alp[-1]=() + done + state=t continue;; esac - if [[ $token == '<<'(|-) ]]; then - state=h - continue - fi - if (( $+__pb_redirect[${token#<0-255>}] )); then state+=r continue |