From 6082b89eb49c0f3182728a7b7c05c00c900e3918 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 9 Feb 2011 09:12:21 -0800 Subject: [PATCH] Use the '(?P<' syntax instead of '(?<' for capturing named subgroups. --- src/parser/diff/ArcanistDiffParser.php | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/parser/diff/ArcanistDiffParser.php b/src/parser/diff/ArcanistDiffParser.php index cbc92087..fec00d3e 100644 --- a/src/parser/diff/ArcanistDiffParser.php +++ b/src/parser/diff/ArcanistDiffParser.php @@ -176,18 +176,18 @@ class ArcanistDiffParser { do { $patterns = array( // This is a normal SVN text change, probably from "svn diff". - '(?Index): (?.+)', + '(?PIndex): (?P.+)', // This is an SVN property change, probably from "svn diff". - '(?Property changes on): (?.+)', + '(?PProperty changes on): (?P.+)', // This is a git commit message, probably from "git show". - '(?commit) (?[a-f0-9]+)', + '(?Pcommit) (?P[a-f0-9]+)', // This is a git diff, probably from "git show" or "git diff". - '(?diff --git) a/(?.+) b/(?.+)', + '(?Pdiff --git) a/(?P.+) b/(?P.+)', // This is a unified diff, probably from "diff -u" or synthetic diffing. - '(?---) (?.+)\s+\d{4}-\d{2}-\d{2}.*', - '(?Binary) files '. - '(?.+)\s+\d{4}-\d{2}-\d{2} and '. - '(?.+)\s+\d{4}-\d{2}-\d{2} differ.*', + '(?P---) (?P.+)\s+\d{4}-\d{2}-\d{2}.*', + '(?PBinary) files '. + '(?P.+)\s+\d{4}-\d{2}-\d{2} and '. + '(?P.+)\s+\d{4}-\d{2}-\d{2} differ.*', ); $ok = false; @@ -419,17 +419,17 @@ class ArcanistDiffParser { do { $patterns = array( - '(?new) file mode (?\d+)', - '(?deleted) file mode (?\d+)', + '(?Pnew) file mode (?P\d+)', + '(?Pdeleted) file mode (?P\d+)', // These occur when someone uses `chmod` on a file. - 'old mode (?\d+)', - 'new mode (?\d+)', + 'old mode (?P\d+)', + 'new mode (?P\d+)', // These occur when you `mv` a file and git figures it out. 'similarity index ', - 'rename from (?.*)', - '(?rename) to (?.*)', - 'copy from (?.*)', - '(?copy) to (?.*)' + 'rename from (?P.*)', + '(?Prename) to (?P.*)', + 'copy from (?P.*)', + '(?Pcopy) to (?P.*)' ); $ok = false; @@ -576,7 +576,7 @@ class ArcanistDiffParser { $line = $this->getLine(); $matches = null; $ok = preg_match( - '@^[-+]{3} (?:[ab]/)?(?.*?)(?:\s*\(.*\))?$@', + '@^[-+]{3} (?:[ab]/)?(?P.*?)(?:\s*\(.*\))?$@', $line, $matches); if (!$ok) {