diff options
author | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2020-05-23 18:01:26 +0100 |
---|---|---|
committer | Peter Stephenson <p.w.stephenson@ntlworld.com> | 2020-05-23 18:01:26 +0100 |
commit | 40723b3991557d0f5db66cbde9feb5cbc33bce78 (patch) | |
tree | ded5db16dda2582264846c256090f8bc317de5c3 /Src | |
parent | b3148194d12064878bf55c6e37e24200cf93d9b8 (diff) | |
download | zsh-40723b3991557d0f5db66cbde9feb5cbc33bce78.tar.gz zsh-40723b3991557d0f5db66cbde9feb5cbc33bce78.tar.xz zsh-40723b3991557d0f5db66cbde9feb5cbc33bce78.zip |
45900: Fix issues with escaped newline in $-substitution.
Diffstat (limited to 'Src')
-rw-r--r-- | Src/lex.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Src/lex.c b/Src/lex.c index a541defe6..37fcec3e2 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -541,6 +541,17 @@ cmd_or_math_sub(void) { int c = hgetc(), ret; + if (c == '\\') { + c = hgetc(); + if (c != '\n') { + hungetc(c); + hungetc('\\'); + lexstop = 0; + return skipcomm() ? CMD_OR_MATH_ERR : CMD_OR_MATH_CMD; + } + c = hgetc(); + } + if (c == '(') { int lexpos = (int)(lexbuf.ptr - tokstr); add(Inpar); @@ -998,6 +1009,16 @@ gettokstr(int c, int sub) break; case LX2_STRING: e = hgetc(); + if (e == '\\') { + e = hgetc(); + if (e != '\n') { + hungetc(e); + hungetc('\\'); + lexstop = 0; + break; + } + e = hgetc(); + } if (e == '[') { cmdpush(CS_MATHSUBST); add(String); |