PageRenderTime 59ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/QingTingFanBianYi/src/com/alibaba/fastjson/parser/JSONLexerBase.java

https://gitlab.com/qt-prometheus/qt-prometheus
Java | 3084 lines | 3033 code | 51 blank | 0 comment | 504 complexity | 8299523255297d1b0d18333e3f59400b MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1. package com.alibaba.fastjson.parser;
  2. import com.alibaba.fastjson.JSON;
  3. import com.alibaba.fastjson.JSONException;
  4. import java.io.Closeable;
  5. import java.lang.ref.SoftReference;
  6. import java.math.BigDecimal;
  7. import java.math.BigInteger;
  8. import java.util.ArrayList;
  9. import java.util.Calendar;
  10. import java.util.Collection;
  11. import java.util.HashSet;
  12. public abstract class JSONLexerBase
  13. implements JSONLexer, Closeable
  14. {
  15. protected static final int INT_MULTMIN_RADIX_TEN = -214748364;
  16. protected static final int INT_N_MULTMAX_RADIX_TEN = -214748364;
  17. protected static final long MULTMIN_RADIX_TEN = -922337203685477580L;
  18. protected static final long N_MULTMAX_RADIX_TEN = -922337203685477580L;
  19. private static final ThreadLocal<SoftReference<char[]>> SBUF_REF_LOCAL = new ThreadLocal();
  20. protected static final int[] digits;
  21. protected static final char[] typeFieldName = ("\"" + JSON.DEFAULT_TYPE_KEY + "\":\"").toCharArray();
  22. protected static boolean[] whitespaceFlags = new boolean[256];
  23. protected int bp;
  24. protected Calendar calendar = null;
  25. protected char ch;
  26. protected int eofPos;
  27. protected int features = JSON.DEFAULT_PARSER_FEATURE;
  28. protected boolean hasSpecial;
  29. protected Keywords keywods = Keywords.DEFAULT_KEYWORDS;
  30. public int matchStat = 0;
  31. protected int np;
  32. protected int pos;
  33. protected char[] sbuf;
  34. protected int sp;
  35. protected int token;
  36. static
  37. {
  38. whitespaceFlags[32] = true;
  39. whitespaceFlags[10] = true;
  40. whitespaceFlags[13] = true;
  41. whitespaceFlags[9] = true;
  42. whitespaceFlags[12] = true;
  43. whitespaceFlags[8] = true;
  44. digits = new int[103];
  45. int i = 48;
  46. while (i <= 57)
  47. {
  48. digits[i] = (i - 48);
  49. i += 1;
  50. }
  51. i = 97;
  52. while (i <= 102)
  53. {
  54. digits[i] = (i - 97 + 10);
  55. i += 1;
  56. }
  57. i = 65;
  58. while (i <= 70)
  59. {
  60. digits[i] = (i - 65 + 10);
  61. i += 1;
  62. }
  63. }
  64. public JSONLexerBase()
  65. {
  66. SoftReference localSoftReference = (SoftReference)SBUF_REF_LOCAL.get();
  67. if (localSoftReference != null)
  68. {
  69. this.sbuf = ((char[])localSoftReference.get());
  70. SBUF_REF_LOCAL.set(null);
  71. }
  72. if (this.sbuf == null)
  73. this.sbuf = new char[64];
  74. }
  75. public static final boolean isWhitespace(char paramChar)
  76. {
  77. return (paramChar == ' ') || (paramChar == '\n') || (paramChar == '\r') || (paramChar == '\t') || (paramChar == '\f') || (paramChar == '\b');
  78. }
  79. private final void scanStringSingleQuote()
  80. {
  81. this.np = this.bp;
  82. this.hasSpecial = false;
  83. while (true)
  84. {
  85. char c = next();
  86. if (c == '\'')
  87. {
  88. this.token = 4;
  89. next();
  90. return;
  91. }
  92. if (c == '\032')
  93. throw new JSONException("unclosed single-quote string");
  94. char[] arrayOfChar;
  95. int i;
  96. if (c == '\\')
  97. {
  98. if (!this.hasSpecial)
  99. {
  100. this.hasSpecial = true;
  101. if (this.sp > this.sbuf.length)
  102. {
  103. arrayOfChar = new char[this.sp * 2];
  104. System.arraycopy(this.sbuf, 0, arrayOfChar, 0, this.sbuf.length);
  105. this.sbuf = arrayOfChar;
  106. }
  107. copyTo(this.np + 1, this.sp, this.sbuf);
  108. }
  109. c = next();
  110. switch (c)
  111. {
  112. default:
  113. this.ch = c;
  114. throw new JSONException("unclosed single-quote string");
  115. case '0':
  116. putChar('\000');
  117. break;
  118. case '1':
  119. putChar('\001');
  120. break;
  121. case '2':
  122. putChar('\002');
  123. break;
  124. case '3':
  125. putChar('\003');
  126. break;
  127. case '4':
  128. putChar('\004');
  129. break;
  130. case '5':
  131. putChar('\005');
  132. break;
  133. case '6':
  134. putChar('\006');
  135. break;
  136. case '7':
  137. putChar('\007');
  138. break;
  139. case 'b':
  140. putChar('\b');
  141. break;
  142. case 't':
  143. putChar('\t');
  144. break;
  145. case 'n':
  146. putChar('\n');
  147. break;
  148. case 'v':
  149. putChar('\013');
  150. break;
  151. case 'F':
  152. case 'f':
  153. putChar('\f');
  154. break;
  155. case 'r':
  156. putChar('\r');
  157. break;
  158. case '"':
  159. putChar('"');
  160. break;
  161. case '\'':
  162. putChar('\'');
  163. break;
  164. case '/':
  165. putChar('/');
  166. break;
  167. case '\\':
  168. putChar('\\');
  169. break;
  170. case 'x':
  171. i = next();
  172. int j = next();
  173. putChar((char)(digits[i] * 16 + digits[j]));
  174. break;
  175. case 'u':
  176. putChar((char)Integer.parseInt(new String(new char[] { next(), next(), next(), next() }), 16));
  177. break;
  178. }
  179. }
  180. else if (!this.hasSpecial)
  181. {
  182. this.sp += 1;
  183. }
  184. else if (this.sp == this.sbuf.length)
  185. {
  186. putChar(c);
  187. }
  188. else
  189. {
  190. arrayOfChar = this.sbuf;
  191. i = this.sp;
  192. this.sp = (i + 1);
  193. arrayOfChar[i] = c;
  194. }
  195. }
  196. }
  197. public abstract String addSymbol(int paramInt1, int paramInt2, int paramInt3, SymbolTable paramSymbolTable);
  198. protected abstract void arrayCopy(int paramInt1, char[] paramArrayOfChar, int paramInt2, int paramInt3);
  199. public abstract byte[] bytesValue();
  200. protected abstract boolean charArrayCompare(char[] paramArrayOfChar);
  201. public abstract char charAt(int paramInt);
  202. public void close()
  203. {
  204. if (this.sbuf.length <= 8192)
  205. SBUF_REF_LOCAL.set(new SoftReference(this.sbuf));
  206. this.sbuf = null;
  207. }
  208. public void config(Feature paramFeature, boolean paramBoolean)
  209. {
  210. this.features = Feature.config(this.features, paramFeature, paramBoolean);
  211. }
  212. protected abstract void copyTo(int paramInt1, int paramInt2, char[] paramArrayOfChar);
  213. public final Number decimalValue(boolean paramBoolean)
  214. {
  215. int i = charAt(this.np + this.sp - 1);
  216. if (i == 70)
  217. return Float.valueOf(Float.parseFloat(numberString()));
  218. if (i == 68)
  219. return Double.valueOf(Double.parseDouble(numberString()));
  220. if (paramBoolean)
  221. return decimalValue();
  222. return Double.valueOf(doubleValue());
  223. }
  224. public final BigDecimal decimalValue()
  225. {
  226. return new BigDecimal(numberString());
  227. }
  228. public double doubleValue()
  229. {
  230. return Double.parseDouble(numberString());
  231. }
  232. public float floatValue()
  233. {
  234. return Float.parseFloat(numberString());
  235. }
  236. public final int getBufferPosition()
  237. {
  238. return this.bp;
  239. }
  240. public Calendar getCalendar()
  241. {
  242. return this.calendar;
  243. }
  244. public final char getCurrent()
  245. {
  246. return this.ch;
  247. }
  248. public abstract int indexOf(char paramChar, int paramInt);
  249. public final int intValue()
  250. {
  251. int j = 0;
  252. int m = 0;
  253. int k = this.np;
  254. int i1 = this.np + this.sp;
  255. int n;
  256. int i;
  257. label73: int i2;
  258. if (charAt(this.np) == '-')
  259. {
  260. m = 1;
  261. n = -2147483648;
  262. k += 1;
  263. if (m != 0);
  264. i = k;
  265. if (k < i1)
  266. {
  267. j = -digits[charAt(k)];
  268. i = k + 1;
  269. }
  270. if (i >= i1)
  271. break label215;
  272. k = i + 1;
  273. i2 = charAt(i);
  274. i = k;
  275. if (i2 != 76)
  276. {
  277. i = k;
  278. if (i2 != 83)
  279. {
  280. if (i2 != 66)
  281. break label141;
  282. i = k;
  283. }
  284. }
  285. }
  286. label141: label215:
  287. while (true)
  288. {
  289. if (m != 0)
  290. {
  291. if (i > this.np + 1)
  292. {
  293. return j;
  294. n = -2147483647;
  295. break;
  296. i = digits[i2];
  297. if (j < -214748364)
  298. throw new NumberFormatException(numberString());
  299. j *= 10;
  300. if (j < n + i)
  301. throw new NumberFormatException(numberString());
  302. j -= i;
  303. i = k;
  304. break label73;
  305. }
  306. throw new NumberFormatException(numberString());
  307. }
  308. return -j;
  309. }
  310. }
  311. public final Number integerValue()
  312. throws NumberFormatException
  313. {
  314. long l1 = 0L;
  315. int n = 0;
  316. if (this.np == -1)
  317. this.np = 0;
  318. int k = this.np;
  319. int i = this.np + this.sp;
  320. int j = 32;
  321. long l2;
  322. label105: int m;
  323. switch (charAt(i - 1))
  324. {
  325. default:
  326. if (charAt(this.np) == '-')
  327. {
  328. n = 1;
  329. l2 = -9223372036854775808L;
  330. k += 1;
  331. if (n != 0);
  332. m = k;
  333. if (k < i)
  334. {
  335. l1 = -digits[charAt(k)];
  336. m = k + 1;
  337. }
  338. }
  339. break;
  340. case 'L':
  341. case 'S':
  342. case 'B':
  343. }
  344. while (true)
  345. {
  346. if (m >= i)
  347. break label259;
  348. k = digits[charAt(m)];
  349. if (l1 < -922337203685477580L)
  350. {
  351. return new BigInteger(numberString());
  352. i -= 1;
  353. j = 76;
  354. break;
  355. i -= 1;
  356. j = 83;
  357. break;
  358. i -= 1;
  359. j = 66;
  360. break;
  361. l2 = -9223372036854775807L;
  362. break label105;
  363. }
  364. l1 *= 10L;
  365. if (l1 < k + l2)
  366. return new BigInteger(numberString());
  367. l1 -= k;
  368. m += 1;
  369. }
  370. label259: if (n != 0)
  371. {
  372. if (m > this.np + 1)
  373. {
  374. if ((l1 >= -2147483648L) && (j != 76))
  375. return Integer.valueOf((int)l1);
  376. return Long.valueOf(l1);
  377. }
  378. throw new NumberFormatException(numberString());
  379. }
  380. l1 = -l1;
  381. if ((l1 <= 2147483647L) && (j != 76))
  382. {
  383. if (j == 83)
  384. return Short.valueOf((short)(int)l1);
  385. if (j == 66)
  386. return Byte.valueOf((byte)(int)l1);
  387. return Integer.valueOf((int)l1);
  388. }
  389. return Long.valueOf(l1);
  390. }
  391. public final boolean isBlankInput()
  392. {
  393. int i = 0;
  394. while (true)
  395. {
  396. char c = charAt(i);
  397. if (c == '\032')
  398. return true;
  399. if (!isWhitespace(c))
  400. return false;
  401. i += 1;
  402. }
  403. }
  404. public abstract boolean isEOF();
  405. public final boolean isEnabled(Feature paramFeature)
  406. {
  407. return Feature.isEnabled(this.features, paramFeature);
  408. }
  409. public final boolean isRef()
  410. {
  411. if (this.sp != 4);
  412. while ((charAt(this.np + 1) != '$') || (charAt(this.np + 2) != 'r') || (charAt(this.np + 3) != 'e') || (charAt(this.np + 4) != 'f'))
  413. return false;
  414. return true;
  415. }
  416. protected void lexError(String paramString, Object[] paramArrayOfObject)
  417. {
  418. this.token = 1;
  419. }
  420. public final long longValue()
  421. throws NumberFormatException
  422. {
  423. long l1 = 0L;
  424. int k = 0;
  425. int j = this.np;
  426. int m = this.np + this.sp;
  427. long l2;
  428. int i;
  429. label74: int n;
  430. if (charAt(this.np) == '-')
  431. {
  432. k = 1;
  433. l2 = -9223372036854775808L;
  434. j += 1;
  435. if (k != 0);
  436. i = j;
  437. if (j < m)
  438. {
  439. l1 = -digits[charAt(j)];
  440. i = j + 1;
  441. }
  442. if (i >= m)
  443. break label230;
  444. j = i + 1;
  445. n = charAt(i);
  446. i = j;
  447. if (n != 76)
  448. {
  449. i = j;
  450. if (n != 83)
  451. {
  452. if (n != 66)
  453. break label143;
  454. i = j;
  455. }
  456. }
  457. }
  458. label143: label230:
  459. while (true)
  460. {
  461. if (k != 0)
  462. {
  463. if (i > this.np + 1)
  464. {
  465. return l1;
  466. l2 = -9223372036854775807L;
  467. break;
  468. i = digits[n];
  469. if (l1 < -922337203685477580L)
  470. throw new NumberFormatException(numberString());
  471. l1 *= 10L;
  472. if (l1 < i + l2)
  473. throw new NumberFormatException(numberString());
  474. l1 -= i;
  475. i = j;
  476. break label74;
  477. }
  478. throw new NumberFormatException(numberString());
  479. }
  480. return -l1;
  481. }
  482. }
  483. public final boolean matchField(char[] paramArrayOfChar)
  484. {
  485. if (!charArrayCompare(paramArrayOfChar))
  486. return false;
  487. this.bp += paramArrayOfChar.length;
  488. this.ch = charAt(this.bp);
  489. if (this.ch == '{')
  490. {
  491. next();
  492. this.token = 12;
  493. }
  494. while (true)
  495. {
  496. return true;
  497. if (this.ch == '[')
  498. {
  499. next();
  500. this.token = 14;
  501. }
  502. else
  503. {
  504. nextToken();
  505. }
  506. }
  507. }
  508. public final int matchStat()
  509. {
  510. return this.matchStat;
  511. }
  512. public abstract char next();
  513. public final void nextIdent()
  514. {
  515. while (isWhitespace(this.ch))
  516. next();
  517. if ((this.ch == '_') || (Character.isLetter(this.ch)))
  518. {
  519. scanIdent();
  520. return;
  521. }
  522. nextToken();
  523. }
  524. public final void nextToken()
  525. {
  526. this.sp = 0;
  527. while (true)
  528. {
  529. this.pos = this.bp;
  530. if (this.ch == '"')
  531. {
  532. scanString();
  533. return;
  534. }
  535. if (this.ch == ',')
  536. {
  537. next();
  538. this.token = 16;
  539. return;
  540. }
  541. if ((this.ch >= '0') && (this.ch <= '9'))
  542. {
  543. scanNumber();
  544. return;
  545. }
  546. if (this.ch == '-')
  547. {
  548. scanNumber();
  549. return;
  550. }
  551. switch (this.ch)
  552. {
  553. default:
  554. if (!isEOF())
  555. break label444;
  556. if (this.token != 20)
  557. break;
  558. throw new JSONException("EOF error");
  559. case '\'':
  560. if (!isEnabled(Feature.AllowSingleQuotes))
  561. throw new JSONException("Feature.AllowSingleQuotes is false");
  562. scanStringSingleQuote();
  563. return;
  564. case '\b':
  565. case '\t':
  566. case '\n':
  567. case '\f':
  568. case '\r':
  569. case ' ':
  570. next();
  571. case 't':
  572. case 'T':
  573. case 'S':
  574. case 'f':
  575. case 'n':
  576. case '(':
  577. case ')':
  578. case '[':
  579. case ']':
  580. case '{':
  581. case '}':
  582. case ':':
  583. }
  584. }
  585. scanTrue();
  586. return;
  587. scanTreeSet();
  588. return;
  589. scanSet();
  590. return;
  591. scanFalse();
  592. return;
  593. scanNullOrNew();
  594. return;
  595. next();
  596. this.token = 10;
  597. return;
  598. next();
  599. this.token = 11;
  600. return;
  601. next();
  602. this.token = 14;
  603. return;
  604. next();
  605. this.token = 15;
  606. return;
  607. next();
  608. this.token = 12;
  609. return;
  610. next();
  611. this.token = 13;
  612. return;
  613. next();
  614. this.token = 17;
  615. return;
  616. this.token = 20;
  617. int i = this.eofPos;
  618. this.bp = i;
  619. this.pos = i;
  620. return;
  621. label444: lexError("illegal.char", new Object[] { String.valueOf(this.ch) });
  622. next();
  623. }
  624. public final void nextToken(int paramInt)
  625. {
  626. this.sp = 0;
  627. switch (paramInt)
  628. {
  629. case 3:
  630. case 5:
  631. case 6:
  632. case 7:
  633. case 8:
  634. case 9:
  635. case 10:
  636. case 11:
  637. case 13:
  638. case 17:
  639. case 19:
  640. default:
  641. case 12:
  642. case 16:
  643. case 2:
  644. case 4:
  645. case 14:
  646. case 15:
  647. case 20:
  648. case 18:
  649. }
  650. while (true)
  651. if ((this.ch == ' ') || (this.ch == '\n') || (this.ch == '\r') || (this.ch == '\t') || (this.ch == '\f') || (this.ch == '\b'))
  652. {
  653. next();
  654. break;
  655. if (this.ch == '{')
  656. {
  657. this.token = 12;
  658. next();
  659. return;
  660. }
  661. if (this.ch == '[')
  662. {
  663. this.token = 14;
  664. next();
  665. return;
  666. if (this.ch == ',')
  667. {
  668. this.token = 16;
  669. next();
  670. return;
  671. }
  672. if (this.ch == '}')
  673. {
  674. this.token = 13;
  675. next();
  676. return;
  677. }
  678. if (this.ch == ']')
  679. {
  680. this.token = 15;
  681. next();
  682. return;
  683. }
  684. if (this.ch == '\032')
  685. {
  686. this.token = 20;
  687. return;
  688. if ((this.ch >= '0') && (this.ch <= '9'))
  689. {
  690. this.pos = this.bp;
  691. scanNumber();
  692. return;
  693. }
  694. if (this.ch == '"')
  695. {
  696. this.pos = this.bp;
  697. scanString();
  698. return;
  699. }
  700. if (this.ch == '[')
  701. {
  702. this.token = 14;
  703. next();
  704. return;
  705. }
  706. if (this.ch == '{')
  707. {
  708. this.token = 12;
  709. next();
  710. return;
  711. if (this.ch == '"')
  712. {
  713. this.pos = this.bp;
  714. scanString();
  715. return;
  716. }
  717. if ((this.ch >= '0') && (this.ch <= '9'))
  718. {
  719. this.pos = this.bp;
  720. scanNumber();
  721. return;
  722. }
  723. if (this.ch == '[')
  724. {
  725. this.token = 14;
  726. next();
  727. return;
  728. }
  729. if (this.ch == '{')
  730. {
  731. this.token = 12;
  732. next();
  733. return;
  734. if (this.ch == '[')
  735. {
  736. this.token = 14;
  737. next();
  738. return;
  739. }
  740. if (this.ch == '{')
  741. {
  742. this.token = 12;
  743. next();
  744. return;
  745. if (this.ch == ']')
  746. {
  747. this.token = 15;
  748. next();
  749. return;
  750. }
  751. if (this.ch == '\032')
  752. {
  753. this.token = 20;
  754. return;
  755. nextIdent();
  756. return;
  757. }
  758. }
  759. }
  760. }
  761. }
  762. }
  763. }
  764. nextToken();
  765. }
  766. public final void nextTokenWithChar(char paramChar)
  767. {
  768. this.sp = 0;
  769. while (true)
  770. {
  771. if (this.ch == paramChar)
  772. {
  773. next();
  774. nextToken();
  775. return;
  776. }
  777. if ((this.ch != ' ') && (this.ch != '\n') && (this.ch != '\r') && (this.ch != '\t') && (this.ch != '\f') && (this.ch != '\b'))
  778. break;
  779. next();
  780. }
  781. throw new JSONException("not match " + paramChar + " - " + this.ch);
  782. }
  783. public final void nextTokenWithChar(char paramChar, int paramInt)
  784. {
  785. this.sp = 0;
  786. if (this.ch == paramChar)
  787. next();
  788. while (true)
  789. {
  790. if (paramInt == 2)
  791. {
  792. if ((this.ch >= '0') && (this.ch <= '9'))
  793. {
  794. this.pos = this.bp;
  795. scanNumber();
  796. return;
  797. if (isWhitespace(this.ch))
  798. {
  799. next();
  800. break;
  801. }
  802. throw new JSONException("not match " + paramInt + " - " + this.ch);
  803. }
  804. if (this.ch != '"')
  805. break label289;
  806. this.pos = this.bp;
  807. scanString();
  808. return;
  809. }
  810. if (paramInt == 4)
  811. {
  812. if (this.ch == '"')
  813. {
  814. this.pos = this.bp;
  815. scanString();
  816. return;
  817. }
  818. if ((this.ch >= '0') && (this.ch <= '9'))
  819. {
  820. this.pos = this.bp;
  821. scanNumber();
  822. }
  823. }
  824. else if (paramInt == 12)
  825. {
  826. if (this.ch == '{')
  827. {
  828. this.token = 12;
  829. next();
  830. return;
  831. }
  832. if (this.ch == '[')
  833. {
  834. this.token = 14;
  835. next();
  836. }
  837. }
  838. else if (paramInt == 14)
  839. {
  840. if (this.ch == '[')
  841. {
  842. this.token = 14;
  843. next();
  844. return;
  845. }
  846. if (this.ch == '{')
  847. {
  848. this.token = 12;
  849. next();
  850. return;
  851. }
  852. }
  853. label289: if (!isWhitespace(this.ch))
  854. break label307;
  855. next();
  856. }
  857. label307: nextToken();
  858. }
  859. public final void nextTokenWithColon()
  860. {
  861. nextTokenWithChar(':');
  862. }
  863. public final void nextTokenWithColon(int paramInt)
  864. {
  865. nextTokenWithChar(':');
  866. }
  867. public final void nextTokenWithComma()
  868. {
  869. nextTokenWithChar(':');
  870. }
  871. public final void nextTokenWithComma(int paramInt)
  872. {
  873. nextTokenWithChar(',');
  874. }
  875. public abstract String numberString();
  876. public final Number numberValue()
  877. {
  878. int i = charAt(this.np + this.sp - 1);
  879. String str = numberString();
  880. switch (i)
  881. {
  882. case 69:
  883. default:
  884. return new BigDecimal(str);
  885. case 68:
  886. return Double.valueOf(Double.parseDouble(str));
  887. case 70:
  888. }
  889. return Float.valueOf(Float.parseFloat(str));
  890. }
  891. public final int pos()
  892. {
  893. return this.pos;
  894. }
  895. protected final void putChar(char paramChar)
  896. {
  897. if (this.sp == this.sbuf.length)
  898. {
  899. arrayOfChar = new char[this.sbuf.length * 2];
  900. System.arraycopy(this.sbuf, 0, arrayOfChar, 0, this.sbuf.length);
  901. this.sbuf = arrayOfChar;
  902. }
  903. char[] arrayOfChar = this.sbuf;
  904. int i = this.sp;
  905. this.sp = (i + 1);
  906. arrayOfChar[i] = paramChar;
  907. }
  908. public final void resetStringPosition()
  909. {
  910. this.sp = 0;
  911. }
  912. public boolean scanBoolean(char paramChar)
  913. {
  914. this.matchStat = 0;
  915. char c = this.bp;
  916. int i = 0 + 1;
  917. c = charAt(c + '\000');
  918. boolean bool = false;
  919. if (c == 't')
  920. if ((charAt(this.bp + 1) == 'r') && (charAt(this.bp + 1 + 1) == 'u') && (charAt(this.bp + 1 + 2) == 'e'))
  921. {
  922. c = this.bp;
  923. i = i + 3 + 1;
  924. c = charAt(c + '\004');
  925. bool = true;
  926. }
  927. while (true)
  928. if (c == paramChar)
  929. {
  930. this.bp += i - 1;
  931. next();
  932. this.matchStat = 3;
  933. return bool;
  934. this.matchStat = -1;
  935. return false;
  936. if (c == 'f')
  937. if ((charAt(this.bp + 1) == 'a') && (charAt(this.bp + 1 + 1) == 'l') && (charAt(this.bp + 1 + 2) == 's') && (charAt(this.bp + 1 + 3) == 'e'))
  938. {
  939. c = this.bp;
  940. i = i + 4 + 1;
  941. c = charAt(c + '\005');
  942. bool = false;
  943. }
  944. else
  945. {
  946. this.matchStat = -1;
  947. return false;
  948. }
  949. }
  950. else
  951. {
  952. this.matchStat = -1;
  953. return bool;
  954. }
  955. }
  956. public Enum<?> scanEnum(Class<?> paramClass, SymbolTable paramSymbolTable, char paramChar)
  957. {
  958. paramSymbolTable = scanSymbolWithSeperator(paramSymbolTable, paramChar);
  959. if (paramSymbolTable == null)
  960. return null;
  961. return Enum.valueOf(paramClass, paramSymbolTable);
  962. }
  963. public final void scanFalse()
  964. {
  965. if (this.ch != 'f')
  966. throw new JSONException("error parse false");
  967. next();
  968. if (this.ch != 'a')
  969. throw new JSONException("error parse false");
  970. next();
  971. if (this.ch != 'l')
  972. throw new JSONException("error parse false");
  973. next();
  974. if (this.ch != 's')
  975. throw new JSONException("error parse false");
  976. next();
  977. if (this.ch != 'e')
  978. throw new JSONException("error parse false");
  979. next();
  980. if ((this.ch == ' ') || (this.ch == ',') || (this.ch == '}') || (this.ch == ']') || (this.ch == '\n') || (this.ch == '\r') || (this.ch == '\t') || (this.ch == '\032') || (this.ch == '\f') || (this.ch == '\b'))
  981. {
  982. this.token = 7;
  983. return;
  984. }
  985. throw new JSONException("scan false error");
  986. }
  987. public boolean scanFieldBoolean(char[] paramArrayOfChar)
  988. {
  989. this.matchStat = 0;
  990. if (!charArrayCompare(paramArrayOfChar))
  991. {
  992. this.matchStat = -2;
  993. return false;
  994. }
  995. int j = paramArrayOfChar.length;
  996. int k = this.bp;
  997. int i = j + 1;
  998. j = charAt(k + j);
  999. boolean bool;
  1000. if (j == 116)
  1001. {
  1002. k = this.bp;
  1003. j = i + 1;
  1004. if (charAt(k + i) != 'r')
  1005. {
  1006. this.matchStat = -1;
  1007. return false;
  1008. }
  1009. i = this.bp;
  1010. k = j + 1;
  1011. if (charAt(i + j) != 'u')
  1012. {
  1013. this.matchStat = -1;
  1014. return false;
  1015. }
  1016. j = this.bp;
  1017. i = k + 1;
  1018. if (charAt(j + k) != 'e')
  1019. {
  1020. this.matchStat = -1;
  1021. return false;
  1022. }
  1023. bool = true;
  1024. }
  1025. while (true)
  1026. {
  1027. k = this.bp;
  1028. j = i + 1;
  1029. i = charAt(k + i);
  1030. if (i != 44)
  1031. break label333;
  1032. this.bp += j - 1;
  1033. next();
  1034. this.matchStat = 3;
  1035. this.token = 16;
  1036. return bool;
  1037. if (j != 102)
  1038. break;
  1039. k = this.bp;
  1040. j = i + 1;
  1041. if (charAt(k + i) != 'a')
  1042. {
  1043. this.matchStat = -1;
  1044. return false;
  1045. }
  1046. k = this.bp;
  1047. i = j + 1;
  1048. if (charAt(k + j) != 'l')
  1049. {
  1050. this.matchStat = -1;
  1051. return false;
  1052. }
  1053. j = this.bp;
  1054. k = i + 1;
  1055. if (charAt(j + i) != 's')
  1056. {
  1057. this.matchStat = -1;
  1058. return false;
  1059. }
  1060. if (charAt(this.bp + k) != 'e')
  1061. {
  1062. this.matchStat = -1;
  1063. return false;
  1064. }
  1065. bool = false;
  1066. i = k + 1;
  1067. }
  1068. this.matchStat = -1;
  1069. return false;
  1070. label333: if (i == 125)
  1071. {
  1072. k = this.bp;
  1073. i = j + 1;
  1074. j = charAt(k + j);
  1075. if (j == 44)
  1076. {
  1077. this.token = 16;
  1078. this.bp += i - 1;
  1079. next();
  1080. }
  1081. while (true)
  1082. {
  1083. this.matchStat = 4;
  1084. return bool;
  1085. if (j == 93)
  1086. {
  1087. this.token = 15;
  1088. this.bp += i - 1;
  1089. next();
  1090. }
  1091. else if (j == 125)
  1092. {
  1093. this.token = 13;
  1094. this.bp += i - 1;
  1095. next();
  1096. }
  1097. else
  1098. {
  1099. if (j != 26)
  1100. break;
  1101. this.token = 20;
  1102. this.bp += i - 1;
  1103. this.ch = '\032';
  1104. }
  1105. }
  1106. this.matchStat = -1;
  1107. return false;
  1108. }
  1109. this.matchStat = -1;
  1110. return false;
  1111. }
  1112. public final double scanFieldDouble(char paramChar)
  1113. {
  1114. this.matchStat = 0;
  1115. char c1 = charAt(this.bp + 0);
  1116. char c2;
  1117. char c3;
  1118. char c4;
  1119. if ((c1 >= '0') && (c1 <= '9'))
  1120. {
  1121. for (c1 = 0 + 1; ; c1 = c3)
  1122. {
  1123. c2 = this.bp;
  1124. c3 = c1 + '\001';
  1125. c4 = charAt(c2 + c1);
  1126. if ((c4 < '0') || (c4 > '9'))
  1127. break;
  1128. }
  1129. c2 = c4;
  1130. c1 = c3;
  1131. if (c4 == '.')
  1132. {
  1133. c2 = this.bp;
  1134. c1 = c3 + '\001';
  1135. c2 = charAt(c2 + c3);
  1136. if ((c2 >= '0') && (c2 <= '9'))
  1137. while (true)
  1138. {
  1139. c2 = this.bp;
  1140. c3 = c1 + '\001';
  1141. c4 = charAt(c2 + c1);
  1142. c2 = c4;
  1143. c1 = c3;
  1144. if (c4 < '0')
  1145. break;
  1146. c2 = c4;
  1147. c1 = c3;
  1148. if (c4 > '9')
  1149. break;
  1150. c1 = c3;
  1151. }
  1152. this.matchStat = -1;
  1153. return 0.0D;
  1154. }
  1155. if (c2 != 'e')
  1156. {
  1157. c3 = c2;
  1158. c4 = c1;
  1159. if (c2 != 'E');
  1160. }
  1161. else
  1162. {
  1163. c3 = this.bp;
  1164. c2 = c1 + '\001';
  1165. c1 = charAt(c3 + c1);
  1166. if ((c1 != '+') && (c1 != '-'))
  1167. break label420;
  1168. c3 = this.bp;
  1169. c1 = c2 + '\001';
  1170. c3 = charAt(c3 + c2);
  1171. c2 = c1;
  1172. c1 = c3;
  1173. }
  1174. }
  1175. label420:
  1176. while (true)
  1177. {
  1178. c3 = c1;
  1179. c4 = c2;
  1180. if (c1 >= '0')
  1181. {
  1182. c3 = c1;
  1183. c4 = c2;
  1184. if (c1 <= '9')
  1185. {
  1186. c1 = charAt(this.bp + c2);
  1187. c2 += '\001';
  1188. }
  1189. }
  1190. else
  1191. {
  1192. c1 = this.bp;
  1193. double d = Double.parseDouble(subString(c1, this.bp + c4 - c1 - 1));
  1194. if (c3 == paramChar)
  1195. {
  1196. this.bp += c4 - '\001';
  1197. next();
  1198. this.matchStat = 3;
  1199. this.token = 16;
  1200. return d;
  1201. this.matchStat = -1;
  1202. return 0.0D;
  1203. }
  1204. this.matchStat = -1;
  1205. return d;
  1206. }
  1207. }
  1208. }
  1209. public final double scanFieldDouble(char[] paramArrayOfChar)
  1210. {
  1211. this.matchStat = 0;
  1212. if (!charArrayCompare(paramArrayOfChar))
  1213. {
  1214. this.matchStat = -2;
  1215. return 0.0D;
  1216. }
  1217. int i = paramArrayOfChar.length;
  1218. int j = charAt(this.bp + i);
  1219. int k;
  1220. int m;
  1221. if ((j >= 48) && (j <= 57))
  1222. {
  1223. i += 1;
  1224. while (true)
  1225. {
  1226. j = this.bp;
  1227. k = i + 1;
  1228. m = charAt(j + i);
  1229. if ((m < 48) || (m > 57))
  1230. break;
  1231. i = k;
  1232. }
  1233. j = m;
  1234. i = k;
  1235. if (m == 46)
  1236. {
  1237. j = this.bp;
  1238. i = k + 1;
  1239. j = charAt(j + k);
  1240. if ((j >= 48) && (j <= 57))
  1241. while (true)
  1242. {
  1243. j = this.bp;
  1244. k = i + 1;
  1245. m = charAt(j + i);
  1246. j = m;
  1247. i = k;
  1248. if (m < 48)
  1249. break;
  1250. j = m;
  1251. i = k;
  1252. if (m > 57)
  1253. break;
  1254. i = k;
  1255. }
  1256. this.matchStat = -1;
  1257. return 0.0D;
  1258. }
  1259. if (j != 101)
  1260. {
  1261. m = j;
  1262. k = i;
  1263. if (j != 69);
  1264. }
  1265. else
  1266. {
  1267. k = this.bp;
  1268. j = i + 1;
  1269. i = charAt(k + i);
  1270. if ((i != 43) && (i != 45))
  1271. break label624;
  1272. k = this.bp;
  1273. i = j + 1;
  1274. k = charAt(k + j);
  1275. j = i;
  1276. i = k;
  1277. }
  1278. }
  1279. label624:
  1280. while (true)
  1281. {
  1282. m = i;
  1283. k = j;
  1284. if (i >= 48)
  1285. {
  1286. m = i;
  1287. k = j;
  1288. if (i <= 57)
  1289. {
  1290. i = charAt(this.bp + j);
  1291. j += 1;
  1292. }
  1293. }
  1294. else
  1295. {
  1296. i = this.bp + paramArrayOfChar.length;
  1297. double d = Double.parseDouble(subString(i, this.bp + k - i - 1));
  1298. if (m == 44)
  1299. {
  1300. this.bp += k - 1;
  1301. next();
  1302. this.matchStat = 3;
  1303. this.token = 16;
  1304. return d;
  1305. this.matchStat = -1;
  1306. return 0.0D;
  1307. }
  1308. if (m == 125)
  1309. {
  1310. j = this.bp;
  1311. i = k + 1;
  1312. j = charAt(j + k);
  1313. if (j == 44)
  1314. {
  1315. this.token = 16;
  1316. this.bp += i - 1;
  1317. next();
  1318. }
  1319. while (true)
  1320. {
  1321. this.matchStat = 4;
  1322. return d;
  1323. if (j == 93)
  1324. {
  1325. this.token = 15;
  1326. this.bp += i - 1;
  1327. next();
  1328. }
  1329. else if (j == 125)
  1330. {
  1331. this.token = 13;
  1332. this.bp += i - 1;
  1333. next();
  1334. }
  1335. else
  1336. {
  1337. if (j != 26)
  1338. break;
  1339. this.token = 20;
  1340. this.bp += i - 1;
  1341. this.ch = '\032';
  1342. }
  1343. }
  1344. this.matchStat = -1;
  1345. return 0.0D;
  1346. }
  1347. this.matchStat = -1;
  1348. return 0.0D;
  1349. }
  1350. }
  1351. }
  1352. public final float scanFieldFloat(char[] paramArrayOfChar)
  1353. {
  1354. this.matchStat = 0;
  1355. if (!charArrayCompare(paramArrayOfChar))
  1356. {
  1357. this.matchStat = -2;
  1358. return 0.0F;
  1359. }
  1360. int i = paramArrayOfChar.length;
  1361. int j = charAt(this.bp + i);
  1362. int k;
  1363. float f;
  1364. if ((j >= 48) && (j <= 57))
  1365. {
  1366. i += 1;
  1367. int m;
  1368. while (true)
  1369. {
  1370. k = this.bp;
  1371. j = i + 1;
  1372. m = charAt(k + i);
  1373. if ((m < 48) || (m > 57))
  1374. break;
  1375. i = j;
  1376. }
  1377. k = m;
  1378. i = j;
  1379. if (m == 46)
  1380. {
  1381. k = this.bp;
  1382. i = j + 1;
  1383. j = charAt(k + j);
  1384. if ((j >= 48) && (j <= 57))
  1385. while (true)
  1386. {
  1387. k = this.bp;
  1388. j = i + 1;
  1389. m = charAt(k + i);
  1390. k = m;
  1391. i = j;
  1392. if (m < 48)
  1393. break;
  1394. k = m;
  1395. i = j;
  1396. if (m > 57)
  1397. break;
  1398. i = j;
  1399. }
  1400. this.matchStat = -1;
  1401. return 0.0F;
  1402. }
  1403. j = this.bp + paramArrayOfChar.length;
  1404. f = Float.parseFloat(subString(j, this.bp + i - j - 1));
  1405. if (k == 44)
  1406. {
  1407. this.bp += i - 1;
  1408. next();
  1409. this.matchStat = 3;
  1410. this.token = 16;
  1411. return f;
  1412. }
  1413. }
  1414. else
  1415. {
  1416. this.matchStat = -1;
  1417. return 0.0F;
  1418. }
  1419. if (k == 125)
  1420. {
  1421. k = this.bp;
  1422. j = i + 1;
  1423. i = charAt(k + i);
  1424. if (i == 44)
  1425. {
  1426. this.token = 16;
  1427. this.bp += j - 1;
  1428. next();
  1429. }
  1430. while (true)
  1431. {
  1432. this.matchStat = 4;
  1433. return f;
  1434. if (i == 93)
  1435. {
  1436. this.token = 15;
  1437. this.bp += j - 1;
  1438. next();
  1439. }
  1440. else if (i == 125)
  1441. {
  1442. this.token = 13;
  1443. this.bp += j - 1;
  1444. next();
  1445. }
  1446. else
  1447. {
  1448. if (i != 26)
  1449. break;
  1450. this.bp += j - 1;
  1451. this.token = 20;
  1452. this.ch = '\032';
  1453. }
  1454. }
  1455. this.matchStat = -1;
  1456. return 0.0F;
  1457. }
  1458. this.matchStat = -1;
  1459. return 0.0F;
  1460. }
  1461. public int scanFieldInt(char[] paramArrayOfChar)
  1462. {
  1463. this.matchStat = 0;
  1464. if (!charArrayCompare(paramArrayOfChar))
  1465. {
  1466. this.matchStat = -2;
  1467. return 0;
  1468. }
  1469. int j = paramArrayOfChar.length;
  1470. int i = charAt(this.bp + j);
  1471. int m;
  1472. int k;
  1473. if ((i >= 48) && (i <= 57))
  1474. {
  1475. i = digits[i];
  1476. j += 1;
  1477. while (true)
  1478. {
  1479. m = this.bp;
  1480. k = j + 1;
  1481. j = charAt(m + j);
  1482. if ((j < 48) || (j > 57))
  1483. break;
  1484. i = i * 10 + digits[j];
  1485. j = k;
  1486. }
  1487. if (j == 46)
  1488. {
  1489. this.matchStat = -1;
  1490. return 0;
  1491. }
  1492. if (i < 0)
  1493. {
  1494. this.matchStat = -1;
  1495. return 0;
  1496. }
  1497. }
  1498. else
  1499. {
  1500. this.matchStat = -1;
  1501. return 0;
  1502. }
  1503. if (j == 44)
  1504. {
  1505. this.bp += k - 1;
  1506. next();
  1507. this.matchStat = 3;
  1508. this.token = 16;
  1509. return i;
  1510. }
  1511. if (j == 125)
  1512. {
  1513. m = this.bp;
  1514. j = k + 1;
  1515. k = charAt(m + k);
  1516. if (k == 44)
  1517. {
  1518. this.token = 16;
  1519. this.bp += j - 1;
  1520. next();
  1521. }
  1522. while (true)
  1523. {
  1524. this.matchStat = 4;
  1525. return i;
  1526. if (k == 93)
  1527. {
  1528. this.token = 15;
  1529. this.bp += j - 1;
  1530. next();
  1531. }
  1532. else if (k == 125)
  1533. {
  1534. this.token = 13;
  1535. this.bp += j - 1;
  1536. next();
  1537. }
  1538. else
  1539. {
  1540. if (k != 26)
  1541. break;
  1542. this.token = 20;
  1543. this.bp += j - 1;
  1544. this.ch = '\032';
  1545. }
  1546. }
  1547. this.matchStat = -1;
  1548. return 0;
  1549. }
  1550. this.matchStat = -1;
  1551. return 0;
  1552. }
  1553. public long scanFieldLong(char[] paramArrayOfChar)
  1554. {
  1555. this.matchStat = 0;
  1556. if (!charArrayCompare(paramArrayOfChar))
  1557. {
  1558. this.matchStat = -2;
  1559. return 0L;
  1560. }
  1561. int i = paramArrayOfChar.length;
  1562. int j = charAt(this.bp + i);
  1563. long l;
  1564. int k;
  1565. if ((j >= 48) && (j <= 57))
  1566. {
  1567. l = digits[j];
  1568. i += 1;
  1569. while (true)
  1570. {
  1571. k = this.bp;
  1572. j = i + 1;
  1573. i = charAt(k + i);
  1574. if ((i < 48) || (i > 57))
  1575. break;
  1576. l = 10L * l + digits[i];
  1577. i = j;
  1578. }
  1579. if (i == 46)
  1580. {
  1581. this.matchStat = -1;
  1582. return 0L;
  1583. }
  1584. if (l < 0L)
  1585. {
  1586. this.matchStat = -1;
  1587. return 0L;
  1588. }
  1589. }
  1590. else
  1591. {
  1592. this.matchStat = -1;
  1593. return 0L;
  1594. }
  1595. if (i == 44)
  1596. {
  1597. this.bp += j - 1;
  1598. next();
  1599. this.matchStat = 3;
  1600. this.token = 16;
  1601. return l;
  1602. }
  1603. if (i == 125)
  1604. {
  1605. k = this.bp;
  1606. i = j + 1;
  1607. j = charAt(k + j);
  1608. if (j == 44)
  1609. {
  1610. this.token = 16;
  1611. this.bp += i - 1;
  1612. next();
  1613. }
  1614. while (true)
  1615. {
  1616. this.matchStat = 4;
  1617. return l;
  1618. if (j == 93)
  1619. {
  1620. this.token = 15;
  1621. this.bp += i - 1;
  1622. next();
  1623. }
  1624. else if (j == 125)
  1625. {
  1626. this.token = 13;
  1627. this.bp += i - 1;
  1628. next();
  1629. }
  1630. else
  1631. {
  1632. if (j != 26)
  1633. break;
  1634. this.token = 20;
  1635. this.bp += i - 1;
  1636. this.ch = '\032';
  1637. }
  1638. }
  1639. this.matchStat = -1;
  1640. return 0L;
  1641. }
  1642. this.matchStat = -1;
  1643. return 0L;
  1644. }
  1645. public String scanFieldString(char[] paramArrayOfChar)
  1646. {
  1647. this.matchStat = 0;
  1648. if (!charArrayCompare(paramArrayOfChar))
  1649. {
  1650. this.matchStat = -2;
  1651. return stringDefaultValue();
  1652. }
  1653. int m = paramArrayOfChar.length;
  1654. if (charAt(this.bp + m) != '"')
  1655. {
  1656. this.matchStat = -1;
  1657. return stringDefaultValue();
  1658. }
  1659. int k = 0;
  1660. int n = indexOf('"', this.bp + paramArrayOfChar.length + 1);
  1661. if (n == -1)
  1662. throw new JSONException("unclosed str");
  1663. int i = this.bp + paramArrayOfChar.length + 1;
  1664. String str = subString(i, n - i);
  1665. i = this.bp + paramArrayOfChar.length + 1;
  1666. while (true)
  1667. {
  1668. j = k;
  1669. if (i < n)
  1670. {
  1671. if (charAt(i) == '\\')
  1672. j = 1;
  1673. }
  1674. else
  1675. {
  1676. if (j == 0)
  1677. break;
  1678. this.matchStat = -1;
  1679. return stringDefaultValue();
  1680. }
  1681. i += 1;
  1682. }
  1683. int j = m + 1 + (n - (this.bp + paramArrayOfChar.length + 1) + 1);
  1684. k = this.bp;
  1685. i = j + 1;
  1686. j = charAt(k + j);
  1687. if (j == 44)
  1688. {
  1689. this.bp += i - 1;
  1690. next();
  1691. this.matchStat = 3;
  1692. return str;
  1693. }
  1694. if (j == 125)
  1695. {
  1696. k = this.bp;
  1697. j = i + 1;
  1698. i = charAt(k + i);
  1699. if (i == 44)
  1700. {
  1701. this.token = 16;
  1702. this.bp += j - 1;
  1703. next();
  1704. }
  1705. while (true)
  1706. {
  1707. this.matchStat = 4;
  1708. return str;
  1709. if (i == 93)
  1710. {
  1711. this.token = 15;
  1712. this.bp += j - 1;
  1713. next();
  1714. }
  1715. else if (i == 125)
  1716. {
  1717. this.token = 13;
  1718. this.bp += j - 1;
  1719. next();
  1720. }
  1721. else
  1722. {
  1723. if (i != 26)
  1724. break;
  1725. this.token = 20;
  1726. this.bp += j - 1;
  1727. this.ch = '\032';
  1728. }
  1729. }
  1730. this.matchStat = -1;
  1731. return stringDefaultValue();
  1732. }
  1733. this.matchStat = -1;
  1734. return stringDefaultValue();
  1735. }
  1736. public Collection<String> scanFieldStringArray(char[] paramArrayOfChar, Class<?> paramClass)
  1737. {
  1738. this.matchStat = 0;
  1739. if (!charArrayCompare(paramArrayOfChar))
  1740. {
  1741. this.matchStat = -2;
  1742. return null;
  1743. }
  1744. if (paramClass.isAssignableFrom(HashSet.class))
  1745. paramClass = new HashSet();
  1746. while (true)
  1747. {
  1748. i = paramArrayOfChar.length;
  1749. k = this.bp;
  1750. j = i + 1;
  1751. if (charAt(k + i) != '[')
  1752. {
  1753. this.matchStat = -1;
  1754. return null;
  1755. if (paramClass.isAssignableFrom(ArrayList.class))
  1756. {
  1757. paramClass = new ArrayList();
  1758. continue;
  1759. }
  1760. try
  1761. {
  1762. paramClass = (Collection)paramClass.newInstance();
  1763. }
  1764. catch (Exception paramArrayOfChar)
  1765. {
  1766. throw new JSONException(paramArrayOfChar.getMessage(), paramArrayOfChar);
  1767. }
  1768. }
  1769. }
  1770. int k = this.bp;
  1771. int i = j + 1;
  1772. int j = charAt(k + j);
  1773. if (j != 34)
  1774. {
  1775. this.matchStat = -1;
  1776. return null;
  1777. }
  1778. j = i;
  1779. while (true)
  1780. {
  1781. k = j;
  1782. int m = this.bp;
  1783. j = k + 1;
  1784. k = charAt(m + k);
  1785. if (k == 34)
  1786. {
  1787. i = this.bp + i;
  1788. paramClass.add(subString(i, this.bp + j - i - 1));
  1789. k = this.bp;
  1790. i = j + 1;
  1791. j = charAt(k + j);
  1792. if (j != 44)
  1793. break label284;
  1794. j = charAt(this.bp + i);
  1795. i += 1;
  1796. break;
  1797. }
  1798. if (k == 92)
  1799. {
  1800. this.matchStat = -1;
  1801. return null;
  1802. label284: if (j == 93)
  1803. {
  1804. k = this.bp;
  1805. j = i + 1;
  1806. i = charAt(k + i);
  1807. if (i == 44)
  1808. {
  1809. this.bp += j - 1;
  1810. next();
  1811. this.matchStat = 3;
  1812. return paramClass;
  1813. }
  1814. }
  1815. else
  1816. {
  1817. this.matchStat = -1;
  1818. return null;
  1819. }
  1820. if (i == 125)
  1821. {
  1822. k = this.bp;
  1823. i = j + 1;
  1824. j = charAt(k + j);
  1825. if (j == 44)
  1826. {
  1827. this.token = 16;
  1828. this.bp += i - 1;
  1829. next();
  1830. }
  1831. while (true)
  1832. {
  1833. this.matchStat = 4;
  1834. return paramClass;
  1835. if (j == 93)
  1836. {
  1837. this.token = 15;
  1838. this.bp += i - 1;
  1839. next();
  1840. }
  1841. else if (j == 125)
  1842. {
  1843. this.token = 13;
  1844. this.bp += i - 1;
  1845. next();
  1846. }
  1847. else
  1848. {
  1849. if (j != 26)
  1850. break;
  1851. this.bp += i - 1;
  1852. this.token = 20;
  1853. this.ch = '\032';
  1854. }
  1855. }
  1856. this.matchStat = -1;
  1857. return null;
  1858. }
  1859. this.matchStat = -1;
  1860. return null;
  1861. }
  1862. }
  1863. }
  1864. public String scanFieldSymbol(char[] paramArrayOfChar, SymbolTable paramSymbolTable)
  1865. {
  1866. this.matchStat = 0;
  1867. if (!charArrayCompare(paramArrayOfChar))
  1868. {
  1869. this.matchStat = -2;
  1870. return null;
  1871. }
  1872. int j = paramArrayOfChar.length;
  1873. if (charAt(this.bp + j) != '"')
  1874. {
  1875. this.matchStat = -1;
  1876. return null;
  1877. }
  1878. int i = 0;
  1879. j += 1;
  1880. while (true)
  1881. {
  1882. int m = this.bp;
  1883. int k = j + 1;
  1884. j = charAt(m + j);
  1885. if (j == 34)
  1886. {
  1887. j = this.bp + paramArrayOfChar.length + 1;
  1888. paramArrayOfChar = addSymbol(j, this.bp + k - j - 1, i, paramSymbolTable);
  1889. j = this.bp;
  1890. i = k + 1;
  1891. j = charAt(j + k);
  1892. if (j == 44)
  1893. {
  1894. this.bp += i - 1;
  1895. next();
  1896. this.matchStat = 3;
  1897. return paramArrayOfChar;
  1898. }
  1899. }
  1900. else
  1901. {
  1902. i = i * 31 + j;
  1903. if (j != 92)
  1904. break label371;
  1905. this.matchStat = -1;
  1906. return null;
  1907. }
  1908. if (j == 125)
  1909. {
  1910. k = this.bp;
  1911. j = i + 1;
  1912. i = charAt(k + i);
  1913. if (i == 44)
  1914. {
  1915. this.token = 16;
  1916. this.bp += j - 1;
  1917. next();
  1918. }
  1919. while (true)
  1920. {
  1921. this.matchStat = 4;
  1922. return paramArrayOfChar;
  1923. if (i == 93)
  1924. {
  1925. this.token = 15;
  1926. this.bp += j - 1;
  1927. next();
  1928. }
  1929. else if (i == 125)
  1930. {
  1931. this.token = 13;
  1932. this.bp += j - 1;
  1933. next();
  1934. }
  1935. else
  1936. {
  1937. if (i != 26)
  1938. break;
  1939. this.token = 20;
  1940. this.bp += j - 1;
  1941. this.ch = '\032';
  1942. }
  1943. }
  1944. this.matchStat = -1;
  1945. return null;
  1946. }
  1947. this.matchStat = -1;
  1948. return null;
  1949. label371: j = k;
  1950. }
  1951. }
  1952. public final float scanFloat(char paramChar)
  1953. {
  1954. this.matchStat = 0;
  1955. char c1 = charAt(this.bp + 0);
  1956. float f;
  1957. if ((c1 >= '0') && (c1 <= '9'))
  1958. {
  1959. char c4;
  1960. for (char c2 = 0 + 1; ; c2 = c1)
  1961. {
  1962. c3 = this.bp;
  1963. c1 = c2 + '\001';
  1964. c4 = charAt(c3 + c2);
  1965. if ((c4 < '0') || (c4 > '9'))
  1966. break;
  1967. }
  1968. c2 = c4;
  1969. char c3 = c1;
  1970. if (c4 == '.')
  1971. {
  1972. c3 = this.bp;
  1973. c2 = c1 + '\001';
  1974. c1 = charAt(c3 + c1);
  1975. if ((c1 >= '0') && (c1 <= '9'))
  1976. while (true)
  1977. {
  1978. c3 = this.bp;
  1979. c1 = c2 + '\001';
  1980. c4 = charAt(c3 + c2);
  1981. c2 = c4;
  1982. c3 = c1;
  1983. if (c4 < '0')
  1984. break;
  1985. c2 = c4;
  1986. c3 = c1;
  1987. if (c4 > '9')
  1988. break;
  1989. c2 = c1;
  1990. }
  1991. this.matchStat = -1;
  1992. return 0.0F;
  1993. }
  1994. c1 = this.bp;
  1995. f = Float.parseFloat(subString(c1, this.bp + c3 - c1 - 1));
  1996. if (c2 == paramChar)
  1997. {
  1998. this.bp += c3 - '\001';
  1999. next();
  2000. this.matchStat = 3;
  2001. this.token = 16;
  2002. return f;
  2003. }
  2004. }
  2005. else
  2006. {
  2007. this.matchStat = -1;
  2008. return 0.0F;
  2009. }
  2010. this.matchStat = -1;
  2011. return f;
  2012. }
  2013. public final void scanIdent()
  2014. {
  2015. this.np = (this.bp - 1);
  2016. this.hasSpecial = false;
  2017. do
  2018. {
  2019. this.sp += 1;
  2020. next();
  2021. }
  2022. while (Character.isLetterOrDigit(this.ch));
  2023. Object localObject = stringVal();
  2024. localObject = this.keywods.getKeyword((String)localObject);
  2025. if (localObject != null)
  2026. {
  2027. this.token = ((Integer)localObject).intValue();
  2028. return;
  2029. }
  2030. this.token = 18;
  2031. }
  2032. public int scanInt(char paramChar)
  2033. {
  2034. this.matchStat = 0;
  2035. int i = charAt(this.bp + 0);
  2036. char c1;
  2037. char c2;
  2038. if ((i >= 48) && (i <= 57))
  2039. {
  2040. i = digits[i];
  2041. for (c1 = 0 + 1; ; c1 = c2)
  2042. {
  2043. char c3 = this.bp;
  2044. c2 = c1 + '\001';
  2045. c1 = charAt(c3 + c1);
  2046. if ((c1 < '0') || (c1 > '9'))
  2047. break;
  2048. i = i * 10 + digits[c1];
  2049. }
  2050. if (c1 == '.')
  2051. {
  2052. this.matchStat = -1;
  2053. return 0;
  2054. }
  2055. if (i < 0)
  2056. {
  2057. this.matchStat = -1;
  2058. return 0;
  2059. }
  2060. }
  2061. else
  2062. {
  2063. this.matchStat = -1;
  2064. return 0;
  2065. }
  2066. if (c1 == paramChar)
  2067. {
  2068. this.bp += c2 - '\001';
  2069. next();
  2070. this.matchStat = 3;
  2071. this.token = 16;
  2072. return i;
  2073. }
  2074. this.matchStat = -1;
  2075. return i;
  2076. }
  2077. public long scanLong(char paramChar)
  2078. {
  2079. this.matchStat = 0;
  2080. char c1 = charAt(this.bp + 0);
  2081. long l;
  2082. char c2;
  2083. if ((c1 >= '0') && (c1 <= '9'))
  2084. {
  2085. l = digits[c1];
  2086. for (c1 = 0 + 1; ; c1 = c2)
  2087. {
  2088. char c3 = this.bp;
  2089. c2 = c1 + '\001';
  2090. c1 = charAt(c3 + c1);
  2091. if ((c1 < '0') || (c1 > '9'))
  2092. break;
  2093. l = 10L * l + digits[c1];
  2094. }
  2095. if (c1 == '.')
  2096. {
  2097. this.matchStat = -1;
  2098. return 0L;
  2099. }
  2100. if (l < 0L)
  2101. {
  2102. this.matchStat = -1;
  2103. return 0L;
  2104. }
  2105. }
  2106. else
  2107. {
  2108. this.matchStat = -1;
  2109. return 0L;
  2110. }
  2111. if (c1 == paramChar)
  2112. {
  2113. this.bp += c2 - '\001';
  2114. next();
  2115. this.matchStat = 3;
  2116. this.token = 16;
  2117. return l;
  2118. }
  2119. this.matchStat = -1;
  2120. return l;
  2121. }
  2122. public final void scanNullOrNew()
  2123. {
  2124. if (this.ch != 'n')
  2125. throw new JSONException("error parse null or new");
  2126. next();
  2127. if (this.ch == 'u')
  2128. {
  2129. next();
  2130. if (this.ch != 'l')
  2131. throw new JSONException("error parse true");
  2132. next();
  2133. if (this.ch != 'l')
  2134. throw new JSONException("error parse true");
  2135. next();
  2136. if ((this.ch == ' ') || (this.ch == ',') || (this.ch == '}') || (this.ch == ']') || (this.ch == '\n') || (this.ch == '\r') || (this.ch == '\t') || (this.ch == '\032') || (this.ch == '\f') || (this.ch == '\b'))
  2137. {
  2138. this.token = 8;
  2139. return;
  2140. }
  2141. throw new JSONException("scan true error");
  2142. }
  2143. if (this.ch != 'e')
  2144. throw new JSONException("error parse e");
  2145. next();
  2146. if (this.ch != 'w')
  2147. throw new JSONException("error parse w");
  2148. next();
  2149. if ((this.ch == ' ') || (this.ch == ',') || (this.ch == '}') || (this.ch == ']') || (this.ch == '\n') || (this.ch == '\r') || (this.ch == '\t') || (this.ch == '\032') || (this.ch == '\f') || (this.ch == '\b'))
  2150. {
  2151. this.token = 9;
  2152. return;
  2153. }
  2154. throw new JSONException("scan true error");
  2155. }
  2156. public final void scanNumber()
  2157. {
  2158. this.np = this.bp;
  2159. if (this.ch == '-')
  2160. {
  2161. this.sp += 1;
  2162. next();
  2163. }
  2164. while ((this.ch >= '0') && (this.ch <= '9'))
  2165. {
  2166. this.sp += 1;
  2167. next();
  2168. }
  2169. int i = 0;
  2170. if (this.ch == '.')
  2171. {
  2172. this.sp += 1;
  2173. next();
  2174. int j = 1;
  2175. while (true)
  2176. {
  2177. i = j;
  2178. if (this.ch < '0')
  2179. break;
  2180. i = j;
  2181. if (this.ch > '9')
  2182. break;
  2183. this.sp += 1;
  2184. next();
  2185. }
  2186. }
  2187. if (this.ch == 'L')
  2188. {
  2189. this.sp += 1;
  2190. next();
  2191. }
  2192. while (i != 0)
  2193. {
  2194. this.token = 3;
  2195. return;
  2196. if (this.ch == 'S')
  2197. {
  2198. this.sp += 1;
  2199. next();
  2200. }
  2201. else if (this.ch == 'B')
  2202. {
  2203. this.sp += 1;
  2204. next();
  2205. }
  2206. else if (this.ch == 'F')
  2207. {
  2208. this.sp += 1;
  2209. next();
  2210. i = 1;
  2211. }
  2212. else if (this.ch == 'D')
  2213. {
  2214. this.sp += 1;
  2215. next();
  2216. i = 1;
  2217. }
  2218. else if ((this.ch == 'e') || (this.ch == 'E'))
  2219. {
  2220. this.sp += 1;
  2221. next();
  2222. if ((this.ch == '+') || (this.ch == '-'))
  2223. {
  2224. this.sp += 1;
  2225. next();
  2226. }
  2227. while ((this.ch >= '0') && (this.ch <= '9'))
  2228. {
  2229. this.sp += 1;
  2230. next();
  2231. }
  2232. if ((this.ch == 'D') || (this.ch == 'F'))
  2233. {
  2234. this.sp += 1;
  2235. next();
  2236. }
  2237. i = 1;
  2238. }
  2239. }
  2240. this.token = 2;
  2241. }
  2242. public final void scanSet()
  2243. {
  2244. if (this.ch != 'S')
  2245. throw new JSONException("error parse true");
  2246. next();
  2247. if (this.ch != 'e')
  2248. throw new JSONException("error parse true");
  2249. next();
  2250. if (this.ch != 't')
  2251. throw new JSONException("error parse true");
  2252. next();
  2253. if ((this.ch == ' ') || (this.ch == '\n') || (this.ch == '\r') || (this.ch == '\t') || (this.ch == '\f') || (this.ch == '\b') || (this.ch == '[') || (this.ch == '('))
  2254. {
  2255. this.token = 21;
  2256. return;
  2257. }
  2258. throw new JSONException("scan set error");
  2259. }
  2260. public String scanString(char paramChar)
  2261. {
  2262. this.matchStat = 0;
  2263. int i = charAt(this.bp + 0);
  2264. if (i == 110)
  2265. {
  2266. if ((charAt(this.bp + 1) == 'u') && (charAt(this.bp + 1 + 1) == 'l') && (charAt(this.bp + 1 + 2) == 'l'))
  2267. {
  2268. if (charAt(this.bp + 4) == paramChar)
  2269. {
  2270. this.bp += 4;
  2271. next();
  2272. this.matchStat = 3;
  2273. return null;
  2274. }
  2275. }
  2276. else
  2277. {
  2278. this.matchStat = -1;
  2279. return null;
  2280. }
  2281. this.matchStat = -1;
  2282. return null;
  2283. }
  2284. if (i != 34)
  2285. {
  2286. this.matchStat = -1;
  2287. return stringDefaultValue();
  2288. }
  2289. int k = 0;
  2290. i = this.bp + 1;
  2291. int m = indexOf('"', i);
  2292. if (m == -1)
  2293. throw new JSONException("unclosed str");
  2294. String str = subString(this.bp + 1, m - i);
  2295. i = this.bp + 1;
  2296. while (true)
  2297. {
  2298. int j = k;
  2299. if (i < m)
  2300. {
  2301. if (charAt(i) == '\\')
  2302. j = 1;
  2303. }
  2304. else
  2305. {
  2306. if (j == 0)
  2307. break;
  2308. this.matchStat = -1;
  2309. return stringDefaultValue();
  2310. }
  2311. i += 1;
  2312. }
  2313. i = m - (this.bp + 1) + 1 + 1;
  2314. if (charAt(this.bp + i) == paramChar)
  2315. {
  2316. this.bp += i + 1 - 1;
  2317. next();
  2318. this.matchStat = 3;
  2319. retu

Large files files are truncated, but you can click here to view the full file