develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33882 - trunk/languages/perl6/src/parser

From:
pmichaud
Date:
December 14, 2008 07:47
Subject:
[svn:parrot] r33882 - trunk/languages/perl6/src/parser
Message ID:
20081214154725.265AACBA12@x12.develooper.com
Author: pmichaud
Date: Sun Dec 14 07:47:24 2008
New Revision: 33882

Modified:
   trunk/languages/perl6/src/parser/grammar.pg

Log:
[rakudo]:  Adjust grammar to use <?{{...}}> assertion syntax.


Modified: trunk/languages/perl6/src/parser/grammar.pg
==============================================================================
--- trunk/languages/perl6/src/parser/grammar.pg	(original)
+++ trunk/languages/perl6/src/parser/grammar.pg	Sun Dec 14 07:47:24 2008
@@ -61,22 +61,24 @@
 ##  last ws token matched.
 
 token ws {
-    ##  STD.pm: <?{ $ยข.pos === $!ws_to }>
-    {{  $P0 = get_global '$!ws'
-        if null $P0 goto end
-        $P1 = $P0.'to'()
-        $P2 = match.'to'()
-        if $P1 != $P2 goto end
-        .return (1)
-      end:
-        set_global '$!ws', match
-    }}
-    <!ww>
-    [
-    | <.unsp>
-    | \v+
-    | <.unv>
-    ]*
+    ## short circuit
+    [ <?{{ $P0 = get_global '$!ws'
+           if null $P0 goto noshort
+           $P1 = $P0.'to'()
+           $P2 = match.'to'()
+           if $P1 != $P2 goto noshort
+           .return (1)
+         noshort:
+           set_global '$!ws', match
+           .return (0)
+      }}>
+    | <!ww>
+      [
+      | <.unsp>
+      | \v+
+      | <.unv>
+      ]*
+    ]
 }
 
 token unsp {



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About