about summary refs log tree commit diff
path: root/Src/parse.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/parse.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/parse.c')
-rw-r--r--Src/parse.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Src/parse.c b/Src/parse.c
index 4829e3a6d..628a9aa2d 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -63,6 +63,12 @@ int isnewlin;
 /**/
 int infor;
 
+/* != 0 if we are after a repeat keyword; if it's nonzero it's a 1-based index
+ * of the current token from the last-seen command position */
+
+/**/
+int inrepeat_; /* trailing underscore because of name clash with Zle/zle_vi.c */
+
 /* != 0 if parsing arguments of typeset etc. */
 
 /**/
@@ -271,6 +277,7 @@ parse_context_save(struct parse_stack *ps, int toplevel)
     ps->incasepat = incasepat;
     ps->isnewlin = isnewlin;
     ps->infor = infor;
+    ps->inrepeat_ = inrepeat_;
     ps->intypeset = intypeset;
 
     ps->hdocs = hdocs;
@@ -305,6 +312,7 @@ parse_context_restore(const struct parse_stack *ps, int toplevel)
     incasepat = ps->incasepat;
     isnewlin = ps->isnewlin;
     infor = ps->infor;
+    inrepeat_ = ps->inrepeat_;
     intypeset = ps->intypeset;
 
     hdocs = ps->hdocs;
@@ -447,6 +455,7 @@ init_parse_status(void)
      * using the lexical analyser for strings as well as here.
      */
     incasepat = incond = inredir = infor = intypeset = 0;
+    inrepeat_ = 0;
     incmdpos = 1;
 }
 
@@ -1482,6 +1491,7 @@ par_while(int *cmplx)
 static void
 par_repeat(int *cmplx)
 {
+    /* ### what to do about inrepeat_ here? */
     int oecused = ecused, p;
 
     p = ecadd(0);