I think its a bug like Bug #75644 for Regexp-Grammars: debug does not work
You can workaround by following http://search.cpan.org/src/DCONWAY/Regexp-Grammars-1.016/t/backref.t and http://search.cpan.org/src/DCONWAY/Regexp-Grammars-1.016/t/backref_ARG.t, which DO NOT test this (your) example from the docs
The workaround does work
#!/usr/bin/perl -- use strict; use warnings; use Data::Dumper; my $grammar = do { use Regexp::Grammars; qr{ <debug:on> <delimited_string> <token: delimited_string> <delim=(['"`])> <content=(.*?)> <rdel=\delim> }xms; }; my $string = "'hi'"; if ($string =~ $grammar) { print Dumper \%/; } __END__ =====> Trying <grammar> from position 0 'hi' |...Trying <delimited_string> | |...Trying <delim=(['"`])> hi' | | \_____<delim=(['"`])> matched ''' | |...Trying <content=(.*?)> | | \_____<content=(.*?)> matched '' | |...Trying <rdel=\delim> | | \FAIL <rdel=\delim> i' | | \_____<content=(.*?)> matched 'h' | |...Trying <rdel=\delim> | | \FAIL <rdel=\delim> ' | | \_____<content=(.*?)> matched 'hi' | |...Trying <rdel=\delim> [eos] | | \_____<rdel=\delim> matched ''' | \_____<delimited_string> matched ''hi'' \_____<grammar> matched ''hi'' $VAR1 = { '' => '\'hi\'', 'delimited_string' => { '' => '\'hi\'', 'content' => 'hi', 'delim' => '\'', 'rdel' => '\'' } };
Regexp::Grammars::Common::String use this syntax
You should report this bug upstream , maybe write this example as a test case following t/backref*
In reply to Re: The usage of <ALIAS=\IDENT> of Regexp::Grammars
by Anonymous Monk
in thread The usage of <ALIAS=\IDENT> of Regexp::Grammars
by 0FGVYqxHQZ
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |