about summary refs log tree commit diff
path: root/Src/lex.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-03-08 01:20:49 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-03-08 01:20:49 +0000
commit25413054c11fc4b67284d4d6db48272182da1d26 (patch)
tree7a7e7a187e8c505d531e1f5d354f846b24de646a /Src/lex.c
parentdb717e3025b54d363d0f25908485370b10c9ec6a (diff)
downloadzsh-25413054c11fc4b67284d4d6db48272182da1d26.tar.gz
zsh-25413054c11fc4b67284d4d6db48272182da1d26.tar.xz
zsh-25413054c11fc4b67284d4d6db48272182da1d26.zip
24699: bug with ${(Q)...} on initial ">"
bug with ${(z)...} on string with unterminated "("
Diffstat (limited to 'Src/lex.c')
-rw-r--r--Src/lex.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/Src/lex.c b/Src/lex.c
index 4128f109a..739a6f391 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -914,6 +914,19 @@ gettok(void)
     return gettokstr(c, 0);
 }
 
+/*
+ * Get the remains of a token string.  This has two uses.
+ * When called from gettok(), with sub = 0, we have already identified
+ * any interesting initial character and want to get the rest of
+ * what we now know is a string.  However, the string may still include
+ * metacharacters and potentially substitutions.
+ *
+ * When called from parse_subst_string() with sub = 1, we are not
+ * fully parsing a command line, merely tokenizing a string.
+ * In this case we always add characters to the parsed string
+ * unless there is a parse error.
+ */
+
 /**/
 static int
 gettokstr(int c, int sub)
@@ -1134,7 +1147,10 @@ gettokstr(int c, int sub)
 	    if (e != '(') {
 		hungetc(e);
 		lexstop = 0;
-		goto brk;
+		if (in_brace_param || sub)
+		    break;
+		else
+		    goto brk;
 	    }
 	    add(Outang);
 	    if (skipcomm()) {