Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Various problems with 3.0.1-test1



> In fact, the whole idea of the lexical tokens depending on some option
> has me less than thrilled.  Since the only difference is in lextok2, I
> think the following patch should work.  It has the bonus of making the
> effect of extendedglob much more transparent in the code.  I would
> urge its inclusion.  If you're counting, I've added seven extendedglob
> tests and removed one.  I believe these are all the ones required.
> (Maybe it was this way before?)

No I think zsh-2.5.0 had the same behaviour.  Your patches to lex.c and
zle_tricky.c are fine but for glob.c the second hunk is unnecessary and
undesired.  The second hunk changes the glob engine.  Here Hat comes from
the pattern parser and denotes negation.  It purely represents the concept
of negation and it is not related to the actual ^ mark).  Later when we
implement ksh globbing only the pattern parser will be changed and in the
parsed Comp structure Hat will still denote !(pattern) negation.

And a change is necessary in subst.c as well because after your patch
$foo:s/^/something/ stopps working.  Perhaps it was a bug even before that
this never worked with extendedglob set.

We also have to double-check all places where the tokenized lexer output is
used since an unexpected Hat or Pound token might cause problems.
For example in the result of get_comp_string() although right now I'm
unable to produce any bug related to this.

Zoltan


*** Src/subst.c	1996/07/28 22:29:59	2.48
--- Src/subst.c	1996/09/10 23:30:38
***************
*** 1568,1573 ****
--- 1568,1574 ----
  		for (tt = hsubl; *tt; tt++)
  		    if (INULL(*tt))
  			chuck(tt--);
+ 		untokenize(hsubl);
  		for (tt = hsubr = ztrdup(ptr2); *tt; tt++)
  		    if (INULL(*tt))
  			chuck(tt--);
*** Src/glob.c.orig	Wed Sep 11 00:51:32 1996
--- Src/glob.c	Wed Sep 11 01:33:59 1996
***************
*** 1710,1717 ****
  	    pat++;
  	    continue;
  	}
! 	if (*pat == Hat && isset(EXTENDEDGLOB))	
! 	    return 1 - doesmatch(c->next);  /* following pattern is negated */
  	if (*pat == Inbrack) {
  	    /* Match groups of characters */
  #define PAT(X) (pat[X] == Meta ? pat[(X)+1] ^ 32 : untok(pat[X]))
--- 1710,1717 ----
  	    pat++;
  	    continue;
  	}
! 	if (*pat == Hat)	/* following pattern is negated */
! 	    return 1 - doesmatch(c->next);
  	if (*pat == Inbrack) {
  	    /* Match groups of characters */
  #define PAT(X) (pat[X] == Meta ? pat[(X)+1] ^ 32 : untok(pat[X]))



Messages sorted by: Reverse Date, Date, Thread, Author