Are you subscribed to perl6-compiler?
Yesterday Patrick Michaud posted "PGE features update (corrections)"
which describes the results you've got:

* Match objects for nested captures are nested into the surrounding
capture object.  Thus, given

      rulesub = p6rule(":w (let) ( (\w+) \:= (\S+) )")
      match = rulesub("let foo := 123")

the outer match object contains two match objects ($/[0] and $/[1]),
and the second of these contains two match objects at
$/[1][0] and $/[1][1].

      print match                        # outputs "let foo := 123"
      $P0 = match[0]                     # first subcapture ($1)
      print $P0                          # outputs "let"
      $P0 = match[1]                     # second subcapture ($2)
      $P1 = $P0[0]                       # first nested capture ($2[0])
      print $P1                          # outputs "foo"
      $P1 = $P0[1]                       # second nested capture ($2[1])
      print $P1                          # outputs "123"

Cheers,
Carl

Reply via email to