@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
@@ -0,0 +1,351 @@
1
+ #ifndef REGPARSE_H
2
+ #define REGPARSE_H
3
+ /**********************************************************************
4
+ regparse.h - Oniguruma (regular expression library)
5
+ **********************************************************************/
6
+ /*-
7
+ * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
8
+ * All rights reserved.
9
+ *
10
+ * Redistribution and use in source and binary forms, with or without
11
+ * modification, are permitted provided that the following conditions
12
+ * are met:
13
+ * 1. Redistributions of source code must retain the above copyright
14
+ * notice, this list of conditions and the following disclaimer.
15
+ * 2. Redistributions in binary form must reproduce the above copyright
16
+ * notice, this list of conditions and the following disclaimer in the
17
+ * documentation and/or other materials provided with the distribution.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29
+ * SUCH DAMAGE.
30
+ */
31
+
32
+ #include "regint.h"
33
+
34
+ /* node type */
35
+ #define NT_STR 0
36
+ #define NT_CCLASS 1
37
+ #define NT_CTYPE 2
38
+ #define NT_CANY 3
39
+ #define NT_BREF 4
40
+ #define NT_QTFR 5
41
+ #define NT_ENCLOSE 6
42
+ #define NT_ANCHOR 7
43
+ #define NT_LIST 8
44
+ #define NT_ALT 9
45
+ #define NT_CALL 10
46
+
47
+ /* node type bit */
48
+ #define NTYPE2BIT(type) (1<<(type))
49
+
50
+ #define BIT_NT_STR NTYPE2BIT(NT_STR)
51
+ #define BIT_NT_CCLASS NTYPE2BIT(NT_CCLASS)
52
+ #define BIT_NT_CTYPE NTYPE2BIT(NT_CTYPE)
53
+ #define BIT_NT_CANY NTYPE2BIT(NT_CANY)
54
+ #define BIT_NT_BREF NTYPE2BIT(NT_BREF)
55
+ #define BIT_NT_QTFR NTYPE2BIT(NT_QTFR)
56
+ #define BIT_NT_ENCLOSE NTYPE2BIT(NT_ENCLOSE)
57
+ #define BIT_NT_ANCHOR NTYPE2BIT(NT_ANCHOR)
58
+ #define BIT_NT_LIST NTYPE2BIT(NT_LIST)
59
+ #define BIT_NT_ALT NTYPE2BIT(NT_ALT)
60
+ #define BIT_NT_CALL NTYPE2BIT(NT_CALL)
61
+
62
+ #define IS_NODE_TYPE_SIMPLE(type) \
63
+ ((NTYPE2BIT(type) & (BIT_NT_STR | BIT_NT_CCLASS | BIT_NT_CTYPE |\
64
+ BIT_NT_CANY | BIT_NT_BREF)) != 0)
65
+
66
+ #define NTYPE(node) ((node)->u.base.type)
67
+ #define SET_NTYPE(node, ntype) (node)->u.base.type = (ntype)
68
+
69
+ #define NSTR(node) (&((node)->u.str))
70
+ #define NCCLASS(node) (&((node)->u.cclass))
71
+ #define NCTYPE(node) (&((node)->u.ctype))
72
+ #define NBREF(node) (&((node)->u.bref))
73
+ #define NQTFR(node) (&((node)->u.qtfr))
74
+ #define NENCLOSE(node) (&((node)->u.enclose))
75
+ #define NANCHOR(node) (&((node)->u.anchor))
76
+ #define NCONS(node) (&((node)->u.cons))
77
+ #define NCALL(node) (&((node)->u.call))
78
+
79
+ #define NCAR(node) (NCONS(node)->car)
80
+ #define NCDR(node) (NCONS(node)->cdr)
81
+
82
+
83
+
84
+ #define ANCHOR_ANYCHAR_STAR_MASK (ANCHOR_ANYCHAR_STAR | ANCHOR_ANYCHAR_STAR_ML)
85
+ #define ANCHOR_END_BUF_MASK (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF)
86
+
87
+ #define ENCLOSE_MEMORY (1<<0)
88
+ #define ENCLOSE_OPTION (1<<1)
89
+ #define ENCLOSE_STOP_BACKTRACK (1<<2)
90
+
91
+ #define NODE_STR_MARGIN 16
92
+ #define NODE_STR_BUF_SIZE 24 /* sizeof(CClassNode) - sizeof(int)*4 */
93
+ #define NODE_BACKREFS_SIZE 6
94
+
95
+ #define NSTR_RAW (1<<0) /* by backslashed number */
96
+ #define NSTR_AMBIG (1<<1)
97
+ #define NSTR_DONT_GET_OPT_INFO (1<<2)
98
+
99
+ #define NSTRING_LEN(node) ((node)->u.str.end - (node)->u.str.s)
100
+ #define NSTRING_SET_RAW(node) (node)->u.str.flag |= NSTR_RAW
101
+ #define NSTRING_CLEAR_RAW(node) (node)->u.str.flag &= ~NSTR_RAW
102
+ #define NSTRING_SET_AMBIG(node) (node)->u.str.flag |= NSTR_AMBIG
103
+ #define NSTRING_SET_DONT_GET_OPT_INFO(node) \
104
+ (node)->u.str.flag |= NSTR_DONT_GET_OPT_INFO
105
+ #define NSTRING_IS_RAW(node) (((node)->u.str.flag & NSTR_RAW) != 0)
106
+ #define NSTRING_IS_AMBIG(node) (((node)->u.str.flag & NSTR_AMBIG) != 0)
107
+ #define NSTRING_IS_DONT_GET_OPT_INFO(node) \
108
+ (((node)->u.str.flag & NSTR_DONT_GET_OPT_INFO) != 0)
109
+
110
+ #define BACKREFS_P(br) \
111
+ (IS_NOT_NULL((br)->back_dynamic) ? (br)->back_dynamic : (br)->back_static);
112
+
113
+ #define NQ_TARGET_ISNOT_EMPTY 0
114
+ #define NQ_TARGET_IS_EMPTY 1
115
+ #define NQ_TARGET_IS_EMPTY_MEM 2
116
+ #define NQ_TARGET_IS_EMPTY_REC 3
117
+
118
+ /* status bits */
119
+ #define NST_MIN_FIXED (1<<0)
120
+ #define NST_MAX_FIXED (1<<1)
121
+ #define NST_CLEN_FIXED (1<<2)
122
+ #define NST_MARK1 (1<<3)
123
+ #define NST_MARK2 (1<<4)
124
+ #define NST_MEM_BACKREFED (1<<5)
125
+ #define NST_STOP_BT_SIMPLE_REPEAT (1<<6)
126
+ #define NST_RECURSION (1<<7)
127
+ #define NST_CALLED (1<<8)
128
+ #define NST_ADDR_FIXED (1<<9)
129
+ #define NST_NAMED_GROUP (1<<10)
130
+ #define NST_NAME_REF (1<<11)
131
+ #define NST_IN_REPEAT (1<<12) /* STK_REPEAT is nested in stack. */
132
+ #define NST_NEST_LEVEL (1<<13)
133
+ #define NST_BY_NUMBER (1<<14) /* {n,m} */
134
+
135
+ #define SET_ENCLOSE_STATUS(node,f) (node)->u.enclose.state |= (f)
136
+ #define CLEAR_ENCLOSE_STATUS(node,f) (node)->u.enclose.state &= ~(f)
137
+
138
+ #define IS_ENCLOSE_CALLED(en) (((en)->state & NST_CALLED) != 0)
139
+ #define IS_ENCLOSE_ADDR_FIXED(en) (((en)->state & NST_ADDR_FIXED) != 0)
140
+ #define IS_ENCLOSE_RECURSION(en) (((en)->state & NST_RECURSION) != 0)
141
+ #define IS_ENCLOSE_MARK1(en) (((en)->state & NST_MARK1) != 0)
142
+ #define IS_ENCLOSE_MARK2(en) (((en)->state & NST_MARK2) != 0)
143
+ #define IS_ENCLOSE_MIN_FIXED(en) (((en)->state & NST_MIN_FIXED) != 0)
144
+ #define IS_ENCLOSE_MAX_FIXED(en) (((en)->state & NST_MAX_FIXED) != 0)
145
+ #define IS_ENCLOSE_CLEN_FIXED(en) (((en)->state & NST_CLEN_FIXED) != 0)
146
+ #define IS_ENCLOSE_STOP_BT_SIMPLE_REPEAT(en) \
147
+ (((en)->state & NST_STOP_BT_SIMPLE_REPEAT) != 0)
148
+ #define IS_ENCLOSE_NAMED_GROUP(en) (((en)->state & NST_NAMED_GROUP) != 0)
149
+
150
+ #define SET_CALL_RECURSION(node) (node)->u.call.state |= NST_RECURSION
151
+ #define IS_CALL_RECURSION(cn) (((cn)->state & NST_RECURSION) != 0)
152
+ #define IS_CALL_NAME_REF(cn) (((cn)->state & NST_NAME_REF) != 0)
153
+ #define IS_BACKREF_NAME_REF(bn) (((bn)->state & NST_NAME_REF) != 0)
154
+ #define IS_BACKREF_NEST_LEVEL(bn) (((bn)->state & NST_NEST_LEVEL) != 0)
155
+ #define IS_QUANTIFIER_IN_REPEAT(qn) (((qn)->state & NST_IN_REPEAT) != 0)
156
+ #define IS_QUANTIFIER_BY_NUMBER(qn) (((qn)->state & NST_BY_NUMBER) != 0)
157
+
158
+ #define CALLNODE_REFNUM_UNDEF -1
159
+
160
+ typedef struct {
161
+ NodeBase base;
162
+ UChar* s;
163
+ UChar* end;
164
+ unsigned int flag;
165
+ int capa; /* (allocated size - 1) or 0: use buf[] */
166
+ UChar buf[NODE_STR_BUF_SIZE];
167
+ } StrNode;
168
+
169
+ typedef struct {
170
+ NodeBase base;
171
+ int state;
172
+ struct _Node* target;
173
+ int lower;
174
+ int upper;
175
+ int greedy;
176
+ int target_empty_info;
177
+ struct _Node* head_exact;
178
+ struct _Node* next_head_exact;
179
+ int is_refered; /* include called node. don't eliminate even if {0} */
180
+ #ifdef USE_COMBINATION_EXPLOSION_CHECK
181
+ int comb_exp_check_num; /* 1,2,3...: check, 0: no check */
182
+ #endif
183
+ } QtfrNode;
184
+
185
+ typedef struct {
186
+ NodeBase base;
187
+ int state;
188
+ int type;
189
+ int regnum;
190
+ OnigOptionType option;
191
+ struct _Node* target;
192
+ AbsAddrType call_addr;
193
+ /* for multiple call reference */
194
+ OnigLen min_len; /* min length (byte) */
195
+ OnigLen max_len; /* max length (byte) */
196
+ int char_len; /* character length */
197
+ int opt_count; /* referenced count in optimize_node_left() */
198
+ } EncloseNode;
199
+
200
+ #ifdef USE_SUBEXP_CALL
201
+
202
+ typedef struct {
203
+ int offset;
204
+ struct _Node* target;
205
+ } UnsetAddr;
206
+
207
+ typedef struct {
208
+ int num;
209
+ int alloc;
210
+ UnsetAddr* us;
211
+ } UnsetAddrList;
212
+
213
+ typedef struct {
214
+ NodeBase base;
215
+ int state;
216
+ int group_num;
217
+ UChar* name;
218
+ UChar* name_end;
219
+ struct _Node* target; /* EncloseNode : ENCLOSE_MEMORY */
220
+ UnsetAddrList* unset_addr_list;
221
+ } CallNode;
222
+
223
+ #endif
224
+
225
+ typedef struct {
226
+ NodeBase base;
227
+ int state;
228
+ int back_num;
229
+ int back_static[NODE_BACKREFS_SIZE];
230
+ int* back_dynamic;
231
+ int nest_level;
232
+ } BRefNode;
233
+
234
+ typedef struct {
235
+ NodeBase base;
236
+ int type;
237
+ struct _Node* target;
238
+ int char_len;
239
+ } AnchorNode;
240
+
241
+ typedef struct {
242
+ NodeBase base;
243
+ struct _Node* car;
244
+ struct _Node* cdr;
245
+ } ConsAltNode;
246
+
247
+ typedef struct {
248
+ NodeBase base;
249
+ int ctype;
250
+ int not;
251
+ } CtypeNode;
252
+
253
+ typedef struct _Node {
254
+ union {
255
+ NodeBase base;
256
+ StrNode str;
257
+ CClassNode cclass;
258
+ QtfrNode qtfr;
259
+ EncloseNode enclose;
260
+ BRefNode bref;
261
+ AnchorNode anchor;
262
+ ConsAltNode cons;
263
+ CtypeNode ctype;
264
+ #ifdef USE_SUBEXP_CALL
265
+ CallNode call;
266
+ #endif
267
+ } u;
268
+ } Node;
269
+
270
+
271
+ #define NULL_NODE ((Node* )0)
272
+
273
+ #define SCANENV_MEMNODES_SIZE 8
274
+ #define SCANENV_MEM_NODES(senv) \
275
+ (IS_NOT_NULL((senv)->mem_nodes_dynamic) ? \
276
+ (senv)->mem_nodes_dynamic : (senv)->mem_nodes_static)
277
+
278
+ typedef struct {
279
+ OnigOptionType option;
280
+ OnigCaseFoldType case_fold_flag;
281
+ OnigEncoding enc;
282
+ OnigSyntaxType* syntax;
283
+ BitStatusType capture_history;
284
+ BitStatusType bt_mem_start;
285
+ BitStatusType bt_mem_end;
286
+ BitStatusType backrefed_mem;
287
+ UChar* pattern;
288
+ UChar* pattern_end;
289
+ UChar* error;
290
+ UChar* error_end;
291
+ regex_t* reg; /* for reg->names only */
292
+ int num_call;
293
+ #ifdef USE_SUBEXP_CALL
294
+ UnsetAddrList* unset_addr_list;
295
+ #endif
296
+ int num_mem;
297
+ #ifdef USE_NAMED_GROUP
298
+ int num_named;
299
+ #endif
300
+ int mem_alloc;
301
+ Node* mem_nodes_static[SCANENV_MEMNODES_SIZE];
302
+ Node** mem_nodes_dynamic;
303
+ #ifdef USE_COMBINATION_EXPLOSION_CHECK
304
+ int num_comb_exp_check;
305
+ int comb_exp_max_regnum;
306
+ int curr_max_regnum;
307
+ int has_recursion;
308
+ #endif
309
+ unsigned int parse_depth;
310
+ } ScanEnv;
311
+
312
+
313
+ #define IS_SYNTAX_OP(syn, opm) (((syn)->op & (opm)) != 0)
314
+ #define IS_SYNTAX_OP2(syn, opm) (((syn)->op2 & (opm)) != 0)
315
+ #define IS_SYNTAX_BV(syn, bvm) (((syn)->behavior & (bvm)) != 0)
316
+
317
+ #ifdef USE_NAMED_GROUP
318
+ typedef struct {
319
+ int new_val;
320
+ } GroupNumRemap;
321
+
322
+ extern int onig_renumber_name_table P_((regex_t* reg, GroupNumRemap* map));
323
+ #endif
324
+
325
+ extern int onig_strncmp P_((const UChar* s1, const UChar* s2, int n));
326
+ extern void onig_strcpy P_((UChar* dest, const UChar* src, const UChar* end));
327
+ extern void onig_scan_env_set_error_string P_((ScanEnv* env, int ecode, UChar* arg, UChar* arg_end));
328
+ extern int onig_scan_unsigned_number P_((UChar** src, const UChar* end, OnigEncoding enc));
329
+ extern void onig_reduce_nested_quantifier P_((Node* pnode, Node* cnode));
330
+ extern void onig_node_conv_to_str_node P_((Node* node, int raw));
331
+ extern int onig_node_str_cat P_((Node* node, const UChar* s, const UChar* end));
332
+ extern int onig_node_str_set P_((Node* node, const UChar* s, const UChar* end));
333
+ extern void onig_node_free P_((Node* node));
334
+ extern Node* onig_node_new_enclose P_((int type));
335
+ extern Node* onig_node_new_anchor P_((int type));
336
+ extern Node* onig_node_new_str P_((const UChar* s, const UChar* end));
337
+ extern Node* onig_node_new_list P_((Node* left, Node* right));
338
+ extern Node* onig_node_list_add P_((Node* list, Node* x));
339
+ extern Node* onig_node_new_alt P_((Node* left, Node* right));
340
+ extern void onig_node_str_clear P_((Node* node));
341
+ extern int onig_names_free P_((regex_t* reg));
342
+ extern int onig_parse_make_tree P_((Node** root, const UChar* pattern, const UChar* end, regex_t* reg, ScanEnv* env));
343
+ extern int onig_free_shared_cclass_table P_((void));
344
+
345
+ #ifdef ONIG_DEBUG
346
+ #ifdef USE_NAMED_GROUP
347
+ extern int onig_print_names(FILE*, regex_t*);
348
+ #endif
349
+ #endif
350
+
351
+ #endif /* REGPARSE_H */
@@ -0,0 +1,105 @@
1
+ /**********************************************************************
2
+ regposerr.c - Oniguruma (regular expression library)
3
+ **********************************************************************/
4
+ /*-
5
+ * Copyright (c) 2002-2007 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
6
+ * All rights reserved.
7
+ *
8
+ * Redistribution and use in source and binary forms, with or without
9
+ * modification, are permitted provided that the following conditions
10
+ * are met:
11
+ * 1. Redistributions of source code must retain the above copyright
12
+ * notice, this list of conditions and the following disclaimer.
13
+ * 2. Redistributions in binary form must reproduce the above copyright
14
+ * notice, this list of conditions and the following disclaimer in the
15
+ * documentation and/or other materials provided with the distribution.
16
+ *
17
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
+ * SUCH DAMAGE.
28
+ */
29
+
30
+ #include "config.h"
31
+ #include "onigposix.h"
32
+
33
+ #ifdef HAVE_STRING_H
34
+ # include <string.h>
35
+ #else
36
+ # include <strings.h>
37
+ #endif
38
+
39
+ #if defined(__GNUC__)
40
+ # define ARG_UNUSED __attribute__ ((unused))
41
+ #else
42
+ # define ARG_UNUSED
43
+ #endif
44
+
45
+ #if defined(_WIN32) && !defined(__GNUC__)
46
+ #define xsnprintf sprintf_s
47
+ #define xstrncpy(dest,src,size) strncpy_s(dest,size,src,_TRUNCATE)
48
+ #else
49
+ #define xsnprintf snprintf
50
+ #define xstrncpy strncpy
51
+ #endif
52
+
53
+ static char* ESTRING[] = {
54
+ NULL,
55
+ "failed to match", /* REG_NOMATCH */
56
+ "Invalid regular expression", /* REG_BADPAT */
57
+ "invalid collating element referenced", /* REG_ECOLLATE */
58
+ "invalid character class type referenced", /* REG_ECTYPE */
59
+ "bad backslash-escape sequence", /* REG_EESCAPE */
60
+ "invalid back reference number", /* REG_ESUBREG */
61
+ "imbalanced [ and ]", /* REG_EBRACK */
62
+ "imbalanced ( and )", /* REG_EPAREN */
63
+ "imbalanced { and }", /* REG_EBRACE */
64
+ "invalid repeat range {n,m}", /* REG_BADBR */
65
+ "invalid range", /* REG_ERANGE */
66
+ "Out of memory", /* REG_ESPACE */
67
+ "? * + not preceded by valid regular expression", /* REG_BADRPT */
68
+
69
+ /* Extended errors */
70
+ "internal error", /* REG_EONIG_INTERNAL */
71
+ "invalid wide char value", /* REG_EONIG_BADWC */
72
+ "invalid argument" /* REG_EONIG_BADARG */
73
+ };
74
+
75
+ #include <stdio.h>
76
+
77
+
78
+ extern size_t
79
+ regerror(int posix_ecode, const regex_t* reg ARG_UNUSED, char* buf,
80
+ size_t size)
81
+ {
82
+ char* s;
83
+ char tbuf[35];
84
+ size_t len;
85
+
86
+ if (posix_ecode > 0
87
+ && posix_ecode < (int )(sizeof(ESTRING) / sizeof(ESTRING[0]))) {
88
+ s = ESTRING[posix_ecode];
89
+ }
90
+ else if (posix_ecode == 0) {
91
+ s = "";
92
+ }
93
+ else {
94
+ xsnprintf(tbuf, sizeof(tbuf), "undefined error code (%d)", posix_ecode);
95
+ s = tbuf;
96
+ }
97
+
98
+ len = strlen(s) + 1; /* use strlen() because s is ascii encoding. */
99
+
100
+ if (buf != NULL && size > 0) {
101
+ xstrncpy(buf, s, size - 1);
102
+ buf[size - 1] = '\0';
103
+ }
104
+ return len;
105
+ }