[phc-internals] [phc commit] r1427 - in branches/saturn: .
test/framework
codesite-noreply at google.com
codesite-noreply at google.com
Thu Jul 3 22:58:01 IST 2008
Author: paul.biggar
Date: Thu Jul 3 14:57:02 2008
New Revision: 1427
Modified:
branches/saturn/analyse.php
branches/saturn/test/framework/compile_calypso.php
Log:
For some reason, the pattern to match MIR:Methods in XML doesn't work
in some cases. Remove " from around them, instead. (Other attempts at
fixing the regex failed, unfortunately).
Modified: branches/saturn/analyse.php
==============================================================================
--- branches/saturn/analyse.php (original)
+++ branches/saturn/analyse.php Thu Jul 3 14:57:02 2008
@@ -96,8 +96,8 @@
$input = file_get_contents ("$base.xml");
// each Method starts with \"<MIR:Method>\n and ends with </MIR:Method>\n\"
- preg_match_all ("!\"(<MIR:Method>\n.*?</MIR:Method>)\n\"!sm",
$input, $matches);
-
+ $input = preg_replace ("!^\"<MIR:Method>$!sm", "<MIR:Method>", $input);
+ $input = preg_replace ("!^</MIR:Method>\n\"\n$!sm", "</MIR:Method>", $input);
// combine them with header and footer
$header =
@@ -109,7 +109,7 @@
. "<MIR:Statement_list>";
$footer = "</MIR:Statement_list>\n</MIR:PHP_script>\n";
- $combined_xml = "$header\n" . join("\n", array_reverse ($matches[1])) . "\n$footer";
+ $combined_xml = "$header\n$input\n$footer";
file_put_contents ("$base.new.xml", $combined_xml);
}
Modified: branches/saturn/test/framework/compile_calypso.php
==============================================================================
--- branches/saturn/test/framework/compile_calypso.php (original)
+++ branches/saturn/test/framework/compile_calypso.php Thu Jul 3
14:57:02 2008
@@ -48,7 +48,8 @@
}
// each Method starts with \"<MIR:Method>\n and ends with </MIR:Method>\n\"
- preg_match_all ("!\"(<MIR:Method>\n.*?</MIR:Method>)\n\"!sm",
$input, $matches);
+ $input = preg_replace ("!^\"<MIR:Method>$!sm", "<MIR:Method>", $input);
+ $input = preg_replace ("!^</MIR:Method>\n\"\n$!sm", "</MIR:Method>", $input);
// combine them with header and footer
@@ -61,7 +62,7 @@
. "<MIR:Statement_list>";
$footer = "</MIR:Statement_list>\n</MIR:PHP_script>\n";
- $combined_xml = "$header\n" . join("\n", array_reverse ($matches[1])) . "\n$footer";
+ $combined_xml = "$header\n$input\n$footer";
$async->ins[6] = $combined_xml;
}
More information about the phc-internals
mailing list