1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-27 04:40:59 +01:00

37689: ! and ^ need to be tokenised in character sets

This commit is contained in:
Peter Stephenson 2016-01-19 17:24:12 +00:00
parent 8eb9070d67
commit ad16356e19
7 changed files with 110 additions and 42 deletions

View file

@ -35,7 +35,7 @@
/* tokens */
/**/
mod_export char ztokens[] = "#$^*(())$=|{}[]`<>>?~`,-'\"\\\\";
mod_export char ztokens[] = "#$^*(())$=|{}[]`<>>?~`,-!'\"\\\\";
/* parts of the current token */
@ -395,8 +395,9 @@ ctxtlex(void)
#define LX2_BQUOTE 16
#define LX2_COMMA 17
#define LX2_DASH 18
#define LX2_OTHER 19
#define LX2_META 20
#define LX2_BANG 19
#define LX2_OTHER 20
#define LX2_META 21
static unsigned char lexact1[256], lexact2[256], lextok2[256];
@ -406,10 +407,10 @@ initlextabs(void)
{
int t0;
static char *lx1 = "\\q\n;!&|(){}[]<>";
static char *lx2 = ";)|$[]~({}><=\\\'\"`,-";
static char *lx2 = ";)|$[]~({}><=\\\'\"`,-!";
for (t0 = 0; t0 != 256; t0++) {
lexact1[t0] = LX1_OTHER;
lexact1[t0] = LX1_OTHER;
lexact2[t0] = LX2_OTHER;
lextok2[t0] = t0;
}
@ -1361,12 +1362,20 @@ gettokstr(int c, int sub)
*/
if (seen_brct)
c = Dash;
else
c = '-';
break;
}
add(c);
c = hgetc();
else
c = '-';
break;
case LX2_BANG:
/*
* Same logic as Dash, for ! to perform negation in range.
*/
if (seen_brct)
c = Bang;
else
c = '!';
}
add(c);
c = hgetc();
if (intpos)
intpos--;
if (lexstop)