#1447: [NQP-rx] failure to capture two duplicate subrules in the same rule
---------------------+------------------------------------------------------
Reporter: allison | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: none | Version: 2.0.0
Severity: medium | Keywords:
Lang: | Patch:
Platform: |
---------------------+------------------------------------------------------
I ran into a problem with nqp-rx grammars in a mini-language I'm working
on. Looks like it might be a bug in nqp-rx, though I'm always suspicious
that cases like this might be a bug in the language grammar (if it's the
latter, you can close the ticket, since the language has switched to true
operator precedence parsing).
With two identical subrules matching in a rule, only the second result is
captured in the parse tree. So a rule like:
{{{
<IF> <expression> <relation> <expression>
}}}
Matches as:
{{{
PMC 'Regex;Match' => "IF 2 < 1\n..." @ 38 {
<relation> => PMC 'Regex;Match' => "<" @ 43
<IF> => PMC 'Regex;Match' => "IF" @ 38
<expression> => PMC 'Regex;Match' => "1\n " @ 45
{
[...]
}
}}}
I was hoping to be able to duplicate the problem in an isolated case, but
a simplified grammar like the following creates an array of <foo> as you
would expect.
{{{
token TOP { <foo> <bar> <foo> }
rule foo { 'foo' | 'oof' }
token bar { 'bar' }
}}}
So far, I've only been able to duplicate the bug with the full language
grammar, so, I've put a copy of the language at that version up on
http://pub.lohutok.net/nqp/camle-0.0.1b-ar9319.tar.gz. Run 'make parrot',
'make', and then './camle --target=parse twosubrule.le' to produce the
output above.
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/1447>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets