From 18a22b79375270aa8d3f23a98130fcdf4be439c9 Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Tue, 5 Jul 2011 11:59:05 -0400 Subject: [PATCH] removed dumb Java syntax emulation idea --- min/lib/Minify/YUI/Java/Matcher.php | 81 ----------------------------- min/lib/Minify/YUI/Java/String.php | 64 ----------------------- 2 files changed, 145 deletions(-) delete mode 100644 min/lib/Minify/YUI/Java/Matcher.php delete mode 100644 min/lib/Minify/YUI/Java/String.php diff --git a/min/lib/Minify/YUI/Java/Matcher.php b/min/lib/Minify/YUI/Java/Matcher.php deleted file mode 100644 index c504896..0000000 --- a/min/lib/Minify/YUI/Java/Matcher.php +++ /dev/null @@ -1,81 +0,0 @@ -_subject = $subject; - preg_match_all($pattern, $subject, $this->_matches, PREG_OFFSET_CAPTURE); - } - - /** - * - * @return bool - */ - public function find() - { - $this->_match = current($this->_matches); - if ($this->_match) { - next($this->_matches); - return true; - } - return false; - } - - public function group($group = 0) - { - return $this->_match[0][$group]; - } - - public function start() - { - return $this->_match[1]; - } - - public function end() - { - return $this->_match[1] + strlen($this->_match[0][0]); - } - - public function appendReplacement(Minify_YUI_Java_String $string, $replacement) - { - $length = $this->start() - $this->_appendPosition; - $string->append(substr($this->_subject, $this->_appendPosition, $length)); - - $i = 0; - $newReplacement = ''; - $next = ''; - $length = strlen($replacement); - while ($i < $length) { - $curr = $replacement[$i]; - $next = ($i === ($length - 1)) ? '' : $replacement[$i + 1]; - if ($curr === '\\' && $next === '$') { - $newReplacement .= '$'; - $i += 2; - continue; - } - if ($curr === '$' && is_numeric($next) && isset($this->_match[0][(int) $next])) { - $newReplacement .= $this->_match[0][(int) $next]; - $i += 2; - continue; - } - $newReplacement .= $curr; - $i++; - } - - $string->append($newReplacement); - $this->_appendPosition = $this->end(); - } - - public function appendTail(Minify_YUI_Java_String $string) - { - $string->append(substr($this->_subject, $this->_appendPosition)); - } -} \ No newline at end of file diff --git a/min/lib/Minify/YUI/Java/String.php b/min/lib/Minify/YUI/Java/String.php deleted file mode 100644 index 63a0c37..0000000 --- a/min/lib/Minify/YUI/Java/String.php +++ /dev/null @@ -1,64 +0,0 @@ -content = $content; - } - - public function replace($target, $replacement) - { - return new self(str_replace($target, $replacement, $this->content)); - } - - public function replaceAll($regex, $replacement) - { - $pattern = '/' . str_replace('/', '\/', $regex) . '/'; - return new self(preg_replace($pattern, $replacement, $this->content)); - } - - /** - * Return position (in bytes) of string found or -1 (not FALSE!) - * @param string $needle - * @param int $offset - * @return int - */ - public function indexOf($needle, $offset = 0) { - $pos = strpos($this->content, $needle, $offset); - return ($pos === false) - ? -1 - : $pos; - } - - /** - * Get number of bytes (not characters) in string - * @return int - */ - public function length() - { - return strlen($this->content); - } - - public function toString() - { - return $this->content; - } - - public function append($str) - { - $this->content .= $str; - } -} \ No newline at end of file