git: 9front

Download patch

ref: 40c58596615fae94289a260da8697d1502a0b396
parent: 432c9f1b4e72c125f145a3fd94e320ca77ec5a8b
author: stanley lieber <stanley.lieber@gmail.com>
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;
--