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

/src/main/java/com/alibaba/fastjson/parser/JSONToken.java

https://bitbucket.org/xiejuntao/xdesktop
Java | 117 lines | 75 code | 6 blank | 36 comment | 1 complexity | 959fb9de6bf5f4d82c2d7fe934d6072d MD5 | raw file
  1. /*
  2. * Copyright 1999-2101 Alibaba Group.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.alibaba.fastjson.parser;
  17. /**
  18. * @author wenshao<szujobs@hotmail.com>
  19. */
  20. public class JSONToken {
  21. //
  22. public final static int ERROR = 1;
  23. //
  24. public final static int LITERAL_INT = 2;
  25. //
  26. public final static int LITERAL_FLOAT = 3;
  27. //
  28. public final static int LITERAL_STRING = 4;
  29. //
  30. public final static int LITERAL_ISO8601_DATE = 5;
  31. public final static int TRUE = 6;
  32. //
  33. public final static int FALSE = 7;
  34. //
  35. public final static int NULL = 8;
  36. //
  37. public final static int NEW = 9;
  38. //
  39. public final static int LPAREN = 10; // ("("),
  40. //
  41. public final static int RPAREN = 11; // (")"),
  42. //
  43. public final static int LBRACE = 12; // ("{"),
  44. //
  45. public final static int RBRACE = 13; // ("}"),
  46. //
  47. public final static int LBRACKET = 14; // ("["),
  48. //
  49. public final static int RBRACKET = 15; // ("]"),
  50. //
  51. public final static int COMMA = 16; // (","),
  52. //
  53. public final static int COLON = 17; // (":"),
  54. //
  55. public final static int IDENTIFIER = 18;
  56. //
  57. public final static int FIELD_NAME = 19;
  58. public final static int EOF = 20;
  59. public final static int SET = 21;
  60. public final static int TREE_SET = 22;
  61. public static String name(int value) {
  62. switch (value) {
  63. case ERROR:
  64. return "error";
  65. case LITERAL_INT:
  66. return "int";
  67. case LITERAL_FLOAT:
  68. return "float";
  69. case LITERAL_STRING:
  70. return "string";
  71. case LITERAL_ISO8601_DATE:
  72. return "iso8601";
  73. case TRUE:
  74. return "true";
  75. case FALSE:
  76. return "false";
  77. case NULL:
  78. return "null";
  79. case NEW:
  80. return "new";
  81. case LPAREN:
  82. return "(";
  83. case RPAREN:
  84. return ")";
  85. case LBRACE:
  86. return "{";
  87. case RBRACE:
  88. return "}";
  89. case LBRACKET:
  90. return "[";
  91. case RBRACKET:
  92. return "]";
  93. case COMMA:
  94. return ",";
  95. case COLON:
  96. return ":";
  97. case IDENTIFIER:
  98. return "ident";
  99. case FIELD_NAME:
  100. return "fieldName";
  101. case EOF:
  102. return "EOF";
  103. case SET:
  104. return "Set";
  105. case TREE_SET:
  106. return "TreeSet";
  107. default:
  108. return "Unkown";
  109. }
  110. }
  111. }