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

"Iteration Past End" with Empty Character Class that has unescaped space in it #6010

Closed
p6rt opened this issue Jan 19, 2017 · 5 comments
Closed
Labels
regex Regular expressions, pattern matching, user-defined grammars, tokens and rules

Comments

@p6rt
Copy link

p6rt commented Jan 19, 2017

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

Searchable as RT130586$

@p6rt
Copy link
Author

p6rt commented Jan 19, 2017

From @zoffixznet

the :sigspace adverb does not affect spaces inside character class. Should it?

Note that having JUST space inside also causes a weird error to be thrown​:

<Zoffix> m​: say " " ~~ m​:s/<-[ ]>/
<camelia> rakudo-moar 1aeea1​: OUTPUT«===SORRY!===␤Iteration past end of iterator␤»

<Zoffix> m​: say " " ~~ m​:s/<-[x ]>/
<camelia> rakudo-moar 1aeea1​: OUTPUT«「 」␤»
<Zoffix> m​: say " " ~~ m​:s/<-[ x]>/
<camelia> rakudo-moar 1aeea1​: OUTPUT«「 」␤»
<Zoffix> m​: say " " ~~ m​:sigspace/<-[ x]>/

<camelia> rakudo-moar 1aeea1​: OUTPUT«「 」␤»
<Zoffix> m​: say " " ~~ m​:sigspace/<[x ]>/

Discovery​: https://irclog.perlgeek.de/perl6/2017-01-19#i_13948706

@p6rt
Copy link
Author

p6rt commented Jan 21, 2017

From @jnthn

On Wed, 18 Jan 2017 18​:16​:20 -0800, cpan@​zoffix.com wrote​:

the :sigspace adverb does not affect spaces inside character class.
Should it?

No, I don't think so. `<.ws>` can match any number of characters (including zero). A char class is defining something a matcher for a single character.

Note that having JUST space inside also causes a weird error to be
thrown​:

<Zoffix> m​: say " " ~~ m​:s/<-[ ]>/
<camelia> rakudo-moar 1aeea1​: OUTPUT«===SORRY!===␤Iteration past end
of iterator␤»

That one's certainly a bug. Since whitespace in a charclass is not significant, then it should complain about an empty charclass, preferably with a hint about space.

<Zoffix> m​: say " " ~~ m​:s/<-[x ]>/
<camelia> rakudo-moar 1aeea1​: OUTPUT«「 」␤»
This matches because it's the same as m​:s/<-[x]>/. You'd need to write <-[x\ ]> to make the space significant.

<Zoffix> m​: say " " ~~ m​:s/<-[ x]>/
<camelia> rakudo-moar 1aeea1​: OUTPUT«「 」␤»
Ditto.

/jnthn

@p6rt
Copy link
Author

p6rt commented Jan 21, 2017

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

@p6rt
Copy link
Author

p6rt commented Mar 17, 2018

From @AlexDaniel

Further discussion on rakudo/rakudo#1622.

On 2017-01-21 14​:13​:42, jnthn@​jnthn.net wrote​:

On Wed, 18 Jan 2017 18​:16​:20 -0800, cpan@​zoffix.com wrote​:

the :sigspace adverb does not affect spaces inside character class.
Should it?

No, I don't think so. `<.ws>` can match any number of characters
(including zero). A char class is defining something a matcher for a
single character.

Note that having JUST space inside also causes a weird error to be
thrown​:

<Zoffix> m​: say " " ~~ m​:s/<-[ ]>/
<camelia> rakudo-moar 1aeea1​: OUTPUT«===SORRY!===␤Iteration past end
of iterator␤»

That one's certainly a bug. Since whitespace in a charclass is not
significant, then it should complain about an empty charclass,
preferably with a hint about space.

<Zoffix> m​: say " " ~~ m​:s/<-[x ]>/
<camelia> rakudo-moar 1aeea1​: OUTPUT«「 」␤»
This matches because it's the same as m​:s/<-[x]>/. You'd need to write
<-[x\ ]> to make the space significant.

<Zoffix> m​: say " " ~~ m​:s/<-[ x]>/
<camelia> rakudo-moar 1aeea1​: OUTPUT«「 」␤»
Ditto.

/jnthn

@p6rt
Copy link
Author

p6rt commented Mar 17, 2018

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

@p6rt p6rt closed this as completed Mar 17, 2018
@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