apiparser_parser.go 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. package api
  2. import (
  3. "fmt"
  4. "reflect"
  5. "strconv"
  6. "github.com/zeromicro/antlr"
  7. )
  8. // Suppress unused import errors
  9. var (
  10. _ = fmt.Printf
  11. _ = reflect.Copy
  12. _ = strconv.Itoa
  13. )
  14. var parserATN = []uint16{
  15. 3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 26, 349,
  16. 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7,
  17. 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13,
  18. 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9,
  19. 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23,
  20. 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4,
  21. 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34,
  22. 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 3, 2, 7,
  23. 2, 78, 10, 2, 12, 2, 14, 2, 81, 11, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5,
  24. 3, 88, 10, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 5, 5, 98,
  25. 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 6, 7, 108, 10, 7,
  26. 13, 7, 14, 7, 109, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 10, 3,
  27. 10, 3, 10, 3, 10, 6, 10, 123, 10, 10, 13, 10, 14, 10, 124, 3, 10, 3, 10,
  28. 3, 11, 3, 11, 5, 11, 131, 10, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 13, 3,
  29. 13, 3, 13, 3, 13, 7, 13, 141, 10, 13, 12, 13, 14, 13, 144, 11, 13, 3, 13,
  30. 3, 13, 3, 14, 3, 14, 5, 14, 150, 10, 14, 3, 15, 3, 15, 5, 15, 154, 10,
  31. 15, 3, 16, 3, 16, 3, 16, 5, 16, 159, 10, 16, 3, 16, 3, 16, 7, 16, 163,
  32. 10, 16, 12, 16, 14, 16, 166, 11, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17,
  33. 5, 17, 173, 10, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 5, 18, 180, 10,
  34. 18, 3, 18, 3, 18, 7, 18, 184, 10, 18, 12, 18, 14, 18, 187, 11, 18, 3, 18,
  35. 3, 18, 3, 19, 3, 19, 3, 19, 5, 19, 194, 10, 19, 3, 19, 3, 19, 3, 20, 3,
  36. 20, 3, 20, 5, 20, 201, 10, 20, 3, 21, 3, 21, 3, 21, 3, 21, 5, 21, 207,
  37. 10, 21, 3, 22, 5, 22, 210, 10, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 23, 3,
  38. 23, 3, 23, 3, 23, 3, 23, 3, 23, 5, 23, 222, 10, 23, 3, 24, 3, 24, 3, 24,
  39. 3, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 26, 3,
  40. 26, 3, 26, 3, 26, 3, 27, 5, 27, 241, 10, 27, 3, 27, 3, 27, 3, 28, 3, 28,
  41. 3, 28, 6, 28, 248, 10, 28, 13, 28, 14, 28, 249, 3, 28, 3, 28, 3, 29, 3,
  42. 29, 3, 29, 3, 29, 3, 29, 7, 29, 259, 10, 29, 12, 29, 14, 29, 262, 11, 29,
  43. 3, 29, 3, 29, 3, 30, 5, 30, 267, 10, 30, 3, 30, 3, 30, 5, 30, 271, 10,
  44. 30, 3, 30, 3, 30, 3, 31, 3, 31, 5, 31, 277, 10, 31, 3, 31, 6, 31, 280,
  45. 10, 31, 13, 31, 14, 31, 281, 3, 31, 5, 31, 285, 10, 31, 3, 31, 5, 31, 288,
  46. 10, 31, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 5, 33, 297, 10,
  47. 33, 3, 33, 5, 33, 300, 10, 33, 3, 34, 3, 34, 5, 34, 304, 10, 34, 3, 34,
  48. 3, 34, 3, 35, 3, 35, 3, 35, 5, 35, 311, 10, 35, 3, 35, 3, 35, 3, 36, 3,
  49. 36, 3, 36, 3, 36, 3, 37, 3, 37, 5, 37, 321, 10, 37, 6, 37, 323, 10, 37,
  50. 13, 37, 14, 37, 324, 3, 38, 3, 38, 3, 38, 3, 38, 7, 38, 331, 10, 38, 12,
  51. 38, 14, 38, 334, 11, 38, 3, 38, 3, 38, 3, 38, 3, 38, 5, 38, 340, 10, 38,
  52. 6, 38, 342, 10, 38, 13, 38, 14, 38, 343, 3, 38, 5, 38, 347, 10, 38, 3,
  53. 38, 2, 2, 39, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32,
  54. 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68,
  55. 70, 72, 74, 2, 2, 2, 358, 2, 79, 3, 2, 2, 2, 4, 87, 3, 2, 2, 2, 6, 89,
  56. 3, 2, 2, 2, 8, 97, 3, 2, 2, 2, 10, 99, 3, 2, 2, 2, 12, 103, 3, 2, 2, 2,
  57. 14, 113, 3, 2, 2, 2, 16, 115, 3, 2, 2, 2, 18, 118, 3, 2, 2, 2, 20, 130,
  58. 3, 2, 2, 2, 22, 132, 3, 2, 2, 2, 24, 136, 3, 2, 2, 2, 26, 149, 3, 2, 2,
  59. 2, 28, 153, 3, 2, 2, 2, 30, 155, 3, 2, 2, 2, 32, 169, 3, 2, 2, 2, 34, 176,
  60. 3, 2, 2, 2, 36, 190, 3, 2, 2, 2, 38, 200, 3, 2, 2, 2, 40, 202, 3, 2, 2,
  61. 2, 42, 209, 3, 2, 2, 2, 44, 221, 3, 2, 2, 2, 46, 223, 3, 2, 2, 2, 48, 227,
  62. 3, 2, 2, 2, 50, 235, 3, 2, 2, 2, 52, 240, 3, 2, 2, 2, 54, 244, 3, 2, 2,
  63. 2, 56, 253, 3, 2, 2, 2, 58, 266, 3, 2, 2, 2, 60, 274, 3, 2, 2, 2, 62, 289,
  64. 3, 2, 2, 2, 64, 292, 3, 2, 2, 2, 66, 301, 3, 2, 2, 2, 68, 307, 3, 2, 2,
  65. 2, 70, 314, 3, 2, 2, 2, 72, 322, 3, 2, 2, 2, 74, 346, 3, 2, 2, 2, 76, 78,
  66. 5, 4, 3, 2, 77, 76, 3, 2, 2, 2, 78, 81, 3, 2, 2, 2, 79, 77, 3, 2, 2, 2,
  67. 79, 80, 3, 2, 2, 2, 80, 3, 3, 2, 2, 2, 81, 79, 3, 2, 2, 2, 82, 88, 5, 6,
  68. 4, 2, 83, 88, 5, 8, 5, 2, 84, 88, 5, 18, 10, 2, 85, 88, 5, 20, 11, 2, 86,
  69. 88, 5, 52, 27, 2, 87, 82, 3, 2, 2, 2, 87, 83, 3, 2, 2, 2, 87, 84, 3, 2,
  70. 2, 2, 87, 85, 3, 2, 2, 2, 87, 86, 3, 2, 2, 2, 88, 5, 3, 2, 2, 2, 89, 90,
  71. 8, 4, 1, 2, 90, 91, 7, 26, 2, 2, 91, 92, 7, 3, 2, 2, 92, 93, 8, 4, 1, 2,
  72. 93, 94, 7, 23, 2, 2, 94, 7, 3, 2, 2, 2, 95, 98, 5, 10, 6, 2, 96, 98, 5,
  73. 12, 7, 2, 97, 95, 3, 2, 2, 2, 97, 96, 3, 2, 2, 2, 98, 9, 3, 2, 2, 2, 99,
  74. 100, 8, 6, 1, 2, 100, 101, 7, 26, 2, 2, 101, 102, 5, 16, 9, 2, 102, 11,
  75. 3, 2, 2, 2, 103, 104, 8, 7, 1, 2, 104, 105, 7, 26, 2, 2, 105, 107, 7, 4,
  76. 2, 2, 106, 108, 5, 14, 8, 2, 107, 106, 3, 2, 2, 2, 108, 109, 3, 2, 2, 2,
  77. 109, 107, 3, 2, 2, 2, 109, 110, 3, 2, 2, 2, 110, 111, 3, 2, 2, 2, 111,
  78. 112, 7, 5, 2, 2, 112, 13, 3, 2, 2, 2, 113, 114, 5, 16, 9, 2, 114, 15, 3,
  79. 2, 2, 2, 115, 116, 8, 9, 1, 2, 116, 117, 7, 23, 2, 2, 117, 17, 3, 2, 2,
  80. 2, 118, 119, 8, 10, 1, 2, 119, 120, 7, 26, 2, 2, 120, 122, 7, 4, 2, 2,
  81. 121, 123, 5, 70, 36, 2, 122, 121, 3, 2, 2, 2, 123, 124, 3, 2, 2, 2, 124,
  82. 122, 3, 2, 2, 2, 124, 125, 3, 2, 2, 2, 125, 126, 3, 2, 2, 2, 126, 127,
  83. 7, 5, 2, 2, 127, 19, 3, 2, 2, 2, 128, 131, 5, 22, 12, 2, 129, 131, 5, 24,
  84. 13, 2, 130, 128, 3, 2, 2, 2, 130, 129, 3, 2, 2, 2, 131, 21, 3, 2, 2, 2,
  85. 132, 133, 8, 12, 1, 2, 133, 134, 7, 26, 2, 2, 134, 135, 5, 26, 14, 2, 135,
  86. 23, 3, 2, 2, 2, 136, 137, 8, 13, 1, 2, 137, 138, 7, 26, 2, 2, 138, 142,
  87. 7, 4, 2, 2, 139, 141, 5, 28, 15, 2, 140, 139, 3, 2, 2, 2, 141, 144, 3,
  88. 2, 2, 2, 142, 140, 3, 2, 2, 2, 142, 143, 3, 2, 2, 2, 143, 145, 3, 2, 2,
  89. 2, 144, 142, 3, 2, 2, 2, 145, 146, 7, 5, 2, 2, 146, 25, 3, 2, 2, 2, 147,
  90. 150, 5, 30, 16, 2, 148, 150, 5, 32, 17, 2, 149, 147, 3, 2, 2, 2, 149, 148,
  91. 3, 2, 2, 2, 150, 27, 3, 2, 2, 2, 151, 154, 5, 34, 18, 2, 152, 154, 5, 36,
  92. 19, 2, 153, 151, 3, 2, 2, 2, 153, 152, 3, 2, 2, 2, 154, 29, 3, 2, 2, 2,
  93. 155, 156, 8, 16, 1, 2, 156, 158, 7, 26, 2, 2, 157, 159, 7, 26, 2, 2, 158,
  94. 157, 3, 2, 2, 2, 158, 159, 3, 2, 2, 2, 159, 160, 3, 2, 2, 2, 160, 164,
  95. 7, 6, 2, 2, 161, 163, 5, 38, 20, 2, 162, 161, 3, 2, 2, 2, 163, 166, 3,
  96. 2, 2, 2, 164, 162, 3, 2, 2, 2, 164, 165, 3, 2, 2, 2, 165, 167, 3, 2, 2,
  97. 2, 166, 164, 3, 2, 2, 2, 167, 168, 7, 7, 2, 2, 168, 31, 3, 2, 2, 2, 169,
  98. 170, 8, 17, 1, 2, 170, 172, 7, 26, 2, 2, 171, 173, 7, 3, 2, 2, 172, 171,
  99. 3, 2, 2, 2, 172, 173, 3, 2, 2, 2, 173, 174, 3, 2, 2, 2, 174, 175, 5, 44,
  100. 23, 2, 175, 33, 3, 2, 2, 2, 176, 177, 8, 18, 1, 2, 177, 179, 7, 26, 2,
  101. 2, 178, 180, 7, 26, 2, 2, 179, 178, 3, 2, 2, 2, 179, 180, 3, 2, 2, 2, 180,
  102. 181, 3, 2, 2, 2, 181, 185, 7, 6, 2, 2, 182, 184, 5, 38, 20, 2, 183, 182,
  103. 3, 2, 2, 2, 184, 187, 3, 2, 2, 2, 185, 183, 3, 2, 2, 2, 185, 186, 3, 2,
  104. 2, 2, 186, 188, 3, 2, 2, 2, 187, 185, 3, 2, 2, 2, 188, 189, 7, 7, 2, 2,
  105. 189, 35, 3, 2, 2, 2, 190, 191, 8, 19, 1, 2, 191, 193, 7, 26, 2, 2, 192,
  106. 194, 7, 3, 2, 2, 193, 192, 3, 2, 2, 2, 193, 194, 3, 2, 2, 2, 194, 195,
  107. 3, 2, 2, 2, 195, 196, 5, 44, 23, 2, 196, 37, 3, 2, 2, 2, 197, 198, 6, 20,
  108. 2, 2, 198, 201, 5, 40, 21, 2, 199, 201, 5, 42, 22, 2, 200, 197, 3, 2, 2,
  109. 2, 200, 199, 3, 2, 2, 2, 201, 39, 3, 2, 2, 2, 202, 203, 8, 21, 1, 2, 203,
  110. 204, 7, 26, 2, 2, 204, 206, 5, 44, 23, 2, 205, 207, 7, 24, 2, 2, 206, 205,
  111. 3, 2, 2, 2, 206, 207, 3, 2, 2, 2, 207, 41, 3, 2, 2, 2, 208, 210, 7, 8,
  112. 2, 2, 209, 208, 3, 2, 2, 2, 209, 210, 3, 2, 2, 2, 210, 211, 3, 2, 2, 2,
  113. 211, 212, 7, 26, 2, 2, 212, 43, 3, 2, 2, 2, 213, 214, 8, 23, 1, 2, 214,
  114. 222, 7, 26, 2, 2, 215, 222, 5, 48, 25, 2, 216, 222, 5, 50, 26, 2, 217,
  115. 222, 7, 18, 2, 2, 218, 222, 7, 9, 2, 2, 219, 222, 5, 46, 24, 2, 220, 222,
  116. 5, 30, 16, 2, 221, 213, 3, 2, 2, 2, 221, 215, 3, 2, 2, 2, 221, 216, 3,
  117. 2, 2, 2, 221, 217, 3, 2, 2, 2, 221, 218, 3, 2, 2, 2, 221, 219, 3, 2, 2,
  118. 2, 221, 220, 3, 2, 2, 2, 222, 45, 3, 2, 2, 2, 223, 224, 7, 8, 2, 2, 224,
  119. 225, 8, 24, 1, 2, 225, 226, 7, 26, 2, 2, 226, 47, 3, 2, 2, 2, 227, 228,
  120. 8, 25, 1, 2, 228, 229, 7, 26, 2, 2, 229, 230, 7, 10, 2, 2, 230, 231, 8,
  121. 25, 1, 2, 231, 232, 7, 26, 2, 2, 232, 233, 7, 11, 2, 2, 233, 234, 5, 44,
  122. 23, 2, 234, 49, 3, 2, 2, 2, 235, 236, 7, 10, 2, 2, 236, 237, 7, 11, 2,
  123. 2, 237, 238, 5, 44, 23, 2, 238, 51, 3, 2, 2, 2, 239, 241, 5, 54, 28, 2,
  124. 240, 239, 3, 2, 2, 2, 240, 241, 3, 2, 2, 2, 241, 242, 3, 2, 2, 2, 242,
  125. 243, 5, 56, 29, 2, 243, 53, 3, 2, 2, 2, 244, 245, 7, 19, 2, 2, 245, 247,
  126. 7, 4, 2, 2, 246, 248, 5, 70, 36, 2, 247, 246, 3, 2, 2, 2, 248, 249, 3,
  127. 2, 2, 2, 249, 247, 3, 2, 2, 2, 249, 250, 3, 2, 2, 2, 250, 251, 3, 2, 2,
  128. 2, 251, 252, 7, 5, 2, 2, 252, 55, 3, 2, 2, 2, 253, 254, 8, 29, 1, 2, 254,
  129. 255, 7, 26, 2, 2, 255, 256, 5, 72, 37, 2, 256, 260, 7, 6, 2, 2, 257, 259,
  130. 5, 58, 30, 2, 258, 257, 3, 2, 2, 2, 259, 262, 3, 2, 2, 2, 260, 258, 3,
  131. 2, 2, 2, 260, 261, 3, 2, 2, 2, 261, 263, 3, 2, 2, 2, 262, 260, 3, 2, 2,
  132. 2, 263, 264, 7, 7, 2, 2, 264, 57, 3, 2, 2, 2, 265, 267, 5, 60, 31, 2, 266,
  133. 265, 3, 2, 2, 2, 266, 267, 3, 2, 2, 2, 267, 270, 3, 2, 2, 2, 268, 271,
  134. 5, 54, 28, 2, 269, 271, 5, 62, 32, 2, 270, 268, 3, 2, 2, 2, 270, 269, 3,
  135. 2, 2, 2, 271, 272, 3, 2, 2, 2, 272, 273, 5, 64, 33, 2, 273, 59, 3, 2, 2,
  136. 2, 274, 276, 7, 16, 2, 2, 275, 277, 7, 4, 2, 2, 276, 275, 3, 2, 2, 2, 276,
  137. 277, 3, 2, 2, 2, 277, 284, 3, 2, 2, 2, 278, 280, 5, 70, 36, 2, 279, 278,
  138. 3, 2, 2, 2, 280, 281, 3, 2, 2, 2, 281, 279, 3, 2, 2, 2, 281, 282, 3, 2,
  139. 2, 2, 282, 285, 3, 2, 2, 2, 283, 285, 7, 23, 2, 2, 284, 279, 3, 2, 2, 2,
  140. 284, 283, 3, 2, 2, 2, 285, 287, 3, 2, 2, 2, 286, 288, 7, 5, 2, 2, 287,
  141. 286, 3, 2, 2, 2, 287, 288, 3, 2, 2, 2, 288, 61, 3, 2, 2, 2, 289, 290, 7,
  142. 17, 2, 2, 290, 291, 7, 26, 2, 2, 291, 63, 3, 2, 2, 2, 292, 293, 8, 33,
  143. 1, 2, 293, 294, 7, 26, 2, 2, 294, 296, 5, 74, 38, 2, 295, 297, 5, 66, 34,
  144. 2, 296, 295, 3, 2, 2, 2, 296, 297, 3, 2, 2, 2, 297, 299, 3, 2, 2, 2, 298,
  145. 300, 5, 68, 35, 2, 299, 298, 3, 2, 2, 2, 299, 300, 3, 2, 2, 2, 300, 65,
  146. 3, 2, 2, 2, 301, 303, 7, 4, 2, 2, 302, 304, 7, 26, 2, 2, 303, 302, 3, 2,
  147. 2, 2, 303, 304, 3, 2, 2, 2, 304, 305, 3, 2, 2, 2, 305, 306, 7, 5, 2, 2,
  148. 306, 67, 3, 2, 2, 2, 307, 308, 7, 12, 2, 2, 308, 310, 7, 4, 2, 2, 309,
  149. 311, 5, 44, 23, 2, 310, 309, 3, 2, 2, 2, 310, 311, 3, 2, 2, 2, 311, 312,
  150. 3, 2, 2, 2, 312, 313, 7, 5, 2, 2, 313, 69, 3, 2, 2, 2, 314, 315, 7, 26,
  151. 2, 2, 315, 316, 8, 36, 1, 2, 316, 317, 7, 25, 2, 2, 317, 71, 3, 2, 2, 2,
  152. 318, 320, 7, 26, 2, 2, 319, 321, 7, 13, 2, 2, 320, 319, 3, 2, 2, 2, 320,
  153. 321, 3, 2, 2, 2, 321, 323, 3, 2, 2, 2, 322, 318, 3, 2, 2, 2, 323, 324,
  154. 3, 2, 2, 2, 324, 322, 3, 2, 2, 2, 324, 325, 3, 2, 2, 2, 325, 73, 3, 2,
  155. 2, 2, 326, 327, 7, 14, 2, 2, 327, 332, 7, 26, 2, 2, 328, 329, 7, 13, 2,
  156. 2, 329, 331, 7, 26, 2, 2, 330, 328, 3, 2, 2, 2, 331, 334, 3, 2, 2, 2, 332,
  157. 330, 3, 2, 2, 2, 332, 333, 3, 2, 2, 2, 333, 342, 3, 2, 2, 2, 334, 332,
  158. 3, 2, 2, 2, 335, 336, 7, 15, 2, 2, 336, 339, 7, 26, 2, 2, 337, 338, 7,
  159. 13, 2, 2, 338, 340, 7, 26, 2, 2, 339, 337, 3, 2, 2, 2, 339, 340, 3, 2,
  160. 2, 2, 340, 342, 3, 2, 2, 2, 341, 326, 3, 2, 2, 2, 341, 335, 3, 2, 2, 2,
  161. 342, 343, 3, 2, 2, 2, 343, 341, 3, 2, 2, 2, 343, 344, 3, 2, 2, 2, 344,
  162. 347, 3, 2, 2, 2, 345, 347, 7, 14, 2, 2, 346, 341, 3, 2, 2, 2, 346, 345,
  163. 3, 2, 2, 2, 347, 75, 3, 2, 2, 2, 41, 79, 87, 97, 109, 124, 130, 142, 149,
  164. 153, 158, 164, 172, 179, 185, 193, 200, 206, 209, 221, 240, 249, 260, 266,
  165. 270, 276, 281, 284, 287, 296, 299, 303, 310, 320, 324, 332, 339, 341, 343,
  166. 346,
  167. }
  168. var literalNames = []string{
  169. "", "'='", "'('", "')'", "'{'", "'}'", "'*'", "'time.Time'", "'['", "']'",
  170. "'returns'", "'-'", "'/'", "'/:'", "'@doc'", "'@handler'", "'interface{}'",
  171. "'@server'",
  172. }
  173. var symbolicNames = []string{
  174. "", "", "", "", "", "", "", "", "", "", "", "", "", "", "ATDOC", "ATHANDLER",
  175. "INTERFACE", "ATSERVER", "WS", "COMMENT", "LINE_COMMENT", "STRING", "RAW_STRING",
  176. "LINE_VALUE", "ID",
  177. }
  178. var ruleNames = []string{
  179. "api", "spec", "syntaxLit", "importSpec", "importLit", "importBlock", "importBlockValue",
  180. "importValue", "infoSpec", "typeSpec", "typeLit", "typeBlock", "typeLitBody",
  181. "typeBlockBody", "typeStruct", "typeAlias", "typeBlockStruct", "typeBlockAlias",
  182. "field", "normalField", "anonymousFiled", "dataType", "pointerType", "mapType",
  183. "arrayType", "serviceSpec", "atServer", "serviceApi", "serviceRoute", "atDoc",
  184. "atHandler", "route", "body", "replybody", "kvLit", "serviceName", "path",
  185. }
  186. type ApiParserParser struct {
  187. *antlr.BaseParser
  188. }
  189. // NewApiParserParser produces a new parser instance for the optional input antlr.TokenStream.
  190. //
  191. // The *ApiParserParser instance produced may be reused by calling the SetInputStream method.
  192. // The initial parser configuration is expensive to construct, and the object is not thread-safe;
  193. // however, if used within a Golang sync.Pool, the construction cost amortizes well and the
  194. // objects can be used in a thread-safe manner.
  195. func NewApiParserParser(input antlr.TokenStream) *ApiParserParser {
  196. this := new(ApiParserParser)
  197. deserializer := antlr.NewATNDeserializer(nil)
  198. deserializedATN := deserializer.DeserializeFromUInt16(parserATN)
  199. decisionToDFA := make([]*antlr.DFA, len(deserializedATN.DecisionToState))
  200. for index, ds := range deserializedATN.DecisionToState {
  201. decisionToDFA[index] = antlr.NewDFA(ds, index)
  202. }
  203. this.BaseParser = antlr.NewBaseParser(input)
  204. this.Interpreter = antlr.NewParserATNSimulator(this, deserializedATN, decisionToDFA, antlr.NewPredictionContextCache())
  205. this.RuleNames = ruleNames
  206. this.LiteralNames = literalNames
  207. this.SymbolicNames = symbolicNames
  208. this.GrammarFileName = "ApiParser.g4"
  209. return this
  210. }
  211. // ApiParserParser tokens.
  212. const (
  213. ApiParserParserEOF = antlr.TokenEOF
  214. ApiParserParserT__0 = 1
  215. ApiParserParserT__1 = 2
  216. ApiParserParserT__2 = 3
  217. ApiParserParserT__3 = 4
  218. ApiParserParserT__4 = 5
  219. ApiParserParserT__5 = 6
  220. ApiParserParserT__6 = 7
  221. ApiParserParserT__7 = 8
  222. ApiParserParserT__8 = 9
  223. ApiParserParserT__9 = 10
  224. ApiParserParserT__10 = 11
  225. ApiParserParserT__11 = 12
  226. ApiParserParserT__12 = 13
  227. ApiParserParserATDOC = 14
  228. ApiParserParserATHANDLER = 15
  229. ApiParserParserINTERFACE = 16
  230. ApiParserParserATSERVER = 17
  231. ApiParserParserWS = 18
  232. ApiParserParserCOMMENT = 19
  233. ApiParserParserLINE_COMMENT = 20
  234. ApiParserParserSTRING = 21
  235. ApiParserParserRAW_STRING = 22
  236. ApiParserParserLINE_VALUE = 23
  237. ApiParserParserID = 24
  238. )
  239. // ApiParserParser rules.
  240. const (
  241. ApiParserParserRULE_api = 0
  242. ApiParserParserRULE_spec = 1
  243. ApiParserParserRULE_syntaxLit = 2
  244. ApiParserParserRULE_importSpec = 3
  245. ApiParserParserRULE_importLit = 4
  246. ApiParserParserRULE_importBlock = 5
  247. ApiParserParserRULE_importBlockValue = 6
  248. ApiParserParserRULE_importValue = 7
  249. ApiParserParserRULE_infoSpec = 8
  250. ApiParserParserRULE_typeSpec = 9
  251. ApiParserParserRULE_typeLit = 10
  252. ApiParserParserRULE_typeBlock = 11
  253. ApiParserParserRULE_typeLitBody = 12
  254. ApiParserParserRULE_typeBlockBody = 13
  255. ApiParserParserRULE_typeStruct = 14
  256. ApiParserParserRULE_typeAlias = 15
  257. ApiParserParserRULE_typeBlockStruct = 16
  258. ApiParserParserRULE_typeBlockAlias = 17
  259. ApiParserParserRULE_field = 18
  260. ApiParserParserRULE_normalField = 19
  261. ApiParserParserRULE_anonymousFiled = 20
  262. ApiParserParserRULE_dataType = 21
  263. ApiParserParserRULE_pointerType = 22
  264. ApiParserParserRULE_mapType = 23
  265. ApiParserParserRULE_arrayType = 24
  266. ApiParserParserRULE_serviceSpec = 25
  267. ApiParserParserRULE_atServer = 26
  268. ApiParserParserRULE_serviceApi = 27
  269. ApiParserParserRULE_serviceRoute = 28
  270. ApiParserParserRULE_atDoc = 29
  271. ApiParserParserRULE_atHandler = 30
  272. ApiParserParserRULE_route = 31
  273. ApiParserParserRULE_body = 32
  274. ApiParserParserRULE_replybody = 33
  275. ApiParserParserRULE_kvLit = 34
  276. ApiParserParserRULE_serviceName = 35
  277. ApiParserParserRULE_path = 36
  278. )
  279. // IApiContext is an interface to support dynamic dispatch.
  280. type IApiContext interface {
  281. antlr.ParserRuleContext
  282. // GetParser returns the parser.
  283. GetParser() antlr.Parser
  284. // IsApiContext differentiates from other interfaces.
  285. IsApiContext()
  286. }
  287. type ApiContext struct {
  288. *antlr.BaseParserRuleContext
  289. parser antlr.Parser
  290. }
  291. func NewEmptyApiContext() *ApiContext {
  292. p := new(ApiContext)
  293. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  294. p.RuleIndex = ApiParserParserRULE_api
  295. return p
  296. }
  297. func (*ApiContext) IsApiContext() {}
  298. func NewApiContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ApiContext {
  299. p := new(ApiContext)
  300. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  301. p.parser = parser
  302. p.RuleIndex = ApiParserParserRULE_api
  303. return p
  304. }
  305. func (s *ApiContext) GetParser() antlr.Parser { return s.parser }
  306. func (s *ApiContext) AllSpec() []ISpecContext {
  307. ts := s.GetTypedRuleContexts(reflect.TypeOf((*ISpecContext)(nil)).Elem())
  308. tst := make([]ISpecContext, len(ts))
  309. for i, t := range ts {
  310. if t != nil {
  311. tst[i] = t.(ISpecContext)
  312. }
  313. }
  314. return tst
  315. }
  316. func (s *ApiContext) Spec(i int) ISpecContext {
  317. t := s.GetTypedRuleContext(reflect.TypeOf((*ISpecContext)(nil)).Elem(), i)
  318. if t == nil {
  319. return nil
  320. }
  321. return t.(ISpecContext)
  322. }
  323. func (s *ApiContext) GetRuleContext() antlr.RuleContext {
  324. return s
  325. }
  326. func (s *ApiContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  327. return antlr.TreesStringTree(s, ruleNames, recog)
  328. }
  329. func (s *ApiContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  330. switch t := visitor.(type) {
  331. case ApiParserVisitor:
  332. return t.VisitApi(s)
  333. default:
  334. return t.VisitChildren(s)
  335. }
  336. }
  337. func (p *ApiParserParser) Api() (localctx IApiContext) {
  338. localctx = NewApiContext(p, p.GetParserRuleContext(), p.GetState())
  339. p.EnterRule(localctx, 0, ApiParserParserRULE_api)
  340. var _la int
  341. defer func() {
  342. p.ExitRule()
  343. }()
  344. defer func() {
  345. if err := recover(); err != nil {
  346. if v, ok := err.(antlr.RecognitionException); ok {
  347. localctx.SetException(v)
  348. p.GetErrorHandler().ReportError(p, v)
  349. p.GetErrorHandler().Recover(p, v)
  350. } else {
  351. panic(err)
  352. }
  353. }
  354. }()
  355. p.EnterOuterAlt(localctx, 1)
  356. p.SetState(77)
  357. p.GetErrorHandler().Sync(p)
  358. _la = p.GetTokenStream().LA(1)
  359. for _la == ApiParserParserATSERVER || _la == ApiParserParserID {
  360. {
  361. p.SetState(74)
  362. p.Spec()
  363. }
  364. p.SetState(79)
  365. p.GetErrorHandler().Sync(p)
  366. _la = p.GetTokenStream().LA(1)
  367. }
  368. return localctx
  369. }
  370. // ISpecContext is an interface to support dynamic dispatch.
  371. type ISpecContext interface {
  372. antlr.ParserRuleContext
  373. // GetParser returns the parser.
  374. GetParser() antlr.Parser
  375. // IsSpecContext differentiates from other interfaces.
  376. IsSpecContext()
  377. }
  378. type SpecContext struct {
  379. *antlr.BaseParserRuleContext
  380. parser antlr.Parser
  381. }
  382. func NewEmptySpecContext() *SpecContext {
  383. p := new(SpecContext)
  384. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  385. p.RuleIndex = ApiParserParserRULE_spec
  386. return p
  387. }
  388. func (*SpecContext) IsSpecContext() {}
  389. func NewSpecContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SpecContext {
  390. p := new(SpecContext)
  391. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  392. p.parser = parser
  393. p.RuleIndex = ApiParserParserRULE_spec
  394. return p
  395. }
  396. func (s *SpecContext) GetParser() antlr.Parser { return s.parser }
  397. func (s *SpecContext) SyntaxLit() ISyntaxLitContext {
  398. t := s.GetTypedRuleContext(reflect.TypeOf((*ISyntaxLitContext)(nil)).Elem(), 0)
  399. if t == nil {
  400. return nil
  401. }
  402. return t.(ISyntaxLitContext)
  403. }
  404. func (s *SpecContext) ImportSpec() IImportSpecContext {
  405. t := s.GetTypedRuleContext(reflect.TypeOf((*IImportSpecContext)(nil)).Elem(), 0)
  406. if t == nil {
  407. return nil
  408. }
  409. return t.(IImportSpecContext)
  410. }
  411. func (s *SpecContext) InfoSpec() IInfoSpecContext {
  412. t := s.GetTypedRuleContext(reflect.TypeOf((*IInfoSpecContext)(nil)).Elem(), 0)
  413. if t == nil {
  414. return nil
  415. }
  416. return t.(IInfoSpecContext)
  417. }
  418. func (s *SpecContext) TypeSpec() ITypeSpecContext {
  419. t := s.GetTypedRuleContext(reflect.TypeOf((*ITypeSpecContext)(nil)).Elem(), 0)
  420. if t == nil {
  421. return nil
  422. }
  423. return t.(ITypeSpecContext)
  424. }
  425. func (s *SpecContext) ServiceSpec() IServiceSpecContext {
  426. t := s.GetTypedRuleContext(reflect.TypeOf((*IServiceSpecContext)(nil)).Elem(), 0)
  427. if t == nil {
  428. return nil
  429. }
  430. return t.(IServiceSpecContext)
  431. }
  432. func (s *SpecContext) GetRuleContext() antlr.RuleContext {
  433. return s
  434. }
  435. func (s *SpecContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string {
  436. return antlr.TreesStringTree(s, ruleNames, recog)
  437. }
  438. func (s *SpecContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
  439. switch t := visitor.(type) {
  440. case ApiParserVisitor:
  441. return t.VisitSpec(s)
  442. default:
  443. return t.VisitChildren(s)
  444. }
  445. }
  446. func (p *ApiParserParser) Spec() (localctx ISpecContext) {
  447. localctx = NewSpecContext(p, p.GetParserRuleContext(), p.GetState())
  448. p.EnterRule(localctx, 2, ApiParserParserRULE_spec)
  449. defer func() {
  450. p.ExitRule()
  451. }()
  452. defer func() {
  453. if err := recover(); err != nil {
  454. if v, ok := err.(antlr.RecognitionException); ok {
  455. localctx.SetException(v)
  456. p.GetErrorHandler().ReportError(p, v)
  457. p.GetErrorHandler().Recover(p, v)
  458. } else {
  459. panic(err)
  460. }
  461. }
  462. }()
  463. p.SetState(85)
  464. p.GetErrorHandler().Sync(p)
  465. switch p.GetInterpreter().AdaptivePredict(p.GetTokenStream(), 1, p.GetParserRuleContext()) {
  466. case 1:
  467. p.EnterOuterAlt(localctx, 1)
  468. {
  469. p.SetState(80)
  470. p.SyntaxLit()
  471. }
  472. case 2:
  473. p.EnterOuterAlt(localctx, 2)
  474. {
  475. p.SetState(81)
  476. p.ImportSpec()
  477. }
  478. case 3:
  479. p.EnterOuterAlt(localctx, 3)
  480. {
  481. p.SetState(82)
  482. p.InfoSpec()
  483. }
  484. case 4:
  485. p.EnterOuterAlt(localctx, 4)
  486. {
  487. p.SetState(83)
  488. p.TypeSpec()
  489. }
  490. case 5:
  491. p.EnterOuterAlt(localctx, 5)
  492. {
  493. p.SetState(84)
  494. p.ServiceSpec()
  495. }
  496. }
  497. return localctx
  498. }
  499. // ISyntaxLitContext is an interface to support dynamic dispatch.
  500. type ISyntaxLitContext interface {
  501. antlr.ParserRuleContext
  502. // GetParser returns the parser.
  503. GetParser() antlr.Parser
  504. // GetSyntaxToken returns the syntaxToken token.
  505. GetSyntaxToken() antlr.Token
  506. // GetAssign returns the assign token.
  507. GetAssign() antlr.Token
  508. // GetVersion returns the version token.
  509. GetVersion() antlr.Token
  510. // SetSyntaxToken sets the syntaxToken token.
  511. SetSyntaxToken(antlr.Token)
  512. // SetAssign sets the assign token.
  513. SetAssign(antlr.Token)
  514. // SetVersion sets the version token.
  515. SetVersion(antlr.Token)
  516. // IsSyntaxLitContext differentiates from other interfaces.
  517. IsSyntaxLitContext()
  518. }
  519. type SyntaxLitContext struct {
  520. *antlr.BaseParserRuleContext
  521. parser antlr.Parser
  522. syntaxToken antlr.Token
  523. assign antlr.Token
  524. version antlr.Token
  525. }
  526. func NewEmptySyntaxLitContext() *SyntaxLitContext {
  527. p := new(SyntaxLitContext)
  528. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(nil, -1)
  529. p.RuleIndex = ApiParserParserRULE_syntaxLit
  530. return p
  531. }
  532. func (*SyntaxLitContext) IsSyntaxLitContext() {}
  533. func NewSyntaxLitContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SyntaxLitContext {
  534. p := new(SyntaxLitContext)
  535. p.BaseParserRuleContext = antlr.NewBaseParserRuleContext(parent, invokingState)
  536. p.parser = parser
  537. p.RuleIndex = ApiParserParserRULE_syntaxLit
  538. return p
  539. }