Skip to content

Commit

Permalink
API-CHANGE: updated jsmin to point at new github repo for the project
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Seidenberg committed Feb 24, 2011
1 parent eee5f3e commit 0bb424e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 30,226 deletions.
8 changes: 4 additions & 4 deletions thirdparty/jsmin/.piston.yml
@@ -1,8 +1,8 @@
---
format: 1
handler:
piston:remote-revision: 7
piston:uuid: d4d03eb5-ab2f-0410-8b36-bd473e2d5c71
commit: e71eac35ce7a0f191d199be9e35a8d12f1f999fd
branch: master
lock: false
repository_url: http://jsmin-php.googlecode.com/svn/trunk/
repository_class: Piston::Svn::Repository
repository_class: Piston::Git::Repository
repository_url: https://github.com/rgrove/jsmin-php/
44 changes: 39 additions & 5 deletions thirdparty/jsmin/jsmin.php
Expand Up @@ -73,6 +73,15 @@ public function __construct($input) {

// -- Protected Instance Methods ---------------------------------------------



/* action -- do something! What you do is determined by the argument:
1 Output A. Copy B to A. Get the next B.
2 Copy B to A. Get the next B. (Delete A).
3 Get the next B. (Delete B).
action treats a string as a single character. Wow!
action recognizes a regular expression if it is preceded by ( or , or =.
*/
protected function action($d) {
switch($d) {
case 1:
Expand Down Expand Up @@ -107,21 +116,40 @@ protected function action($d) {
if ($this->b === '/' && (
$this->a === '(' || $this->a === ',' || $this->a === '=' ||
$this->a === ':' || $this->a === '[' || $this->a === '!' ||
$this->a === '&' || $this->a === '|' || $this->a === '?')) {
$this->a === '&' || $this->a === '|' || $this->a === '?' ||
$this->a === '{' || $this->a === '}' || $this->a === ';' ||
$this->a === "\n" )) {

$this->output .= $this->a . $this->b;

for (;;) {
$this->a = $this->get();

if ($this->a === '/') {
if ($this->a === '[') {
/*
inside a regex [...] set, which MAY contain a '/' itself. Example: mootools Form.Validator near line 460:
return Form.Validator.getValidator('IsEmpty').test(element) || (/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]\.?){0,63}[a-z0-9!#$%&'*+/=?^_`{|}~-]@(?:(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\])$/i).test(element.get('value'));
*/
for (;;) {
$this->output .= $this->a;
$this->a = $this->get();

if ($this->a === ']') {
break;
} elseif ($this->a === '\\') {
$this->output .= $this->a;
$this->a = $this->get();
} elseif (ord($this->a) <= self::ORD_LF) {
throw new JSMinException('Unterminated regular expression set in regex literal.');
}
}
} elseif ($this->a === '/') {
break;
} elseif ($this->a === '\\') {
$this->output .= $this->a;
$this->a = $this->get();
} elseif (ord($this->a) <= self::ORD_LF) {
throw new JSMinException('Unterminated regular expression '.
'literal.');
throw new JSMinException('Unterminated regular expression literal.');
}

$this->output .= $this->a;
Expand All @@ -138,7 +166,7 @@ protected function get() {

if ($c === null) {
if ($this->inputIndex < $this->inputLength) {
$c = $this->input[$this->inputIndex];
$c = substr($this->input, $this->inputIndex, 1);
$this->inputIndex += 1;
} else {
$c = null;
Expand All @@ -156,6 +184,9 @@ protected function get() {
return ' ';
}

/* isAlphanum -- return true if the character is a letter, digit, underscore,
dollar sign, or non-ASCII character.
*/
protected function isAlphaNum($c) {
return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
}
Expand Down Expand Up @@ -241,6 +272,9 @@ protected function min() {
return $this->output;
}

/* next -- get the next character, excluding comments. peek() is used to see
if a '/' is followed by a '/' or '*'.
*/
protected function next() {
$c = $this->get();

Expand Down

0 comments on commit 0bb424e

Please sign in to comment.