32 $this->
split = array();
34 $this->doubleDash =
false;
36 for ($i = 0; $i < strlen($line); $i++) {
38 $next = (isset($line[$i+1])) ? $line[$i+1] :
'';
39 $prev = (isset($line[$i-1])) ? $line[$i-1] :
'';
42 $this->
append(
'comment', $char);
43 if ($this->multiLine && $char ==
'/' && $prev ==
'*') {
44 $this->multiLine =
false;
48 $this->
append(
'string', $char);
50 if ($this->singleQuote && $char ==
'\'') {
51 $this->singleQuote =
false;
52 } elseif ($this->doubleQuote && $char ==
'"') {
53 $this->doubleQuote =
false;
59 } elseif ($char ==
'-' && $next ==
'-') {
60 $this->doubleDash =
true;
61 } elseif ($char ==
'/' && $next ==
'*') {
62 $this->multiLine =
true;
63 } elseif ($char ==
';') {
64 $this->
append(
'break', $char);
65 } elseif ($char ==
'\'') {
66 $this->singleQuote =
true;
67 $this->
append(
'string', $char);
68 } elseif ($char ==
'"') {
69 $this->doubleQuote =
true;
70 $this->
append(
'string', $char);
72 $this->
append(
'code', $char);
84 foreach (
$split as $statement) {
85 $type = $statement[
'type'];
87 if ($type ==
'code') {
88 $append = preg_replace(
'/\s+/',
' ', $statement[
'string']);
90 if (substr($this->parsedString, -1) ==
' ' && $append[0] ==
' ') {
91 $append = ltrim($append);
94 $this->parsedString .= $append;
95 } elseif ($type ==
'string') {
96 $this->parsedString .= $statement[
'string'];
97 } elseif ($type ==
'break') {
98 $finished[] = trim($this->parsedString);
99 $this->parsedString =
'';