Skip Menu |
Report information
Id: 130217
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: alex.jakimenko [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [LTA] No warning when using complex rules as a character class (/<+ident>/)
Download (untitled) / with headers
text/plain 898b
Code: say ‘25_8thelloworld_234aeou’ ~~ / <+ident +[∞]> / Result: 「_8thelloworld_234aeou」 Code: say ‘25∞_8thelloworld_234aeou’ ~~ / <+ident +[∞]> / Result: ∞ Obviously, <ident> is not a character class, but you can still use like if it was. More generally, you can use *any* rule exactly the same way, as long as it is in the grammar: Code: grammar Blah { rule TOP { <+foo -bar> }; rule foo { .+ }; rule bar { <[def]>+ } }; say Blah.parse(‘abcdefgh’)' Result 「abcdefgh」 Obviously, the code above does not make any sense, which is why I think Perl 6 should be smart enough to give a warning in this case. Could be something like “attempt to use a complex rule as a character class” or something along the lines. Related doc ticket: https://github.com/perl6/doc/issues/973 Related IRC discussion: https://irclog.perlgeek.de/perl6/2016-11-29#i_13650256
Date: Tue, 29 Nov 2016 17:03:43 -0500
To: perl6-compiler <perl6-compiler [...] perl.org>
From: Brandon Allbery <allbery.b [...] gmail.com>
CC: bugs-bitbucket [...] rt.perl.org
Subject: Re: [perl #130217] [LTA] No warning when using complex rules as a character class (/<+ident>/)
Download (untitled) / with headers
text/plain 1017b

On Tue, Nov 29, 2016 at 4:53 PM, Aleks-Daniel Jakimenko-Aleksejev <perl6-bugs-followup@perl.org> wrote:
Show quoted text
Obviously, the code above does not make any sense, which is why I think Perl 6 should be smart enough to give a warning in this case.
Could be something like “attempt to use a complex rule as a character class” or something along the lines.

There's another similar confusion that I asked the finder to file as a bug, but I don't recall if they did: if you define a rule named "before" or "after", it changes the meaning of the "<before ...>" and "<!after ...>" constructs, which are still parsed as if they are lookahead/behind but then behave as the user defined rule (or as whatever the regex engine makes of trying to negate them, if you used those forms).

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
Oh, OK. I created another ticket for that: https://rt.perl.org/Ticket/Display.html?id=130218

On 2016-11-29 14:04:12, allbery.b@gmail.com wrote:
Show quoted text
> On Tue, Nov 29, 2016 at 4:53 PM, Aleks-Daniel Jakimenko-Aleksejev <
> perl6-bugs-followup@perl.org> wrote:
>
> > Obviously, the code above does not make any sense, which is why I think
> > Perl 6 should be smart enough to give a warning in this case.
> > Could be something like “attempt to use a complex rule as a character
> > class” or something along the lines.
> >
>
> There's another similar confusion that I asked the finder to file as a bug,
> but I don't recall if they did: if you define a rule named "before" or
> "after", it changes the meaning of the "<before ...>" and "<!after ...>"
> constructs, which are still parsed as if they are lookahead/behind but then
> behave as the user defined rule (or as whatever the regex engine makes of
> trying to negate them, if you used those forms).
>




This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org