# New Ticket Created by  Moritz Lenz 
# Please include the string:  [perl #121006]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=121006 >


< moritz> p: /a | /
<+camelia> rakudo-parrot 4f66ce: OUTPUT«===SORRY!===␤Unrecognized regex 
metacharacter | (must be quoted to match literally)␤at 
/tmp/zXzH2EnbDL:1␤------> /a | ⏏/␤Unable to parse regex;  couldn't find 
final '/'␤at /tmp/zXzH2EnbDL:1␤------> /…»

This should be reported as null pattern instead:

< moritz> std: /a | /
<+camelia> std 09dda5b: OUTPUT«===SORRY!===␤Null pattern not allowed at 
  /tmp/bw6vpvA5Z0 line 1:␤------> /a | ⏏/␤Parse failed␤FAILED  00:01 122m␤»

I have already added tests for that:

commit 73208bff83283e4eb1b994bfcd5ef6fd885a00ec
Author: Moritz Lenz <[email protected]>
Date:   Wed Jan 15 10:58:54 2014 +0100

     RT #78404: Error reporting on Null regexes

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',

Reply via email to