fix e2 production to match regexp(6) and do it right this time

This commit is contained in:
spew 2016-05-02 15:11:48 -05:00
parent de5cabceaf
commit 7657312dcf

View file

@ -78,14 +78,17 @@ e2(Parselex *plex)
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);
break;
case L'+':
return node(plex, TPLUS, n, nil);
n = node(plex, TPLUS, n, nil);
break;
case L'?':
return node(plex, TQUES, n, nil);
n = node(plex, TQUES, n, nil);
break;
}
}
plex->peek = 1;