Example #1
0
 public function decodeNumber()
 {
     $sb = new StringBuf();
     $hex = false;
     $floating = false;
     do {
         $sb->add(com_wiris_util_json_JSon_0($this, $floating, $hex, $sb));
         $this->nextToken();
         if ($this->c === 120) {
             $hex = true;
             $sb->add(com_wiris_util_json_JSon_1($this, $floating, $hex, $sb));
             $this->nextToken();
         }
         if ($this->c === 46 || $this->c === 69 || $this->c === 101) {
             $floating = true;
         }
     } while ($this->c >= 48 && $this->c <= 58 || $hex && $this->isHexDigit($this->c) || $floating && ($this->c === 46 || $this->c === 69 || $this->c === 101 || $this->c === 45));
     if ($floating) {
         return Std::parseFloat($sb->b);
     } else {
         return Std::parseInt($sb->b);
     }
 }
Example #2
0
 public function decodeInteger()
 {
     $sb = new StringBuf();
     $hex = null;
     $hex = false;
     do {
         $sb->add(com_wiris_util_json_JSon_0($this, $hex, $sb));
         $this->nextToken();
         if ($this->c === 120) {
             $hex = true;
             $sb->add(com_wiris_util_json_JSon_1($this, $hex, $sb));
             $this->nextToken();
         }
     } while ($this->c >= 48 && $this->c <= 58 || $hex && $this->isHexDigit($this->c));
     return Std::parseInt($sb->b);
 }