Permalink
Browse files

Mise en place d'un portage plus récent de jsmin-php

  • Loading branch information...
1 parent 25a825c commit 1431421fcab8f2489f1157314eb88a23a9cd7ebb @dsferruzza committed Aug 1, 2012
Showing with 17 additions and 8 deletions.
  1. +15 −6 lib/jsmin-php/jsmin.php
  2. +2 −2 lib/moteur/deps.txt
View
@@ -59,6 +59,8 @@ class JSMin {
protected $inputIndex = 0;
protected $inputLength = 0;
protected $lookAhead = null;
+ protected $y = null;
+ protected $x = null;
protected $output = '';
// -- Public Static Methods --------------------------------------------------
@@ -111,6 +113,9 @@ protected function action($command) {
switch($command) {
case self::ACTION_KEEP_A:
$this->output .= $this->a;
+ if ($this->a == $this->b && ($this->a == '+' || $this->a == '-') && $this->y != $this->a) {
+ $this->output .= ' ';
+ }
case self::ACTION_DELETE_A:
$this->a = $this->b;
@@ -124,7 +129,8 @@ protected function action($command) {
break;
}
- if (ord($this->a) <= self::ORD_LF) {
+ //if (ord($this->a) <= self::ORD_LF) {
+ if ($this->a === null) {
throw new JSMinException('Unterminated string literal.');
}
@@ -164,17 +170,19 @@ protected function action($command) {
} 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 (ord($this->a) <= self::ORD_LF) {
+ } elseif ($this->a === null) {
+ throw new JSMinException('Unterminated set in Regular Expression 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.');
+ //} elseif (ord($this->a) <= self::ORD_LF) {
+ } elseif ($this->a === null) {
+ throw new JSMinException('Unterminated Regular Expression literal.');
}
$this->output .= $this->a;
@@ -198,6 +206,8 @@ protected function get() {
if ($this->inputIndex < $this->inputLength) {
$c = substr($this->input, $this->inputIndex, 1);
$this->inputIndex += 1;
+ $this->y = $this->x;
+ $this->x = $c;
} else {
$c = null;
}
@@ -383,4 +393,3 @@ protected function peek() {
// -- Exceptions ---------------------------------------------------------------
class JSMinException extends Exception {}
-?>
View
@@ -6,5 +6,5 @@ CSSTidy
v1.4 (19eb2cf21b)
jsmin-php
- https://github.com/rgrove/jsmin-php/
- 6025086f2a
+ https://github.com/jaydiablo/jsmin-php
+ 22671b1b1e

0 comments on commit 1431421

Please sign in to comment.