/**
  * Retrieves the next token from the source stream.
  * 
  * @return int or false
  */
 function nextToken()
 {
     $src = ltrim($this->_source);
     $this->_tokenValue = null;
     $this->_token = JSPHON_TOKEN_EOF;
     switch (true) {
         case $src === '':
             break;
         case ($c = $src[0]) !== "" and isset($this->_tokenTable[$c]):
             $this->_token = $this->_tokenTable[$c];
             $src = substr($src, 1);
             break;
         case $c == '"' and preg_match('/^"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"/', $src, $m):
             $this->_token = JSPHON_TOKEN_DATUM;
             $this->_tokenValue = $m[1];
             $src = substr($src, strlen($m[0]));
             break;
         case preg_match('/^(true|false|null)\\b/', $src, $m):
             $this->_token = JSPHON_TOKEN_DATUM;
             $this->_tokenValue = $this->_tokenValueTable[$m[1]];
             $src = substr($src, $m[1][0] == 'f' ? 5 : 4);
             break;
         case preg_match('/^-?(?:[1-9]\\d+|\\d)(?:\\.\\d+)?(?:[eE][-+]?\\d+)?/', $src, $m):
             $this->_token = JSPHON_TOKEN_DATUM;
             $intV = (int) $m[0];
             $floatV = (double) $m[0];
             $this->_tokenValue = $intV == $floatV ? $intV : $floatV;
             $src = substr($src, strlen($m[0]));
             break;
         default:
             $err = Jsphon_Error::push(JSPHON_ERROR_DECODE_SYNTAX, 'error', array(), 'Illegal Token', false, debug_backtrace());
             if (is_callable($this->_errorCallback)) {
                 call_user_func($this->_errorCallback, $err);
             }
             return false;
     }
     $this->_source = $src;
     return $this->_token;
 }
 /**
  * a simple wrapper for PEAR_ErrorStack::push.
  * 
  * @param  String    $message
  * @param  array     $param
  * @param  string    $level
  * @param  int       $code
  * @return String
  */
 function _error($message, $param = array(), $level = 'error', $code = JSPHON_ERROR_DECODE_SYNTAX)
 {
     $e = Jsphon_Error::push($code, $level, $param, $message, false, debug_backtrace());
     $this->_internalError = true;
     return $e;
 }