You are here

protected function JSMin::action in Javascript Aggregator 5

Same name and namespace in other branches
  1. 6 jsmin.php \JSMin::action()
1 call to JSMin::action()
JSMin::min in ./jsmin.php

File

./jsmin.php, line 76

Class

JSMin
jsmin.php - PHP implementation of Douglas Crockford's JSMin.

Code

protected function action($d) {
  switch ($d) {
    case 1:
      $this->output .= $this->a;
    case 2:
      $this->a = $this->b;
      if ($this->a === "'" || $this->a === '"') {
        for (;;) {
          $this->output .= $this->a;
          $this->a = $this
            ->get();
          if ($this->a === $this->b) {
            break;
          }
          if (ord($this->a) <= self::ORD_LF) {
            throw new JSMinException('Unterminated string literal.');
          }
          if ($this->a === '\\') {
            $this->output .= $this->a;
            $this->a = $this
              ->get();
          }
        }
      }
    case 3:
      $this->b = $this
        ->next();
      if ($this->b === '/' && ($this->a === '(' || $this->a === ',' || $this->a === '=' || $this->a === ':' || $this->a === '[' || $this->a === '!' || $this->a === '&' || $this->a === '|' || $this->a === '?')) {
        $this->output .= $this->a . $this->b;
        for (;;) {
          $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 ' . 'literal.');
          }
          $this->output .= $this->a;
        }
        $this->b = $this
          ->next();
      }
  }
}