shithub: riscv

Download patch

ref: b4c1cf2ea1220698c00fa2692477505e20431bb0
parent: 6e65596827f7ee292221697ff5248c9bc9520851
author: cinap_lenrek <[email protected]>
date: Mon Jul 31 02:56:22 EDT 2017

libregexp: fix lexer so it doesnt move past the string when it gets a \ escape

--- a/sys/src/libregexp/regcomp.c
+++ b/sys/src/libregexp/regcomp.c
@@ -312,13 +312,10 @@
 		return;
 	}
 	l->rawexp += chartorune(&l->rune, l->rawexp);
-	if(l->rune == L'\\') {
-		l->rawexp += chartorune(&l->rune, l->rawexp);
-		l->literal = 1;
-	}
 	if(*l->rawexp == 0)
 		l->done = 1;
-	return;
+	if(l->rune == L'\\')
+		getnextrlit(l);
 }
 
 static void
@@ -333,7 +330,6 @@
 	l->rawexp += chartorune(&l->rune, l->rawexp);
 	if(*l->rawexp == 0)
 		l->done = 1;
-	return;
 }
 
 static int