You are here

protected function JSMin::next in Javascript Aggregator 5

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

File

./jsmin.php, line 244

Class

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

Code

protected function next() {
  $c = $this
    ->get();
  if ($c === '/') {
    switch ($this
      ->peek()) {
      case '/':
        for (;;) {
          $c = $this
            ->get();
          if (ord($c) <= self::ORD_LF) {
            return $c;
          }
        }
      case '*':
        $this
          ->get();
        for (;;) {
          switch ($this
            ->get()) {
            case '*':
              if ($this
                ->peek() === '/') {
                $this
                  ->get();
                return ' ';
              }
              break;
            case null:
              throw new JSMinException('Unterminated comment.');
          }
        }
      default:
        return $c;
    }
  }
  return $c;
}