shithub: riscv

Download patch

ref: 4d0a446123daebf8d9de77f5359e49229fe1eeb8
parent: cde97a4d5f17fe597cc55aa4653082bf2c01598c
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Mar 30 00:29:04 EDT 2014

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.

--- a/sys/src/cmd/grep/comp.c
+++ b/sys/src/cmd/grep/comp.c
@@ -135,11 +135,13 @@
 {
 	0x007f,
 	0x07ff,
+	0xffff,
 };
 Rune	tab2[] =
 {
 	0x003f,
 	0x0fff,
+	0xffff,
 };
 
 Re2
@@ -275,7 +277,7 @@
 			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)