zsv 1.3.0 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +41 -3
  4. data/ext/zsv/extconf.rb +66 -49
  5. data/ext/zsv/options.c +1 -2
  6. data/ext/zsv/parser.c +14 -0
  7. data/ext/zsv/zsv_ext.c +3 -0
  8. data/lib/zsv/version.rb +1 -1
  9. metadata +6 -226
  10. data/ext/zsv/vendor/zsv-1.3.0/app/2db.c +0 -756
  11. data/ext/zsv/vendor/zsv-1.3.0/app/2json.c +0 -381
  12. data/ext/zsv/vendor/zsv-1.3.0/app/2tsv.c +0 -228
  13. data/ext/zsv/vendor/zsv-1.3.0/app/builtin/help.c +0 -123
  14. data/ext/zsv/vendor/zsv-1.3.0/app/builtin/license.c +0 -39
  15. data/ext/zsv/vendor/zsv-1.3.0/app/builtin/register.c +0 -104
  16. data/ext/zsv/vendor/zsv-1.3.0/app/builtin/thirdparty.c +0 -41
  17. data/ext/zsv/vendor/zsv-1.3.0/app/builtin/unregister.c +0 -1
  18. data/ext/zsv/vendor/zsv-1.3.0/app/builtin/version.c +0 -14
  19. data/ext/zsv/vendor/zsv-1.3.0/app/check/simdutf_wrapper.h +0 -19
  20. data/ext/zsv/vendor/zsv-1.3.0/app/check/utf8.c +0 -116
  21. data/ext/zsv/vendor/zsv-1.3.0/app/check.c +0 -194
  22. data/ext/zsv/vendor/zsv-1.3.0/app/cli.c +0 -796
  23. data/ext/zsv/vendor/zsv-1.3.0/app/cli_const.h +0 -41
  24. data/ext/zsv/vendor/zsv-1.3.0/app/cli_export.h +0 -16
  25. data/ext/zsv/vendor/zsv-1.3.0/app/cli_ini.c +0 -280
  26. data/ext/zsv/vendor/zsv-1.3.0/app/cli_internal.h +0 -36
  27. data/ext/zsv/vendor/zsv-1.3.0/app/compare.c +0 -913
  28. data/ext/zsv/vendor/zsv-1.3.0/app/compare.h +0 -23
  29. data/ext/zsv/vendor/zsv-1.3.0/app/compare_added_column.c +0 -20
  30. data/ext/zsv/vendor/zsv-1.3.0/app/compare_internal.h +0 -140
  31. data/ext/zsv/vendor/zsv-1.3.0/app/compare_sort.c +0 -91
  32. data/ext/zsv/vendor/zsv-1.3.0/app/compare_unique_colname.c +0 -81
  33. data/ext/zsv/vendor/zsv-1.3.0/app/count-pull.c +0 -82
  34. data/ext/zsv/vendor/zsv-1.3.0/app/count.c +0 -404
  35. data/ext/zsv/vendor/zsv-1.3.0/app/desc.c +0 -569
  36. data/ext/zsv/vendor/zsv-1.3.0/app/echo.c +0 -365
  37. data/ext/zsv/vendor/zsv-1.3.0/app/ext_example/my_extension.c +0 -366
  38. data/ext/zsv/vendor/zsv-1.3.0/app/ext_example/mysheet_extension.c +0 -341
  39. data/ext/zsv/vendor/zsv-1.3.0/app/ext_template/YOUR_EXTENSION_zsvext.c +0 -263
  40. data/ext/zsv/vendor/zsv-1.3.0/app/external/inih/ini.c +0 -298
  41. data/ext/zsv/vendor/zsv-1.3.0/app/external/inih/ini.h +0 -157
  42. data/ext/zsv/vendor/zsv-1.3.0/app/external/json_writer-1.01/json_numeric.c +0 -177
  43. data/ext/zsv/vendor/zsv-1.3.0/app/external/json_writer-1.01/jsonwriter.c +0 -444
  44. data/ext/zsv/vendor/zsv-1.3.0/app/external/json_writer-1.01/jsonwriter.h +0 -145
  45. data/ext/zsv/vendor/zsv-1.3.0/app/external/json_writer-1.01/utils.c +0 -110
  46. data/ext/zsv/vendor/zsv-1.3.0/app/external/memfile-1.0/include/memfile.h +0 -15
  47. data/ext/zsv/vendor/zsv-1.3.0/app/external/memfile-1.0/src/memfile.c +0 -64
  48. data/ext/zsv/vendor/zsv-1.3.0/app/external/sglib/sglib.h +0 -1955
  49. data/ext/zsv/vendor/zsv-1.3.0/app/external/simdutf/simdutf.h +0 -6802
  50. data/ext/zsv/vendor/zsv-1.3.0/app/external/sqlite3/sqlite3.c +0 -230517
  51. data/ext/zsv/vendor/zsv-1.3.0/app/external/sqlite3/sqlite3.h +0 -12174
  52. data/ext/zsv/vendor/zsv-1.3.0/app/external/sqlite3/sqlite3_and_csv_vtab.c +0 -2
  53. data/ext/zsv/vendor/zsv-1.3.0/app/external/sqlite3/sqlite3_csv_vtab-mem.c +0 -142
  54. data/ext/zsv/vendor/zsv-1.3.0/app/external/sqlite3/sqlite3_csv_vtab-mem.h +0 -49
  55. data/ext/zsv/vendor/zsv-1.3.0/app/external/sqlite3/sqlite3_csv_vtab-zsv.c +0 -485
  56. data/ext/zsv/vendor/zsv-1.3.0/app/external/sqlite3/sqlite3_csv_vtab.c +0 -1015
  57. data/ext/zsv/vendor/zsv-1.3.0/app/external/sqlite3/sqlite3ext.h +0 -663
  58. data/ext/zsv/vendor/zsv-1.3.0/app/external/sqlite3/vtab_helper.c +0 -85
  59. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/build/yajl-2.1.1/include/yajl/yajl_common.h +0 -75
  60. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/build/yajl-2.1.1/include/yajl/yajl_gen.h +0 -167
  61. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/build/yajl-2.1.1/include/yajl/yajl_parse.h +0 -228
  62. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/build/yajl-2.1.1/include/yajl/yajl_tree.h +0 -186
  63. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/build/yajl-2.1.1/include/yajl/yajl_version.h +0 -23
  64. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/api/yajl_common.h +0 -76
  65. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/api/yajl_gen.h +0 -167
  66. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/api/yajl_parse.h +0 -238
  67. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/api/yajl_tree.h +0 -186
  68. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl.c +0 -184
  69. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_alloc.c +0 -52
  70. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_alloc.h +0 -34
  71. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_buf.c +0 -103
  72. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_buf.h +0 -57
  73. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_bytestack.h +0 -69
  74. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_encode.c +0 -220
  75. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_encode.h +0 -34
  76. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_gen.c +0 -362
  77. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_lex.c +0 -764
  78. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_lex.h +0 -117
  79. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_parser.c +0 -508
  80. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_parser.h +0 -78
  81. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_tree.c +0 -505
  82. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl/src/yajl_version.c +0 -7
  83. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl_helper/yajl_helper/json_value.h +0 -59
  84. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl_helper/yajl_helper/yajl_helper.h +0 -208
  85. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl_helper/yajl_helper.c +0 -795
  86. data/ext/zsv/vendor/zsv-1.3.0/app/external/yajl_helper/yajl_helper_internal.h +0 -28
  87. data/ext/zsv/vendor/zsv-1.3.0/app/flatten.c +0 -851
  88. data/ext/zsv/vendor/zsv-1.3.0/app/jq.c +0 -106
  89. data/ext/zsv/vendor/zsv-1.3.0/app/jq.h +0 -6
  90. data/ext/zsv/vendor/zsv-1.3.0/app/mv.c +0 -113
  91. data/ext/zsv/vendor/zsv-1.3.0/app/noop.c +0 -90
  92. data/ext/zsv/vendor/zsv-1.3.0/app/overwrite.c +0 -295
  93. data/ext/zsv/vendor/zsv-1.3.0/app/paste.c +0 -175
  94. data/ext/zsv/vendor/zsv-1.3.0/app/pretty.c +0 -693
  95. data/ext/zsv/vendor/zsv-1.3.0/app/prop.c +0 -980
  96. data/ext/zsv/vendor/zsv-1.3.0/app/rm.c +0 -131
  97. data/ext/zsv/vendor/zsv-1.3.0/app/select/fixed.c +0 -130
  98. data/ext/zsv/vendor/zsv-1.3.0/app/select/internal.h +0 -118
  99. data/ext/zsv/vendor/zsv-1.3.0/app/select/parallel.c +0 -45
  100. data/ext/zsv/vendor/zsv-1.3.0/app/select/parallel.h +0 -41
  101. data/ext/zsv/vendor/zsv-1.3.0/app/select/processing.c +0 -107
  102. data/ext/zsv/vendor/zsv-1.3.0/app/select/rand.c +0 -20
  103. data/ext/zsv/vendor/zsv-1.3.0/app/select/regex.c +0 -61
  104. data/ext/zsv/vendor/zsv-1.3.0/app/select/search.c +0 -14
  105. data/ext/zsv/vendor/zsv-1.3.0/app/select/selection.c +0 -192
  106. data/ext/zsv/vendor/zsv-1.3.0/app/select/usage.c +0 -72
  107. data/ext/zsv/vendor/zsv-1.3.0/app/select-pull.c +0 -812
  108. data/ext/zsv/vendor/zsv-1.3.0/app/select.c +0 -753
  109. data/ext/zsv/vendor/zsv-1.3.0/app/serialize.c +0 -372
  110. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/curses.h +0 -15
  111. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/cursor.c +0 -119
  112. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/errors.c +0 -45
  113. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/file.c +0 -63
  114. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/file.h +0 -12
  115. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/filter.c +0 -166
  116. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/handlers.c +0 -214
  117. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/handlers_internal.h +0 -128
  118. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/help.c +0 -43
  119. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/index.c +0 -81
  120. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/index.h +0 -25
  121. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/key-bindings.c +0 -325
  122. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/key-bindings.h +0 -73
  123. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/lexer.c +0 -203
  124. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/newline_handler.c +0 -7
  125. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/pivot.c +0 -318
  126. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/procedure.c +0 -134
  127. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/procedure.h +0 -119
  128. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/read-data.c +0 -322
  129. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/screen_buffer.c +0 -203
  130. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/screen_buffer.h +0 -36
  131. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/sheet-sql.c +0 -167
  132. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/sheet_internal.h +0 -36
  133. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/sqlfilter.c +0 -153
  134. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/terminfo.c +0 -32
  135. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/transformation.c +0 -312
  136. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/transformation.h +0 -29
  137. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/ui_buffer.c +0 -266
  138. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/usage.c +0 -9
  139. data/ext/zsv/vendor/zsv-1.3.0/app/sheet/utf8-width.c +0 -60
  140. data/ext/zsv/vendor/zsv-1.3.0/app/sheet.c +0 -1007
  141. data/ext/zsv/vendor/zsv-1.3.0/app/sql.c +0 -453
  142. data/ext/zsv/vendor/zsv-1.3.0/app/sql_internal.c +0 -101
  143. data/ext/zsv/vendor/zsv-1.3.0/app/sql_internal.h +0 -49
  144. data/ext/zsv/vendor/zsv-1.3.0/app/stack.c +0 -393
  145. data/ext/zsv/vendor/zsv-1.3.0/app/utils/arg.c +0 -322
  146. data/ext/zsv/vendor/zsv-1.3.0/app/utils/cache.c +0 -228
  147. data/ext/zsv/vendor/zsv-1.3.0/app/utils/cat.c +0 -91
  148. data/ext/zsv/vendor/zsv-1.3.0/app/utils/chunk.c +0 -240
  149. data/ext/zsv/vendor/zsv-1.3.0/app/utils/chunk.h +0 -63
  150. data/ext/zsv/vendor/zsv-1.3.0/app/utils/clock.c +0 -57
  151. data/ext/zsv/vendor/zsv-1.3.0/app/utils/db.c +0 -148
  152. data/ext/zsv/vendor/zsv-1.3.0/app/utils/dirs-no-jq.c +0 -2
  153. data/ext/zsv/vendor/zsv-1.3.0/app/utils/dirs.c +0 -427
  154. data/ext/zsv/vendor/zsv-1.3.0/app/utils/dirs_from_json.c +0 -253
  155. data/ext/zsv/vendor/zsv-1.3.0/app/utils/dirs_to_json.c +0 -121
  156. data/ext/zsv/vendor/zsv-1.3.0/app/utils/dl.c +0 -20
  157. data/ext/zsv/vendor/zsv-1.3.0/app/utils/emcc/fs_api.c +0 -159
  158. data/ext/zsv/vendor/zsv-1.3.0/app/utils/err.c +0 -24
  159. data/ext/zsv/vendor/zsv-1.3.0/app/utils/file-mem.c +0 -180
  160. data/ext/zsv/vendor/zsv-1.3.0/app/utils/file.c +0 -256
  161. data/ext/zsv/vendor/zsv-1.3.0/app/utils/index.c +0 -197
  162. data/ext/zsv/vendor/zsv-1.3.0/app/utils/index.h +0 -49
  163. data/ext/zsv/vendor/zsv-1.3.0/app/utils/jq.c +0 -400
  164. data/ext/zsv/vendor/zsv-1.3.0/app/utils/json.c +0 -120
  165. data/ext/zsv/vendor/zsv-1.3.0/app/utils/mem.c +0 -18
  166. data/ext/zsv/vendor/zsv-1.3.0/app/utils/memmem.c +0 -132
  167. data/ext/zsv/vendor/zsv-1.3.0/app/utils/os.c +0 -178
  168. data/ext/zsv/vendor/zsv-1.3.0/app/utils/overwrite.c +0 -258
  169. data/ext/zsv/vendor/zsv-1.3.0/app/utils/overwrite_writer.c +0 -246
  170. data/ext/zsv/vendor/zsv-1.3.0/app/utils/pcre2-8/pcre2-8-test.c +0 -123
  171. data/ext/zsv/vendor/zsv-1.3.0/app/utils/pcre2-8/pcre2-8.c +0 -153
  172. data/ext/zsv/vendor/zsv-1.3.0/app/utils/pcre2-8/pcre2-8.h +0 -54
  173. data/ext/zsv/vendor/zsv-1.3.0/app/utils/prop.c +0 -267
  174. data/ext/zsv/vendor/zsv-1.3.0/app/utils/signal.c +0 -53
  175. data/ext/zsv/vendor/zsv-1.3.0/app/utils/string.c +0 -357
  176. data/ext/zsv/vendor/zsv-1.3.0/app/utils/win/dir_exists_longpath.c +0 -83
  177. data/ext/zsv/vendor/zsv-1.3.0/app/utils/win/dl.c +0 -33
  178. data/ext/zsv/vendor/zsv-1.3.0/app/utils/win/fopen_longpath.c +0 -184
  179. data/ext/zsv/vendor/zsv-1.3.0/app/utils/win/foreach_dirent_longpath.c +0 -292
  180. data/ext/zsv/vendor/zsv-1.3.0/app/utils/win/io.c +0 -259
  181. data/ext/zsv/vendor/zsv-1.3.0/app/utils/win/io.h +0 -13
  182. data/ext/zsv/vendor/zsv-1.3.0/app/utils/win/mkdir_longpath.c +0 -255
  183. data/ext/zsv/vendor/zsv-1.3.0/app/utils/win/remove_longpath.c +0 -96
  184. data/ext/zsv/vendor/zsv-1.3.0/app/utils/writer.c +0 -361
  185. data/ext/zsv/vendor/zsv-1.3.0/app/zsv_command.h +0 -40
  186. data/ext/zsv/vendor/zsv-1.3.0/app/zsv_command_standalone.c +0 -16
  187. data/ext/zsv/vendor/zsv-1.3.0/app/zsv_main.h +0 -44
  188. data/ext/zsv/vendor/zsv-1.3.0/examples/js/zsv_parser_api_dummy.c +0 -3
  189. data/ext/zsv/vendor/zsv-1.3.0/examples/lib/parse_by_chunk.c +0 -100
  190. data/ext/zsv/vendor/zsv-1.3.0/examples/lib/print_my_column.c +0 -143
  191. data/ext/zsv/vendor/zsv-1.3.0/examples/lib/pull.c +0 -89
  192. data/ext/zsv/vendor/zsv-1.3.0/examples/lib/simple.c +0 -123
  193. data/ext/zsv/vendor/zsv-1.3.0/fuzz/fuzz.c +0 -16
  194. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/api.h +0 -336
  195. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/common.h +0 -361
  196. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/ext/implementation.h +0 -62
  197. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/ext/implementation_private.h +0 -113
  198. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/ext/sheet.h +0 -73
  199. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/ext.h +0 -329
  200. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/arg.h +0 -90
  201. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/cache.h +0 -49
  202. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/clock.h +0 -36
  203. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/compiler.h +0 -58
  204. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/db.h +0 -19
  205. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/dirs.h +0 -147
  206. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/dl.h +0 -22
  207. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/emcc/fs_api.h +0 -28
  208. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/err.h +0 -22
  209. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/file-mem.h +0 -17
  210. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/file.h +0 -99
  211. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/jq.h +0 -65
  212. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/json.h +0 -19
  213. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/mem.h +0 -19
  214. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/memmem.h +0 -13
  215. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/os.h +0 -54
  216. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/overwrite.h +0 -71
  217. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/overwrite_writer.h +0 -53
  218. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/prop.h +0 -107
  219. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/signal.h +0 -18
  220. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/sql.h +0 -11
  221. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/string.h +0 -148
  222. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/utf8.h +0 -41
  223. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/win/dl.h +0 -25
  224. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/utils/writer.h +0 -101
  225. data/ext/zsv/vendor/zsv-1.3.0/include/zsv/zsv_export.h +0 -33
  226. data/ext/zsv/vendor/zsv-1.3.0/include/zsv.h +0 -20
  227. data/ext/zsv/vendor/zsv-1.3.0/src/vector_delim.c +0 -60
  228. data/ext/zsv/vendor/zsv-1.3.0/src/zsv.c +0 -484
  229. data/ext/zsv/vendor/zsv-1.3.0/src/zsv_internal.c +0 -731
  230. data/ext/zsv/vendor/zsv-1.3.0/src/zsv_scan_delim.c +0 -285
  231. data/ext/zsv/vendor/zsv-1.3.0/src/zsv_scan_fixed.c +0 -88
  232. data/ext/zsv/vendor/zsv-1.3.0/src/zsv_strencode.c +0 -51
@@ -1,117 +0,0 @@
1
- /*
2
- * Copyright (c) 2007-2014, Lloyd Hilaiel <me@lloyd.io>
3
- *
4
- * Permission to use, copy, modify, and/or distribute this software for any
5
- * purpose with or without fee is hereby granted, provided that the above
6
- * copyright notice and this permission notice appear in all copies.
7
- *
8
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
- */
16
-
17
- #ifndef __YAJL_LEX_H__
18
- #define __YAJL_LEX_H__
19
-
20
- #include "api/yajl_common.h"
21
-
22
- typedef enum {
23
- yajl_tok_bool,
24
- yajl_tok_colon,
25
- yajl_tok_comma,
26
- yajl_tok_eof,
27
- yajl_tok_error,
28
- yajl_tok_left_brace,
29
- yajl_tok_left_bracket,
30
- yajl_tok_null,
31
- yajl_tok_right_brace,
32
- yajl_tok_right_bracket,
33
-
34
- /* we differentiate between integers and doubles to allow the
35
- * parser to interpret the number without re-scanning */
36
- yajl_tok_integer,
37
- yajl_tok_double,
38
-
39
- /* we differentiate between strings which require further processing,
40
- * and strings that do not */
41
- yajl_tok_string,
42
- yajl_tok_string_with_escapes,
43
-
44
- /* comment tokens are not currently returned to the parser, ever */
45
- yajl_tok_comment
46
- } yajl_tok;
47
-
48
- typedef struct yajl_lexer_t * yajl_lexer;
49
-
50
- yajl_lexer yajl_lex_alloc(yajl_alloc_funcs * alloc,
51
- unsigned int allowComments,
52
- unsigned int validateUTF8);
53
-
54
- void yajl_lex_free(yajl_lexer lexer);
55
-
56
- /**
57
- * run/continue a lex. "offset" is an input/output parameter.
58
- * It should be initialized to zero for a
59
- * new chunk of target text, and upon subsetquent calls with the same
60
- * target text should passed with the value of the previous invocation.
61
- *
62
- * the client may be interested in the value of offset when an error is
63
- * returned from the lexer. This allows the client to render useful
64
- * error messages.
65
- *
66
- * When you pass the next chunk of data, context should be reinitialized
67
- * to zero.
68
- *
69
- * Finally, the output buffer is usually just a pointer into the jsonText,
70
- * however in cases where the entity being lexed spans multiple chunks,
71
- * the lexer will buffer the entity and the data returned will be
72
- * a pointer into that buffer.
73
- *
74
- * This behavior is abstracted from client code except for the performance
75
- * implications which require that the client choose a reasonable chunk
76
- * size to get adequate performance.
77
- */
78
- yajl_tok yajl_lex_lex(yajl_lexer lexer, const unsigned char * jsonText,
79
- size_t jsonTextLen, size_t * offset,
80
- const unsigned char ** outBuf, size_t * outLen);
81
-
82
- /** have a peek at the next token, but don't move the lexer forward */
83
- yajl_tok yajl_lex_peek(yajl_lexer lexer, const unsigned char * jsonText,
84
- size_t jsonTextLen, size_t offset);
85
-
86
-
87
- typedef enum {
88
- yajl_lex_e_ok = 0,
89
- yajl_lex_string_invalid_utf8,
90
- yajl_lex_string_invalid_escaped_char,
91
- yajl_lex_string_invalid_json_char,
92
- yajl_lex_string_invalid_hex_char,
93
- yajl_lex_invalid_char,
94
- yajl_lex_invalid_string,
95
- yajl_lex_missing_integer_after_decimal,
96
- yajl_lex_missing_integer_after_exponent,
97
- yajl_lex_missing_integer_after_minus,
98
- yajl_lex_unallowed_comment
99
- } yajl_lex_error;
100
-
101
- const char * yajl_lex_error_to_string(yajl_lex_error error);
102
-
103
- /** allows access to more specific information about the lexical
104
- * error when yajl_lex_lex returns yajl_tok_error. */
105
- yajl_lex_error yajl_lex_get_error(yajl_lexer lexer);
106
-
107
- /** get the current offset into the most recently lexed json string. */
108
- size_t yajl_lex_current_offset(yajl_lexer lexer);
109
-
110
- /** get the number of lines lexed by this lexer instance */
111
- size_t yajl_lex_current_line(yajl_lexer lexer);
112
-
113
- /** get the number of chars lexed by this lexer instance since the last
114
- * \n or \r */
115
- size_t yajl_lex_current_char(yajl_lexer lexer);
116
-
117
- #endif
@@ -1,508 +0,0 @@
1
- /*
2
- * Copyright (c) 2007-2014, Lloyd Hilaiel <me@lloyd.io>
3
- *
4
- * Permission to use, copy, modify, and/or distribute this software for any
5
- * purpose with or without fee is hereby granted, provided that the above
6
- * copyright notice and this permission notice appear in all copies.
7
- *
8
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
- */
16
-
17
- #include "api/yajl_parse.h"
18
- #include "yajl_lex.h"
19
- #include "yajl_parser.h"
20
- #include "yajl_encode.h"
21
- #include "yajl_bytestack.h"
22
-
23
- #include <stdlib.h>
24
- #include <limits.h>
25
- #include <errno.h>
26
- #include <stdio.h>
27
- #include <string.h>
28
- #include <ctype.h>
29
- #include <assert.h>
30
- #include <math.h>
31
-
32
- #include <sys/types.h>
33
- #include <stdlib.h>
34
-
35
- #define MAX_VALUE_TO_MULTIPLY ((LLONG_MAX / 10) + (LLONG_MAX % 10))
36
-
37
- /* same semantics as strtol */
38
- long long
39
- yajl_parse_integer(const unsigned char *number, unsigned int length)
40
- {
41
- long long ret = 0;
42
- long sign = 1;
43
- const unsigned char *pos = number;
44
- if (*pos == '-') { pos++; sign = -1; }
45
- if (*pos == '+') { pos++; }
46
-
47
- while (pos < number + length) {
48
- if ( ret > MAX_VALUE_TO_MULTIPLY ) {
49
- errno = ERANGE;
50
- return sign == 1 ? LLONG_MAX : LLONG_MIN;
51
- }
52
- ret *= 10;
53
- if (LLONG_MAX - ret < (*pos - '0')) {
54
- errno = ERANGE;
55
- return sign == 1 ? LLONG_MAX : LLONG_MIN;
56
- }
57
- if (*pos < '0' || *pos > '9') {
58
- errno = ERANGE;
59
- return sign == 1 ? LLONG_MAX : LLONG_MIN;
60
- }
61
- ret += (*pos++ - '0');
62
- }
63
-
64
- return sign * ret;
65
- }
66
-
67
-
68
- unsigned char *
69
- yajl_render_error_string(yajl_handle hand, const unsigned char * jsonText,
70
- size_t jsonTextLen, int verbose)
71
- {
72
- size_t offset = hand->bytesConsumed;
73
- unsigned char * str;
74
- const char * errorType = NULL;
75
- const char * errorText = NULL;
76
- char text[72];
77
- const char * arrow = " (right here) ------^\n";
78
-
79
- if (yajl_bs_current(hand->stateStack) == yajl_state_parse_error) {
80
- errorType = "parse";
81
- errorText = hand->parseError;
82
- } else if (yajl_bs_current(hand->stateStack) == yajl_state_lexical_error) {
83
- errorType = "lexical";
84
- errorText = yajl_lex_error_to_string(yajl_lex_get_error(hand->lexer));
85
- } else {
86
- errorType = "unknown";
87
- }
88
-
89
- {
90
- size_t memneeded = 0;
91
- memneeded += strlen(errorType);
92
- memneeded += strlen(" error");
93
- if (errorText != NULL) {
94
- memneeded += strlen(": ");
95
- memneeded += strlen(errorText);
96
- }
97
- str = (unsigned char *) YA_MALLOC(&(hand->alloc), memneeded + 2);
98
- if (!str) return NULL;
99
- str[0] = 0;
100
- strcat((char *) str, errorType);
101
- strcat((char *) str, " error");
102
- if (errorText != NULL) {
103
- strcat((char *) str, ": ");
104
- strcat((char *) str, errorText);
105
- }
106
- strcat((char *) str, "\n");
107
- }
108
-
109
- /* now we append as many spaces as needed to make sure the error
110
- * falls at char 41, if verbose was specified */
111
- if (verbose) {
112
- size_t start, end, i;
113
- size_t spacesNeeded;
114
-
115
- spacesNeeded = (offset < 30 ? 40 - offset : 10);
116
- start = (offset >= 30 ? offset - 30 : 0);
117
- end = (offset + 30 > jsonTextLen ? jsonTextLen : offset + 30);
118
-
119
- for (i=0;i<spacesNeeded;i++) text[i] = ' ';
120
-
121
- for (;start < end;start++, i++) {
122
- if (jsonText[start] != '\n' && jsonText[start] != '\r')
123
- {
124
- text[i] = jsonText[start];
125
- }
126
- else
127
- {
128
- text[i] = ' ';
129
- }
130
- }
131
- assert(i <= 71);
132
- text[i++] = '\n';
133
- text[i] = 0;
134
- {
135
- char * newStr = (char *)
136
- YA_MALLOC(&(hand->alloc), (unsigned int)(strlen((char *) str) +
137
- strlen((char *) text) +
138
- strlen(arrow) + 1));
139
- if (newStr) {
140
- newStr[0] = 0;
141
- strcat((char *) newStr, (char *) str);
142
- strcat((char *) newStr, text);
143
- strcat((char *) newStr, arrow);
144
- }
145
- YA_FREE(&(hand->alloc), str);
146
- str = (unsigned char *) newStr;
147
- }
148
- }
149
- return str;
150
- }
151
-
152
- /* check for client cancelation */
153
- #define _CC_CHK(x) \
154
- if (!(x)) { \
155
- yajl_bs_set(hand->stateStack, yajl_state_parse_error); \
156
- hand->parseError = \
157
- "client cancelled parse via callback return value"; \
158
- return yajl_status_client_canceled; \
159
- }
160
-
161
-
162
- yajl_status
163
- yajl_do_finish(yajl_handle hand)
164
- {
165
- yajl_status stat;
166
- stat = yajl_do_parse(hand,(const unsigned char *) " ",1);
167
-
168
- if (stat != yajl_status_ok) return stat;
169
-
170
- switch(yajl_bs_current(hand->stateStack))
171
- {
172
- case yajl_state_parse_error:
173
- case yajl_state_lexical_error:
174
- return yajl_status_error;
175
- case yajl_state_got_value:
176
- case yajl_state_parse_complete:
177
- return yajl_status_ok;
178
- default:
179
- if (!(hand->flags & yajl_allow_partial_values))
180
- {
181
- yajl_bs_set(hand->stateStack, yajl_state_parse_error);
182
- hand->parseError = "premature EOF";
183
- return yajl_status_error;
184
- }
185
- return yajl_status_ok;
186
- }
187
- }
188
-
189
- yajl_status
190
- yajl_do_parse(yajl_handle hand, const unsigned char * jsonText,
191
- size_t jsonTextLen)
192
- {
193
- yajl_tok tok;
194
- const unsigned char * buf;
195
- size_t bufLen;
196
- size_t * offset = &(hand->bytesConsumed);
197
-
198
- *offset = 0;
199
-
200
- around_again:
201
- switch (yajl_bs_current(hand->stateStack)) {
202
- case yajl_state_parse_complete:
203
- if (hand->flags & yajl_allow_multiple_values) {
204
- yajl_bs_set(hand->stateStack, yajl_state_got_value);
205
- goto around_again;
206
- }
207
- if (!(hand->flags & yajl_allow_trailing_garbage)) {
208
- if (*offset != jsonTextLen) {
209
- tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen,
210
- offset, &buf, &bufLen);
211
- if (tok != yajl_tok_eof) {
212
- yajl_bs_set(hand->stateStack, yajl_state_parse_error);
213
- hand->parseError = "trailing garbage";
214
- }
215
- goto around_again;
216
- }
217
- }
218
- return yajl_status_ok;
219
- case yajl_state_lexical_error:
220
- case yajl_state_parse_error:
221
- return yajl_status_error;
222
- case yajl_state_start:
223
- case yajl_state_got_value:
224
- case yajl_state_map_need_val:
225
- case yajl_state_array_need_val:
226
- case yajl_state_array_start: {
227
- /* for arrays and maps, we advance the state for this
228
- * depth, then push the state of the next depth.
229
- * If an error occurs during the parsing of the nesting
230
- * enitity, the state at this level will not matter.
231
- * a state that needs pushing will be anything other
232
- * than state_start */
233
-
234
- yajl_state stateToPush = yajl_state_start;
235
-
236
- tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen,
237
- offset, &buf, &bufLen);
238
-
239
- switch (tok) {
240
- case yajl_tok_eof:
241
- return yajl_status_ok;
242
- case yajl_tok_error:
243
- yajl_bs_set(hand->stateStack, yajl_state_lexical_error);
244
- goto around_again;
245
- case yajl_tok_string:
246
- if (hand->callbacks && hand->callbacks->yajl_string) {
247
- _CC_CHK(hand->callbacks->yajl_string(hand->ctx,
248
- buf, bufLen));
249
- }
250
- break;
251
- case yajl_tok_string_with_escapes:
252
- if (hand->callbacks && hand->callbacks->yajl_string) {
253
- yajl_buf_clear(hand->decodeBuf);
254
- yajl_string_decode(hand->decodeBuf, buf, bufLen);
255
- _CC_CHK(hand->callbacks->yajl_string(
256
- hand->ctx, yajl_buf_data(hand->decodeBuf),
257
- yajl_buf_len(hand->decodeBuf)));
258
- }
259
- break;
260
- case yajl_tok_bool:
261
- if (hand->callbacks && hand->callbacks->yajl_boolean) {
262
- _CC_CHK(hand->callbacks->yajl_boolean(hand->ctx,
263
- *buf == 't'));
264
- }
265
- break;
266
- case yajl_tok_null:
267
- if (hand->callbacks && hand->callbacks->yajl_null) {
268
- _CC_CHK(hand->callbacks->yajl_null(hand->ctx));
269
- }
270
- break;
271
- case yajl_tok_left_bracket:
272
- if (hand->callbacks && hand->callbacks->yajl_start_map) {
273
- _CC_CHK(hand->callbacks->yajl_start_map(hand->ctx));
274
- }
275
- stateToPush = yajl_state_map_start;
276
- break;
277
- case yajl_tok_left_brace:
278
- if (hand->callbacks && hand->callbacks->yajl_start_array) {
279
- _CC_CHK(hand->callbacks->yajl_start_array(hand->ctx));
280
- }
281
- stateToPush = yajl_state_array_start;
282
- break;
283
- case yajl_tok_integer:
284
- if (hand->callbacks) {
285
- if (hand->callbacks->yajl_number) {
286
- _CC_CHK(hand->callbacks->yajl_number(
287
- hand->ctx,(const char *) buf, bufLen));
288
- } else if (hand->callbacks->yajl_integer) {
289
- long long i;
290
- errno = 0;
291
- i = yajl_parse_integer(buf, bufLen);
292
- if ((i == LLONG_MIN || i == LLONG_MAX) &&
293
- errno == ERANGE) {
294
- if(hand->callbacks->yajl_error) {
295
- _CC_CHK(hand->callbacks->yajl_error(hand->ctx, buf, bufLen, errno));
296
- } else {
297
- yajl_bs_set(hand->stateStack,
298
- yajl_state_parse_error);
299
- hand->parseError = "integer overflow" ;
300
- /* try to restore error offset */
301
- if (*offset >= bufLen) *offset -= bufLen;
302
- else *offset = 0;
303
- goto around_again;
304
- }
305
- } else
306
- _CC_CHK(hand->callbacks->yajl_integer(hand->ctx,
307
- i));
308
- }
309
- }
310
- break;
311
- case yajl_tok_double:
312
- if (hand->callbacks) {
313
- if (hand->callbacks->yajl_number) {
314
- _CC_CHK(hand->callbacks->yajl_number(
315
- hand->ctx, (const char *) buf, bufLen));
316
- } else if (hand->callbacks->yajl_double) {
317
- double d = 0.0;
318
- yajl_buf_clear(hand->decodeBuf);
319
- yajl_buf_append(hand->decodeBuf, buf, bufLen);
320
- buf = yajl_buf_data(hand->decodeBuf);
321
- errno = 0;
322
- d = strtod((char *) buf, NULL);
323
- if ((d == HUGE_VAL || d == -HUGE_VAL) &&
324
- errno == ERANGE)
325
- {
326
- if(hand->callbacks->yajl_error) {
327
- _CC_CHK(hand->callbacks->yajl_error(hand->ctx, buf, buf ? strlen((const char *)buf) : 0, errno));
328
- } else {
329
- yajl_bs_set(hand->stateStack,
330
- yajl_state_parse_error);
331
- hand->parseError = "numeric (floating point) "
332
- "overflow";
333
- /* try to restore error offset */
334
- if (*offset >= bufLen) *offset -= bufLen;
335
- else *offset = 0;
336
- goto around_again;
337
- }
338
- } else
339
- _CC_CHK(hand->callbacks->yajl_double(hand->ctx,
340
- d));
341
- }
342
- }
343
- break;
344
- case yajl_tok_right_brace: {
345
- if (yajl_bs_current(hand->stateStack) ==
346
- yajl_state_array_start)
347
- {
348
- if (hand->callbacks &&
349
- hand->callbacks->yajl_end_array)
350
- {
351
- _CC_CHK(hand->callbacks->yajl_end_array(hand->ctx));
352
- }
353
- yajl_bs_pop(hand->stateStack);
354
- goto around_again;
355
- }
356
- /* intentional fall-through */
357
- }
358
- case yajl_tok_colon:
359
- case yajl_tok_comma:
360
- case yajl_tok_right_bracket:
361
- yajl_bs_set(hand->stateStack, yajl_state_parse_error);
362
- hand->parseError =
363
- "unallowed token at this point in JSON text";
364
- goto around_again;
365
- default:
366
- yajl_bs_set(hand->stateStack, yajl_state_parse_error);
367
- hand->parseError = "invalid token, internal error";
368
- goto around_again;
369
- }
370
- /* got a value. transition depends on the state we're in. */
371
- {
372
- yajl_state s = yajl_bs_current(hand->stateStack);
373
- if (s == yajl_state_start || s == yajl_state_got_value) {
374
- yajl_bs_set(hand->stateStack, yajl_state_parse_complete);
375
- } else if (s == yajl_state_map_need_val) {
376
- yajl_bs_set(hand->stateStack, yajl_state_map_got_val);
377
- } else {
378
- yajl_bs_set(hand->stateStack, yajl_state_array_got_val);
379
- }
380
- }
381
- if (stateToPush != yajl_state_start) {
382
- yajl_bs_push(hand->stateStack, stateToPush);
383
- }
384
-
385
- goto around_again;
386
- }
387
- case yajl_state_map_start:
388
- case yajl_state_map_need_key: {
389
- /* only difference between these two states is that in
390
- * start '}' is valid, whereas in need_key, we've parsed
391
- * a comma, and a string key _must_ follow */
392
- tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen,
393
- offset, &buf, &bufLen);
394
- switch (tok) {
395
- case yajl_tok_eof:
396
- return yajl_status_ok;
397
- case yajl_tok_error:
398
- yajl_bs_set(hand->stateStack, yajl_state_lexical_error);
399
- goto around_again;
400
- case yajl_tok_string_with_escapes:
401
- if (hand->callbacks && hand->callbacks->yajl_map_key) {
402
- yajl_buf_clear(hand->decodeBuf);
403
- yajl_string_decode(hand->decodeBuf, buf, bufLen);
404
- buf = yajl_buf_data(hand->decodeBuf);
405
- bufLen = yajl_buf_len(hand->decodeBuf);
406
- }
407
- /* intentional fall-through */
408
- case yajl_tok_string:
409
- if (hand->callbacks && hand->callbacks->yajl_map_key) {
410
- _CC_CHK(hand->callbacks->yajl_map_key(hand->ctx, buf,
411
- bufLen));
412
- }
413
- yajl_bs_set(hand->stateStack, yajl_state_map_sep);
414
- goto around_again;
415
- case yajl_tok_right_bracket:
416
- if (yajl_bs_current(hand->stateStack) ==
417
- yajl_state_map_start)
418
- {
419
- if (hand->callbacks && hand->callbacks->yajl_end_map) {
420
- _CC_CHK(hand->callbacks->yajl_end_map(hand->ctx));
421
- }
422
- yajl_bs_pop(hand->stateStack);
423
- goto around_again;
424
- }
425
- default:
426
- yajl_bs_set(hand->stateStack, yajl_state_parse_error);
427
- hand->parseError =
428
- "invalid object key (must be a string)";
429
- goto around_again;
430
- }
431
- }
432
- case yajl_state_map_sep: {
433
- tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen,
434
- offset, &buf, &bufLen);
435
- switch (tok) {
436
- case yajl_tok_colon:
437
- yajl_bs_set(hand->stateStack, yajl_state_map_need_val);
438
- goto around_again;
439
- case yajl_tok_eof:
440
- return yajl_status_ok;
441
- case yajl_tok_error:
442
- yajl_bs_set(hand->stateStack, yajl_state_lexical_error);
443
- goto around_again;
444
- default:
445
- yajl_bs_set(hand->stateStack, yajl_state_parse_error);
446
- hand->parseError = "object key and value must "
447
- "be separated by a colon (':')";
448
- goto around_again;
449
- }
450
- }
451
- case yajl_state_map_got_val: {
452
- tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen,
453
- offset, &buf, &bufLen);
454
- switch (tok) {
455
- case yajl_tok_right_bracket:
456
- if (hand->callbacks && hand->callbacks->yajl_end_map) {
457
- _CC_CHK(hand->callbacks->yajl_end_map(hand->ctx));
458
- }
459
- yajl_bs_pop(hand->stateStack);
460
- goto around_again;
461
- case yajl_tok_comma:
462
- yajl_bs_set(hand->stateStack, yajl_state_map_need_key);
463
- goto around_again;
464
- case yajl_tok_eof:
465
- return yajl_status_ok;
466
- case yajl_tok_error:
467
- yajl_bs_set(hand->stateStack, yajl_state_lexical_error);
468
- goto around_again;
469
- default:
470
- yajl_bs_set(hand->stateStack, yajl_state_parse_error);
471
- hand->parseError = "after key and value, inside map, "
472
- "I expect ',' or '}'";
473
- /* try to restore error offset */
474
- if (*offset >= bufLen) *offset -= bufLen;
475
- else *offset = 0;
476
- goto around_again;
477
- }
478
- }
479
- case yajl_state_array_got_val: {
480
- tok = yajl_lex_lex(hand->lexer, jsonText, jsonTextLen,
481
- offset, &buf, &bufLen);
482
- switch (tok) {
483
- case yajl_tok_right_brace:
484
- if (hand->callbacks && hand->callbacks->yajl_end_array) {
485
- _CC_CHK(hand->callbacks->yajl_end_array(hand->ctx));
486
- }
487
- yajl_bs_pop(hand->stateStack);
488
- goto around_again;
489
- case yajl_tok_comma:
490
- yajl_bs_set(hand->stateStack, yajl_state_array_need_val);
491
- goto around_again;
492
- case yajl_tok_eof:
493
- return yajl_status_ok;
494
- case yajl_tok_error:
495
- yajl_bs_set(hand->stateStack, yajl_state_lexical_error);
496
- goto around_again;
497
- default:
498
- yajl_bs_set(hand->stateStack, yajl_state_parse_error);
499
- hand->parseError =
500
- "after array element, I expect ',' or ']'";
501
- goto around_again;
502
- }
503
- }
504
- }
505
-
506
- abort();
507
- return yajl_status_error;
508
- }