summary refs log tree commit diff
path: root/Src/lex.c
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-09-27 23:56:38 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2015-09-27 23:56:38 -0700
commit4bed2cf256cf79f8e17093d54a67f75dfa54794a (patch)
treef5063f9d4ec33038b89b7fa885850d2ccb724512 /Src/lex.c
parent6d6b63c884a7484334a22671d2bd6ca138bb8751 (diff)
downloadzsh-4bed2cf256cf79f8e17093d54a67f75dfa54794a.tar.gz
zsh-4bed2cf256cf79f8e17093d54a67f75dfa54794a.tar.xz
zsh-4bed2cf256cf79f8e17093d54a67f75dfa54794a.zip
36669: fix ${(z)...} of an an incomplete math expression by restoring "((" at the front of the token
Diffstat (limited to 'Src/lex.c')
-rw-r--r--Src/lex.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Src/lex.c b/Src/lex.c
index 70f3d142a..89af96123 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -783,6 +783,15 @@ gettok(void)
 		     */
 		    tokstr = NULL;
 		    return INPAR;
+		    
+		case CMD_OR_MATH_ERR:
+		    /*
+		     * LEXFLAGS_ACTIVE means we came from bufferwords(),
+		     * so we treat as an incomplete math expression
+		     */
+		    if (lexflags & LEXFLAGS_ACTIVE)
+			tokstr = dyncat("((", tokstr ? tokstr : "");
+		    /* fall through */
 
 		default:
 		    return LEXERR;