shithub: riscv

Download patch

ref: 9c01b9a9580effc1b379e5ae04264c49f5849a15
parent: 9ccbf1dcb15a69dbe21a6767c137537f3a5863af
author: stanley lieber <[email protected]>
date: Mon May 2 10:48:11 EDT 2016

libregexp/regcomp.c: fix parser for e2 production (thanks, spew)

--- a/sys/src/libregexp/regcomp.c
+++ b/sys/src/libregexp/regcomp.c
@@ -78,14 +78,14 @@
 	Renode *n;
 
 	n = e3(plex);
-	if(lex(plex) == LREP) {
+	while(lex(plex) == LREP) {
 		switch(plex->rune) {
 		case L'*':
-			return node(plex, TSTAR, n, nil);
+			n = node(plex, TSTAR, n, nil);
 		case L'+':
-			return node(plex, TPLUS, n, nil);
+			n = node(plex, TPLUS, n, nil);
 		case L'?':
-			return node(plex, TQUES, n, nil);
+			n = node(plex, TQUES, n, nil);
 		}
 	}
 	plex->peek = 1;