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 stopped matching a regex, related to | vs. || #4442

Closed
p6rt opened this issue Jul 25, 2015 · 5 comments
Closed

Rakudo has stopped matching a regex, related to | vs. || #4442

p6rt opened this issue Jul 25, 2015 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 25, 2015

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

Searchable as RT125690$

@p6rt
Copy link
Author

p6rt commented Jul 25, 2015

From @moritz

This script here​:

# BEGIN SCRIPT
my grammar PgTokenizer {
  token double_quote_normal { <-[\\"]>+ }
  token double_quote_escape { [\\ . ]+ }
  token double_quote {
  \"
  [
  | <.double_quote_normal>
  | <.double_quote_escape>
  ]*
  \"
  }
  token single_quote_normal { <-['\\]>+ }
  token single_quote_escape { [ \'\' || \\ . ]+ }
  token single_quote {
  \'
  [
  | <.single_quote_normal>
  | <.single_quote_escape>
  ]*
  \'
  }
  token placeholder { '?' }
  token normal { <-[?"']>+ }

  token TOP {
  ^
  (
  | <normal>
  | <placeholder>
  | <single_quote>
  | <double_quote>
  )*
  $
  }
}

say PgTokenizer.parse(q['a\.b''cd?', "\"?", ?])
# END SCRIPT

use to match successfully (and presumably did with 2015.06, otherwise
we'd have had rakudo star test failures), but doesn't match anymore with
rakudo 2015.07.

If one changes the || to | in single_quote_escape, it matches again.

I think this is a bug, because the two alternatives are mutually
exclusive, and thus | vs || shouldn't matter.

@p6rt
Copy link
Author

p6rt commented Sep 25, 2015

From @perlpilot

On Sat Jul 25 12​:03​:18 2015, moritz wrote​:

This script here​:

# BEGIN SCRIPT
my grammar PgTokenizer {
token double_quote_normal { <-[\\"]>+ }
token double_quote_escape { [\\ . ]+ }
token double_quote {
\"
[
| <.double_quote_normal>
| <.double_quote_escape>
]*
\"
}
token single_quote_normal { <-['\\]>+ }
token single_quote_escape { [ \'\' || \\ . ]+ }
token single_quote {
\'
[
| <.single_quote_normal>
| <.single_quote_escape>
]*
\'
}
token placeholder { '?' }
token normal { <-[?"']>+ }

 token TOP \{
     ^
     \(
         | \<normal>
         | \<placeholder>
         | \<single\_quote>
         | \<double\_quote>
     \)\*
     $
 \}

}

say PgTokenizer.parse(q['a\.b''cd?', "\"?", ?])
# END SCRIPT

use to match successfully (and presumably did with 2015.06, otherwise
we'd have had rakudo star test failures), but doesn't match anymore with
rakudo 2015.07.

If one changes the || to | in single_quote_escape, it matches again.

I think this is a bug, because the two alternatives are mutually
exclusive, and thus | vs || shouldn't matter.

For someone who has time to actually fix this in case I don't get to it​:

I bisected rakudo and got rakudo/rakudo@d378509 as the commit that introduced the change. Since this just bumps the NQP version, further bisection of nqp showed that Raku/nqp@5834191 was the real culprit.

that's all I've got for now.

-Scott (PerlJam/perlpilot)

@p6rt
Copy link
Author

p6rt commented Feb 14, 2019

From @AlexDaniel

Ticket moved to rakudo/rakudo#2697

On 2015-09-25 14​:06​:27, duff wrote​:

On Sat Jul 25 12​:03​:18 2015, moritz wrote​:

This script here​:

# BEGIN SCRIPT
my grammar PgTokenizer {
token double_quote_normal { <-[\\"]>+ }
token double_quote_escape { [\\ . ]+ }
token double_quote {
\"
[
| <.double_quote_normal>
| <.double_quote_escape>
]*
\"
}
token single_quote_normal { <-['\\]>+ }
token single_quote_escape { [ \'\' || \\ . ]+ }
token single_quote {
\'
[
| <.single_quote_normal>
| <.single_quote_escape>
]*
\'
}
token placeholder { '?' }
token normal { <-[?"']>+ }

token TOP {
^
(
| <normal>
| <placeholder>
| <single_quote>
| <double_quote>
)*
$
}
}

say PgTokenizer.parse(q['a\.b''cd?', "\"?", ?])
# END SCRIPT

use to match successfully (and presumably did with 2015.06, otherwise
we'd have had rakudo star test failures), but doesn't match anymore
with
rakudo 2015.07.

If one changes the || to | in single_quote_escape, it matches again.

I think this is a bug, because the two alternatives are mutually
exclusive, and thus | vs || shouldn't matter.

For someone who has time to actually fix this in case I don't get to
it​:

I bisected rakudo and got
rakudo/rakudo@d378509
as the commit that introduced the change. Since this just bumps the
NQP version, further bisection of nqp showed that
Raku/nqp@5834191
was the real culprit.

that's all I've got for now.

-Scott (PerlJam/perlpilot)

@p6rt
Copy link
Author

p6rt commented Feb 14, 2019

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

@p6rt
Copy link
Author

p6rt commented Feb 14, 2019

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

@p6rt p6rt closed this as completed Feb 14, 2019
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant