Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[GGE::Perl6Regex] renamed s/parse_regex/regex/

Realized that I could call this sub if I prefixed it with a '&'. (Not doing
that still triggers sadness in Rakudo.)

Also removed no-longer-necessary parentheses in a return statement. Oh, and
a fossil comment.
  • Loading branch information...
commit 466b14fe91b51abf6ff8c06ba4e28ccb5c7ec734 1 parent fa43d23
Carl Mäsak authored May 29, 2010

Showing 1 changed file with 8 additions and 12 deletions. Show diff stats Hide diff stats

  1. 20  lib/GGE/Perl6Regex.pm
20  lib/GGE/Perl6Regex.pm
@@ -9,11 +9,6 @@ class GGE::Exp::WS is GGE::Exp::Subrule {
9 9
     method contents() {}
10 10
 }
11 11
 
12  
-# XXX: why 'is also'? Because we'd really like to do something like
13  
-# &::<GGE::Perl6Regex::parse_regex> in GGE::Match::before (and after), but
14  
-# that syntax isn't implemented yet. Thus, we do the next best thing and
15  
-# declare the GGE::Perl6Regex class in the GGE::Match module, and re-open it
16  
-# here.
17 12
 class GGE::Perl6Regex {
18 13
     has GGE::Exp $!exp;
19 14
     has Callable $!binary;
@@ -123,7 +118,8 @@ class GGE::Perl6Regex {
123 118
                     :parsed(&GGE::Perl6Regex::parse_modifier));
124 119
 
125 120
     method new($pattern, :$debug) {
126  
-        my $match = parse_regex($pattern);
  121
+        # RAKUDO: Cannot call a sub named 'regex' without the '&'
  122
+        my $match = &regex($pattern);
127 123
         die 'Perl6Regex rule error: can not parse expression'
128 124
             if $match.to < $pattern.chars;
129 125
         my $exp = perl6exp($match<expr>, { lexscope => {} });
@@ -138,8 +134,7 @@ class GGE::Perl6Regex {
138 134
         $!binary($target, :$debug);
139 135
     }
140 136
 
141  
-    # RAKUDO: Cannot call a sub named 'regex'.
142  
-    sub parse_regex($mob, :$tighter, :$stop) {
  137
+    sub regex($mob, :$tighter, :$stop) {
143 138
         return $optable.parse($mob, :$tighter, :$stop);
144 139
     }
145 140
 
@@ -265,8 +260,7 @@ class GGE::Perl6Regex {
265 260
             ++$pos;
266 261
         }
267 262
         my $subname = $target.substr($startpos, $pos - $startpos);
268  
-        # RAKUDO: Can only return one thing. Returning a list as a workaround.
269  
-        return ($subname, $pos);
  263
+        return $subname, $pos;
270 264
     }
271 265
 
272 266
     our sub parse_subrule($mob) {
@@ -284,7 +278,8 @@ class GGE::Perl6Regex {
284 278
         my $cname = $subname;
285 279
         if $target.substr($pos, 1) eq ' ' {
286 280
             $m.to = ++$pos;
287  
-            my $arg = parse_regex($m, :stop('>'));
  281
+            # RAKUDO: Cannot call a sub named 'regex' without the '&'
  282
+            my $arg = &regex($m, :stop('>'));
288 283
             return $m unless $arg;
289 284
             $m<arg> = ~$arg;
290 285
             $pos = $arg.to;
@@ -508,7 +503,8 @@ class GGE::Perl6Regex {
508 503
                 ++$m.to;
509 504
             }
510 505
             if $sep {
511  
-                my $repetition_controller = parse_regex($m, :tighter<infix:>);
  506
+                # RAKUDO: Cannot call a sub named 'regex' without the '&'
  507
+                my $repetition_controller = &regex($m, :tighter<infix:>);
512 508
                 die 'perl6regex parse error: Error in repetition controller'
513 509
                     unless $repetition_controller;
514 510
                 my $pos = $repetition_controller.to;

0 notes on commit 466b14f

Please sign in to comment.
Something went wrong with that request. Please try again.