diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-03-30 04:29:04 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2014-03-30 04:29:04 +0200 |
commit | 4d0a446123daebf8d9de77f5359e49229fe1eeb8 (patch) | |
tree | 9d92b3ed633ac6b009acaba62be6b4a34237aa85 | |
parent | cde97a4d5f17fe597cc55aa4653082bf2c01598c (diff) |
grep: fix wrong rlcass splitting (thanks erik and kenji)
add 0xffff to tab1 as range 0xffff-0x10ffff has 4 byte utf-8 sequence.
use Runemax (0x10ffff) instead of Runemask (0x1fffff) to denote
the last valid rune for inverted [^] match as Runemask is out of the
valid rune space.
-rw-r--r-- | sys/src/cmd/grep/comp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/src/cmd/grep/comp.c b/sys/src/cmd/grep/comp.c index 6be061bbc..d74a7bdaa 100644 --- a/sys/src/cmd/grep/comp.c +++ b/sys/src/cmd/grep/comp.c @@ -135,11 +135,13 @@ Rune tab1[] = { 0x007f, 0x07ff, + 0xffff, }; Rune tab2[] = { 0x003f, 0x0fff, + 0xffff, }; Re2 @@ -275,7 +277,7 @@ re2class(char *s) x = re2or(x, rclass(ov, p[0]-1)); ov = p[1]+1; } - x = re2or(x, rclass(ov, Runemask)); + x = re2or(x, rclass(ov, Runemax)); } else { x = rclass(p[0], p[1]); for(p+=2; *p; p+=2) |