Open p6rt opened 7 years ago
---------- Forwarded message ---------- From: Rong Shen \rongshenmd@​gmail\.com Date: Thu, Nov 24, 2016 at 10:11 PM Subject: [BUG] [REGEX] error : âCannot find method 'ann' on object of type NQPMuâ To: rakudobug@perl.org
My system:
uname -a Linux XubuntuVBox1404i32 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:08:14 UTC 2014 i686 i686 i686 GNU/Linux
My perl6 version:
perl6 --version This is Rakudo version 2016.07.1 built on MoarVM version 2016.07 implementing Perl 6.c.
Okay, I am still having trouble with perl6 grammar and action. I want to find a pattern in a string, and as soon as it is is found, change the pattern according to action, and return the modified string.
my $test = "xx, 1-March-23, 23.feb.21, yy foo 12/january/2099 , zzz";# want this result: xx, 010323, 230221, yy foo 120199 , zzz"; # 2 digits for day, month, year
grammar month {
regex TOP { \
But it says:
===SORRY!===Cannot find method 'ann' on object of type NQPMu
What did I do wrong ? Thank you for your help !!!
This looks like a bug in Rakudo to me, possibly related to before being part of the syntax for lookahead assertions \https://docs.perl6.org/language/regexes.html#Lookahead_assertions.
It can already be triggered with a simple / \
$ perl6 --versionThis is Rakudo version 2016.11-20-gbd42363 built on MoarVM version 2016.11-10-g0132729 implementing Perl 6.c.
$ perl6 -e '/ \
At the very least, it's a case of a less than awesome error message.
You should report this to rakudobug@perl.org, cf How to report a bug \https://github.com/rakudo/rakudo/wiki/rt-introduction.
On Mon, 05 Dec 2016 22:58:27 -0800, rongshenmd@gmail.com wrote:
------------------------------------------------------------ ---------------------
Okay, I am still having trouble with perl6 grammar and action. I want to find a pattern in a string, and as soon as it is is found, change the pattern according to action, and return the modified string.
my $test = "xx, 1-March-23, 23.feb.21, yy foo 12/january/2099 , zzz";# want this result: xx, 010323, 230221, yy foo 120199 , zzz"; # 2 digits for day, month, year
grammar month { regex TOP { \
+ } regex unit { \ \ \ } regex before { .*? } regex after { .*? }
Both `before` and `after` happen to be the names of a couple of the standard rules (for doing lookahead and lookbehind), inherited from the base Grammar class. In theory overriding these as you have is fine enough (until you try to use the built-in ones and then get confused because yours took precedence, at least ;-)).
In practice, part of the regex compiler treated the name `before` specially and then got very upset when it was not something of the form `\
What needs a bit more discussion is whether we'd like to simply leave it at that and add a spectest to codify that overriding before/after this way is fine (I'm good with this), or treat those two names a bit more specially (but then where do we draw the line on which built-ins get such treatment?)
Thanks,
/jnthn
The RT System itself - Status changed from 'new' to 'open'
Migrated from rt.perl.org#130273 (status was 'open')
Searchable as RT130273$