diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-04-26 06:54:26 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-04-26 06:54:26 +0000 |
commit | ddb16a1b2b2426f14daa54e6ee759bea64f3cb55 (patch) | |
tree | 9565d21ca50cbe033a3400774d0e9a5903820ebc /Src/Zle/complete.c | |
parent | 9ecbacab6b041c12f2dd3eb1f78ba69ccbff100d (diff) | |
download | zsh-ddb16a1b2b2426f14daa54e6ee759bea64f3cb55.tar.gz zsh-ddb16a1b2b2426f14daa54e6ee759bea64f3cb55.tar.xz zsh-ddb16a1b2b2426f14daa54e6ee759bea64f3cb55.zip |
allow to anchor on gaps between strings in matching control specs (10926)
Diffstat (limited to 'Src/Zle/complete.c')
-rw-r--r-- | Src/Zle/complete.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c index 58cd8a216..2746f52d3 100644 --- a/Src/Zle/complete.c +++ b/Src/Zle/complete.c @@ -182,12 +182,15 @@ parse_cmatcher(char *name, char *s) { Cmatcher ret = NULL, r = NULL, n; Cpattern line, word, left, right; - int fl, ll, wl, lal, ral, err; + int fl, ll, wl, lal, ral, err, both; if (!*s) return NULL; while (*s) { + lal = ral = both = 0; + left = right = NULL; + while (*s && inblank(*s)) s++; if (!*s) break; @@ -216,6 +219,10 @@ parse_cmatcher(char *name, char *s) left = parse_pattern(name, &s, &lal, '|', &err); if (err) return pcm_err; + + if ((both = (*s == '|'))) + s++; + if (!*s || !*++s) { zwarnnam(name, "missing line pattern", NULL, 0); return pcm_err; @@ -227,6 +234,12 @@ parse_cmatcher(char *name, char *s) &err); if (err) return pcm_err; + if (both) { + right = line; + ral = ll; + line = NULL; + ll = 0; + } if ((fl & CMF_RIGHT) && (!*s || !*++s)) { zwarnnam(name, "missing right anchor", NULL, 0); } else if (!(fl & CMF_RIGHT)) { @@ -237,6 +250,13 @@ parse_cmatcher(char *name, char *s) s++; } if (fl & CMF_RIGHT) { + if (*s == '|') { + left = line; + lal = ll; + line = NULL; + ll = 0; + s++; + } right = parse_pattern(name, &s, &ral, '=', &err); if (err) return pcm_err; |