From bb68ee8db7971b683fba7dd7bf404186872ba7cf Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 8 Jun 2008 17:53:53 +0000 Subject: 25138(? mailing list stuck): rewrite of completion matching. Will one day use multibyte/wide characters, doesn't yet. --- Src/Zle/comp.h | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'Src/Zle/comp.h') diff --git a/Src/Zle/comp.h b/Src/Zle/comp.h index bcad3df05..7ac051c25 100644 --- a/Src/Zle/comp.h +++ b/Src/Zle/comp.h @@ -162,12 +162,49 @@ struct cmatcher { #define CMF_RIGHT 4 #define CMF_INTER 8 +/* + * Types of cpattern structure. + * Note freecpattern() assumes any <= CPAT_EQUIV have string. + */ +enum { + CPAT_CCLASS, /* [...]: ordinary character class */ + CPAT_NCLASS, /* [!...]: ordinary character class, negated */ + CPAT_EQUIV, /* {...}: equivalence class */ + CPAT_ANY, /* ?: any character */ + CPAT_CHAR /* Single character given explicitly */ +}; + +/* + * A pattern element in a matcher specification. + * Unlike normal patterns this only presents one character in + * either the test completion or the word on the command line. + */ struct cpattern { Cpattern next; /* next sub-pattern */ - unsigned char tab[256]; /* table of matched characters */ - int equiv; /* if this is a {...} class */ + int tp; /* type of object as above */ + union { + char *str; /* if a character class, the objects + * in it in a similar form to normal + * pattern matching (a metafied string + * with tokens). + * Note the allocated length may be longer + * than the null-terminated string. + */ + int chr; /* if a single character, it + * TODO: eventually should be a + * convchar_t. + */ + } u; }; +/* + * For now this just handles single-byte characters. + * TODO: this will change. + */ +#define PATMATCHRANGE(r, c, ip, mtp) patmatchrange(r, c, ip, mtp) +#define PATMATCHINDEX(r, i, cp, mtp) patmatchindex(r, i, cp, mtp) +#define CONVCAST(c) (c) + /* This is a special return value for parse_cmatcher(), * * signalling an error. */ -- cgit 1.4.1