I think I may have found something wrong with PGE capturing with the :w
modifier. In this code:


.sub main @MAIN
    .local pmc p6rule, rulesub, match
    .local string input

    input = "dog spot"


    load_bytecode "runtime/parrot/library/PGE.pbc"
    p6rule = find_global "PGE", "p6rule"


    rulesub = p6rule(':w(\w+) (\S+)')
    match = rulesub(input)
    $S0 = match.dump()
    print $S0
    print "\n\n"


    rulesub = p6rule('(\w+)\s+(\S+)')
    match = rulesub(input)
    $S0 = match.dump()
    print $S0
    print "\n"
.end


The first match is getting 'dog' in both 0 and 1 and never capturing
'spot'  I think it should be like the second one (which doesn't use :w
but should be the same expression). Output:


: <dog @ 0> 0
[0]: <dog @ 0> 0
[1]: <dog @ 0> 0
dog spot

: <dog spot @ 0> 0
[0]: <dog @ 0> 0
[1]: <spot @ 4> 0
dog spot


-Dino

-- 
 .~.    Dino Morelli
 /V\    email: [EMAIL PROTECTED]
/( )\   weblog: http://categorically.net/d/blog/
^^-^^   preferred distro: Debian GNU/Linux  http://www.debian.org

Reply via email to