85 define(
'JSMIN_VERSION', 
'0.2');
 
   99 define(
'ORD_NL', ord(
"\n"));
 
  100 define(
'ORD_space', ord(
' '));
 
  101 define(
'ORD_cA', ord(
'A'));
 
  102 define(
'ORD_cZ', ord(
'Z'));
 
  103 define(
'ORD_a', ord(
'a'));
 
  104 define(
'ORD_z', ord(
'z'));
 
  105 define(
'ORD_0', ord(
'0'));
 
  106 define(
'ORD_9', ord(
'9'));
 
  150 define (
'JSMIN_ACT_FULL', 1);
 
  156 define (
'JSMIN_ACT_BUF', 2);
 
  162 define (
'JSMIN_ACT_IMM', 3);
 
  227             $c === 
'_' || $c === 
'$' || $c === 
'\\' || $a > 126
 
  244                 if ($this->isString) {
 
  245                         if ($this->inPos < $this->inLength) {
 
  254                 $c = $this->in->fgetc();
 
  258         if ($c === 
"\n" || $c === 
EOF || ord($c) >= 
ORD_space) {
 
  285                 if ($this->isString) {
 
  286                         if ($this->inPos < $this->inLength) {
 
  296                 $c = $this->in->fgetc();
 
  300                 $this->in->fseek(-1, SEEK_CUR);
 
  314                 if ($this->isString) {
 
  318                         $this->out->fwrite($c);
 
  343             switch ($this->
peek()) {
 
  374                             if ($this->
peek() == 
'/') {
 
  382                         else if ($c === 
EOF) {
 
  387                             trigger_error(
'UnterminatedComment', E_USER_ERROR);
 
  429                 $this->
put($this->theA);
 
  440                 if ($tmpA == 
'\'' || $tmpA == 
'"') {
 
  452                         $tmpA = $this->theA = $this->
get();
 
  454                         if ($tmpA == $this->theB) {
 
  463                         if (ord($tmpA) <= 
ORD_NL) {
 
  468                             trigger_error(
'UnterminatedStringLiteral', E_USER_ERROR);
 
  478                             $tmpA = $this->theA = $this->
get();
 
  487                 $this->theB = $this->
next();
 
  494                 if ($this->theB == 
'/' && ($tmpA == 
'(' || $tmpA == 
',' || $tmpA == 
'=')) {
 
  499                     $this->
put($this->theB);
 
  506                         $tmpA = $this->theA = $this->
get();
 
  522                             $tmpA = $this->theA = $this->
get();
 
  524                         else if (ord($tmpA) <= 
ORD_NL) {
 
  529                             trigger_error(
'UnterminatedRegExpLiteral', E_USER_ERROR);
 
  539                     $this->theB = $this->
next();
 
  545                                 trigger_error(
'Expected a JSMin::ACT_* constant in action()', E_USER_ERROR);
 
  573         while ($this->theA !== 
EOF) {
 
  575             switch ($this->theA) {
 
  589                     switch ($this->theB) {
 
  591                         case '{' : 
case '[' : 
case '(' :
 
  592                         case '+' : 
case '-' :
 
  617                     switch ($this->theB) {
 
  634                             switch ($this->theA) {
 
  636                                 case '}' : 
case ']' : 
case ')' : 
case '+' :
 
  637                                 case '-' : 
case '"' : 
case '\'' :
 
  666             if ($this->isString) {
 
  682         function JSMin($inFileName = 
'-', $outFileName = 
'-', $comments = NULL) {
 
  683                 if ($outFileName === FALSE) {
 
  687                         $this->
JSMin_File($inFileName, $outFileName, $comments);
 
  691     function JSMin_File($inFileName = 
'-', $outFileName = 
'-', $comments = NULL) {
 
  696             if ($inFileName == 
'-')  $inFileName  = 
'php://stdin';
 
  697             if ($outFileName == 
'-') $outFileName = 
'php://stdout';
 
  721                         $this->in = fopen($inFileName, 
'rb');
 
  723                                 trigger_error(
'Failed to open "'.$inFileName, E_USER_ERROR);
 
  725                         $this->out = fopen($outFileName, 
'wb');
 
  727                                 trigger_error(
'Failed to open "'.$outFileName, E_USER_ERROR);
 
  732             if ($comments !== NULL) {
 
  733                 foreach ($comments as $comm) {
 
  734                     $this->out->fwrite(
'// '.str_replace(
"\n", 
" ", $comm).
"\n");
 
  741         $this->in = $inString;
 
  743                 $this->inLength = strlen($inString);
 
  745                 $this->isString = 
true;
 
  747         if ($comments !== NULL) {
 
  748             foreach ($comments as $comm) {
 
  749                 $this->out .= 
'// '.str_replace(
"\n", 
" ", $comm).
"\n";