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

Re: Bug in case stmt with '('

On Jul 23,  4:08pm, Zoltan Hidvegi wrote:
} Subject: Re: Bug in case stmt with '('
} The best would be to handle it in glob.c but here it is a problem how can
} we distinguish ( foo\ | bar ) from ( foo | bar ).

The `if (incasepat && ...)' patch that I sent handles this correctly.
The only drawback I've found so far to my patch is that if you *don't*
use the POSIX balanced-parens syntax for "case", then parenthesized
patterns can't have *meaningful* spaces in them.

I don't think this is a significant difficulty, since "case" already
has the `|' syntax so there's not much reason to use glob-grouping
parens in "case" patterns in the first place.

} The simplest solution is to convert every unquoted space
} and TAB which is inside a globbing paren to a null-space and null-tab token
} and later in glob.c a null-space or null-tab is either treated as space/tab
} or discarded if it is adjacent to | or comes after a `(' of before a `)'
} (or it may be better to disard these after `)' and before `(' as well).
} This seems to be a quite simple solution.

Maybe, but not simpler than mine, and it's solving a problem that I don't
think we ought to be solving -- we don't need to be able to ignore spaces
in generalized glob patterns, only in "case" statements.  I don't like the
suggestion to do it everywhere.

Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"

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