zsh-workers
 help / color / mirror / code / Atom feed
From: Tanaka Akira <akr@jaist.ac.jp>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: regexparse
Date: 25 Dec 1999 20:37:58 +0900	[thread overview]
Message-ID: <rsq3dsrxnc9.fsf@crane.jaist.ac.jp> (raw)
In-Reply-To: Tanaka Akira's message of "25 Dec 1999 09:41:08 +0900"

In article <rsqiu1nj1i3.fsf@crane.jaist.ac.jp>,
  Tanaka Akira <akr@jaist.ac.jp> writes:

> Finally, I re-implemented most of `_regex_arguments' in C.
> This should accelerate `_apt'.

Oops.  I found that `apt-config shell <TAB>' prints `no more
arguments'.  This is caused by regexparse doesnot execute completion
actions since `apt-config shell ' is already valid command line.

This patch make regexparse to call completion actions even if command
line is valid.

Index: Completion/Base/_regex_arguments
===================================================================
RCS file: /projects/zsh/zsh/Completion/Base/_regex_arguments,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 _regex_arguments
--- Completion/Base/_regex_arguments	1999/12/25 00:41:47	1.1.1.11
+++ Completion/Base/_regex_arguments	1999/12/25 11:31:19
@@ -70,7 +70,7 @@
   "$funcname"' () {
     local _ra_p1 _ra_p2 _ra_left _ra_right _ra_com
     local _ra_actions _ra_line="${(pj:\0:)${(@)words[1,CURRENT - 1]:Q}}"$'\''\0'\''"$PREFIX"
-    regexparse _ra_p1 _ra_p2 "$_ra_line" '"${(j: :)${(qqqq)regex[@]}}"'
+    regexparse -c _ra_p1 _ra_p2 "$_ra_line" '"${(j: :)${(qqqq)regex[@]}}"'
     case "$?" in
     0|2) _message "no more arguments";;
     1) 
Index: Src/Modules/zutil.c
===================================================================
RCS file: /projects/zsh/zsh/Src/Modules/zutil.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 zutil.c
--- Src/Modules/zutil.c	1999/12/25 00:42:05	1.1.1.5
+++ Src/Modules/zutil.c	1999/12/25 11:31:22
@@ -992,7 +992,7 @@
 }
 
 static int
-rmatch(RParseResult *sm, char *subj, char *var1, char *var2)
+rmatch(RParseResult *sm, char *subj, char *var1, char *var2, int comp)
 {
     LinkNode ln, lnn;
     LinkList nexts;
@@ -1080,8 +1080,8 @@
 	}
     } while(ln);
 
-    if(!*subj)
-        for(ln = firstnode(sm->out); ln; ln = nextnode(ln)) {
+    if(!comp && !*subj)
+	for(ln = firstnode(sm->out); ln; ln = nextnode(ln)) {
 	    br = getdata(ln);
 	    if(br->state == st) {
 		for(ln = firstnode(br->actions); ln; ln = nextnode(ln)) {
@@ -1141,7 +1141,7 @@
 	    ret = 0;
 
 	if(!ret)
-	    ret = rmatch(&result, subj, var1, var2);
+	    ret = rmatch(&result, subj, var1, var2, ops['c']);
         popheap();
     } LASTALLOC;
 
@@ -1152,7 +1152,7 @@
 static struct builtin bintab[] = {
     BUILTIN("zstyle", 0, bin_zstyle, 0, -1, 0, NULL, NULL),
     BUILTIN("zformat", 0, bin_zformat, 3, -1, 0, NULL, NULL),
-    BUILTIN("regexparse", 0, bin_regexparse, 3, -1, 0, NULL, NULL),
+    BUILTIN("regexparse", 0, bin_regexparse, 3, -1, 0, "c", NULL),
 };
 
 
-- 
Tanaka Akira


  reply	other threads:[~1999-12-25 11:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-25  0:41 Tanaka Akira
1999-12-25 11:37 ` Tanaka Akira [this message]
1999-12-28 12:01   ` Peter Stephenson
1999-12-29 13:13 ` Tanaka Akira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=rsq3dsrxnc9.fsf@crane.jaist.ac.jp \
    --to=akr@jaist.ac.jp \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).