@port-labs/jq-node-bindings 0.0.4 → 0.0.6

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 (286) hide show
  1. package/binding.gyp +3 -3
  2. package/configure +8 -6
  3. package/deps/jq/.travis.yml +184 -35
  4. package/deps/jq/AUTHORS +31 -30
  5. package/deps/jq/COPYING +2 -2
  6. package/deps/jq/KEYS +8 -0
  7. package/deps/jq/Makefile.am +85 -70
  8. package/deps/jq/NEWS +5 -4
  9. package/deps/jq/README.md +18 -9
  10. package/deps/jq/appveyor.yml +53 -0
  11. package/deps/jq/compile-ios.sh +5 -5
  12. package/deps/jq/config/m4/check-math-func.m4 +7 -2
  13. package/deps/jq/configure.ac +130 -68
  14. package/deps/jq/docs/Rakefile +14 -135
  15. package/deps/jq/docs/Rakefile.manual +49 -0
  16. package/deps/jq/docs/Rakefile.website +76 -0
  17. package/deps/jq/docs/content/2.download/default.yml +115 -39
  18. package/deps/jq/docs/content/3.manual/manual.yml +641 -231
  19. package/deps/jq/docs/content/3.manual/v1.3/manual.yml +130 -130
  20. package/deps/jq/docs/content/3.manual/v1.4/manual.yml +160 -160
  21. package/deps/jq/docs/content/3.manual/v1.5/manual.yml +2878 -0
  22. package/deps/jq/docs/content/3.manual/v1.6/manual.yml +3287 -0
  23. package/deps/jq/docs/content/index/index.yml +28 -6
  24. package/deps/jq/docs/public/.htaccess +2 -2
  25. package/deps/jq/docs/public/css/base.scss +141 -59
  26. package/deps/jq/docs/public/js/manual-search.js +52 -0
  27. package/deps/jq/docs/site.yml +1 -10
  28. package/deps/jq/docs/templates/default.liquid +10 -10
  29. package/deps/jq/docs/templates/index.liquid +45 -32
  30. package/deps/jq/docs/templates/manual.liquid +67 -90
  31. package/deps/jq/docs/templates/shared/_footer.liquid +10 -5
  32. package/deps/jq/docs/templates/shared/_head.liquid +17 -12
  33. package/deps/jq/docs/templates/shared/_navbar.liquid +27 -0
  34. package/deps/jq/jq.1.prebuilt +523 -139
  35. package/deps/jq/modules/oniguruma/AUTHORS +1 -0
  36. package/deps/jq/modules/oniguruma/CMakeLists.txt +86 -0
  37. package/deps/jq/modules/oniguruma/COPYING +28 -0
  38. package/deps/jq/modules/oniguruma/ChangeLog +0 -0
  39. package/deps/jq/modules/oniguruma/HISTORY +2138 -0
  40. package/deps/jq/modules/oniguruma/Makefile.am +33 -0
  41. package/deps/jq/modules/oniguruma/NEWS +0 -0
  42. package/deps/jq/modules/oniguruma/README +189 -0
  43. package/deps/jq/modules/oniguruma/README.ja +195 -0
  44. package/deps/jq/modules/oniguruma/README.md +203 -0
  45. package/deps/jq/modules/oniguruma/cmake/dist.cmake +321 -0
  46. package/deps/jq/modules/oniguruma/compile +348 -0
  47. package/deps/jq/modules/oniguruma/config.guess +1754 -0
  48. package/deps/jq/modules/oniguruma/config.sub +1890 -0
  49. package/deps/jq/modules/oniguruma/configure.ac +87 -0
  50. package/deps/jq/modules/oniguruma/contributed/libfuzzer-onig.cpp +31 -0
  51. package/deps/jq/modules/oniguruma/depcomp +791 -0
  52. package/deps/jq/modules/oniguruma/dist.info +10 -0
  53. package/deps/jq/modules/oniguruma/doc/API +660 -0
  54. package/deps/jq/modules/oniguruma/doc/API.ja +667 -0
  55. package/deps/jq/modules/oniguruma/doc/FAQ +12 -0
  56. package/deps/jq/modules/oniguruma/doc/FAQ.ja +22 -0
  57. package/deps/jq/modules/oniguruma/doc/RE +436 -0
  58. package/deps/jq/modules/oniguruma/doc/RE.ja +448 -0
  59. package/deps/jq/modules/oniguruma/doc/UNICODE_PROPERTIES +698 -0
  60. package/deps/jq/modules/oniguruma/index.html +181 -0
  61. package/deps/jq/modules/oniguruma/index_ja.html +184 -0
  62. package/deps/jq/modules/oniguruma/install-sh +541 -0
  63. package/deps/jq/modules/oniguruma/m4/.whatever +0 -0
  64. package/deps/jq/modules/oniguruma/make_win32.bat +3 -0
  65. package/deps/jq/modules/oniguruma/make_win64.bat +3 -0
  66. package/deps/jq/modules/oniguruma/missing +215 -0
  67. package/deps/jq/modules/oniguruma/onig-config.in +78 -0
  68. package/deps/jq/modules/oniguruma/oniguruma.pc.cmake.in +13 -0
  69. package/deps/jq/modules/oniguruma/oniguruma.pc.in +14 -0
  70. package/deps/jq/modules/oniguruma/sample/CMakeLists.txt +28 -0
  71. package/deps/jq/modules/oniguruma/sample/Makefile.am +34 -0
  72. package/deps/jq/modules/oniguruma/sample/bug_fix.c +131 -0
  73. package/deps/jq/modules/oniguruma/sample/crnl.c +127 -0
  74. package/deps/jq/modules/oniguruma/sample/encode.c +308 -0
  75. package/deps/jq/modules/oniguruma/sample/listcap.c +110 -0
  76. package/deps/jq/modules/oniguruma/sample/names.c +75 -0
  77. package/deps/jq/modules/oniguruma/sample/posix.c +96 -0
  78. package/deps/jq/modules/oniguruma/sample/scan.c +88 -0
  79. package/deps/jq/modules/oniguruma/sample/simple.c +59 -0
  80. package/deps/jq/modules/oniguruma/sample/sql.c +76 -0
  81. package/deps/jq/modules/oniguruma/sample/syntax.c +76 -0
  82. package/deps/jq/modules/oniguruma/sample/user_property.c +87 -0
  83. package/deps/jq/modules/oniguruma/src/Makefile.am +58 -0
  84. package/deps/jq/modules/oniguruma/src/Makefile.windows +183 -0
  85. package/deps/jq/modules/oniguruma/src/ascii.c +61 -0
  86. package/deps/jq/modules/oniguruma/src/big5.c +190 -0
  87. package/deps/jq/modules/oniguruma/src/config.h.cmake.in +71 -0
  88. package/deps/jq/modules/oniguruma/src/config.h.win32 +84 -0
  89. package/deps/jq/modules/oniguruma/src/config.h.win64 +84 -0
  90. package/deps/jq/modules/oniguruma/src/cp1251.c +203 -0
  91. package/deps/jq/modules/oniguruma/src/euc_jp.c +310 -0
  92. package/deps/jq/modules/oniguruma/src/euc_jp_prop.c +158 -0
  93. package/deps/jq/modules/oniguruma/src/euc_jp_prop.gperf +27 -0
  94. package/deps/jq/modules/oniguruma/src/euc_kr.c +188 -0
  95. package/deps/jq/modules/oniguruma/src/euc_tw.c +171 -0
  96. package/deps/jq/modules/oniguruma/src/gb18030.c +538 -0
  97. package/deps/jq/modules/oniguruma/src/gperf_fold_key_conv.py +67 -0
  98. package/deps/jq/modules/oniguruma/src/gperf_unfold_key_conv.py +55 -0
  99. package/deps/jq/modules/oniguruma/src/iso8859_1.c +275 -0
  100. package/deps/jq/modules/oniguruma/src/iso8859_10.c +242 -0
  101. package/deps/jq/modules/oniguruma/src/iso8859_11.c +99 -0
  102. package/deps/jq/modules/oniguruma/src/iso8859_13.c +231 -0
  103. package/deps/jq/modules/oniguruma/src/iso8859_14.c +244 -0
  104. package/deps/jq/modules/oniguruma/src/iso8859_15.c +238 -0
  105. package/deps/jq/modules/oniguruma/src/iso8859_16.c +240 -0
  106. package/deps/jq/modules/oniguruma/src/iso8859_2.c +238 -0
  107. package/deps/jq/modules/oniguruma/src/iso8859_3.c +238 -0
  108. package/deps/jq/modules/oniguruma/src/iso8859_4.c +240 -0
  109. package/deps/jq/modules/oniguruma/src/iso8859_5.c +229 -0
  110. package/deps/jq/modules/oniguruma/src/iso8859_6.c +99 -0
  111. package/deps/jq/modules/oniguruma/src/iso8859_7.c +225 -0
  112. package/deps/jq/modules/oniguruma/src/iso8859_8.c +99 -0
  113. package/deps/jq/modules/oniguruma/src/iso8859_9.c +231 -0
  114. package/deps/jq/modules/oniguruma/src/koi8.c +253 -0
  115. package/deps/jq/modules/oniguruma/src/koi8_r.c +215 -0
  116. package/deps/jq/modules/oniguruma/src/make_unicode_fold.sh +22 -0
  117. package/deps/jq/modules/oniguruma/src/make_unicode_fold_data.py +306 -0
  118. package/deps/jq/modules/oniguruma/src/make_unicode_property.sh +18 -0
  119. package/deps/jq/modules/oniguruma/src/make_unicode_property_data.py +545 -0
  120. package/deps/jq/modules/oniguruma/src/mktable.c +1184 -0
  121. package/deps/jq/modules/oniguruma/src/onig_init.c +45 -0
  122. package/deps/jq/modules/oniguruma/src/oniggnu.h +85 -0
  123. package/deps/jq/modules/oniguruma/src/onigposix.h +169 -0
  124. package/deps/jq/modules/oniguruma/src/oniguruma.h +841 -0
  125. package/deps/jq/modules/oniguruma/src/regcomp.c +6300 -0
  126. package/deps/jq/modules/oniguruma/src/regenc.c +917 -0
  127. package/deps/jq/modules/oniguruma/src/regenc.h +243 -0
  128. package/deps/jq/modules/oniguruma/src/regerror.c +393 -0
  129. package/deps/jq/modules/oniguruma/src/regexec.c +3856 -0
  130. package/deps/jq/modules/oniguruma/src/regext.c +202 -0
  131. package/deps/jq/modules/oniguruma/src/reggnu.c +147 -0
  132. package/deps/jq/modules/oniguruma/src/regint.h +779 -0
  133. package/deps/jq/modules/oniguruma/src/regparse.c +5403 -0
  134. package/deps/jq/modules/oniguruma/src/regparse.h +351 -0
  135. package/deps/jq/modules/oniguruma/src/regposerr.c +105 -0
  136. package/deps/jq/modules/oniguruma/src/regposix.c +306 -0
  137. package/deps/jq/modules/oniguruma/src/regsyntax.c +315 -0
  138. package/deps/jq/modules/oniguruma/src/regtrav.c +76 -0
  139. package/deps/jq/modules/oniguruma/src/regversion.c +57 -0
  140. package/deps/jq/modules/oniguruma/src/sjis.c +341 -0
  141. package/deps/jq/modules/oniguruma/src/sjis_prop.c +158 -0
  142. package/deps/jq/modules/oniguruma/src/sjis_prop.gperf +27 -0
  143. package/deps/jq/modules/oniguruma/src/st.c +589 -0
  144. package/deps/jq/modules/oniguruma/src/st.h +68 -0
  145. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold1_key.c +2250 -0
  146. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold2_key.c +203 -0
  147. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold3_key.c +113 -0
  148. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold_data.c +1225 -0
  149. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_property_data.c +24742 -0
  150. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_property_data_posix.c +4846 -0
  151. package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_unfold_key.c +2571 -0
  152. package/deps/jq/modules/oniguruma/src/unicode.c +664 -0
  153. package/deps/jq/modules/oniguruma/src/unicode_fold1_key.c +2548 -0
  154. package/deps/jq/modules/oniguruma/src/unicode_fold2_key.c +203 -0
  155. package/deps/jq/modules/oniguruma/src/unicode_fold3_key.c +113 -0
  156. package/deps/jq/modules/oniguruma/src/unicode_fold_data.c +1366 -0
  157. package/deps/jq/modules/oniguruma/src/unicode_property_data.c +25306 -0
  158. package/deps/jq/modules/oniguruma/src/unicode_property_data_posix.c +4940 -0
  159. package/deps/jq/modules/oniguruma/src/unicode_unfold_key.c +2854 -0
  160. package/deps/jq/modules/oniguruma/src/utf16_be.c +235 -0
  161. package/deps/jq/modules/oniguruma/src/utf16_le.c +245 -0
  162. package/deps/jq/modules/oniguruma/src/utf32_be.c +194 -0
  163. package/deps/jq/modules/oniguruma/src/utf32_le.c +194 -0
  164. package/deps/jq/modules/oniguruma/src/utf8.c +335 -0
  165. package/deps/jq/modules/oniguruma/test/Makefile.am +28 -0
  166. package/deps/jq/modules/oniguruma/test/testc.c +874 -0
  167. package/deps/jq/modules/oniguruma/test/testu.c +916 -0
  168. package/deps/jq/modules/oniguruma/test-driver +153 -0
  169. package/deps/jq/modules/oniguruma/windows/testc.c +869 -0
  170. package/deps/jq/scripts/crosscompile +2 -1
  171. package/deps/jq/scripts/gen_utf8_tables.py +2 -3
  172. package/deps/jq/scripts/update-website +29 -0
  173. package/deps/jq/scripts/version +7 -2
  174. package/deps/jq/sig/jq-release.key +41 -0
  175. package/deps/jq/sig/v1.3/jq-linux-x86.asc +17 -0
  176. package/deps/jq/sig/v1.3/jq-linux-x86_64.asc +17 -0
  177. package/deps/jq/sig/v1.3/jq-osx-x86.asc +17 -0
  178. package/deps/jq/sig/v1.3/jq-osx-x86_64.asc +17 -0
  179. package/deps/jq/sig/v1.3/jq-win32.exe.asc +17 -0
  180. package/deps/jq/sig/v1.3/jq-win64.exe.asc +17 -0
  181. package/deps/jq/sig/v1.3/sha256sum.txt +6 -0
  182. package/deps/jq/sig/v1.4/jq-linux-x86.asc +17 -0
  183. package/deps/jq/sig/v1.4/jq-linux-x86_64.asc +17 -0
  184. package/deps/jq/sig/v1.4/jq-osx-x86.asc +17 -0
  185. package/deps/jq/sig/v1.4/jq-osx-x86_64.asc +17 -0
  186. package/deps/jq/sig/v1.4/jq-solaris11-32.asc +17 -0
  187. package/deps/jq/sig/v1.4/jq-solaris11-64.asc +17 -0
  188. package/deps/jq/sig/v1.4/jq-win32.exe.asc +17 -0
  189. package/deps/jq/sig/v1.4/jq-win64.exe.asc +17 -0
  190. package/deps/jq/sig/v1.4/sha256sum.txt +8 -0
  191. package/deps/jq/sig/v1.5/jq-linux32-no-oniguruma.asc +17 -0
  192. package/deps/jq/sig/v1.5/jq-linux32.asc +17 -0
  193. package/deps/jq/sig/v1.5/jq-linux64.asc +17 -0
  194. package/deps/jq/sig/v1.5/jq-osx-amd64.asc +17 -0
  195. package/deps/jq/sig/v1.5/jq-win32.exe.asc +17 -0
  196. package/deps/jq/sig/v1.5/jq-win64.exe.asc +17 -0
  197. package/deps/jq/sig/v1.5/sha256sum.txt +5 -0
  198. package/deps/jq/sig/v1.5rc1/jq-linux-x86_64-static.asc +17 -0
  199. package/deps/jq/sig/v1.5rc1/jq-win32.exe.asc +17 -0
  200. package/deps/jq/sig/v1.5rc1/jq-win64.exe.asc +17 -0
  201. package/deps/jq/sig/v1.5rc1/sha256sum.txt +3 -0
  202. package/deps/jq/sig/v1.5rc2/jq-linux-x86.asc +17 -0
  203. package/deps/jq/sig/v1.5rc2/jq-linux-x86_64.asc +17 -0
  204. package/deps/jq/sig/v1.5rc2/jq-osx-x86_64.asc +17 -0
  205. package/deps/jq/sig/v1.5rc2/jq-win32.exe.asc +17 -0
  206. package/deps/jq/sig/v1.5rc2/jq-win64.exe.asc +17 -0
  207. package/deps/jq/sig/v1.5rc2/sha256sum.txt +5 -0
  208. package/deps/jq/sig/v1.6/jq-linux32.asc +16 -0
  209. package/deps/jq/sig/v1.6/jq-linux64.asc +16 -0
  210. package/deps/jq/sig/v1.6/jq-osx-amd64.asc +16 -0
  211. package/deps/jq/sig/v1.6/jq-win32.exe.asc +16 -0
  212. package/deps/jq/sig/v1.6/jq-win64.exe.asc +16 -0
  213. package/deps/jq/sig/v1.6/sha256sum.txt +5 -0
  214. package/deps/jq/{builtin.c → src/builtin.c} +449 -344
  215. package/deps/jq/{builtin.h → src/builtin.h} +0 -0
  216. package/deps/jq/src/builtin.jq +311 -0
  217. package/deps/jq/{bytecode.c → src/bytecode.c} +0 -0
  218. package/deps/jq/{bytecode.h → src/bytecode.h} +0 -0
  219. package/deps/jq/{compile.c → src/compile.c} +213 -37
  220. package/deps/jq/{compile.h → src/compile.h} +7 -2
  221. package/deps/jq/{exec_stack.h → src/exec_stack.h} +0 -0
  222. package/deps/jq/{execute.c → src/execute.c} +127 -24
  223. package/deps/jq/{inject_errors.c → src/inject_errors.c} +0 -0
  224. package/deps/jq/{jq.h → src/jq.h} +13 -2
  225. package/deps/jq/{jq_parser.h → src/jq_parser.h} +0 -0
  226. package/deps/jq/{jq_test.c → src/jq_test.c} +1 -1
  227. package/deps/jq/{jv.c → src/jv.c} +24 -5
  228. package/deps/jq/{jv.h → src/jv.h} +46 -11
  229. package/deps/jq/{jv_alloc.c → src/jv_alloc.c} +0 -0
  230. package/deps/jq/{jv_alloc.h → src/jv_alloc.h} +0 -0
  231. package/deps/jq/{jv_aux.c → src/jv_aux.c} +38 -14
  232. package/deps/jq/{jv_dtoa.c → src/jv_dtoa.c} +4 -5
  233. package/deps/jq/{jv_dtoa.h → src/jv_dtoa.h} +0 -0
  234. package/deps/jq/src/jv_file.c +81 -0
  235. package/deps/jq/{jv_parse.c → src/jv_parse.c} +8 -2
  236. package/deps/jq/{jv_print.c → src/jv_print.c} +80 -27
  237. package/deps/jq/{jv_unicode.c → src/jv_unicode.c} +28 -4
  238. package/deps/jq/{jv_unicode.h → src/jv_unicode.h} +1 -0
  239. package/deps/jq/{jv_utf8_tables.h → src/jv_utf8_tables.h} +0 -0
  240. package/deps/jq/{lexer.c → src/lexer.c} +317 -292
  241. package/deps/jq/{lexer.h → src/lexer.h} +16 -12
  242. package/deps/jq/{lexer.l → src/lexer.l} +5 -4
  243. package/deps/jq/src/libm.h +291 -0
  244. package/deps/jq/{linker.c → src/linker.c} +5 -3
  245. package/deps/jq/{linker.h → src/linker.h} +0 -0
  246. package/deps/jq/{locfile.c → src/locfile.c} +1 -1
  247. package/deps/jq/{locfile.h → src/locfile.h} +0 -0
  248. package/deps/jq/{main.c → src/main.c} +202 -100
  249. package/deps/jq/{opcode_list.h → src/opcode_list.h} +4 -0
  250. package/deps/jq/{parser.c → src/parser.c} +1149 -1069
  251. package/deps/jq/{parser.h → src/parser.h} +28 -24
  252. package/deps/jq/{parser.y → src/parser.y} +108 -52
  253. package/deps/jq/{util.c → src/util.c} +12 -9
  254. package/deps/jq/{util.h → src/util.h} +0 -0
  255. package/deps/jq/tests/base64.test +35 -0
  256. package/deps/jq/tests/base64test +5 -0
  257. package/deps/jq/tests/jq-f-test.sh +4 -0
  258. package/deps/jq/tests/jq.test +305 -21
  259. package/deps/jq/tests/jqtest +1 -1
  260. package/deps/jq/tests/mantest +1 -1
  261. package/deps/jq/tests/onig.test +13 -0
  262. package/deps/jq/tests/onigtest +1 -1
  263. package/deps/jq/tests/optional.test +20 -0
  264. package/deps/jq/tests/optionaltest +5 -0
  265. package/deps/jq/tests/setup +7 -1
  266. package/deps/jq/tests/shtest +133 -29
  267. package/deps/jq/tests/utf8-truncate.jq +3 -0
  268. package/deps/jq/tests/utf8test +10 -0
  269. package/lib/index.js +7 -1
  270. package/package.json +3 -3
  271. package/test/santiy.test.js +24 -0
  272. package/deps/jq/docs/default_manpage.md +0 -22
  273. package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.css +0 -1058
  274. package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.min.css +0 -9
  275. package/deps/jq/docs/public/bootstrap/css/bootstrap.css +0 -5224
  276. package/deps/jq/docs/public/bootstrap/css/bootstrap.min.css +0 -9
  277. package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings-white.png +0 -0
  278. package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings.png +0 -0
  279. package/deps/jq/docs/public/bootstrap/js/bootstrap.js +0 -2027
  280. package/deps/jq/docs/public/bootstrap/js/bootstrap.min.js +0 -6
  281. package/deps/jq/docs/templates/shared/_header.liquid +0 -26
  282. package/deps/jq/jq.1.default +0 -39
  283. package/deps/jq/jv_file.c +0 -49
  284. package/deps/jq/libm.h +0 -160
  285. package/deps/jq/setup.sh +0 -33
  286. package/reports/jest-port-api.xml +0 -35
@@ -1,8 +1,8 @@
1
- /* A Bison parser, made by GNU Bison 3.0.2. */
1
+ /* A Bison parser, made by GNU Bison 3.0.4. */
2
2
 
3
3
  /* Bison interface for Yacc-like parsers in C
4
4
 
5
- Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
5
+ Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
6
6
 
7
7
  This program is free software: you can redistribute it and/or modify
8
8
  it under the terms of the GNU General Public License as published by
@@ -30,8 +30,8 @@
30
30
  This special exception was added by the Free Software Foundation in
31
31
  version 2.2 of Bison. */
32
32
 
33
- #ifndef YY_YY_PARSER_H_INCLUDED
34
- # define YY_YY_PARSER_H_INCLUDED
33
+ #ifndef YY_YY_SRC_PARSER_H_INCLUDED
34
+ # define YY_YY_SRC_PARSER_H_INCLUDED
35
35
  /* Debug traces. */
36
36
  #ifndef YYDEBUG
37
37
  # define YYDEBUG 0
@@ -40,7 +40,7 @@
40
40
  extern int yydebug;
41
41
  #endif
42
42
  /* "%code requires" blocks. */
43
- #line 11 "parser.y" /* yacc.c:1909 */
43
+ #line 11 "src/parser.y" /* yacc.c:1909 */
44
44
 
45
45
  #include "locfile.h"
46
46
  struct lexer_param;
@@ -57,7 +57,7 @@ struct lexer_param;
57
57
  } \
58
58
  } while (0)
59
59
 
60
- #line 61 "parser.h" /* yacc.c:1909 */
60
+ #line 61 "src/parser.h" /* yacc.c:1909 */
61
61
 
62
62
  /* Token type. */
63
63
  #ifndef YYTOKENTYPE
@@ -101,13 +101,14 @@ struct lexer_param;
101
101
  SETDEFINEDOR = 292,
102
102
  LESSEQ = 293,
103
103
  GREATEREQ = 294,
104
- QQSTRING_START = 295,
105
- QQSTRING_TEXT = 296,
106
- QQSTRING_INTERP_START = 297,
107
- QQSTRING_INTERP_END = 298,
108
- QQSTRING_END = 299,
109
- FUNCDEF = 300,
110
- NONOPT = 301
104
+ ALTERNATION = 295,
105
+ QQSTRING_START = 296,
106
+ QQSTRING_TEXT = 297,
107
+ QQSTRING_INTERP_START = 298,
108
+ QQSTRING_INTERP_END = 299,
109
+ QQSTRING_END = 300,
110
+ FUNCDEF = 301,
111
+ NONOPT = 302
111
112
  };
112
113
  #endif
113
114
  /* Tokens. */
@@ -148,26 +149,29 @@ struct lexer_param;
148
149
  #define SETDEFINEDOR 292
149
150
  #define LESSEQ 293
150
151
  #define GREATEREQ 294
151
- #define QQSTRING_START 295
152
- #define QQSTRING_TEXT 296
153
- #define QQSTRING_INTERP_START 297
154
- #define QQSTRING_INTERP_END 298
155
- #define QQSTRING_END 299
156
- #define FUNCDEF 300
157
- #define NONOPT 301
152
+ #define ALTERNATION 295
153
+ #define QQSTRING_START 296
154
+ #define QQSTRING_TEXT 297
155
+ #define QQSTRING_INTERP_START 298
156
+ #define QQSTRING_INTERP_END 299
157
+ #define QQSTRING_END 300
158
+ #define FUNCDEF 301
159
+ #define NONOPT 302
158
160
 
159
161
  /* Value type. */
160
162
  #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
161
- typedef union YYSTYPE YYSTYPE;
163
+
162
164
  union YYSTYPE
163
165
  {
164
- #line 31 "parser.y" /* yacc.c:1909 */
166
+ #line 31 "src/parser.y" /* yacc.c:1909 */
165
167
 
166
168
  jv literal;
167
169
  block blk;
168
170
 
169
- #line 170 "parser.h" /* yacc.c:1909 */
171
+ #line 172 "src/parser.h" /* yacc.c:1909 */
170
172
  };
173
+
174
+ typedef union YYSTYPE YYSTYPE;
171
175
  # define YYSTYPE_IS_TRIVIAL 1
172
176
  # define YYSTYPE_IS_DECLARED 1
173
177
  #endif
@@ -190,4 +194,4 @@ struct YYLTYPE
190
194
 
191
195
  int yyparse (block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr);
192
196
 
193
- #endif /* !YY_YY_PARSER_H_INCLUDED */
197
+ #endif /* !YY_YY_SRC_PARSER_H_INCLUDED */
@@ -83,6 +83,7 @@ struct lexer_param;
83
83
  %token SETDEFINEDOR "//="
84
84
  %token LESSEQ "<="
85
85
  %token GREATEREQ ">="
86
+ %token ALTERNATION "?//"
86
87
 
87
88
  %token QQSTRING_START
88
89
  %token <literal> QQSTRING_TEXT
@@ -111,9 +112,14 @@ struct lexer_param;
111
112
  %precedence "catch"
112
113
 
113
114
 
114
- %type <blk> Exp Term MkDict MkDictPair ExpD ElseBody QQString
115
- %type <blk> FuncDef FuncDefs String Import Imports Param Params
116
- %type <blk> Arg Args Module Pattern ArrayPats ObjPats ObjPat
115
+ %type <blk> Exp Term
116
+ %type <blk> MkDict MkDictPair ExpD
117
+ %type <blk> ElseBody
118
+ %type <blk> String QQString
119
+ %type <blk> FuncDef FuncDefs
120
+ %type <blk> Module Import Imports ImportWhat ImportFrom
121
+ %type <blk> Param Params Arg Args
122
+ %type <blk> Patterns RepPatterns Pattern ArrayPats ObjPats ObjPat
117
123
  %type <literal> Keyword
118
124
  %{
119
125
  #include "lexer.h"
@@ -159,8 +165,16 @@ int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, block* answer, int* errors,
159
165
  return tok;
160
166
  }
161
167
 
162
- static block gen_dictpair(block k, block v) {
163
- return BLOCK(gen_subexp(k), gen_subexp(v), gen_op_simple(INSERT));
168
+ /* Returns string message if the block is a constant that is not valid as an
169
+ * object key. */
170
+ static jv check_object_key(block k) {
171
+ if (block_is_const(k) && block_const_kind(k) != JV_KIND_STRING) {
172
+ char errbuf[15];
173
+ return jv_string_fmt("Cannot use %s (%s) as object key",
174
+ jv_kind_name(block_const_kind(k)),
175
+ jv_dump_string_trunc(jv_copy(block_const(k)), errbuf, sizeof(errbuf)));
176
+ }
177
+ return jv_invalid();
164
178
  }
165
179
 
166
180
  static block gen_index(block obj, block key) {
@@ -186,6 +200,16 @@ static block constant_fold(block a, block b, int op) {
186
200
  if (!block_is_single(a) || !block_is_const(a) ||
187
201
  !block_is_single(b) || !block_is_const(b))
188
202
  return gen_noop();
203
+ if (op == '+') {
204
+ if (block_const_kind(a) == JV_KIND_NULL) {
205
+ block_free(a);
206
+ return b;
207
+ }
208
+ if (block_const_kind(b) == JV_KIND_NULL) {
209
+ block_free(b);
210
+ return a;
211
+ }
212
+ }
189
213
  if (block_const_kind(a) != block_const_kind(b))
190
214
  return gen_noop();
191
215
 
@@ -246,7 +270,7 @@ static block gen_binop(block a, block b, int op) {
246
270
  }
247
271
 
248
272
  static block gen_format(block a, jv fmt) {
249
- return BLOCK(a, gen_call("format", BLOCK(gen_lambda(gen_const(fmt)))));
273
+ return BLOCK(a, gen_call("format", gen_lambda(gen_const(fmt))));
250
274
  }
251
275
 
252
276
  static block gen_definedor_assign(block object, block val) {
@@ -286,8 +310,9 @@ Module:
286
310
  } |
287
311
  "module" Exp ';' {
288
312
  if (!block_is_const($2)) {
289
- FAIL(@$, "Module metadata must be constant.");
313
+ FAIL(@$, "Module metadata must be constant");
290
314
  $$ = gen_noop();
315
+ block_free($2);
291
316
  } else {
292
317
  $$ = gen_module($2);
293
318
  }
@@ -314,19 +339,18 @@ FuncDef Exp %prec FUNCDEF {
314
339
  $$ = block_bind_referenced($1, $2, OP_IS_CALL_PSEUDO);
315
340
  } |
316
341
 
317
- Term "as" Pattern '|' Exp {
342
+ Term "as" Patterns '|' Exp {
318
343
  $$ = gen_destructure($1, $3, $5);
319
344
  } |
320
-
321
- "reduce" Term "as" Pattern '(' Exp ';' Exp ')' {
345
+ "reduce" Term "as" Patterns '(' Exp ';' Exp ')' {
322
346
  $$ = gen_reduce($2, $4, $6, $8);
323
347
  } |
324
348
 
325
- "foreach" Term "as" Pattern '(' Exp ';' Exp ';' Exp ')' {
349
+ "foreach" Term "as" Patterns '(' Exp ';' Exp ';' Exp ')' {
326
350
  $$ = gen_foreach($2, $4, $6, $8, $10);
327
351
  } |
328
352
 
329
- "foreach" Term "as" Pattern '(' Exp ';' Exp ')' {
353
+ "foreach" Term "as" Patterns '(' Exp ';' Exp ')' {
330
354
  $$ = gen_foreach($2, $4, $6, $8, gen_noop());
331
355
  } |
332
356
 
@@ -471,62 +495,58 @@ Term {
471
495
  }
472
496
 
473
497
  Import:
474
- "import" String "as" '$' IDENT ';' {
498
+ ImportWhat ';' {
499
+ $$ = $1;
500
+ } |
501
+ ImportWhat Exp ';' {
502
+ if (!block_is_const($2)) {
503
+ FAIL(@$, "Module metadata must be constant");
504
+ $$ = gen_noop();
505
+ block_free($1);
506
+ block_free($2);
507
+ } else if (block_const_kind($2) != JV_KIND_OBJECT) {
508
+ FAIL(@$, "Module metadata must be an object");
509
+ $$ = gen_noop();
510
+ block_free($1);
511
+ block_free($2);
512
+ } else {
513
+ $$ = gen_import_meta($1, $2);
514
+ }
515
+ }
516
+
517
+ ImportWhat:
518
+ "import" ImportFrom "as" '$' IDENT {
475
519
  jv v = block_const($2);
476
520
  // XXX Make gen_import take only blocks and the int is_data so we
477
521
  // don't have to free so much stuff here
478
- $$ = gen_import(jv_string_value(v), gen_noop(), jv_string_value($5), 1);
522
+ $$ = gen_import(jv_string_value(v), jv_string_value($5), 1);
479
523
  block_free($2);
480
524
  jv_free($5);
481
525
  jv_free(v);
482
526
  } |
483
- "import" String "as" IDENT ';' {
527
+ "import" ImportFrom "as" IDENT {
484
528
  jv v = block_const($2);
485
- $$ = gen_import(jv_string_value(v), gen_noop(), jv_string_value($4), 0);
529
+ $$ = gen_import(jv_string_value(v), jv_string_value($4), 0);
486
530
  block_free($2);
487
531
  jv_free($4);
488
532
  jv_free(v);
489
533
  } |
490
- "include" String ';' {
534
+ "include" ImportFrom {
491
535
  jv v = block_const($2);
492
- $$ = gen_import(jv_string_value(v), gen_noop(), NULL, 0);
536
+ $$ = gen_import(jv_string_value(v), NULL, 0);
493
537
  block_free($2);
494
538
  jv_free(v);
495
- } |
496
- "import" String "as" IDENT Exp ';' {
497
- if (!block_is_const($5)) {
498
- FAIL(@$, "Module metadata must be constant.");
499
- $$ = gen_noop();
500
- } else {
501
- jv v = block_const($2);
502
- $$ = gen_import(jv_string_value(v), $5, jv_string_value($4), 0);
503
- jv_free(v);
504
- }
505
- block_free($2);
506
- jv_free($4);
507
- } |
508
- "include" String Exp ';' {
509
- if (!block_is_const($3)) {
510
- FAIL(@$, "Module metadata must be constant.");
511
- $$ = gen_noop();
512
- } else {
513
- jv v = block_const($2);
514
- $$ = gen_import(jv_string_value(v), $3, NULL, 0);
515
- jv_free(v);
516
- }
517
- block_free($2);
518
- } |
519
- "import" String "as" '$' IDENT Exp ';' {
520
- if (!block_is_const($6)) {
521
- FAIL(@$, "Module metadata must be constant.");
522
- $$ = gen_noop();
539
+ }
540
+
541
+ ImportFrom:
542
+ String {
543
+ if (!block_is_const($1)) {
544
+ FAIL(@$, "Import path must be constant");
545
+ $$ = gen_const(jv_string(""));
546
+ block_free($1);
523
547
  } else {
524
- jv v = block_const($2);
525
- $$ = gen_import(jv_string_value(v), $6, jv_string_value($5), 1);
526
- jv_free(v);
548
+ $$ = $1;
527
549
  }
528
- block_free($2);
529
- jv_free($5);
530
550
  }
531
551
 
532
552
  FuncDef:
@@ -754,6 +774,22 @@ Exp {
754
774
  $$ = gen_lambda($1);
755
775
  }
756
776
 
777
+ RepPatterns:
778
+ RepPatterns "?//" Pattern {
779
+ $$ = BLOCK($1, gen_destructure_alt($3));
780
+ } |
781
+ Pattern {
782
+ $$ = gen_destructure_alt($1);
783
+ }
784
+
785
+ Patterns:
786
+ RepPatterns "?//" Pattern {
787
+ $$ = BLOCK($1, $3);
788
+ } |
789
+ Pattern {
790
+ $$ = $1;
791
+ }
792
+
757
793
  Pattern:
758
794
  '$' IDENT {
759
795
  $$ = gen_op_unbound(STOREV, jv_string_value($2));
@@ -786,6 +822,9 @@ ObjPat:
786
822
  '$' IDENT {
787
823
  $$ = gen_object_matcher(gen_const($2), gen_op_unbound(STOREV, jv_string_value($2)));
788
824
  } |
825
+ '$' IDENT ':' Pattern {
826
+ $$ = gen_object_matcher(gen_const($2), BLOCK(gen_op_simple(DUP), gen_op_unbound(STOREV, jv_string_value($2)), $4));
827
+ } |
789
828
  IDENT ':' Pattern {
790
829
  $$ = gen_object_matcher(gen_const($1), $3);
791
830
  } |
@@ -796,7 +835,16 @@ String ':' Pattern {
796
835
  $$ = gen_object_matcher($1, $3);
797
836
  } |
798
837
  '(' Exp ')' ':' Pattern {
838
+ jv msg = check_object_key($2);
839
+ if (jv_is_valid(msg)) {
840
+ FAIL(@$, jv_string_value(msg));
841
+ }
842
+ jv_free(msg);
799
843
  $$ = gen_object_matcher($2, $5);
844
+ } |
845
+ error ':' Pattern {
846
+ FAIL(@$, "May need parentheses around object key expression");
847
+ $$ = $3;
800
848
  }
801
849
 
802
850
  Keyword:
@@ -889,9 +937,17 @@ IDENT ':' ExpD {
889
937
  gen_index(gen_noop(), gen_const($1)));
890
938
  }
891
939
  | '(' Exp ')' ':' ExpD {
940
+ jv msg = check_object_key($2);
941
+ if (jv_is_valid(msg)) {
942
+ FAIL(@$, jv_string_value(msg));
943
+ }
944
+ jv_free(msg);
892
945
  $$ = gen_dictpair($2, $5);
893
946
  }
894
- | '(' error ')' ':' ExpD { $$ = $5; }
947
+ | error ':' ExpD {
948
+ FAIL(@$, "May need parentheses around object key expression");
949
+ $$ = $3;
950
+ }
895
951
  %%
896
952
 
897
953
  int jq_parse(struct locfile* locations, block* answer) {
@@ -47,12 +47,12 @@ void *alloca (size_t);
47
47
 
48
48
  #ifdef WIN32
49
49
  FILE *fopen(const char *fname, const char *mode) {
50
- size_t sz = MultiByteToWideChar(CP_UTF8, 0, fname, -1, NULL, 0);
51
- wchar_t *wfname = alloca(sz);
50
+ size_t sz = sizeof(wchar_t) * MultiByteToWideChar(CP_UTF8, 0, fname, -1, NULL, 0);
51
+ wchar_t *wfname = alloca(sz + 2); // +2 is not needed, but just in case
52
52
  MultiByteToWideChar(CP_UTF8, 0, fname, -1, wfname, sz);
53
53
 
54
- sz = MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0);
55
- wchar_t *wmode = alloca(sz);
54
+ sz = sizeof(wchar_t) * MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0);
55
+ wchar_t *wmode = alloca(sz + 2); // +2 is not needed, but just in case
56
56
  MultiByteToWideChar(CP_UTF8, 0, mode, -1, wmode, sz);
57
57
  return _wfopen(wfname, wmode);
58
58
  }
@@ -139,7 +139,7 @@ jv jq_realpath(jv path) {
139
139
  path_max = PATH_MAX;
140
140
  #endif
141
141
  if (path_max > 0) {
142
- buf = malloc(sizeof(char) * path_max);
142
+ buf = jv_mem_alloc(path_max);
143
143
  }
144
144
  #ifdef WIN32
145
145
  char *tmp = _fullpath(buf, jv_string_value(path), path_max);
@@ -410,6 +410,7 @@ jv jq_util_input_get_current_line(jq_state* jq) {
410
410
  // When slurping, it returns just one value
411
411
  jv jq_util_input_next_input(jq_util_input_state *state) {
412
412
  int is_last = 0;
413
+ int has_more = 0;
413
414
  jv value = jv_invalid(); // need more input
414
415
  do {
415
416
  if (state->parser == NULL) {
@@ -435,14 +436,16 @@ jv jq_util_input_next_input(jq_util_input_state *state) {
435
436
  } else {
436
437
  if (jv_parser_remaining(state->parser) == 0) {
437
438
  is_last = jq_util_input_read_more(state);
438
- if (is_last && state->buf_valid_len == 0) {
439
+ if (is_last && state->buf_valid_len == 0)
439
440
  value = jv_invalid();
440
- break;
441
- }
442
441
  jv_parser_set_buf(state->parser, state->buf, state->buf_valid_len, !is_last);
443
442
  }
444
443
  value = jv_parser_next(state->parser);
445
444
  if (jv_is_valid(state->slurped)) {
445
+ // When slurping an input that doesn't have a trailing newline,
446
+ // we might have more than one value on the same line, so let's check
447
+ // to see if we have more data to parse.
448
+ has_more = jv_parser_remaining(state->parser);
446
449
  if (jv_is_valid(value)) {
447
450
  state->slurped = jv_array_append(state->slurped, value);
448
451
  value = jv_invalid();
@@ -452,7 +455,7 @@ jv jq_util_input_next_input(jq_util_input_state *state) {
452
455
  return value;
453
456
  }
454
457
  }
455
- } while (!is_last);
458
+ } while (!is_last || has_more);
456
459
 
457
460
  if (jv_is_valid(state->slurped)) {
458
461
  value = state->slurped;
File without changes
@@ -0,0 +1,35 @@
1
+ # Tests are groups of three lines: program, input, expected output
2
+ # Blank lines and lines starting with # are ignored
3
+
4
+ @base64
5
+ "<>&'\"\t"
6
+ "PD4mJyIJ"
7
+
8
+ # decoding encoded output results in same text
9
+ (@base64|@base64d)
10
+ "<>&'\"\t"
11
+ "<>&'\"\t"
12
+
13
+ # regression test for #436
14
+ @base64
15
+ "foóbar\n"
16
+ "Zm/Ds2Jhcgo="
17
+
18
+ @base64d
19
+ "Zm/Ds2Jhcgo="
20
+ "foóbar\n"
21
+
22
+ # optional trailing equals padding (With padding, this is cWl4YmF6Cg==)
23
+ @base64d
24
+ "cWl4YmF6Cg"
25
+ "qixbaz\n"
26
+
27
+ # invalid base64 characters (whitespace)
28
+ . | try @base64d catch .
29
+ "Not base64 data"
30
+ "string (\"Not base64...) is not valid base64 data"
31
+
32
+ # invalid base64 (too many bytes, QUJD = "ABCD"
33
+ . | try @base64d catch .
34
+ "QUJDa"
35
+ "string (\"QUJDa\") trailing base64 byte found"
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ . "${0%/*}/setup" "$@"
4
+
5
+ $VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/base64.test
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ # this next line is ignored by jq, which otherwise does not continue comments \
3
+ exec jq -nef "$0" "$@"
4
+ true