Diffs between last version checked in and current workfile(s): Index: compilers/pge/PGE/Regex.pir =================================================================== --- compilers/pge/PGE/Regex.pir (revision 14851) +++ compilers/pge/PGE/Regex.pir (working copy) @@ -411,13 +411,17 @@ =cut .sub "ws" - .param pmc mob + .param pmc passed_mob .local string target - .local pmc mfrom, mpos .local int rep, pos, lastpos .local string nextchars .const .Sub corou = "ws_corou" + .local pmc mob, mfrom, mpos + .lex 'mob', mob + .lex 'mfrom', mfrom + .lex 'mpos', mpos nextchars = "" + mob = passed_mob ws_1: $P0 = get_hll_global ["PGE::Match"], "newfrom" (mob, target, mfrom, mpos) = $P0(mob) @@ -441,10 +445,9 @@ if $I1 >= $I0 goto nobacktrack backtrack: mpos = pos - $P0 = corou - $P0 = clone $P0 + $P0 = newclosure corou setattribute mob, "PGE::Match\x0&!corou", $P0 - $P0(mob, mfrom, mpos) + ## $P0(mob, mfrom, mpos) .return (mob) nobacktrack: if nextchars == "" goto found @@ -456,17 +459,24 @@ end: .return (mob) .end -.sub "ws_corou" :anon - .param pmc mob - .param pmc mfrom - .param pmc mpos - loop: - .yield (mob) +.sub "ws_corou" :outer("ws") + .local pmc mob, mfrom, mpos + .lex 'mob', mob + .lex 'mfrom', mfrom + .lex 'mpos', mpos + + printerr "woop\n" + .local pmc old_mpos + null old_mpos + if null mpos goto flush + old_mpos = clone mpos dec mpos - if mpos > mfrom goto loop + if mpos <= mfrom goto done +flush: null $P0 setattribute mob, "PGE::Match\x0&!corou", $P0 - goto loop +done: + .return (old_mpos) .end Index: t/compilers/pge/06-grammar.t =================================================================== --- t/compilers/pge/06-grammar.t (revision 14851) +++ t/compilers/pge/06-grammar.t (working copy) @@ -161,6 +161,11 @@ $S2 = $P0[$I1] inc $I1 inc n_tests + ## printerr "[matching '" + ## printerr $S0 + ## printerr "' versus '" + ## printerr $S2 + ## printerr "']\n" ok = _match_expr($S0,$S2) $I3 = todo_tests[n_tests] if $I3 == 1 goto todo_test End of diffs.