private function getToken($open = array(), $close = false, $str = false, $ws = false, $split = false) { $t = ""; $sPos = $this->i; $t = new token(); if ($ws === false) { $ws = $this->whiteSpace; } if ($str === false) { $str = $this->stringChars; } if ($split === false) { $split = array(); } $t->start = $this->i; if ($close === false) { do { $c = $this->data[$this->i]; if (isset($str[$c])) { $schar = $c; //$t->a($c); $t->len++; $t->t .= $c; do { $escape = $this->data[$this->i] == "\\" && !$escape; $this->i++; //$t->a($this->data{$this->i}); $t->len++; $t->t .= $this->data[$this->i]; } while ($this->i < $this->len && ($this->data[$this->i] != $schar || $escape)); } else { if (in_array($c, $open)) { $t->endChar = $c; return $t; } else { if (isset($ws[$c])) { //do nothing? } else { if (isset($split[$c])) { $t->split(); } else { //$t->a($c); $t->len++; $t->t .= $c; } } } } } while (++$this->i <= $this->len); } else { $level = 0; do { $c = $this->data[$this->i]; if (isset($str[$c])) { $schar = $c; //$t->a($c); $t->len++; $t->t .= $c; do { $escape = $this->data[$this->i] == "\\" && !$escape; $this->i++; //$t->a($this->data{$this->i}); $t->len++; $t->t .= $this->data[$this->i]; } while ($this->i < $this->len && ($this->data[$this->i] != $schar || $escape)); } else { if (in_array($c, $open)) { $level++; if ($level > 1) { //$t->a($c); $t->len++; $t->t .= $c; } } else { if (in_array($c, $close)) { $level--; if ($level > 0) { //$t->a($c); $t->len++; $t->t .= $c; } } else { if (isset($ws[$c])) { //do nothing? } else { if (isset($split[$c])) { $t->split(); } else { //$t->a($c); $t->len++; $t->t .= $c; } } } } } } while (++$this->i <= $this->len && $level > 0); $t->endChar = $this->data[$this->i - 1]; return $t; } }