]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Use the '(?P<' syntax instead of '(?<' for capturing named subgroups.
authorepriestley <epriestley@phabricator.com>
Wed, 9 Feb 2011 17:12:21 +0000 (09:12 -0800)
committerepriestley <epriestley@phabricator.com>
Wed, 9 Feb 2011 17:12:21 +0000 (09:12 -0800)
src/parser/diff/ArcanistDiffParser.php

index cbc920872a67ab9fc8138e37e322d5d04edc130c..fec00d3ef9f1d8bc9db4c905e88dc905649fdfc5 100644 (file)
@@ -176,18 +176,18 @@ class ArcanistDiffParser {
     do {
       $patterns = array(
         // This is a normal SVN text change, probably from "svn diff".
-        '(?<type>Index): (?<cur>.+)',
+        '(?P<type>Index): (?P<cur>.+)',
         // This is an SVN property change, probably from "svn diff".
-        '(?<type>Property changes on): (?<cur>.+)',
+        '(?P<type>Property changes on): (?P<cur>.+)',
         // This is a git commit message, probably from "git show".
-        '(?<type>commit) (?<hash>[a-f0-9]+)',
+        '(?P<type>commit) (?P<hash>[a-f0-9]+)',
         // This is a git diff, probably from "git show" or "git diff".
-        '(?<type>diff --git) a/(?<old>.+) b/(?<cur>.+)',
+        '(?P<type>diff --git) a/(?P<old>.+) b/(?P<cur>.+)',
         // This is a unified diff, probably from "diff -u" or synthetic diffing.
-        '(?<type>---) (?<old>.+)\s+\d{4}-\d{2}-\d{2}.*',
-        '(?<binary>Binary) files '.
-          '(?<old>.+)\s+\d{4}-\d{2}-\d{2} and '.
-          '(?<new>.+)\s+\d{4}-\d{2}-\d{2} differ.*',
+        '(?P<type>---) (?P<old>.+)\s+\d{4}-\d{2}-\d{2}.*',
+        '(?P<binary>Binary) files '.
+          '(?P<old>.+)\s+\d{4}-\d{2}-\d{2} and '.
+          '(?P<new>.+)\s+\d{4}-\d{2}-\d{2} differ.*',
       );
 
       $ok = false;
@@ -419,17 +419,17 @@ class ArcanistDiffParser {
       do {
 
         $patterns = array(
-          '(?<new>new) file mode (?<newmode>\d+)',
-          '(?<deleted>deleted) file mode (?<oldmode>\d+)',
+          '(?P<new>new) file mode (?P<newmode>\d+)',
+          '(?P<deleted>deleted) file mode (?P<oldmode>\d+)',
           // These occur when someone uses `chmod` on a file.
-          'old mode (?<oldmode>\d+)',
-          'new mode (?<newmode>\d+)',
+          'old mode (?P<oldmode>\d+)',
+          'new mode (?P<newmode>\d+)',
           // These occur when you `mv` a file and git figures it out.
           'similarity index ',
-          'rename from (?<old>.*)',
-          '(?<move>rename) to (?<cur>.*)',
-          'copy from (?<old>.*)',
-          '(?<copy>copy) to (?<cur>.*)'
+          'rename from (?P<old>.*)',
+          '(?P<move>rename) to (?P<cur>.*)',
+          'copy from (?P<old>.*)',
+          '(?P<copy>copy) to (?P<cur>.*)'
         );
 
         $ok = false;
@@ -576,7 +576,7 @@ class ArcanistDiffParser {
     $line = $this->getLine();
     $matches = null;
     $ok = preg_match(
-      '@^[-+]{3} (?:[ab]/)?(?<path>.*?)(?:\s*\(.*\))?$@',
+      '@^[-+]{3} (?:[ab]/)?(?P<path>.*?)(?:\s*\(.*\))?$@',
       $line,
       $matches);
     if (!$ok) {