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

Rakudo has problems with general quantifier in regexes #1979

Closed
p6rt opened this issue Jul 29, 2010 · 5 comments
Closed

Rakudo has problems with general quantifier in regexes #1979

p6rt opened this issue Jul 29, 2010 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jul 29, 2010

Migrated from rt.perl.org#76792 (status was 'resolved')

Searchable as RT76792$

@p6rt
Copy link
Author

p6rt commented Jul 29, 2010

From @moritz

09​:07 <@​szabgab> rakudo​: say "a b,c,d" ~~ rule { a \w ** [\,] }
09​:07 <+p6eval> rakudo 9fd5ea​: OUTPUT«a b?»
09​:08 <@​szabgab> can anyone help me to understand why this does not
match the whole string?
09​:08 < moritz_> rakudo​: say "a b,c,d" ~~ rule { a \w**[\,] }
09​:08 <+p6eval> rakudo 9fd5ea​: OUTPUT«a b?»
09​:08 < moritz_> rakudo​: say "a b,c,d" ~~ rule { a \w**\, }
09​:08 < sorear> [\,] seems very contrived
09​:08 <+p6eval> rakudo 9fd5ea​: OUTPUT«a b?»
09​:09 < moritz_> sorear​: still it should work, no?
09​:09 < sorear> should
09​:09 <@​szabgab> oh, right I don't need the [] at the end
09​:10 < moritz_> rakudo​: say "a b,c,d" ~~ rule { a \w[\,\w]* }
09​:10 <+p6eval> rakudo 9fd5ea​: OUTPUT«a b,c,d?»
09​:12 < moritz_> rakudo​: say "a b,c,d" ~~ token { a <.ws> \w ** \, }
09​:12 <@​szabgab> moritz_​: yes, that's a workaround :)
09​:12 <@​szabgab> thanks
09​:12 <+p6eval> rakudo 9fd5ea​: OUTPUT«a b?»

I kinda expect \w ** \, to match 'b,c,d', and the last evalbot line
shows that it's not a problem with whitespaces.

@p6rt
Copy link
Author

p6rt commented Jul 29, 2010

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

@p6rt
Copy link
Author

p6rt commented Jul 30, 2010

From @pmichaud

Now fixed in 50e0e7e​:

say 'a b,c,d' ~~ token { \w \s \w ** \, }
a b,c,d

Assigning to moritz++ for spectest coverage.

Pm

@p6rt
Copy link
Author

p6rt commented Aug 2, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S05-metasyntax/repeat.t

commit c3a2cd0aced0bcb0960d03aeca8152e316011bfc
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Mon Aug 2 19​:32​:21 2010 +0000

  [t/spec] test for RT #​76792, ** and \w interact badly in regexes
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31889 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S05-metasyntax/repeat.t b/t/spec/S05-metasyntax/repeat.t
index a467b93..6f57666 100644
--- a/t/spec/S05-metasyntax/repeat.t
+++ b/t/spec/S05-metasyntax/repeat.t
@@ -14,7 +14,7 @@ be valid perl6.
 
 # Note: single-quotes.t tests repetition on single quoted items in regexes.
 
-plan 21;
+plan 22;
 
 # L<S05/Bracket rationalization/The general repetition specifier is now>
 
@@ -57,4 +57,7 @@ ok 'a, b, c' !~~ /:s^<alpha>**\,$/, 'with no spaces around **, no spaces can be
 ok 'a, b, c'  ~~ /:s^ <alpha> ** \, $/, 'with spaces around **, spaces can be matched';
 ok 'a , b ,c' ~~ /:s^ <alpha> ** \, $/, 'same, but with leading spaces';
 
+# RT #76792
+ok ('a b,c,d' ~~ token { \w \s \w ** \, }), 'can combine ** with backslash character classes';
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Aug 2, 2010

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Aug 2, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant