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 allows an empty regex declaration #2226

Closed
p6rt opened this issue Oct 16, 2010 · 5 comments
Closed

Rakudo allows an empty regex declaration #2226

p6rt opened this issue Oct 16, 2010 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Oct 16, 2010

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

Searchable as RT78404$

@p6rt
Copy link
Author

p6rt commented Oct 16, 2010

From @masak

<masak> rakudo​: grammar G { regex foo { } }; say "alive"
<p6eval> rakudo 064702​: OUTPUT«alive␤»
* masak submits rakudobug
<masak> std​: grammar G { regex foo { } }
<p6eval> std 263c207​: OUTPUT«�[31m===�[0mSORRY!�[31m===�[0m␤Null
pattern not allowed [...] FAILED 00​:01 116m␤»
<masak> rakudo​: / /
<p6eval> rakudo 064702​: OUTPUT«===SORRY!===␤Null regex not allowed [...]

@p6rt
Copy link
Author

p6rt commented Jan 14, 2014

From @coke

On Sat Oct 16 11​:33​:21 2010, masak wrote​:

<masak> rakudo​: grammar G { regex foo { } }; say "alive"
<p6eval> rakudo 064702​: OUTPUT«alive␤»
* masak submits rakudobug
<masak> std​: grammar G { regex foo { } }
<p6eval> std 263c207​: OUTPUT«�[31m===�[0mSORRY!�[31m===�[0m␤Null
pattern not allowed [...] FAILED 00​:01 116m␤»
<masak> rakudo​: / /
<p6eval> rakudo 064702​: OUTPUT«===SORRY!===␤Null regex not allowed [...]

Fixed​:
16​:35 < [Coke]> r​: grammar G { regex foo { } }; say "alive" ; RT #​78404
16​:35 < synopsebot> Link​:
  https://rt-archive.perl.org/perl6//Public/Bug/Display.html?id=78404
16​:35 <+camelia> rakudo-jvm 4f66ce​: OUTPUT«===SORRY!===␤Null regex not
  allowed␤at /tmp/hdgrwlkAZv​:1␤------> grammar G { regex foo {
  ⏏} }; say "alive" ; RT #​78404␤Undeclared name​:␤ RT used at
  line 1␤␤␤»
16​:35 <+camelia> ..rakudo-parrot 4f66ce​: OUTPUT«===SORRY!===␤Null regex not
  allowed␤at /tmp/ucxkXZy_Y7​:1␤------> grammar G { regex foo {
  ⏏} }; say "alive" ; RT #​78404␤Undeclared name​:␤ RT used at
  line 1␤␤␤»
16​:35 < synopsebot> Link​:
  https://rt-archive.perl.org/perl6//Public/Bug/Display.html?id=78404
16​:35 < synopsebot> Link​:
  https://rt-archive.perl.org/perl6//Public/Bug/Display.html?id=78404

Closable with tests.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jan 14, 2014

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

@p6rt
Copy link
Author

p6rt commented Jan 15, 2014

From @moritz

On Tue Jan 14 13​:35​:37 2014, coke wrote​:

On Sat Oct 16 11​:33​:21 2010, masak wrote​:

<masak> rakudo​: grammar G { regex foo { } }; say "alive"
<p6eval> rakudo 064702​: OUTPUT«alive␤»
* masak submits rakudobug
<masak> std​: grammar G { regex foo { } }
<p6eval> std 263c207​: OUTPUT«�[31m===�[0mSORRY!�[31m===�[0m␤Null
pattern not allowed [...] FAILED 00​:01 116m␤»
<masak> rakudo​: / /
<p6eval> rakudo 064702​: OUTPUT«===SORRY!===␤Null regex not allowed
[...]

Fixed​:
16​:35 < [Coke]> r​: grammar G { regex foo { } }; say "alive" ; RT
#​78404
16​:35 < synopsebot> Link​:
https://rt-archive.perl.org/perl6//Public/Bug/Display.html?id=78404
16​:35 <+camelia> rakudo-jvm 4f66ce​: OUTPUT«===SORRY!===␤Null regex not
allowed␤at /tmp/hdgrwlkAZv​:1␤------> grammar G {
regex foo {
⏏} }; say "alive" ; RT #​78404␤Undeclared name​:␤ RT
used at
line 1␤␤␤»
16​:35 <+camelia> ..rakudo-parrot 4f66ce​: OUTPUT«===SORRY!===␤Null
regex not
allowed␤at /tmp/ucxkXZy_Y7​:1␤------> grammar G {
regex foo {
⏏} }; say "alive" ; RT #​78404␤Undeclared name​:␤ RT
used at
line 1␤␤␤»
16​:35 < synopsebot> Link​:
https://rt-archive.perl.org/perl6//Public/Bug/Display.html?id=78404
16​:35 < synopsebot> Link​:
https://rt-archive.perl.org/perl6//Public/Bug/Display.html?id=78404

Closable with tests.

Tested here​:
commit 73208bff83283e4eb1b994bfcd5ef6fd885a00ec
Author​: Moritz Lenz <mlenz@​noris.net>
Date​: Wed Jan 15 10​:58​:54 2014 +0100

  RT #​78404​: Error reporting on Null regexes

Inline Patch
diff --git a/S32-exceptions/misc.t b/S32-exceptions/misc.t
index 0d4b9ed..d361f9c 100644
--- a/S32-exceptions/misc.t
+++ b/S32-exceptions/misc.t
@@ -133,6 +133,17 @@ throws_like 'my role R { has $.x; has $.y }; 99 does R("wrong");', X::R
 # RT #73806
 throws_like q[if() {}], X::Comp::Group, sorrows => sub (@s) { @s[0] ~~ X::Syntax::KeywordAs
 
+# RT #78404
+throws_like q[my grammar G { regex foo { } }], X::Syntax::Regex::NullRegex;
+throws_like q[/ /], X::Syntax::Regex::NullRegex;
+# just an empty branch, still same error, please
+#?rakudo skip "LTA error"
+throws_like q[/ a | /], X::Syntax::Regex::NullRegex;
+#?rakudo skip "LTA error"
+throws_like q[/ a || /], X::Syntax::Regex::NullRegex;
+#?rakudo skip "LTA error"
+throws_like q[/ a & /], X::Syntax::Regex::NullRegex;
+
 
 throws_like 'sub f($a?, $b) { }', X::Parameter::WrongOrder,
     misplaced   => 'required',

@p6rt
Copy link
Author

p6rt commented Jan 15, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant