Skip to content
This repository
Browse code

Use PIR for simpler code. Thanks masak++!

  • Loading branch information...
commit 1311963cd3ea733f5aa942e97f8759ae48c62f16 1 parent 9dc4827
authored November 24, 2009

Showing 1 changed file with 3 additions and 7 deletions. Show diff stats Hide diff stats

  1. 10  lib/URI/Grammar.pm
10  lib/URI/Grammar.pm
@@ -4,13 +4,9 @@ grammar URI::Grammar {
4 4
     token scheme     { <-[:/&?#]>+ };
5 5
     token authority  { <host> [':' <port>]? };
6 6
     token host       { <-[/&?#:]>* };
7  
-    token port       { <pt6553X>|<pt655XX>|<pt65XXX>|<pt6XXXX>|<pt10K>|<ptLow> };
8  
-    token ptLow      { \d**1..4 };
9  
-    token pt10K      { <[1..5]>\d**4 };
10  
-    token pt6XXXX    { 6<[0..4]>\d**3 };
11  
-    token pt65XXX    { 65<[0..4]>\d**2 };
12  
-    token pt655XX    { 655<[0..2]>\d };
13  
-    token pt6553X    { 6553<[0..5]> };
  7
+    token port       { (\d**1..5) 
  8
+        <?{{$I0 = match[0]␤$I1 = 0␤if $I0 > 65535 goto fail␤$I1 = 1␤fail:␤.return ($I1) }}>
  9
+        <!before \d> };
14 10
     token path       { <slash>? [ <chunk> '/'?]* }; # * mb wrong, because that allow '' URI
15 11
     token slash      { '/' };
16 12
     token chunk      { <-[/?#]>+ };

0 notes on commit 1311963

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