fix FS#13122 (again): removing comment removal as early as possible

comments need to be removed before concatenating lines, otherwise
not matched brackets can cause problems on submit

Signed-off-by: Gergely Imreh <imrehg@gmail.com>
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
This commit is contained in:
Gergely Imreh 2009-05-30 14:35:08 +08:00 committed by Loui Chang
parent 51c62f2dc1
commit 0427eebaa4

View file

@ -77,6 +77,9 @@ if ($_COOKIE["AURSID"]):
$paren_depth = 0; $paren_depth = 0;
while (!feof($fp)) { while (!feof($fp)) {
$line = trim(fgets($fp)); $line = trim(fgets($fp));
# Remove comments
$line = preg_replace('/\s*#.*/', '', $line);
$char_counts = count_chars($line, 0); $char_counts = count_chars($line, 0);
$paren_depth += $char_counts[ord('(')] - $char_counts[ord(')')]; $paren_depth += $char_counts[ord('(')] - $char_counts[ord(')')];
if (substr($line, strlen($line)-1) == "\\") { if (substr($line, strlen($line)-1) == "\\") {
@ -119,9 +122,6 @@ if ($_COOKIE["AURSID"]):
# Neutralize parameter substitution # Neutralize parameter substitution
$line = preg_replace('/\${(\w+)#(\w*)}?/', '$1$2', $line); $line = preg_replace('/\${(\w+)#(\w*)}?/', '$1$2', $line);
# Remove comments
$line = preg_replace('/\s*#.*/', '', $line);
$lparts = Array(); $lparts = Array();
# Match variable assignment only. # Match variable assignment only.
if (preg_match('/^\s*[_\w]+=[^=].*/', $line, $matches)) { if (preg_match('/^\s*[_\w]+=[^=].*/', $line, $matches)) {