about summary refs log tree commit diff
path: root/Src/lex.c
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-01-20 07:47:53 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-01-29 09:14:53 +0000
commitbced1beb8cc530ea28aa994808707043dd156fb8 (patch)
tree30b7dca6a24e5a11f6b9b4dd4fd34c73a9f2f098 /Src/lex.c
parenta090acab63c02900e86bd268fc9194fccf459d08 (diff)
downloadzsh-bced1beb8cc530ea28aa994808707043dd156fb8.tar.gz
zsh-bced1beb8cc530ea28aa994808707043dd156fb8.tar.xz
zsh-bced1beb8cc530ea28aa994808707043dd156fb8.zip
37700: Teach ${(z)} the 'repeat WORD SUBLIST' syntax.
Diffstat (limited to 'Src/lex.c')
-rw-r--r--Src/lex.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Src/lex.c b/Src/lex.c
index 23b0a1cd9..d4132fe76 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -267,9 +267,13 @@ zshlex(void)
 {
     if (tok == LEXERR)
 	return;
-    do
+    do {
+	if (inrepeat_)
+	    ++inrepeat_;
+	if (inrepeat_ == 3 && isset(SHORTLOOPS))
+	    incmdpos = 1;
 	tok = gettok();
-    while (tok != ENDINPUT && exalias());
+    } while (tok != ENDINPUT && exalias());
     nocorrect &= 1;
     if (tok == NEWLIN || tok == ENDINPUT) {
 	while (hdocs) {
@@ -1899,6 +1903,7 @@ exalias(void)
 		  zshlextext[0] == '}' && !zshlextext[1])) &&
 		(rw = (Reswd) reswdtab->getnode(reswdtab, zshlextext))) {
 		tok = rw->token;
+		inrepeat_ = (tok == REPEAT);
 		if (tok == DINBRACK)
 		    incond = 1;
 	    } else if (incond && !strcmp(zshlextext, "]]")) {