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

Lexical character classes cannot be used for complement or combined #4619

Open
p6rt opened this issue Oct 2, 2015 · 4 comments
Open

Lexical character classes cannot be used for complement or combined #4619

p6rt opened this issue Oct 2, 2015 · 4 comments
Labels
regex Regular expressions, pattern matching, user-defined grammars, tokens and rules

Comments

@p6rt
Copy link

p6rt commented Oct 2, 2015

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

Searchable as RT126252$

@p6rt
Copy link
Author

p6rt commented Oct 2, 2015

From @ronaldxs

The last two cases below fail and they should not. The problem was discussed on IRC here​: http://irclog.perlgeek.de/perl6/2015-10-02#i_11309820 .

The error in both cases on my system reads​:
Method 'hexlet' not found for invocant of class 'Cursor'
  in block <unit> at unreserved.pl6​:11

my token hexlet { <[A..F]> }

grammar G {
  token TOP { <- hexlet> }
  token hexlet { <[A..F]> }
}

say so G.parse('.');
say so G.parse('A');
say so '.' ~~ /<- alpha>/;
try { say so '.' ~~ /<- hexlet>/ }
say $!;
try { say so '.' ~~ /<[Q..Z] + hexlet>/ }
say $!;

@p6rt
Copy link
Author

p6rt commented Aug 25, 2016

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 21, 2016

From @smls

This bug is still present in
  Rakudo version 2016.09-21-g3ed51de built on MoarVM version 2016.09 implementing Perl 6.c.

Shorter test-case​:

  my token hexlet { <[A..F]> };
  say "A" ~~ /<hexlet>/; # 「A」␤ hexlet => 「A」
  say "A" ~~ /<- hexlet>/; # Method 'hexlet' not found for invocant of class 'Cursor'

@p6rt
Copy link
Author

p6rt commented Jan 7, 2017

From @ronaldxs

Possibly more complete test case​:

my token hexlet { <[A..F]> };
say "A" ~~ /<hexlet>/; # 「A」␤ hexlet => 「A」
try { # Method 'hexlet' not found for invocant of class 'Cursor'
  say "A" ~~ /<+ hexlet>/
} // say "error​: $!";
try { # also Method 'hexlet' not found for invocant of class 'Cursor'
  say "A" ~~ /<- hexlet>/
} // say "error​: $!";

@p6rt p6rt added the regex Regular expressions, pattern matching, user-defined grammars, tokens and rules label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regex Regular expressions, pattern matching, user-defined grammars, tokens and rules
Projects
None yet
Development

No branches or pull requests

1 participant