# New Ticket Created by Mitchell N Charity
# Please include the string: [perl #36606]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=36606 >
PGE is currently passing all tests, but failing to run a "large" pugs
grammar (one for p6 regexps). So I transliterated part of the grammar
into a (failing) test. Attached. The test can grow into a full regexp
description, and serves as a way of flagging any apparent pge problems
encountered along the way.
Thanks for all your work,
Mitchell Charity
diff -urN ./t/p6rules/rx_grammar.t ../deleteme1/t/p6rules/rx_grammar.t
--- ./t/p6rules/rx_grammar.t 1969-12-31 19:00:00.000000000 -0500
+++ ../deleteme1/t/p6rules/rx_grammar.t 2005-07-20 13:01:04.000000000 -0400
@@ -0,0 +1,80 @@
+use strict;
+use warnings;
+use Parrot::Test tests => 1;
+use Parrot::Test::PGE;
+
+=pod
+
+This test is intended to verify that PGE can run a grammar for perl6
+regular expressions.
+
+PGE will never be able to run all expressions which match the grammar.
+PGE should simply be able to run the grammar itself.
+
+Feel free to rephrase the grammar to make it easier for PGE to run.
+
+The grammar is a work in progress, and is currently an incomplete,
+incorrect, and no doubt buggy description of perl6 regexps.
+
+
+Currently the grammar is failing to match "a". If foo is added to the
+beginning of alternation and repetition, then it works. This appears
+to be a backtracking problem.
+
+=cut
+
+my @rx_grammar =
+ (
+ [ name => '<ident>'],
+ [ pattern => '<term>+' ],
+ [ term => '<alternation> | <non_alternation>'],
+# [ alternation => 'foo <non_alternation> \| <pattern>'],
+ [ alternation => '<non_alternation> \| <pattern>'],
+ [ non_alternation => '<repetition> | <alias> | <simple_term>'],
+# [ repetition => 'foo <simple_term> <quantifier>'],
+ [ repetition => '<simple_term> <quantifier>'],
+ [ quantifier => '<[\?\*\+]>(\??) | \*\*{<[\d\.]>+}(\??)'],
+ [ simple_term => '<null_term>|<assertion>|<subrule>|<subpattern>|<noncapturing_group>|<literal>|<character>'],
+ [ null_term => '\< null \>'],
+ [ assertion => '<anchor>|<lookahead>|<lookbehind>'],
+ [ anchor => '<anchor_bos>|<anchor_eos>|<anchor_bol>|<anchor_eol>|<word_anchor>'],
+ [ anchor_bos => '\^'],
+ [ anchor_eos => '\$'],
+ [ anchor_bol => '\^\^'],
+ [ anchor_eol => '\$\$'],
+ [ lookahead => '\< (!?) before <ws> <pattern> \>'],
+ [ lookbehind => '\< (!?) after <ws> <pattern> \>'],
+ [ word_anchor => '\\\\b'],
+ [ subrule => '\< (\??) <name> \>'],
+ [ subpattern => '\( <pattern> \)'],
+ [ noncapturing_group => '\[ <pattern> \]'],
+ [ literal => '\<\' [ <-[\\\\\']> | \\\\ . ]* \'\>'],
+ [ alias => '<named_scalar_alias>|<numbered_scalar_alias>|<array_alias>|<hash_alias>|<external_scalar_alias>|<external_array_alias>|<external_hash_alias>'],
+ [ named_scalar_alias => ' \$\< <name> \> \:\= <construct> '],
+ [ array_alias => ' [EMAIL PROTECTED]< <name> \> \:\= <construct> '],
+ [ hash_alias => ' \%\< <name> \> \:\= <construct> '],
+ [ numbered_scalar_alias => ' \$ <number> \:\= <construct> '],
+ [ number => '\d+'],
+ [ external_scalar_alias => ' \$<name> \:\= <construct> '],
+ [ external_array_alias => ' \@<name> \:\= <construct> '],
+ [ external_hash_alias => ' \%<name> \:\= <construct> '],
+ [ construct => '<subrule>|<subpattern>|<noncapturing_group>|<quantified_construct>'],
+ [ quantified_construct => ' <construct> <quantifier> '],
+ [ character => '<character_class>|<escape_sequence>|<simple_character>'],
+ [ character_class => '<a_dot>|<abbreviated_class>|<explicit_class>'],
+ [ a_dot => '\.'],
+ [ abbreviated_class => '\\\\ <[dswDSWhvHV]>'],
+ [ explicit_class => '\< <character_set>+ \>'],
+ [ character_set => '(\+|-)? \[ [ <-[\\\\\]]> | \\\\ . ]* \]'],
+ [ escape_sequence => '\\\\ <[tnrfeTNRFE]>'],
+ [ simple_character => '<-[\{\}\[\]\(\)\^\$\.\|\*\+\?\\\\]>'],
+ );
+
+p6rule_is ("a",
+ [
+ @rx_grammar,
+ [ _MASTER => '^<pattern>$' ],
+ ],
+ "matched 'a'");
+
+# Don't forget to change the number of tests :-)