@port-labs/jq-node-bindings 1.0.4 → 1.1.0-dev

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 (352) hide show
  1. package/.claude/settings.local.json +12 -0
  2. package/configure +6 -5
  3. package/deps/jq/.claude/settings.local.json +7 -0
  4. package/deps/jq/.gitattributes +1 -3
  5. package/deps/jq/AUTHORS +55 -1
  6. package/deps/jq/COPYING +40 -0
  7. package/deps/jq/Makefile.am +40 -36
  8. package/deps/jq/NEWS.md +277 -2
  9. package/deps/jq/README.md +23 -5
  10. package/deps/jq/compile-ios.sh +1 -1
  11. package/deps/jq/config/m4/check-math-func.m4 +2 -2
  12. package/deps/jq/config/m4/find-func-no-libs2.m4 +3 -3
  13. package/deps/jq/configure.ac +10 -18
  14. package/deps/jq/docs/Pipfile.lock +368 -313
  15. package/deps/jq/docs/README.md +3 -4
  16. package/deps/jq/docs/build_manpage.py +1 -1
  17. package/deps/jq/docs/build_mantests.py +1 -1
  18. package/deps/jq/docs/build_website.py +1 -8
  19. package/deps/jq/docs/content/download/default.yml +49 -9
  20. package/deps/jq/docs/content/index.yml +9 -0
  21. package/deps/jq/docs/content/manual/{manual.yml → dev/manual.yml} +218 -61
  22. package/deps/jq/docs/content/manual/v1.3/manual.yml +0 -5
  23. package/deps/jq/docs/content/manual/v1.4/manual.yml +0 -5
  24. package/deps/jq/docs/content/manual/v1.5/manual.yml +3 -8
  25. package/deps/jq/docs/content/manual/v1.6/manual.yml +3 -8
  26. package/deps/jq/docs/content/manual/v1.7/manual.yml +499 -500
  27. package/deps/jq/docs/content/manual/v1.8/manual.yml +3858 -0
  28. package/deps/jq/docs/content/tutorial/default.yml +3 -3
  29. package/deps/jq/docs/manual_schema.yml +0 -3
  30. package/deps/jq/docs/public/CNAME +1 -0
  31. package/deps/jq/docs/templates/index.html.j2 +10 -10
  32. package/deps/jq/docs/templates/manual.html.j2 +14 -3
  33. package/deps/jq/docs/templates/shared/_head.html.j2 +8 -3
  34. package/deps/jq/docs/templates/shared/_navbar.html.j2 +4 -4
  35. package/deps/jq/jq.1.prebuilt +219 -44
  36. package/deps/jq/jq.spec +2 -2
  37. package/deps/jq/libjq.pc.in +1 -1
  38. package/deps/jq/scripts/version +1 -1
  39. package/deps/jq/sig/v1.7.1/jq-1.7.1.tar.gz.asc +16 -0
  40. package/deps/jq/sig/v1.7.1/jq-1.7.1.zip.asc +16 -0
  41. package/deps/jq/sig/v1.7.1/jq-linux-amd64.asc +16 -0
  42. package/deps/jq/sig/v1.7.1/jq-linux-arm64.asc +16 -0
  43. package/deps/jq/sig/v1.7.1/jq-linux-armel.asc +16 -0
  44. package/deps/jq/sig/v1.7.1/jq-linux-armhf.asc +16 -0
  45. package/deps/jq/sig/v1.7.1/jq-linux-i386.asc +16 -0
  46. package/deps/jq/sig/v1.7.1/jq-linux-mips.asc +16 -0
  47. package/deps/jq/sig/v1.7.1/jq-linux-mips64.asc +16 -0
  48. package/deps/jq/sig/v1.7.1/jq-linux-mips64el.asc +16 -0
  49. package/deps/jq/sig/v1.7.1/jq-linux-mips64r6.asc +16 -0
  50. package/deps/jq/sig/v1.7.1/jq-linux-mips64r6el.asc +16 -0
  51. package/deps/jq/sig/v1.7.1/jq-linux-mipsel.asc +16 -0
  52. package/deps/jq/sig/v1.7.1/jq-linux-mipsr6.asc +16 -0
  53. package/deps/jq/sig/v1.7.1/jq-linux-mipsr6el.asc +16 -0
  54. package/deps/jq/sig/v1.7.1/jq-linux-powerpc.asc +16 -0
  55. package/deps/jq/sig/v1.7.1/jq-linux-ppc64el.asc +16 -0
  56. package/deps/jq/sig/v1.7.1/jq-linux-riscv64.asc +16 -0
  57. package/deps/jq/sig/v1.7.1/jq-linux-s390x.asc +16 -0
  58. package/deps/jq/sig/v1.7.1/jq-linux64.asc +16 -0
  59. package/deps/jq/sig/v1.7.1/jq-macos-amd64.asc +16 -0
  60. package/deps/jq/sig/v1.7.1/jq-macos-arm64.asc +16 -0
  61. package/deps/jq/sig/v1.7.1/jq-osx-amd64.asc +16 -0
  62. package/deps/jq/sig/v1.7.1/jq-win64.exe.asc +16 -0
  63. package/deps/jq/sig/v1.7.1/jq-windows-amd64.exe.asc +16 -0
  64. package/deps/jq/sig/v1.7.1/jq-windows-i386.exe.asc +16 -0
  65. package/deps/jq/sig/v1.7.1/sha256sum.txt +26 -0
  66. package/deps/jq/sig/v1.8.0/jq-1.8.0.tar.gz.asc +16 -0
  67. package/deps/jq/sig/v1.8.0/jq-1.8.0.zip.asc +16 -0
  68. package/deps/jq/sig/v1.8.0/jq-linux-amd64.asc +16 -0
  69. package/deps/jq/sig/v1.8.0/jq-linux-arm64.asc +16 -0
  70. package/deps/jq/sig/v1.8.0/jq-linux-armel.asc +16 -0
  71. package/deps/jq/sig/v1.8.0/jq-linux-armhf.asc +16 -0
  72. package/deps/jq/sig/v1.8.0/jq-linux-i386.asc +16 -0
  73. package/deps/jq/sig/v1.8.0/jq-linux-mips.asc +16 -0
  74. package/deps/jq/sig/v1.8.0/jq-linux-mips64.asc +16 -0
  75. package/deps/jq/sig/v1.8.0/jq-linux-mips64el.asc +16 -0
  76. package/deps/jq/sig/v1.8.0/jq-linux-mips64r6.asc +16 -0
  77. package/deps/jq/sig/v1.8.0/jq-linux-mips64r6el.asc +16 -0
  78. package/deps/jq/sig/v1.8.0/jq-linux-mipsel.asc +16 -0
  79. package/deps/jq/sig/v1.8.0/jq-linux-mipsr6.asc +16 -0
  80. package/deps/jq/sig/v1.8.0/jq-linux-mipsr6el.asc +16 -0
  81. package/deps/jq/sig/v1.8.0/jq-linux-powerpc.asc +16 -0
  82. package/deps/jq/sig/v1.8.0/jq-linux-ppc64el.asc +16 -0
  83. package/deps/jq/sig/v1.8.0/jq-linux-riscv64.asc +16 -0
  84. package/deps/jq/sig/v1.8.0/jq-linux-s390x.asc +16 -0
  85. package/deps/jq/sig/v1.8.0/jq-linux64.asc +16 -0
  86. package/deps/jq/sig/v1.8.0/jq-macos-amd64.asc +16 -0
  87. package/deps/jq/sig/v1.8.0/jq-macos-arm64.asc +16 -0
  88. package/deps/jq/sig/v1.8.0/jq-osx-amd64.asc +16 -0
  89. package/deps/jq/sig/v1.8.0/jq-win64.exe.asc +16 -0
  90. package/deps/jq/sig/v1.8.0/jq-windows-amd64.exe.asc +16 -0
  91. package/deps/jq/sig/v1.8.0/jq-windows-i386.exe.asc +16 -0
  92. package/deps/jq/sig/v1.8.0/sha256sum.txt +26 -0
  93. package/deps/jq/src/builtin.c +446 -271
  94. package/deps/jq/src/builtin.jq +25 -60
  95. package/deps/jq/src/bytecode.h +8 -3
  96. package/deps/jq/src/compile.c +22 -43
  97. package/deps/jq/src/compile.h +1 -1
  98. package/deps/jq/src/execute.c +20 -25
  99. package/deps/jq/src/jq_test.c +113 -44
  100. package/deps/jq/src/jv.c +134 -42
  101. package/deps/jq/src/jv.h +10 -3
  102. package/deps/jq/src/jv_alloc.c +8 -5
  103. package/deps/jq/src/jv_alloc.h +0 -1
  104. package/deps/jq/src/jv_aux.c +41 -8
  105. package/deps/jq/src/jv_dtoa.c +4 -12
  106. package/deps/jq/src/jv_dtoa_tsd.c +5 -4
  107. package/deps/jq/src/jv_dtoa_tsd.h +1 -1
  108. package/deps/jq/src/jv_parse.c +5 -3
  109. package/deps/jq/src/jv_print.c +87 -65
  110. package/deps/jq/src/jv_unicode.c +18 -0
  111. package/deps/jq/src/jv_unicode.h +2 -0
  112. package/deps/jq/src/lexer.c +303 -278
  113. package/deps/jq/src/lexer.h +5 -4
  114. package/deps/jq/src/lexer.l +8 -2
  115. package/deps/jq/src/libm.h +15 -5
  116. package/deps/jq/src/linker.c +6 -4
  117. package/deps/jq/src/locfile.c +12 -12
  118. package/deps/jq/src/main.c +204 -270
  119. package/deps/jq/src/parser.c +1105 -1273
  120. package/deps/jq/src/parser.y +149 -181
  121. package/deps/jq/src/util.c +46 -48
  122. package/deps/jq/src/util.h +1 -1
  123. package/deps/jq/tests/base64.test +12 -0
  124. package/deps/jq/tests/jq.test +429 -37
  125. package/deps/jq/tests/jq_fuzz_load_file.c +1 -0
  126. package/deps/jq/tests/man.test +46 -13
  127. package/deps/jq/tests/manonig.test +13 -0
  128. package/deps/jq/tests/onig.test +40 -2
  129. package/deps/jq/tests/optional.test +4 -12
  130. package/deps/jq/tests/setup +5 -1
  131. package/deps/jq/tests/shtest +358 -130
  132. package/deps/jq/tests/uri.test +38 -0
  133. package/deps/jq/tests/uritest +5 -0
  134. package/deps/jq/{src → vendor}/decNumber/decBasic.c +1 -1
  135. package/deps/jq/{src → vendor}/decNumber/decCommon.c +1 -1
  136. package/deps/jq/{src → vendor}/decNumber/decNumber.c +4 -4
  137. package/deps/jq/{modules → vendor}/oniguruma/CMakeLists.txt +5 -3
  138. package/deps/jq/{modules → vendor}/oniguruma/HISTORY +45 -7
  139. package/deps/jq/{modules → vendor}/oniguruma/Makefile.am +1 -1
  140. package/deps/jq/{modules → vendor}/oniguruma/README.md +10 -23
  141. package/deps/jq/{modules → vendor}/oniguruma/compile +29 -13
  142. package/deps/jq/{modules → vendor}/oniguruma/config.guess +91 -27
  143. package/deps/jq/{modules → vendor}/oniguruma/config.sub +716 -242
  144. package/deps/jq/{modules → vendor}/oniguruma/configure.ac +2 -2
  145. package/deps/jq/{modules → vendor}/oniguruma/depcomp +10 -9
  146. package/deps/jq/{modules → vendor}/oniguruma/doc/API +3 -1
  147. package/deps/jq/{modules → vendor}/oniguruma/doc/API.ja +3 -1
  148. package/deps/jq/{modules → vendor}/oniguruma/doc/CALLOUTS.BUILTIN +10 -1
  149. package/deps/jq/{modules → vendor}/oniguruma/doc/CALLOUTS.BUILTIN.ja +9 -1
  150. package/deps/jq/{modules → vendor}/oniguruma/doc/RE +12 -13
  151. package/deps/jq/{modules → vendor}/oniguruma/doc/RE.ja +12 -13
  152. package/deps/jq/{modules → vendor}/oniguruma/doc/SYNTAX.md +202 -167
  153. package/deps/jq/{modules → vendor}/oniguruma/doc/UNICODE_PROPERTIES +33 -1
  154. package/deps/jq/vendor/oniguruma/doc/onig_syn_md.c +667 -0
  155. package/deps/jq/{modules → vendor}/oniguruma/harnesses/base.c +1 -1
  156. package/deps/jq/{modules → vendor}/oniguruma/install-sh +9 -9
  157. package/deps/jq/{modules → vendor}/oniguruma/missing +50 -29
  158. package/deps/jq/{modules → vendor}/oniguruma/sample/callback_each_match.c +1 -3
  159. package/deps/jq/vendor/oniguruma/sbom.cdx.json +44 -0
  160. package/deps/jq/{modules → vendor}/oniguruma/src/ascii.c +4 -1
  161. package/deps/jq/{modules → vendor}/oniguruma/src/gperf_fold_key_conv.py +4 -4
  162. package/deps/jq/{modules → vendor}/oniguruma/src/gperf_unfold_key_conv.py +4 -4
  163. package/deps/jq/vendor/oniguruma/src/make_unicode_egcb.sh +7 -0
  164. package/deps/jq/{modules → vendor}/oniguruma/src/make_unicode_egcb_data.py +20 -19
  165. package/deps/jq/{modules → vendor}/oniguruma/src/make_unicode_fold.sh +5 -5
  166. package/deps/jq/{modules → vendor}/oniguruma/src/make_unicode_fold_data.py +37 -37
  167. package/deps/jq/{modules → vendor}/oniguruma/src/make_unicode_property.sh +2 -2
  168. package/deps/jq/{modules → vendor}/oniguruma/src/make_unicode_property_data.py +66 -65
  169. package/deps/jq/vendor/oniguruma/src/make_unicode_wb.sh +7 -0
  170. package/deps/jq/{modules → vendor}/oniguruma/src/make_unicode_wb_data.py +20 -19
  171. package/deps/jq/{modules → vendor}/oniguruma/src/oniguruma.h +6 -3
  172. package/deps/jq/{modules → vendor}/oniguruma/src/regcomp.c +14 -6
  173. package/deps/jq/{modules → vendor}/oniguruma/src/regerror.c +2 -2
  174. package/deps/jq/{modules → vendor}/oniguruma/src/regexec.c +85 -14
  175. package/deps/jq/{modules → vendor}/oniguruma/src/regint.h +17 -4
  176. package/deps/jq/{modules → vendor}/oniguruma/src/regparse.c +115 -27
  177. package/deps/jq/{modules → vendor}/oniguruma/src/regsyntax.c +10 -7
  178. package/deps/jq/{modules → vendor}/oniguruma/src/st.c +49 -75
  179. package/deps/jq/{modules → vendor}/oniguruma/src/st.h +3 -10
  180. package/deps/jq/{modules → vendor}/oniguruma/src/unicode_egcb_data.c +54 -49
  181. package/deps/jq/{modules → vendor}/oniguruma/src/unicode_fold1_key.c +1567 -1507
  182. package/deps/jq/{modules → vendor}/oniguruma/src/unicode_fold2_key.c +1 -1
  183. package/deps/jq/{modules → vendor}/oniguruma/src/unicode_fold3_key.c +1 -1
  184. package/deps/jq/vendor/oniguruma/src/unicode_fold_data.c +1619 -0
  185. package/deps/jq/{modules → vendor}/oniguruma/src/unicode_property_data.c +5520 -4178
  186. package/deps/jq/{modules → vendor}/oniguruma/src/unicode_property_data_posix.c +239 -83
  187. package/deps/jq/vendor/oniguruma/src/unicode_unfold_key.c +3497 -0
  188. package/deps/jq/{modules → vendor}/oniguruma/src/unicode_wb_data.c +51 -19
  189. package/deps/jq/{modules → vendor}/oniguruma/src/utf16_be.c +3 -2
  190. package/deps/jq/{modules → vendor}/oniguruma/src/utf16_le.c +3 -2
  191. package/deps/jq/{modules → vendor}/oniguruma/test/test_back.c +3 -3
  192. package/deps/jq/{modules → vendor}/oniguruma/test/test_options.c +2 -2
  193. package/deps/jq/{modules → vendor}/oniguruma/test/test_syntax.c +54 -2
  194. package/deps/jq/{modules → vendor}/oniguruma/test/test_utf8.c +19 -5
  195. package/deps/jq/{modules → vendor}/oniguruma/test/testc.c +1 -1
  196. package/deps/jq/{modules → vendor}/oniguruma/test/testp.c +1 -1
  197. package/deps/jq/{modules → vendor}/oniguruma/test-driver +13 -6
  198. package/deps/jq/{modules → vendor}/oniguruma/windows/CMakeLists.txt +1 -1
  199. package/index.d.ts +2 -1
  200. package/lib/index.js +1 -0
  201. package/lib/jq.js +2 -1
  202. package/package.json +4 -3
  203. package/test/santiy-async.test.js +4 -4
  204. package/test/santiy.test.js +4 -4
  205. package/test/template.test.js +6 -6
  206. package/deps/jq/modules/oniguruma/src/make_unicode_egcb.sh +0 -7
  207. package/deps/jq/modules/oniguruma/src/make_unicode_wb.sh +0 -7
  208. package/deps/jq/modules/oniguruma/src/unicode_fold_data.c +0 -1592
  209. package/deps/jq/modules/oniguruma/src/unicode_unfold_key.c +0 -3394
  210. package/deps/jq/scripts/update-website +0 -30
  211. /package/deps/jq/{src → vendor}/decNumber/ICU-license.html +0 -0
  212. /package/deps/jq/{src → vendor}/decNumber/decContext.c +0 -0
  213. /package/deps/jq/{src → vendor}/decNumber/decContext.h +0 -0
  214. /package/deps/jq/{src → vendor}/decNumber/decDPD.h +0 -0
  215. /package/deps/jq/{src → vendor}/decNumber/decDouble.c +0 -0
  216. /package/deps/jq/{src → vendor}/decNumber/decDouble.h +0 -0
  217. /package/deps/jq/{src → vendor}/decNumber/decNumber.h +0 -0
  218. /package/deps/jq/{src → vendor}/decNumber/decNumberLocal.h +0 -0
  219. /package/deps/jq/{src → vendor}/decNumber/decPacked.c +0 -0
  220. /package/deps/jq/{src → vendor}/decNumber/decPacked.h +0 -0
  221. /package/deps/jq/{src → vendor}/decNumber/decQuad.c +0 -0
  222. /package/deps/jq/{src → vendor}/decNumber/decQuad.h +0 -0
  223. /package/deps/jq/{src → vendor}/decNumber/decSingle.c +0 -0
  224. /package/deps/jq/{src → vendor}/decNumber/decSingle.h +0 -0
  225. /package/deps/jq/{src → vendor}/decNumber/decimal128.c +0 -0
  226. /package/deps/jq/{src → vendor}/decNumber/decimal128.h +0 -0
  227. /package/deps/jq/{src → vendor}/decNumber/decimal32.c +0 -0
  228. /package/deps/jq/{src → vendor}/decNumber/decimal32.h +0 -0
  229. /package/deps/jq/{src → vendor}/decNumber/decimal64.c +0 -0
  230. /package/deps/jq/{src → vendor}/decNumber/decimal64.h +0 -0
  231. /package/deps/jq/{src → vendor}/decNumber/decnumber.pdf +0 -0
  232. /package/deps/jq/{src → vendor}/decNumber/example1.c +0 -0
  233. /package/deps/jq/{src → vendor}/decNumber/example2.c +0 -0
  234. /package/deps/jq/{src → vendor}/decNumber/example3.c +0 -0
  235. /package/deps/jq/{src → vendor}/decNumber/example4.c +0 -0
  236. /package/deps/jq/{src → vendor}/decNumber/example5.c +0 -0
  237. /package/deps/jq/{src → vendor}/decNumber/example6.c +0 -0
  238. /package/deps/jq/{src → vendor}/decNumber/example7.c +0 -0
  239. /package/deps/jq/{src → vendor}/decNumber/example8.c +0 -0
  240. /package/deps/jq/{src → vendor}/decNumber/readme.txt +0 -0
  241. /package/deps/jq/{modules → vendor}/oniguruma/.travis.yml +0 -0
  242. /package/deps/jq/{modules → vendor}/oniguruma/AUTHORS +0 -0
  243. /package/deps/jq/{modules → vendor}/oniguruma/COPYING +0 -0
  244. /package/deps/jq/{modules → vendor}/oniguruma/ChangeLog +0 -0
  245. /package/deps/jq/{modules → vendor}/oniguruma/NEWS +0 -0
  246. /package/deps/jq/{modules → vendor}/oniguruma/README +0 -0
  247. /package/deps/jq/{modules → vendor}/oniguruma/README_japanese +0 -0
  248. /package/deps/jq/{modules → vendor}/oniguruma/autogen.sh +0 -0
  249. /package/deps/jq/{modules → vendor}/oniguruma/cmake/Config.cmake.in +0 -0
  250. /package/deps/jq/{modules → vendor}/oniguruma/doc/CALLOUTS.API +0 -0
  251. /package/deps/jq/{modules → vendor}/oniguruma/doc/CALLOUTS.API.ja +0 -0
  252. /package/deps/jq/{modules → vendor}/oniguruma/doc/FAQ +0 -0
  253. /package/deps/jq/{modules → vendor}/oniguruma/doc/FAQ.ja +0 -0
  254. /package/deps/jq/{modules → vendor}/oniguruma/harnesses/ascii_compatible.dict +0 -0
  255. /package/deps/jq/{modules → vendor}/oniguruma/harnesses/deluxe.c +0 -0
  256. /package/deps/jq/{modules → vendor}/oniguruma/harnesses/dict_conv.py +0 -0
  257. /package/deps/jq/{modules → vendor}/oniguruma/harnesses/fuzzer.options +0 -0
  258. /package/deps/jq/{modules → vendor}/oniguruma/harnesses/libfuzzer-onig.cpp +0 -0
  259. /package/deps/jq/{modules → vendor}/oniguruma/harnesses/regset.c +0 -0
  260. /package/deps/jq/{modules → vendor}/oniguruma/index.html +0 -0
  261. /package/deps/jq/{modules → vendor}/oniguruma/index_ja.html +0 -0
  262. /package/deps/jq/{modules → vendor}/oniguruma/m4/.whatever +0 -0
  263. /package/deps/jq/{modules → vendor}/oniguruma/make_win.bat +0 -0
  264. /package/deps/jq/{modules → vendor}/oniguruma/make_win32.bat +0 -0
  265. /package/deps/jq/{modules → vendor}/oniguruma/make_win64.bat +0 -0
  266. /package/deps/jq/{modules → vendor}/oniguruma/onig-config.cmake.in +0 -0
  267. /package/deps/jq/{modules → vendor}/oniguruma/onig-config.in +0 -0
  268. /package/deps/jq/{modules → vendor}/oniguruma/oniguruma.pc.cmake.in +0 -0
  269. /package/deps/jq/{modules → vendor}/oniguruma/oniguruma.pc.in +0 -0
  270. /package/deps/jq/{modules → vendor}/oniguruma/sample/CMakeLists.txt +0 -0
  271. /package/deps/jq/{modules → vendor}/oniguruma/sample/Makefile.am +0 -0
  272. /package/deps/jq/{modules → vendor}/oniguruma/sample/bug_fix.c +0 -0
  273. /package/deps/jq/{modules → vendor}/oniguruma/sample/callout.c +0 -0
  274. /package/deps/jq/{modules → vendor}/oniguruma/sample/count.c +0 -0
  275. /package/deps/jq/{modules → vendor}/oniguruma/sample/crnl.c +0 -0
  276. /package/deps/jq/{modules → vendor}/oniguruma/sample/echo.c +0 -0
  277. /package/deps/jq/{modules → vendor}/oniguruma/sample/encode.c +0 -0
  278. /package/deps/jq/{modules → vendor}/oniguruma/sample/listcap.c +0 -0
  279. /package/deps/jq/{modules → vendor}/oniguruma/sample/names.c +0 -0
  280. /package/deps/jq/{modules → vendor}/oniguruma/sample/posix.c +0 -0
  281. /package/deps/jq/{modules → vendor}/oniguruma/sample/regset.c +0 -0
  282. /package/deps/jq/{modules → vendor}/oniguruma/sample/scan.c +0 -0
  283. /package/deps/jq/{modules → vendor}/oniguruma/sample/simple.c +0 -0
  284. /package/deps/jq/{modules → vendor}/oniguruma/sample/sql.c +0 -0
  285. /package/deps/jq/{modules → vendor}/oniguruma/sample/syntax.c +0 -0
  286. /package/deps/jq/{modules → vendor}/oniguruma/sample/user_property.c +0 -0
  287. /package/deps/jq/{modules → vendor}/oniguruma/src/Makefile.am +0 -0
  288. /package/deps/jq/{modules → vendor}/oniguruma/src/Makefile.windows +0 -0
  289. /package/deps/jq/{modules → vendor}/oniguruma/src/big5.c +0 -0
  290. /package/deps/jq/{modules → vendor}/oniguruma/src/config.h.cmake.in +0 -0
  291. /package/deps/jq/{modules → vendor}/oniguruma/src/config.h.win32 +0 -0
  292. /package/deps/jq/{modules → vendor}/oniguruma/src/config.h.win64 +0 -0
  293. /package/deps/jq/{modules → vendor}/oniguruma/src/config.h.windows.in +0 -0
  294. /package/deps/jq/{modules → vendor}/oniguruma/src/cp1251.c +0 -0
  295. /package/deps/jq/{modules → vendor}/oniguruma/src/euc_jp.c +0 -0
  296. /package/deps/jq/{modules → vendor}/oniguruma/src/euc_jp_prop.c +0 -0
  297. /package/deps/jq/{modules → vendor}/oniguruma/src/euc_jp_prop.gperf +0 -0
  298. /package/deps/jq/{modules → vendor}/oniguruma/src/euc_kr.c +0 -0
  299. /package/deps/jq/{modules → vendor}/oniguruma/src/euc_tw.c +0 -0
  300. /package/deps/jq/{modules → vendor}/oniguruma/src/gb18030.c +0 -0
  301. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_1.c +0 -0
  302. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_10.c +0 -0
  303. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_11.c +0 -0
  304. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_13.c +0 -0
  305. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_14.c +0 -0
  306. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_15.c +0 -0
  307. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_16.c +0 -0
  308. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_2.c +0 -0
  309. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_3.c +0 -0
  310. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_4.c +0 -0
  311. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_5.c +0 -0
  312. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_6.c +0 -0
  313. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_7.c +0 -0
  314. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_8.c +0 -0
  315. /package/deps/jq/{modules → vendor}/oniguruma/src/iso8859_9.c +0 -0
  316. /package/deps/jq/{modules → vendor}/oniguruma/src/koi8.c +0 -0
  317. /package/deps/jq/{modules → vendor}/oniguruma/src/koi8_r.c +0 -0
  318. /package/deps/jq/{modules → vendor}/oniguruma/src/make_property.sh +0 -0
  319. /package/deps/jq/{modules → vendor}/oniguruma/src/mktable.c +0 -0
  320. /package/deps/jq/{modules → vendor}/oniguruma/src/onig_init.c +0 -0
  321. /package/deps/jq/{modules → vendor}/oniguruma/src/oniggnu.h +0 -0
  322. /package/deps/jq/{modules → vendor}/oniguruma/src/onigposix.h +0 -0
  323. /package/deps/jq/{modules → vendor}/oniguruma/src/regenc.c +0 -0
  324. /package/deps/jq/{modules → vendor}/oniguruma/src/regenc.h +0 -0
  325. /package/deps/jq/{modules → vendor}/oniguruma/src/regext.c +0 -0
  326. /package/deps/jq/{modules → vendor}/oniguruma/src/reggnu.c +0 -0
  327. /package/deps/jq/{modules → vendor}/oniguruma/src/regparse.h +0 -0
  328. /package/deps/jq/{modules → vendor}/oniguruma/src/regposerr.c +0 -0
  329. /package/deps/jq/{modules → vendor}/oniguruma/src/regposix.c +0 -0
  330. /package/deps/jq/{modules → vendor}/oniguruma/src/regtrav.c +0 -0
  331. /package/deps/jq/{modules → vendor}/oniguruma/src/regversion.c +0 -0
  332. /package/deps/jq/{modules → vendor}/oniguruma/src/sjis.c +0 -0
  333. /package/deps/jq/{modules → vendor}/oniguruma/src/sjis_prop.c +0 -0
  334. /package/deps/jq/{modules → vendor}/oniguruma/src/sjis_prop.gperf +0 -0
  335. /package/deps/jq/{modules → vendor}/oniguruma/src/unicode.c +0 -0
  336. /package/deps/jq/{modules → vendor}/oniguruma/src/utf32_be.c +0 -0
  337. /package/deps/jq/{modules → vendor}/oniguruma/src/utf32_le.c +0 -0
  338. /package/deps/jq/{modules → vendor}/oniguruma/src/utf8.c +0 -0
  339. /package/deps/jq/{modules → vendor}/oniguruma/test/CMakeLists.txt +0 -0
  340. /package/deps/jq/{modules → vendor}/oniguruma/test/Makefile.am +0 -0
  341. /package/deps/jq/{modules → vendor}/oniguruma/test/test.sh +0 -0
  342. /package/deps/jq/{modules → vendor}/oniguruma/test/test_regset.c +0 -0
  343. /package/deps/jq/{modules → vendor}/oniguruma/test/testu.c +0 -0
  344. /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/stub.c +0 -0
  345. /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/test_back.config +0 -0
  346. /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/test_regset.config +0 -0
  347. /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/test_syntax.config +0 -0
  348. /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/test_utf8.config +0 -0
  349. /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/testc.config +0 -0
  350. /package/deps/jq/{modules → vendor}/oniguruma/tis-ci/testu.config +0 -0
  351. /package/deps/jq/{modules → vendor}/oniguruma/tis.config +0 -0
  352. /package/deps/jq/{modules → vendor}/oniguruma/windows/testc.c +0 -0
@@ -4,11 +4,11 @@ def map(f): [.[] | f];
4
4
  def select(f): if f then . else empty end;
5
5
  def sort_by(f): _sort_by_impl(map([f]));
6
6
  def group_by(f): _group_by_impl(map([f]));
7
- def unique: group_by(.) | map(.[0]);
8
- def unique_by(f): group_by(f) | map(.[0]);
7
+ def unique_by(f): _unique_by_impl(map([f]));
9
8
  def max_by(f): _max_by_impl(map([f]));
10
9
  def min_by(f): _min_by_impl(map([f]));
11
- def add: reduce .[] as $x (null; . + $x);
10
+ def add(f): reduce f as $x (null; . + $x);
11
+ def add: add(.[]);
12
12
  def del(f): delpaths([path(f)]);
13
13
  def abs: if . < 0 then - . else . end;
14
14
  def _assign(paths; $value): reduce path(paths) as $p (.; setpath($p; $value));
@@ -74,6 +74,9 @@ def fromdateiso8601: strptime("%Y-%m-%dT%H:%M:%SZ")|mktime;
74
74
  def todateiso8601: strftime("%Y-%m-%dT%H:%M:%SZ");
75
75
  def fromdate: fromdateiso8601;
76
76
  def todate: todateiso8601;
77
+ def ltrimstr($left): if startswith($left) then .[$left | length:] end;
78
+ def rtrimstr($right): if endswith($right) then .[:$right | -length] end;
79
+ def trimstr($val): ltrimstr($val) | rtrimstr($val);
77
80
  def match(re; mode): _match_impl(re; mode; false)|.[];
78
81
  def match($val): ($val|type) as $vt | if $vt == "string" then match($val; null)
79
82
  elif $vt == "array" and ($val | length) > 1 then match($val[0]; $val[1])
@@ -96,26 +99,16 @@ def scan($re; $flags):
96
99
  else .string
97
100
  end;
98
101
  def scan($re): scan($re; null);
99
- #
100
- # If input is an array, then emit a stream of successive subarrays of length n (or less),
101
- # and similarly for strings.
102
- def _nwise($n):
103
- def n: if length <= $n then . else .[0:$n] , (.[$n:] | n) end;
104
- n;
105
- def _nwise(a; $n): a | _nwise($n);
106
- #
102
+
107
103
  # splits/1 produces a stream; split/1 is retained for backward compatibility.
108
- def splits($re; flags): . as $s
109
- # # multiple occurrences of "g" are acceptable
110
- | [ match($re; "g" + flags) | (.offset, .offset + .length) ]
111
- | [0] + . +[$s|length]
112
- | _nwise(2)
113
- | $s[.[0]:.[1] ] ;
104
+ def splits($re; $flags):
105
+ .[foreach (match($re; $flags+"g"), null) as {$offset, $length}
106
+ (null; {start: .next, end: $offset, next: ($offset+$length)})];
114
107
  def splits($re): splits($re; null);
115
- #
108
+
116
109
  # split emits an array for backward compatibility
117
- def split($re; flags): [ splits($re; flags) ];
118
- #
110
+ def split($re; $flags): [ splits($re; $flags) ];
111
+
119
112
  # If s contains capture variables, then create a capture object and pipe it to s, bearing
120
113
  # in mind that s could be a stream
121
114
  def sub($re; s; $flags):
@@ -130,12 +123,12 @@ def sub($re; s; $flags):
130
123
  | .previous = ($edit | .offset + .length ) )
131
124
  | .result[] + $in[.previous:] )
132
125
  // $in;
133
- #
126
+
134
127
  def sub($re; s): sub($re; s; "");
135
- #
128
+
136
129
  def gsub($re; s; flags): sub($re; s; flags + "g");
137
130
  def gsub($re; s): sub($re; s; "g");
138
- #
131
+
139
132
  ########################################################################
140
133
  # generic iterator/generator
141
134
  def while(cond; update):
@@ -146,10 +139,14 @@ def until(cond; next):
146
139
  def _until:
147
140
  if cond then . else (next|_until) end;
148
141
  _until;
149
- def limit($n; exp):
150
- if $n > 0 then label $out | foreach exp as $item ($n; .-1; $item, if . <= 0 then break $out else empty end)
151
- elif $n == 0 then empty
152
- else exp end;
142
+ def limit($n; expr):
143
+ if $n > 0 then label $out | foreach expr as $item ($n; . - 1; $item, if . <= 0 then break $out else empty end)
144
+ elif $n == 0 then empty
145
+ else error("limit doesn't support negative count") end;
146
+ def skip($n; expr):
147
+ if $n > 0 then foreach expr as $item ($n; . - 1; if . < 0 then $item else empty end)
148
+ elif $n == 0 then expr
149
+ else error("skip doesn't support negative count") end;
153
150
  # range/3, with a `by` expression argument
154
151
  def range($init; $upto; $by):
155
152
  if $by > 0 then $init|while(. < $upto; . + $by)
@@ -163,10 +160,9 @@ def all(condition): all(.[]; condition);
163
160
  def any(condition): any(.[]; condition);
164
161
  def all: all(.[]; .);
165
162
  def any: any(.[]; .);
166
- def last(g): reduce g as $item (null; $item);
167
163
  def nth($n; g):
168
164
  if $n < 0 then error("nth doesn't support negative indices")
169
- else label $out | foreach g as $item ($n + 1; . - 1; if . <= 0 then $item, break $out else empty end) end;
165
+ else first(skip($n; g)) end;
170
166
  def first: .[0];
171
167
  def last: .[-1];
172
168
  def nth($n): .[$n];
@@ -213,37 +209,6 @@ def tostream:
213
209
  getpath($p) |
214
210
  reduce path(.[]?) as $q ([$p, .]; [$p+$q]);
215
211
 
216
- # Assuming the input array is sorted, bsearch/1 returns
217
- # the index of the target if the target is in the input array; and otherwise
218
- # (-1 - ix), where ix is the insertion point that would leave the array sorted.
219
- # If the input is not sorted, bsearch will terminate but with irrelevant results.
220
- def bsearch($target):
221
- if length == 0 then -1
222
- elif length == 1 then
223
- if $target == .[0] then 0 elif $target < .[0] then -1 else -2 end
224
- else . as $in
225
- # state variable: [start, end, answer]
226
- # where start and end are the upper and lower offsets to use.
227
- | [0, length-1, null]
228
- | until( .[0] > .[1] ;
229
- if .[2] != null then (.[1] = -1) # i.e. break
230
- else
231
- ( ( (.[1] + .[0]) / 2 ) | floor ) as $mid
232
- | $in[$mid] as $monkey
233
- | if $monkey == $target then (.[2] = $mid) # success
234
- elif .[0] == .[1] then (.[1] = -1) # failure
235
- elif $monkey < $target then (.[0] = ($mid + 1))
236
- else (.[1] = ($mid - 1))
237
- end
238
- end )
239
- | if .[2] == null then # compute the insertion point
240
- if $in[ .[0] ] < $target then (-2 -.[0])
241
- else (-1 -.[0])
242
- end
243
- else .[2]
244
- end
245
- end;
246
-
247
212
  # Apply f to composite entities recursively, and to atoms
248
213
  def walk(f):
249
214
  def w:
@@ -2,7 +2,7 @@
2
2
  #define BYTECODE_H
3
3
  #include <stdint.h>
4
4
 
5
- #include "jv.h"
5
+ #include "jq.h"
6
6
 
7
7
  typedef enum {
8
8
  #define OP(name, imm, in, out) name,
@@ -44,9 +44,14 @@ struct opcode_description {
44
44
  const struct opcode_description* opcode_describe(opcode op);
45
45
 
46
46
 
47
- #define MAX_CFUNCTION_ARGS 10
47
+ #define MAX_CFUNCTION_ARGS 4
48
48
  struct cfunction {
49
- jv (*fptr)();
49
+ union {
50
+ jv (*a1)(jq_state *, jv);
51
+ jv (*a2)(jq_state *, jv, jv);
52
+ jv (*a3)(jq_state *, jv, jv, jv);
53
+ jv (*a4)(jq_state *, jv, jv, jv, jv);
54
+ } fptr;
50
55
  const char* name;
51
56
  int nargs;
52
57
  };
@@ -1,5 +1,4 @@
1
1
  #include <assert.h>
2
- #include <math.h>
3
2
  #include <string.h>
4
3
  #include <stdlib.h>
5
4
  #include <unistd.h>
@@ -7,7 +6,7 @@
7
6
  #include "bytecode.h"
8
7
  #include "locfile.h"
9
8
  #include "jv_alloc.h"
10
- #include "linker.h"
9
+ #include "util.h"
11
10
 
12
11
  /*
13
12
  The intermediate representation for jq filters is as a sequence of
@@ -129,7 +128,7 @@ block gen_location(location loc, struct locfile* l, block b) {
129
128
  return b;
130
129
  }
131
130
 
132
- block gen_noop() {
131
+ block gen_noop(void) {
133
132
  block b = {0,0};
134
133
  return b;
135
134
  }
@@ -845,46 +844,26 @@ block gen_reduce(block source, block matcher, block init, block body) {
845
844
  }
846
845
 
847
846
  block gen_foreach(block source, block matcher, block init, block update, block extract) {
848
- block output = gen_op_targetlater(JUMP);
849
847
  block state_var = gen_op_var_fresh(STOREV, "foreach");
850
- block loop = BLOCK(gen_op_simple(DUPN),
851
- // get a value from the source expression:
852
- source,
853
- // destructure the value into variable(s) for all the code
854
- // in the body to see
855
- bind_alternation_matchers(matcher,
856
- // load the loop state variable
857
- BLOCK(gen_op_bound(LOADVN, state_var),
858
- // generate updated state
859
- update,
860
- // save the updated state for value extraction
861
- gen_op_simple(DUP),
862
- // save new state
863
- gen_op_bound(STOREV, state_var),
864
- // extract an output...
865
- extract,
866
- // ...and output it by jumping
867
- // past the BACKTRACK that comes
868
- // right after the loop body,
869
- // which in turn is there
870
- // because...
871
- //
872
- // (Incidentally, extract can also
873
- // backtrack, e.g., if it calls
874
- // empty, in which case we don't
875
- // get here.)
876
- output)));
877
- block foreach = BLOCK(gen_op_simple(DUP),
878
- init,
879
- state_var,
880
- gen_op_target(FORK, loop),
881
- loop,
882
- // ...at this point `foreach`'s original input
883
- // will be on top of the stack, and we don't
884
- // want to output it, so we backtrack.
885
- gen_op_simple(BACKTRACK));
886
- inst_set_target(output, foreach); // make that JUMP go bast the BACKTRACK at the end of the loop
887
- return foreach;
848
+ return BLOCK(gen_op_simple(DUP),
849
+ init,
850
+ state_var,
851
+ gen_op_simple(DUP),
852
+ // get a value from the source expression:
853
+ source,
854
+ // destructure the value into variable(s) for all the code
855
+ // in the body to see
856
+ bind_alternation_matchers(matcher,
857
+ // load the loop state variable
858
+ BLOCK(gen_op_bound(LOADVN, state_var),
859
+ // generate updated state
860
+ update,
861
+ // save the updated state for value extraction
862
+ gen_op_simple(DUP),
863
+ // save new state
864
+ gen_op_bound(STOREV, state_var),
865
+ // extract an output...
866
+ extract)));
888
867
  }
889
868
 
890
869
  block gen_definedor(block a, block b) {
@@ -1374,7 +1353,7 @@ int block_compile(block b, struct bytecode** out, struct locfile* lf, jv args) {
1374
1353
  bc->globals = jv_mem_alloc(sizeof(struct symbol_table));
1375
1354
  int ncfunc = count_cfunctions(b);
1376
1355
  bc->globals->ncfunctions = 0;
1377
- bc->globals->cfunctions = jv_mem_calloc(ncfunc, sizeof(struct cfunction));
1356
+ bc->globals->cfunctions = jv_mem_calloc(MAX(ncfunc, 1), sizeof(struct cfunction));
1378
1357
  bc->globals->cfunc_names = jv_array();
1379
1358
  bc->debuginfo = jv_object_set(jv_object(), jv_string("name"), jv_null());
1380
1359
  jv env = jv_invalid();
@@ -16,7 +16,7 @@ typedef struct block {
16
16
 
17
17
  block gen_location(location, struct locfile*, block);
18
18
 
19
- block gen_noop();
19
+ block gen_noop(void);
20
20
  int block_is_noop(block b);
21
21
  block gen_op_simple(opcode op);
22
22
  block gen_error(jv constant);
@@ -318,7 +318,9 @@ static void jq_reset(jq_state *jq) {
318
318
 
319
319
  jq->halted = 0;
320
320
  jv_free(jq->exit_code);
321
+ jq->exit_code = jv_invalid();
321
322
  jv_free(jq->error_message);
323
+ jq->error_message = jv_invalid();
322
324
  if (jv_get_kind(jq->path) != JV_KIND_INVALID)
323
325
  jv_free(jq->path);
324
326
  jq->path = jv_null();
@@ -342,8 +344,6 @@ static void set_error(jq_state *jq, jv value) {
342
344
  #define ON_BACKTRACK(op) ((op)+NUM_OPCODES)
343
345
 
344
346
  jv jq_next(jq_state *jq, unsigned int timeout_sec) {
345
- jv cfunc_input[MAX_CFUNCTION_ARGS];
346
-
347
347
  jv_nomem_handler(jq->nomem_handler, jq->nomem_handler_data);
348
348
 
349
349
  uint16_t* pc = stack_restore(jq);
@@ -796,8 +796,10 @@ jv jq_next(jq_state *jq, unsigned int timeout_sec) {
796
796
  }
797
797
 
798
798
  if (!keep_going || raising) {
799
- if (keep_going)
799
+ if (keep_going) {
800
+ jv_free(key);
800
801
  jv_free(value);
802
+ }
801
803
  jv_free(container);
802
804
  goto do_backtrack;
803
805
  } else if (is_last) {
@@ -920,34 +922,27 @@ jv jq_next(jq_state *jq, unsigned int timeout_sec) {
920
922
 
921
923
  case CALL_BUILTIN: {
922
924
  int nargs = *pc++;
923
- jv top = stack_pop(jq);
924
- jv* in = cfunc_input;
925
- in[0] = top;
926
- for (int i = 1; i < nargs; i++) {
927
- in[i] = stack_pop(jq);
928
- }
929
925
  struct cfunction* function = &frame_current(jq)->bc->globals->cfunctions[*pc++];
926
+ jv in[MAX_CFUNCTION_ARGS];
927
+ for (int i = 0; i < nargs; ++i)
928
+ in[i] = stack_pop(jq);
929
+
930
+ jv top;
930
931
  switch (function->nargs) {
931
- case 1: top = ((jv (*)(jq_state *, jv))function->fptr)(jq, in[0]); break;
932
- case 2: top = ((jv (*)(jq_state *, jv, jv))function->fptr)(jq, in[0], in[1]); break;
933
- case 3: top = ((jv (*)(jq_state *, jv, jv, jv))function->fptr)(jq, in[0], in[1], in[2]); break;
934
- case 4: top = ((jv (*)(jq_state *, jv, jv, jv, jv))function->fptr)(jq, in[0], in[1], in[2], in[3]); break;
935
- case 5: top = ((jv (*)(jq_state *, jv, jv, jv, jv, jv))function->fptr)(jq, in[0], in[1], in[2], in[3], in[4]); break;
936
- // FIXME: a) up to 7 arguments (input + 6), b) should assert
937
- // because the compiler should not generate this error.
938
- default: return jv_invalid_with_msg(jv_string("Function takes too many arguments"));
932
+ case 1: top = function->fptr.a1(jq, in[0]); break;
933
+ case 2: top = function->fptr.a2(jq, in[0], in[1]); break;
934
+ case 3: top = function->fptr.a3(jq, in[0], in[1], in[2]); break;
935
+ case 4: top = function->fptr.a4(jq, in[0], in[1], in[2], in[3]); break;
936
+ default: assert(0 && "Invalid number of arguments");
939
937
  }
940
938
 
941
- if (jv_is_valid(top)) {
942
- stack_push(jq, top);
943
- } else if (jv_invalid_has_msg(jv_copy(top))) {
944
- set_error(jq, top);
945
- goto do_backtrack;
946
- } else {
947
- // C-coded function returns invalid w/o msg? -> backtrack, as if
948
- // it had returned `empty`
939
+ if (!jv_is_valid(top)) {
940
+ if (jv_invalid_has_msg(jv_copy(top)))
941
+ set_error(jq, top);
949
942
  goto do_backtrack;
950
943
  }
944
+
945
+ stack_push(jq, top);
951
946
  break;
952
947
  }
953
948
 
@@ -8,10 +8,11 @@
8
8
  #include "jv.h"
9
9
  #include "jq.h"
10
10
 
11
- static void jv_test();
11
+ static void jv_test(void);
12
12
  static void run_jq_tests(jv, int, FILE *, int, int);
13
+ static void run_jq_start_state_tests(void);
13
14
  #ifdef HAVE_PTHREAD
14
- static void run_jq_pthread_tests();
15
+ static void run_jq_pthread_tests(void);
15
16
  #endif
16
17
 
17
18
  #define TIMEOUT_SEC 5
@@ -39,6 +40,7 @@ int jq_testsuite(jv libdirs, int verbose, int argc, char* argv[]) {
39
40
  }
40
41
  }
41
42
  run_jq_tests(libdirs, verbose, testdata, skip, take);
43
+ run_jq_start_state_tests();
42
44
  #ifdef HAVE_PTHREAD
43
45
  run_jq_pthread_tests();
44
46
  #endif
@@ -70,13 +72,11 @@ static void test_err_cb(void *data, jv e) {
70
72
  e = jv_dump_string(e, JV_PRINT_INVALID);
71
73
  if (!strncmp(jv_string_value(e), "jq: error", sizeof("jq: error") - 1))
72
74
  snprintf(err_data->buf, sizeof(err_data->buf), "%s", jv_string_value(e));
73
- if (strchr(err_data->buf, '\n'))
74
- *(strchr(err_data->buf, '\n')) = '\0';
75
75
  jv_free(e);
76
76
  }
77
77
 
78
78
  static void run_jq_tests(jv lib_dirs, int verbose, FILE *testdata, int skip, int take) {
79
- char prog[4096];
79
+ char prog[4096] = {0};
80
80
  char buf[4096];
81
81
  struct err_data err_msg;
82
82
  int tests = 0, passed = 0, invalid = 0;
@@ -108,18 +108,7 @@ static void run_jq_tests(jv lib_dirs, int verbose, FILE *testdata, int skip, int
108
108
 
109
109
  if (skip > 0) {
110
110
  skip--;
111
-
112
- // skip past test data
113
- while (fgets(buf, sizeof(buf), testdata)) {
114
- lineno++;
115
- if (buf[0] == '\n' || (buf[0] == '\r' && buf[1] == '\n'))
116
- break;
117
- }
118
-
119
- must_fail = 0;
120
- check_msg = 0;
121
-
122
- continue;
111
+ goto next;
123
112
  } else if (skip == 0) {
124
113
  printf("Skipped %d tests\n", tests_to_skip);
125
114
  skip = -1;
@@ -139,37 +128,40 @@ static void run_jq_tests(jv lib_dirs, int verbose, FILE *testdata, int skip, int
139
128
 
140
129
  if (must_fail) {
141
130
  jq_set_error_cb(jq, NULL, NULL);
142
- if (!fgets(buf, sizeof(buf), testdata)) { invalid++; break; }
143
- lineno++;
144
- if (buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = 0;
145
131
  if (compiled) {
146
- printf("*** Test program compiled that should not have at line %u: %s\n", lineno, prog);
147
- must_fail = 0;
148
- check_msg = 0;
149
- invalid++;
150
- continue;
132
+ printf("*** Test program compiled successfully, but should fail at line number %u: %s\n", lineno, prog);
133
+ goto fail;
151
134
  }
152
- if (check_msg && strcmp(buf, err_msg.buf) != 0) {
153
- printf("*** Erroneous test program failed with wrong message (%s) at line %u: %s\n", err_msg.buf, lineno, prog);
135
+ char *err_buf = err_msg.buf;
136
+ while (fgets(buf, sizeof(buf), testdata)) {
137
+ lineno++;
138
+ if (skipline(buf)) break;
139
+ if (check_msg) {
140
+ if (buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0';
141
+ if (strncmp(buf, err_buf, strlen(buf)) != 0) {
142
+ if (strchr(err_buf, '\n')) *strchr(err_buf, '\n') = '\0';
143
+ printf("*** Erroneous program failed with '%s', but expected '%s' at line number %u: %s\n", err_buf, buf, lineno, prog);
144
+ goto fail;
145
+ }
146
+ err_buf += strlen(buf);
147
+ if (*err_buf == '\n') err_buf++;
148
+ }
149
+ }
150
+ if (check_msg && *err_buf != '\0') {
151
+ if (strchr(err_buf, '\n')) *strchr(err_buf, '\n') = '\0';
152
+ printf("*** Erroneous program failed with extra message '%s' at line %u: %s\n", err_buf, lineno, prog);
154
153
  invalid++;
155
- } else {
156
- passed++;
154
+ pass = 0;
157
155
  }
158
156
  must_fail = 0;
159
157
  check_msg = 0;
158
+ passed += pass;
160
159
  continue;
161
160
  }
162
161
 
163
162
  if (!compiled) {
164
163
  printf("*** Test program failed to compile at line %u: %s\n", lineno, prog);
165
- invalid++;
166
- // skip past test data
167
- while (fgets(buf, sizeof(buf), testdata)) {
168
- lineno++;
169
- if (buf[0] == '\n' || (buf[0] == '\r' && buf[1] == '\n'))
170
- break;
171
- }
172
- continue;
164
+ goto fail;
173
165
  }
174
166
  if (verbose) {
175
167
  printf("Disassembly:\n");
@@ -181,8 +173,7 @@ static void run_jq_tests(jv lib_dirs, int verbose, FILE *testdata, int skip, int
181
173
  jv input = jv_parse(buf);
182
174
  if (!jv_is_valid(input)) {
183
175
  printf("*** Input is invalid on line %u: %s\n", lineno, buf);
184
- invalid++;
185
- continue;
176
+ goto fail;
186
177
  }
187
178
  jq_start(jq, input, verbose ? JQ_DEBUG_TRACE : 0);
188
179
 
@@ -192,8 +183,7 @@ static void run_jq_tests(jv lib_dirs, int verbose, FILE *testdata, int skip, int
192
183
  jv expected = jv_parse(buf);
193
184
  if (!jv_is_valid(expected)) {
194
185
  printf("*** Expected result is invalid on line %u: %s\n", lineno, buf);
195
- invalid++;
196
- continue;
186
+ goto fail;
197
187
  }
198
188
  jv actual = jq_next(jq, TIMEOUT_SEC);
199
189
  if (!jv_is_valid(actual)) {
@@ -210,11 +200,13 @@ static void run_jq_tests(jv lib_dirs, int verbose, FILE *testdata, int skip, int
210
200
  printf(" for test at line number %u: %s\n", lineno, prog);
211
201
  pass = 0;
212
202
  }
203
+ #ifdef USE_DECNUM
213
204
  jv as_string = jv_dump_string(jv_copy(expected), rand() & ~(JV_PRINT_COLOR|JV_PRINT_REFCOUNT));
214
205
  jv reparsed = jv_parse_sized(jv_string_value(as_string), jv_string_length_bytes(jv_copy(as_string)));
215
206
  assert(jv_equal(jv_copy(expected), jv_copy(reparsed)));
216
207
  jv_free(as_string);
217
208
  jv_free(reparsed);
209
+ #endif
218
210
  jv_free(expected);
219
211
  jv_free(actual);
220
212
  }
@@ -224,12 +216,25 @@ static void run_jq_tests(jv lib_dirs, int verbose, FILE *testdata, int skip, int
224
216
  printf("*** Superfluous result: ");
225
217
  jv_dump(extra, 0);
226
218
  printf(" for test at line number %u, %s\n", lineno, prog);
219
+ invalid++;
227
220
  pass = 0;
228
221
  } else {
229
222
  jv_free(extra);
230
223
  }
231
224
  }
232
- passed+=pass;
225
+ passed += pass;
226
+ continue;
227
+
228
+ fail:
229
+ invalid++;
230
+
231
+ next:
232
+ while (fgets(buf, sizeof(buf), testdata)) {
233
+ lineno++;
234
+ if (skipline(buf)) break;
235
+ }
236
+ must_fail = 0;
237
+ check_msg = 0;
233
238
  }
234
239
  jq_teardown(&jq);
235
240
 
@@ -251,6 +256,66 @@ static void run_jq_tests(jv lib_dirs, int verbose, FILE *testdata, int skip, int
251
256
  }
252
257
 
253
258
 
259
+ static int test_start_state(jq_state *jq, char *prog) {
260
+ int pass = 1;
261
+ jv message = jq_get_error_message(jq);
262
+ if (jv_is_valid(message)) {
263
+ printf("*** Expected error_message to be invalid after jq_start: %s\n", prog);
264
+ pass = 0;
265
+ }
266
+ jv_free(message);
267
+
268
+ jv exit_code = jq_get_exit_code(jq);
269
+ if (jv_is_valid(exit_code)) {
270
+ printf("*** Expected exit_code to be invalid after jq_start: %s\n", prog);
271
+ pass = 0;
272
+ }
273
+ jv_free(exit_code);
274
+
275
+ if (jq_halted(jq)) {
276
+ printf("*** Expected jq to not be halted after jq_start: %s\n", prog);
277
+ pass = 0;
278
+ }
279
+
280
+ return pass;
281
+ }
282
+
283
+ // Test jq_state is reset after subsequent calls to jq_start.
284
+ static void test_jq_start_resets_state(char *prog, const char *input) {
285
+ printf("Test jq_state: %s\n", prog);
286
+ jq_state *jq = jq_init();
287
+ assert(jq);
288
+
289
+ int compiled = jq_compile(jq, prog);
290
+ assert(compiled);
291
+
292
+ // First call to jq_start. Run until completion.
293
+ jv parsed_input = jv_parse(input);
294
+ assert(jv_is_valid(parsed_input));
295
+ jq_start(jq, parsed_input, 0);
296
+ assert(test_start_state(jq, prog));
297
+ while (1) {
298
+ jv result = jq_next(jq, TIMEOUT_SEC);
299
+ int valid = jv_is_valid(result);
300
+ jv_free(result);
301
+ if (!valid) { break; }
302
+ }
303
+
304
+ // Second call to jq_start.
305
+ jv parsed_input2 = jv_parse(input);
306
+ assert(jv_is_valid(parsed_input2));
307
+ jq_start(jq, parsed_input2, 0);
308
+ assert(test_start_state(jq, prog));
309
+
310
+ jq_teardown(&jq);
311
+ }
312
+
313
+ static void run_jq_start_state_tests(void) {
314
+ test_jq_start_resets_state(".[]", "[1,2,3]");
315
+ test_jq_start_resets_state(".[] | if .%2 == 0 then halt_error else . end", "[1,2,3]");
316
+ }
317
+
318
+
254
319
  /// pthread regression test
255
320
  #ifdef HAVE_PTHREAD
256
321
  #define NUMBER_OF_THREADS 3
@@ -303,7 +368,7 @@ static void *test_pthread_run(void *ptr) {
303
368
  return NULL;
304
369
  }
305
370
 
306
- static void run_jq_pthread_tests() {
371
+ static void run_jq_pthread_tests(void) {
307
372
  pthread_t threads[NUMBER_OF_THREADS];
308
373
  struct test_pthread_data data[NUMBER_OF_THREADS];
309
374
  int createerror;
@@ -320,7 +385,11 @@ static void run_jq_pthread_tests() {
320
385
 
321
386
  // wait for all threads
322
387
  for(a = 0; a < NUMBER_OF_THREADS; ++a) {
388
+ #ifdef __MVS__
389
+ if (threads[a].__ != 0) {
390
+ #else
323
391
  if (threads[a] != 0) {
392
+ #endif
324
393
  pthread_join(threads[a], NULL);
325
394
  }
326
395
  }
@@ -333,7 +402,7 @@ static void run_jq_pthread_tests() {
333
402
  #endif // HAVE_PTHREAD
334
403
 
335
404
 
336
- static void jv_test() {
405
+ static void jv_test(void) {
337
406
  /// JSON parser regression tests
338
407
  {
339
408
  jv v = jv_parse("{\"a':\"12\"}");