Пример #1
0
 public function decodeString()
 {
     $sb = new StringBuf();
     $d = $this->c;
     $this->nextToken();
     while ($this->c !== $d) {
         if ($this->c === 92) {
             $this->nextToken();
             if ($this->c === 110) {
                 $sb->add("\n");
             } else {
                 if ($this->c === 114) {
                     $sb->add("\r");
                 } else {
                     if ($this->c === 34) {
                         $sb->add("\"");
                     } else {
                         if ($this->c === 39) {
                             $sb->add("'");
                         } else {
                             if ($this->c === 116) {
                                 $sb->add("\t");
                             } else {
                                 if ($this->c === 92) {
                                     $sb->add("\\");
                                 } else {
                                     if ($this->c === 117) {
                                         $this->nextToken();
                                         $code = com_wiris_util_json_JSon_2($this, $d, $sb);
                                         $this->nextToken();
                                         $code .= com_wiris_util_json_JSon_3($this, $code, $d, $sb);
                                         $this->nextToken();
                                         $code .= com_wiris_util_json_JSon_4($this, $code, $d, $sb);
                                         $this->nextToken();
                                         $code .= com_wiris_util_json_JSon_5($this, $code, $d, $sb);
                                         $dec = Std::parseInt("0x" . $code);
                                         $sb->add(com_wiris_util_json_JSon_6($this, $code, $d, $dec, $sb));
                                         unset($dec, $code);
                                     } else {
                                         throw new HException("Unknown scape sequence '\\" . com_wiris_util_json_JSon_7($this, $d, $sb) . "'");
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         } else {
             $sb->add(com_wiris_util_json_JSon_8($this, $d, $sb));
         }
         $this->nextToken();
     }
     $this->nextToken();
     return $sb->b;
 }
Пример #2
0
 public function decodeString()
 {
     $sb = new StringBuf();
     $d = $this->c;
     $this->nextToken();
     $this->skipBlanks();
     do {
         if ($this->c === 92) {
             $this->nextToken();
             if ($this->c === 110) {
                 $sb->add("\n");
             } else {
                 if ($this->c === 114) {
                     $sb->add("\r");
                 } else {
                     if ($this->c === 34) {
                         $sb->add("\"");
                     } else {
                         if ($this->c === 39) {
                             $sb->add("'");
                         } else {
                             if ($this->c === 116) {
                                 $sb->add("\t");
                             } else {
                                 throw new HException("Unknown scape sequence '\\" . _hx_string_rec($this->c, "") . "'");
                             }
                         }
                     }
                 }
             }
         } else {
             $sb->add(com_wiris_util_json_JSon_2($this, $d, $sb));
         }
         $this->nextToken();
     } while ($this->c !== $d);
     $this->nextToken();
     return $sb->b;
 }