Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No warning when using complex rules as a character class (/<+ident>/) #5840

Open
p6rt opened this issue Nov 29, 2016 · 4 comments
Open

No warning when using complex rules as a character class (/<+ident>/) #5840

p6rt opened this issue Nov 29, 2016 · 4 comments
Labels
LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented Nov 29, 2016

Migrated from rt.perl.org#130217 (status was 'open')

Searchable as RT130217$

@p6rt
Copy link
Author

p6rt commented Nov 29, 2016

From @AlexDaniel

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​: Raku/doc#973
Related IRC discussion​: https://irclog.perlgeek.de/perl6/2016-11-29#i_13650256

@p6rt
Copy link
Author

p6rt commented Nov 29, 2016

From @geekosaur

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).

--
brandon s allbery kf8nh sine nomine associates
allbery.b@​gmail.com ballbery@​sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

@p6rt
Copy link
Author

p6rt commented Nov 29, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Nov 29, 2016

From @AlexDaniel

Oh, OK. I created another ticket for that​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=130218

On 2016-11-29 14​:04​:12, allbery.b@​gmail.com wrote​:

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).

@p6rt p6rt added the LTA Less Than Awesome; typically an error message that could be better label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

1 participant