diff --git a/lib/bitter/formats/symphony.php b/lib/bitter/formats/symphony.php index ff79cd3..df742f1 100755 --- a/lib/bitter/formats/symphony.php +++ b/lib/bitter/formats/symphony.php @@ -2,7 +2,7 @@ /*----------------------------------------------------------------------------*/ class BitterFormatSymphony extends BitterFormat { - protected $tabsize = 4; + protected $tabsize = 2; protected $line = 1; protected $output = ''; @@ -19,19 +19,17 @@ public function process($source) { } protected function processTabs() { - if (!function_exists('__expander')) eval(" - function __expander(\$matches) { - return \$matches[1] . str_repeat( - ' ', strlen(\$matches[2]) * {$this->tabsize} - (strlen(\$matches[1]) % {$this->tabsize}) - ); - } - "); - while (strstr($this->output, "\t")) { - $this->output = preg_replace_callback('%^([^\t\n]*)(\t+)%m', '__expander', $this->output); + $this->output = preg_replace_callback('%^([^\t]*)(\t+)%m', array($this, 'processTabsLine'), $this->output); } } + protected function processTabsLine($matches) { + return $matches[1] . str_repeat( + ' ', strlen($matches[2]) * $this->tabsize - (strlen($matches[1]) % $this->tabsize) + ); + } + protected function processLines() { $tokens = preg_split('%(|)%', $this->output, 0, PREG_SPLIT_DELIM_CAPTURE); $stack = array(); $this->output = ''; @@ -56,9 +54,9 @@ protected function processLines() { foreach ($characters as $character) { if ($character == "\n") { - $this->endLine(); - foreach ($stack as $alt_token) $this->output .= ''; + + $this->endLine(); } $this->output .= $character;