@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,779 @@
1
+ #ifndef REGINT_H
2
+ #define REGINT_H
3
+ /**********************************************************************
4
+ regint.h - Oniguruma (regular expression library)
5
+ **********************************************************************/
6
+ /*-
7
+ * Copyright (c) 2002-2013 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
+ /* for debug */
33
+ /* #define ONIG_DEBUG_PARSE_TREE */
34
+ /* #define ONIG_DEBUG_COMPILE */
35
+ /* #define ONIG_DEBUG_SEARCH */
36
+ /* #define ONIG_DEBUG_MATCH */
37
+ /* #define ONIG_DONT_OPTIMIZE */
38
+
39
+ /* for byte-code statistical data. */
40
+ /* #define ONIG_DEBUG_STATISTICS */
41
+
42
+ #if defined(ONIG_DEBUG_PARSE_TREE) || defined(ONIG_DEBUG_MATCH) || \
43
+ defined(ONIG_DEBUG_SEARCH) || defined(ONIG_DEBUG_COMPILE) || \
44
+ defined(ONIG_DEBUG_STATISTICS)
45
+ #ifndef ONIG_DEBUG
46
+ #define ONIG_DEBUG
47
+ #endif
48
+ #endif
49
+
50
+ #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
51
+ (defined(__ppc__) && defined(__APPLE__)) || \
52
+ defined(__x86_64) || defined(__x86_64__) || \
53
+ defined(__mc68020__)
54
+ #define PLATFORM_UNALIGNED_WORD_ACCESS
55
+ #endif
56
+
57
+ /* config */
58
+ /* spec. config */
59
+ #define USE_NAMED_GROUP
60
+ #define USE_SUBEXP_CALL
61
+ #define USE_BACKREF_WITH_LEVEL /* \k<name+n>, \k<name-n> */
62
+ #define USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT /* /(?:()|())*\2/ */
63
+ #define USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE /* /\n$/ =~ "\n" */
64
+ #define USE_WARNING_REDUNDANT_NESTED_REPEAT_OPERATOR
65
+ /* !!! moved to regenc.h. */ /* #define USE_CRNL_AS_LINE_TERMINATOR */
66
+
67
+ /* internal config */
68
+ #define USE_OP_PUSH_OR_JUMP_EXACT
69
+ #define USE_QTFR_PEEK_NEXT
70
+ #define USE_ST_LIBRARY
71
+
72
+ #define INIT_MATCH_STACK_SIZE 160
73
+ #define DEFAULT_MATCH_STACK_LIMIT_SIZE 0 /* unlimited */
74
+ #define DEFAULT_PARSE_DEPTH_LIMIT 4096
75
+
76
+ #if defined(__GNUC__)
77
+ # define ARG_UNUSED __attribute__ ((unused))
78
+ #else
79
+ # define ARG_UNUSED
80
+ #endif
81
+
82
+ /* */
83
+ /* escape other system UChar definition */
84
+ #include "config.h"
85
+ #ifdef ONIG_ESCAPE_UCHAR_COLLISION
86
+ #undef ONIG_ESCAPE_UCHAR_COLLISION
87
+ #endif
88
+
89
+ #define USE_WORD_BEGIN_END /* "\<", "\>" */
90
+ #define USE_CAPTURE_HISTORY
91
+ #define USE_VARIABLE_META_CHARS
92
+ #define USE_POSIX_API_REGION_OPTION
93
+ #define USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
94
+ /* #define USE_COMBINATION_EXPLOSION_CHECK */ /* (X*)* */
95
+
96
+ #define xmalloc malloc
97
+ #define xrealloc realloc
98
+ #define xcalloc calloc
99
+ #define xfree free
100
+
101
+ #define CHECK_INTERRUPT_IN_MATCH_AT
102
+
103
+ #define st_init_table onig_st_init_table
104
+ #define st_init_table_with_size onig_st_init_table_with_size
105
+ #define st_init_numtable onig_st_init_numtable
106
+ #define st_init_numtable_with_size onig_st_init_numtable_with_size
107
+ #define st_init_strtable onig_st_init_strtable
108
+ #define st_init_strtable_with_size onig_st_init_strtable_with_size
109
+ #define st_delete onig_st_delete
110
+ #define st_delete_safe onig_st_delete_safe
111
+ #define st_insert onig_st_insert
112
+ #define st_lookup onig_st_lookup
113
+ #define st_foreach onig_st_foreach
114
+ #define st_add_direct onig_st_add_direct
115
+ #define st_free_table onig_st_free_table
116
+ #define st_cleanup_safe onig_st_cleanup_safe
117
+ #define st_copy onig_st_copy
118
+ #define st_nothing_key_clone onig_st_nothing_key_clone
119
+ #define st_nothing_key_free onig_st_nothing_key_free
120
+ /* */
121
+ #define onig_st_is_member st_is_member
122
+
123
+ #define STATE_CHECK_STRING_THRESHOLD_LEN 7
124
+ #define STATE_CHECK_BUFF_MAX_SIZE 0x4000
125
+
126
+ #define xmemset memset
127
+ #define xmemcpy memcpy
128
+ #define xmemmove memmove
129
+
130
+ #if defined(_WIN32) && !defined(__GNUC__)
131
+ #define xalloca _alloca
132
+ #define xvsnprintf(buf,size,fmt,args) _vsnprintf_s(buf,size,_TRUNCATE,fmt,args)
133
+ #define xsnprintf sprintf_s
134
+ #define xstrcat(dest,src,size) strcat_s(dest,size,src)
135
+ #else
136
+ #define xalloca alloca
137
+ #define xvsnprintf vsnprintf
138
+ #define xsnprintf snprintf
139
+ #define xstrcat(dest,src,size) strcat(dest,src)
140
+ #endif
141
+
142
+
143
+ #ifdef HAVE_STDLIB_H
144
+ #include <stdlib.h>
145
+ #endif
146
+
147
+ #if defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
148
+ #include <alloca.h>
149
+ #endif
150
+
151
+ #ifdef HAVE_STRING_H
152
+ # include <string.h>
153
+ #else
154
+ # include <strings.h>
155
+ #endif
156
+
157
+ #include <ctype.h>
158
+ #ifdef HAVE_SYS_TYPES_H
159
+ #ifndef __BORLANDC__
160
+ #include <sys/types.h>
161
+ #endif
162
+ #endif
163
+
164
+ #ifdef __BORLANDC__
165
+ #include <malloc.h>
166
+ #endif
167
+
168
+ #ifdef ONIG_DEBUG
169
+ # include <stdio.h>
170
+ #endif
171
+
172
+ #include "regenc.h"
173
+
174
+ #ifdef MIN
175
+ #undef MIN
176
+ #endif
177
+ #ifdef MAX
178
+ #undef MAX
179
+ #endif
180
+ #define MIN(a,b) (((a)>(b))?(b):(a))
181
+ #define MAX(a,b) (((a)<(b))?(b):(a))
182
+
183
+ #define IS_NULL(p) (((void*)(p)) == (void*)0)
184
+ #define IS_NOT_NULL(p) (((void*)(p)) != (void*)0)
185
+ #define CHECK_NULL_RETURN(p) if (IS_NULL(p)) return NULL
186
+ #define CHECK_NULL_RETURN_MEMERR(p) if (IS_NULL(p)) return ONIGERR_MEMORY
187
+ #define NULL_UCHARP ((UChar* )0)
188
+
189
+ #ifdef PLATFORM_UNALIGNED_WORD_ACCESS
190
+
191
+ #define PLATFORM_GET_INC(val,p,type) do{\
192
+ val = *(type* )p;\
193
+ (p) += sizeof(type);\
194
+ } while(0)
195
+
196
+ #else
197
+
198
+ #define PLATFORM_GET_INC(val,p,type) do{\
199
+ xmemcpy(&val, (p), sizeof(type));\
200
+ (p) += sizeof(type);\
201
+ } while(0)
202
+
203
+ /* sizeof(OnigCodePoint) */
204
+ #define WORD_ALIGNMENT_SIZE SIZEOF_LONG
205
+
206
+ #define GET_ALIGNMENT_PAD_SIZE(addr,pad_size) do {\
207
+ (pad_size) = WORD_ALIGNMENT_SIZE \
208
+ - ((unsigned int )(addr) % WORD_ALIGNMENT_SIZE);\
209
+ if ((pad_size) == WORD_ALIGNMENT_SIZE) (pad_size) = 0;\
210
+ } while (0)
211
+
212
+ #define ALIGNMENT_RIGHT(addr) do {\
213
+ (addr) += (WORD_ALIGNMENT_SIZE - 1);\
214
+ (addr) -= ((unsigned int )(addr) % WORD_ALIGNMENT_SIZE);\
215
+ } while (0)
216
+
217
+ #endif /* PLATFORM_UNALIGNED_WORD_ACCESS */
218
+
219
+ /* stack pop level */
220
+ #define STACK_POP_LEVEL_FREE 0
221
+ #define STACK_POP_LEVEL_MEM_START 1
222
+ #define STACK_POP_LEVEL_ALL 2
223
+
224
+ /* optimize flags */
225
+ #define ONIG_OPTIMIZE_NONE 0
226
+ #define ONIG_OPTIMIZE_EXACT 1 /* Slow Search */
227
+ #define ONIG_OPTIMIZE_EXACT_BM 2 /* Boyer Moore Search */
228
+ #define ONIG_OPTIMIZE_EXACT_BM_NOT_REV 3 /* BM (but not simple match) */
229
+ #define ONIG_OPTIMIZE_EXACT_IC 4 /* Slow Search (ignore case) */
230
+ #define ONIG_OPTIMIZE_MAP 5 /* char map */
231
+
232
+ /* bit status */
233
+ typedef unsigned int BitStatusType;
234
+
235
+ #define BIT_STATUS_BITS_NUM (sizeof(BitStatusType) * 8)
236
+ #define BIT_STATUS_CLEAR(stats) (stats) = 0
237
+ #define BIT_STATUS_ON_ALL(stats) (stats) = ~((BitStatusType )0)
238
+ #define BIT_STATUS_AT(stats,n) \
239
+ ((n) < (int )BIT_STATUS_BITS_NUM ? ((stats) & (1 << n)) : ((stats) & 1))
240
+
241
+ #define BIT_STATUS_ON_AT(stats,n) do {\
242
+ if ((n) < (int )BIT_STATUS_BITS_NUM) \
243
+ (stats) |= (1 << (n));\
244
+ else\
245
+ (stats) |= 1;\
246
+ } while (0)
247
+
248
+ #define BIT_STATUS_ON_AT_SIMPLE(stats,n) do {\
249
+ if ((n) < (int )BIT_STATUS_BITS_NUM)\
250
+ (stats) |= (1 << (n));\
251
+ } while (0)
252
+
253
+
254
+ #define INT_MAX_LIMIT ((1UL << (SIZEOF_INT * 8 - 1)) - 1)
255
+
256
+ #define DIGITVAL(code) ((code) - '0')
257
+ #define ODIGITVAL(code) DIGITVAL(code)
258
+ #define XDIGITVAL(enc,code) \
259
+ (ONIGENC_IS_CODE_DIGIT(enc,code) ? DIGITVAL(code) \
260
+ : (ONIGENC_IS_CODE_UPPER(enc,code) ? (code) - 'A' + 10 : (code) - 'a' + 10))
261
+
262
+ #define IS_SINGLELINE(option) ((option) & ONIG_OPTION_SINGLELINE)
263
+ #define IS_MULTILINE(option) ((option) & ONIG_OPTION_MULTILINE)
264
+ #define IS_IGNORECASE(option) ((option) & ONIG_OPTION_IGNORECASE)
265
+ #define IS_EXTEND(option) ((option) & ONIG_OPTION_EXTEND)
266
+ #define IS_FIND_LONGEST(option) ((option) & ONIG_OPTION_FIND_LONGEST)
267
+ #define IS_FIND_NOT_EMPTY(option) ((option) & ONIG_OPTION_FIND_NOT_EMPTY)
268
+ #define IS_FIND_CONDITION(option) ((option) & \
269
+ (ONIG_OPTION_FIND_LONGEST | ONIG_OPTION_FIND_NOT_EMPTY))
270
+ #define IS_NOTBOL(option) ((option) & ONIG_OPTION_NOTBOL)
271
+ #define IS_NOTEOL(option) ((option) & ONIG_OPTION_NOTEOL)
272
+ #define IS_POSIX_REGION(option) ((option) & ONIG_OPTION_POSIX_REGION)
273
+
274
+ /* OP_SET_OPTION is required for these options.
275
+ #define IS_DYNAMIC_OPTION(option) \
276
+ (((option) & (ONIG_OPTION_MULTILINE | ONIG_OPTION_IGNORECASE)) != 0)
277
+ */
278
+ /* ignore-case and multibyte status are included in compiled code. */
279
+ #define IS_DYNAMIC_OPTION(option) 0
280
+
281
+ #define DISABLE_CASE_FOLD_MULTI_CHAR(case_fold_flag) \
282
+ ((case_fold_flag) & ~INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR)
283
+
284
+ #define REPEAT_INFINITE -1
285
+ #define IS_REPEAT_INFINITE(n) ((n) == REPEAT_INFINITE)
286
+
287
+ /* bitset */
288
+ #define BITS_PER_BYTE 8
289
+ #define SINGLE_BYTE_SIZE (1 << BITS_PER_BYTE)
290
+ #define BITS_IN_ROOM (sizeof(Bits) * BITS_PER_BYTE)
291
+ #define BITSET_SIZE (SINGLE_BYTE_SIZE / BITS_IN_ROOM)
292
+
293
+ #ifdef PLATFORM_UNALIGNED_WORD_ACCESS
294
+ typedef unsigned int Bits;
295
+ #else
296
+ typedef unsigned char Bits;
297
+ #endif
298
+ typedef Bits BitSet[BITSET_SIZE];
299
+ typedef Bits* BitSetRef;
300
+
301
+ #define SIZE_BITSET sizeof(BitSet)
302
+
303
+ #define BITSET_CLEAR(bs) do {\
304
+ int i;\
305
+ for (i = 0; i < (int )BITSET_SIZE; i++) { (bs)[i] = 0; } \
306
+ } while (0)
307
+
308
+ #define BS_ROOM(bs,pos) (bs)[pos / BITS_IN_ROOM]
309
+ #define BS_BIT(pos) (1 << (pos % BITS_IN_ROOM))
310
+
311
+ #define BITSET_AT(bs, pos) (BS_ROOM(bs,pos) & BS_BIT(pos))
312
+ #define BITSET_SET_BIT(bs, pos) BS_ROOM(bs,pos) |= BS_BIT(pos)
313
+ #define BITSET_CLEAR_BIT(bs, pos) BS_ROOM(bs,pos) &= ~(BS_BIT(pos))
314
+ #define BITSET_INVERT_BIT(bs, pos) BS_ROOM(bs,pos) ^= BS_BIT(pos)
315
+
316
+ /* bytes buffer */
317
+ typedef struct _BBuf {
318
+ UChar* p;
319
+ unsigned int used;
320
+ unsigned int alloc;
321
+ } BBuf;
322
+
323
+ #define BBUF_INIT(buf,size) onig_bbuf_init((BBuf* )(buf), (size))
324
+
325
+ #define BBUF_SIZE_INC(buf,inc) do{\
326
+ (buf)->alloc += (inc);\
327
+ (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
328
+ if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
329
+ } while (0)
330
+
331
+ #define BBUF_EXPAND(buf,low) do{\
332
+ do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
333
+ (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
334
+ if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
335
+ } while (0)
336
+
337
+ #define BBUF_ENSURE_SIZE(buf,size) do{\
338
+ unsigned int new_alloc = (buf)->alloc;\
339
+ while (new_alloc < (unsigned int )(size)) { new_alloc *= 2; }\
340
+ if ((buf)->alloc != new_alloc) {\
341
+ (buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\
342
+ if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
343
+ (buf)->alloc = new_alloc;\
344
+ }\
345
+ } while (0)
346
+
347
+ #define BBUF_WRITE(buf,pos,bytes,n) do{\
348
+ int used = (pos) + (n);\
349
+ if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
350
+ xmemcpy((buf)->p + (pos), (bytes), (n));\
351
+ if ((buf)->used < (unsigned int )used) (buf)->used = used;\
352
+ } while (0)
353
+
354
+ #define BBUF_WRITE1(buf,pos,byte) do{\
355
+ int used = (pos) + 1;\
356
+ if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
357
+ (buf)->p[(pos)] = (byte);\
358
+ if ((buf)->used < (unsigned int )used) (buf)->used = used;\
359
+ } while (0)
360
+
361
+ #define BBUF_ADD(buf,bytes,n) BBUF_WRITE((buf),(buf)->used,(bytes),(n))
362
+ #define BBUF_ADD1(buf,byte) BBUF_WRITE1((buf),(buf)->used,(byte))
363
+ #define BBUF_GET_ADD_ADDRESS(buf) ((buf)->p + (buf)->used)
364
+ #define BBUF_GET_OFFSET_POS(buf) ((buf)->used)
365
+
366
+ /* from < to */
367
+ #define BBUF_MOVE_RIGHT(buf,from,to,n) do {\
368
+ if ((unsigned int )((to)+(n)) > (buf)->alloc) BBUF_EXPAND((buf),(to) + (n));\
369
+ xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
370
+ if ((unsigned int )((to)+(n)) > (buf)->used) (buf)->used = (to) + (n);\
371
+ } while (0)
372
+
373
+ /* from > to */
374
+ #define BBUF_MOVE_LEFT(buf,from,to,n) do {\
375
+ xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
376
+ } while (0)
377
+
378
+ /* from > to */
379
+ #define BBUF_MOVE_LEFT_REDUCE(buf,from,to) do {\
380
+ xmemmove((buf)->p + (to), (buf)->p + (from), (buf)->used - (from));\
381
+ (buf)->used -= (from - to);\
382
+ } while (0)
383
+
384
+ #define BBUF_INSERT(buf,pos,bytes,n) do {\
385
+ if (pos >= (buf)->used) {\
386
+ BBUF_WRITE(buf,pos,bytes,n);\
387
+ }\
388
+ else {\
389
+ BBUF_MOVE_RIGHT((buf),(pos),(pos) + (n),((buf)->used - (pos)));\
390
+ xmemcpy((buf)->p + (pos), (bytes), (n));\
391
+ }\
392
+ } while (0)
393
+
394
+ #define BBUF_GET_BYTE(buf, pos) (buf)->p[(pos)]
395
+
396
+
397
+ #define ANCHOR_BEGIN_BUF (1<<0)
398
+ #define ANCHOR_BEGIN_LINE (1<<1)
399
+ #define ANCHOR_BEGIN_POSITION (1<<2)
400
+ #define ANCHOR_END_BUF (1<<3)
401
+ #define ANCHOR_SEMI_END_BUF (1<<4)
402
+ #define ANCHOR_END_LINE (1<<5)
403
+
404
+ #define ANCHOR_WORD_BOUND (1<<6)
405
+ #define ANCHOR_NOT_WORD_BOUND (1<<7)
406
+ #define ANCHOR_WORD_BEGIN (1<<8)
407
+ #define ANCHOR_WORD_END (1<<9)
408
+ #define ANCHOR_PREC_READ (1<<10)
409
+ #define ANCHOR_PREC_READ_NOT (1<<11)
410
+ #define ANCHOR_LOOK_BEHIND (1<<12)
411
+ #define ANCHOR_LOOK_BEHIND_NOT (1<<13)
412
+
413
+ #define ANCHOR_ANYCHAR_STAR (1<<14) /* ".*" optimize info */
414
+ #define ANCHOR_ANYCHAR_STAR_ML (1<<15) /* ".*" optimize info (multi-line) */
415
+
416
+ /* operation code */
417
+ enum OpCode {
418
+ OP_FINISH = 0, /* matching process terminator (no more alternative) */
419
+ OP_END = 1, /* pattern code terminator (success end) */
420
+
421
+ OP_EXACT1 = 2, /* single byte, N = 1 */
422
+ OP_EXACT2, /* single byte, N = 2 */
423
+ OP_EXACT3, /* single byte, N = 3 */
424
+ OP_EXACT4, /* single byte, N = 4 */
425
+ OP_EXACT5, /* single byte, N = 5 */
426
+ OP_EXACTN, /* single byte */
427
+ OP_EXACTMB2N1, /* mb-length = 2 N = 1 */
428
+ OP_EXACTMB2N2, /* mb-length = 2 N = 2 */
429
+ OP_EXACTMB2N3, /* mb-length = 2 N = 3 */
430
+ OP_EXACTMB2N, /* mb-length = 2 */
431
+ OP_EXACTMB3N, /* mb-length = 3 */
432
+ OP_EXACTMBN, /* other length */
433
+
434
+ OP_EXACT1_IC, /* single byte, N = 1, ignore case */
435
+ OP_EXACTN_IC, /* single byte, ignore case */
436
+
437
+ OP_CCLASS,
438
+ OP_CCLASS_MB,
439
+ OP_CCLASS_MIX,
440
+ OP_CCLASS_NOT,
441
+ OP_CCLASS_MB_NOT,
442
+ OP_CCLASS_MIX_NOT,
443
+ OP_CCLASS_NODE, /* pointer to CClassNode node */
444
+
445
+ OP_ANYCHAR, /* "." */
446
+ OP_ANYCHAR_ML, /* "." multi-line */
447
+ OP_ANYCHAR_STAR, /* ".*" */
448
+ OP_ANYCHAR_ML_STAR, /* ".*" multi-line */
449
+ OP_ANYCHAR_STAR_PEEK_NEXT,
450
+ OP_ANYCHAR_ML_STAR_PEEK_NEXT,
451
+
452
+ OP_WORD,
453
+ OP_NOT_WORD,
454
+ OP_WORD_BOUND,
455
+ OP_NOT_WORD_BOUND,
456
+ OP_WORD_BEGIN,
457
+ OP_WORD_END,
458
+
459
+ OP_BEGIN_BUF,
460
+ OP_END_BUF,
461
+ OP_BEGIN_LINE,
462
+ OP_END_LINE,
463
+ OP_SEMI_END_BUF,
464
+ OP_BEGIN_POSITION,
465
+
466
+ OP_BACKREF1,
467
+ OP_BACKREF2,
468
+ OP_BACKREFN,
469
+ OP_BACKREFN_IC,
470
+ OP_BACKREF_MULTI,
471
+ OP_BACKREF_MULTI_IC,
472
+ OP_BACKREF_WITH_LEVEL, /* \k<xxx+n>, \k<xxx-n> */
473
+
474
+ OP_MEMORY_START,
475
+ OP_MEMORY_START_PUSH, /* push back-tracker to stack */
476
+ OP_MEMORY_END_PUSH, /* push back-tracker to stack */
477
+ OP_MEMORY_END_PUSH_REC, /* push back-tracker to stack */
478
+ OP_MEMORY_END,
479
+ OP_MEMORY_END_REC, /* push marker to stack */
480
+
481
+ OP_FAIL, /* pop stack and move */
482
+ OP_JUMP,
483
+ OP_PUSH,
484
+ OP_POP,
485
+ OP_PUSH_OR_JUMP_EXACT1, /* if match exact then push, else jump. */
486
+ OP_PUSH_IF_PEEK_NEXT, /* if match exact then push, else none. */
487
+ OP_REPEAT, /* {n,m} */
488
+ OP_REPEAT_NG, /* {n,m}? (non greedy) */
489
+ OP_REPEAT_INC,
490
+ OP_REPEAT_INC_NG, /* non greedy */
491
+ OP_REPEAT_INC_SG, /* search and get in stack */
492
+ OP_REPEAT_INC_NG_SG, /* search and get in stack (non greedy) */
493
+ OP_NULL_CHECK_START, /* null loop checker start */
494
+ OP_NULL_CHECK_END, /* null loop checker end */
495
+ OP_NULL_CHECK_END_MEMST, /* null loop checker end (with capture status) */
496
+ OP_NULL_CHECK_END_MEMST_PUSH, /* with capture status and push check-end */
497
+
498
+ OP_PUSH_POS, /* (?=...) start */
499
+ OP_POP_POS, /* (?=...) end */
500
+ OP_PUSH_POS_NOT, /* (?!...) start */
501
+ OP_FAIL_POS, /* (?!...) end */
502
+ OP_PUSH_STOP_BT, /* (?>...) start */
503
+ OP_POP_STOP_BT, /* (?>...) end */
504
+ OP_LOOK_BEHIND, /* (?<=...) start (no needs end opcode) */
505
+ OP_PUSH_LOOK_BEHIND_NOT, /* (?<!...) start */
506
+ OP_FAIL_LOOK_BEHIND_NOT, /* (?<!...) end */
507
+
508
+ OP_CALL, /* \g<name> */
509
+ OP_RETURN,
510
+
511
+ OP_STATE_CHECK_PUSH, /* combination explosion check and push */
512
+ OP_STATE_CHECK_PUSH_OR_JUMP, /* check ok -> push, else jump */
513
+ OP_STATE_CHECK, /* check only */
514
+ OP_STATE_CHECK_ANYCHAR_STAR,
515
+ OP_STATE_CHECK_ANYCHAR_ML_STAR,
516
+
517
+ /* no need: IS_DYNAMIC_OPTION() == 0 */
518
+ OP_SET_OPTION_PUSH, /* set option and push recover option */
519
+ OP_SET_OPTION /* set option */
520
+ };
521
+
522
+ typedef int RelAddrType;
523
+ typedef int AbsAddrType;
524
+ typedef int LengthType;
525
+ typedef int RepeatNumType;
526
+ typedef short int MemNumType;
527
+ typedef short int StateCheckNumType;
528
+ typedef void* PointerType;
529
+
530
+ #define SIZE_OPCODE 1
531
+ #define SIZE_RELADDR sizeof(RelAddrType)
532
+ #define SIZE_ABSADDR sizeof(AbsAddrType)
533
+ #define SIZE_LENGTH sizeof(LengthType)
534
+ #define SIZE_MEMNUM sizeof(MemNumType)
535
+ #define SIZE_STATE_CHECK_NUM sizeof(StateCheckNumType)
536
+ #define SIZE_REPEATNUM sizeof(RepeatNumType)
537
+ #define SIZE_OPTION sizeof(OnigOptionType)
538
+ #define SIZE_CODE_POINT sizeof(OnigCodePoint)
539
+ #define SIZE_POINTER sizeof(PointerType)
540
+
541
+
542
+ #define GET_RELADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, RelAddrType)
543
+ #define GET_ABSADDR_INC(addr,p) PLATFORM_GET_INC(addr, p, AbsAddrType)
544
+ #define GET_LENGTH_INC(len,p) PLATFORM_GET_INC(len, p, LengthType)
545
+ #define GET_MEMNUM_INC(num,p) PLATFORM_GET_INC(num, p, MemNumType)
546
+ #define GET_REPEATNUM_INC(num,p) PLATFORM_GET_INC(num, p, RepeatNumType)
547
+ #define GET_OPTION_INC(option,p) PLATFORM_GET_INC(option, p, OnigOptionType)
548
+ #define GET_POINTER_INC(ptr,p) PLATFORM_GET_INC(ptr, p, PointerType)
549
+ #define GET_STATE_CHECK_NUM_INC(num,p) PLATFORM_GET_INC(num, p, StateCheckNumType)
550
+
551
+ /* code point's address must be aligned address. */
552
+ #define GET_CODE_POINT(code,p) code = *((OnigCodePoint* )(p))
553
+ #define GET_BYTE_INC(byte,p) do{\
554
+ byte = *(p);\
555
+ (p)++;\
556
+ } while(0)
557
+
558
+
559
+ /* op-code + arg size */
560
+ #define SIZE_OP_ANYCHAR_STAR SIZE_OPCODE
561
+ #define SIZE_OP_ANYCHAR_STAR_PEEK_NEXT (SIZE_OPCODE + 1)
562
+ #define SIZE_OP_JUMP (SIZE_OPCODE + SIZE_RELADDR)
563
+ #define SIZE_OP_PUSH (SIZE_OPCODE + SIZE_RELADDR)
564
+ #define SIZE_OP_POP SIZE_OPCODE
565
+ #define SIZE_OP_PUSH_OR_JUMP_EXACT1 (SIZE_OPCODE + SIZE_RELADDR + 1)
566
+ #define SIZE_OP_PUSH_IF_PEEK_NEXT (SIZE_OPCODE + SIZE_RELADDR + 1)
567
+ #define SIZE_OP_REPEAT_INC (SIZE_OPCODE + SIZE_MEMNUM)
568
+ #define SIZE_OP_REPEAT_INC_NG (SIZE_OPCODE + SIZE_MEMNUM)
569
+ #define SIZE_OP_PUSH_POS SIZE_OPCODE
570
+ #define SIZE_OP_PUSH_POS_NOT (SIZE_OPCODE + SIZE_RELADDR)
571
+ #define SIZE_OP_POP_POS SIZE_OPCODE
572
+ #define SIZE_OP_FAIL_POS SIZE_OPCODE
573
+ #define SIZE_OP_SET_OPTION (SIZE_OPCODE + SIZE_OPTION)
574
+ #define SIZE_OP_SET_OPTION_PUSH (SIZE_OPCODE + SIZE_OPTION)
575
+ #define SIZE_OP_FAIL SIZE_OPCODE
576
+ #define SIZE_OP_MEMORY_START (SIZE_OPCODE + SIZE_MEMNUM)
577
+ #define SIZE_OP_MEMORY_START_PUSH (SIZE_OPCODE + SIZE_MEMNUM)
578
+ #define SIZE_OP_MEMORY_END_PUSH (SIZE_OPCODE + SIZE_MEMNUM)
579
+ #define SIZE_OP_MEMORY_END_PUSH_REC (SIZE_OPCODE + SIZE_MEMNUM)
580
+ #define SIZE_OP_MEMORY_END (SIZE_OPCODE + SIZE_MEMNUM)
581
+ #define SIZE_OP_MEMORY_END_REC (SIZE_OPCODE + SIZE_MEMNUM)
582
+ #define SIZE_OP_PUSH_STOP_BT SIZE_OPCODE
583
+ #define SIZE_OP_POP_STOP_BT SIZE_OPCODE
584
+ #define SIZE_OP_NULL_CHECK_START (SIZE_OPCODE + SIZE_MEMNUM)
585
+ #define SIZE_OP_NULL_CHECK_END (SIZE_OPCODE + SIZE_MEMNUM)
586
+ #define SIZE_OP_LOOK_BEHIND (SIZE_OPCODE + SIZE_LENGTH)
587
+ #define SIZE_OP_PUSH_LOOK_BEHIND_NOT (SIZE_OPCODE + SIZE_RELADDR + SIZE_LENGTH)
588
+ #define SIZE_OP_FAIL_LOOK_BEHIND_NOT SIZE_OPCODE
589
+ #define SIZE_OP_CALL (SIZE_OPCODE + SIZE_ABSADDR)
590
+ #define SIZE_OP_RETURN SIZE_OPCODE
591
+
592
+ #ifdef USE_COMBINATION_EXPLOSION_CHECK
593
+ #define SIZE_OP_STATE_CHECK (SIZE_OPCODE + SIZE_STATE_CHECK_NUM)
594
+ #define SIZE_OP_STATE_CHECK_PUSH (SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR)
595
+ #define SIZE_OP_STATE_CHECK_PUSH_OR_JUMP (SIZE_OPCODE + SIZE_STATE_CHECK_NUM + SIZE_RELADDR)
596
+ #define SIZE_OP_STATE_CHECK_ANYCHAR_STAR (SIZE_OPCODE + SIZE_STATE_CHECK_NUM)
597
+ #endif
598
+
599
+ #define MC_ESC(syn) (syn)->meta_char_table.esc
600
+ #define MC_ANYCHAR(syn) (syn)->meta_char_table.anychar
601
+ #define MC_ANYTIME(syn) (syn)->meta_char_table.anytime
602
+ #define MC_ZERO_OR_ONE_TIME(syn) (syn)->meta_char_table.zero_or_one_time
603
+ #define MC_ONE_OR_MORE_TIME(syn) (syn)->meta_char_table.one_or_more_time
604
+ #define MC_ANYCHAR_ANYTIME(syn) (syn)->meta_char_table.anychar_anytime
605
+
606
+ #define IS_MC_ESC_CODE(code, syn) \
607
+ ((code) == MC_ESC(syn) && \
608
+ !IS_SYNTAX_OP2((syn), ONIG_SYN_OP2_INEFFECTIVE_ESCAPE))
609
+
610
+
611
+ #define SYN_POSIX_COMMON_OP \
612
+ ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_POSIX_BRACKET | \
613
+ ONIG_SYN_OP_DECIMAL_BACKREF | \
614
+ ONIG_SYN_OP_BRACKET_CC | ONIG_SYN_OP_ASTERISK_ZERO_INF | \
615
+ ONIG_SYN_OP_LINE_ANCHOR | \
616
+ ONIG_SYN_OP_ESC_CONTROL_CHARS )
617
+
618
+ #define SYN_GNU_REGEX_OP \
619
+ ( ONIG_SYN_OP_DOT_ANYCHAR | ONIG_SYN_OP_BRACKET_CC | \
620
+ ONIG_SYN_OP_POSIX_BRACKET | ONIG_SYN_OP_DECIMAL_BACKREF | \
621
+ ONIG_SYN_OP_BRACE_INTERVAL | ONIG_SYN_OP_LPAREN_SUBEXP | \
622
+ ONIG_SYN_OP_VBAR_ALT | \
623
+ ONIG_SYN_OP_ASTERISK_ZERO_INF | ONIG_SYN_OP_PLUS_ONE_INF | \
624
+ ONIG_SYN_OP_QMARK_ZERO_ONE | \
625
+ ONIG_SYN_OP_ESC_AZ_BUF_ANCHOR | ONIG_SYN_OP_ESC_CAPITAL_G_BEGIN_ANCHOR | \
626
+ ONIG_SYN_OP_ESC_W_WORD | \
627
+ ONIG_SYN_OP_ESC_B_WORD_BOUND | ONIG_SYN_OP_ESC_LTGT_WORD_BEGIN_END | \
628
+ ONIG_SYN_OP_ESC_S_WHITE_SPACE | ONIG_SYN_OP_ESC_D_DIGIT | \
629
+ ONIG_SYN_OP_LINE_ANCHOR )
630
+
631
+ #define SYN_GNU_REGEX_BV \
632
+ ( ONIG_SYN_CONTEXT_INDEP_ANCHORS | ONIG_SYN_CONTEXT_INDEP_REPEAT_OPS | \
633
+ ONIG_SYN_CONTEXT_INVALID_REPEAT_OPS | ONIG_SYN_ALLOW_INVALID_INTERVAL | \
634
+ ONIG_SYN_BACKSLASH_ESCAPE_IN_CC | ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC )
635
+
636
+
637
+ #define NCCLASS_FLAGS(cc) ((cc)->flags)
638
+ #define NCCLASS_FLAG_SET(cc,flag) (NCCLASS_FLAGS(cc) |= (flag))
639
+ #define NCCLASS_FLAG_CLEAR(cc,flag) (NCCLASS_FLAGS(cc) &= ~(flag))
640
+ #define IS_NCCLASS_FLAG_ON(cc,flag) ((NCCLASS_FLAGS(cc) & (flag)) != 0)
641
+
642
+ /* cclass node */
643
+ #define FLAG_NCCLASS_NOT (1<<0)
644
+ #define FLAG_NCCLASS_SHARE (1<<1)
645
+
646
+ #define NCCLASS_SET_NOT(nd) NCCLASS_FLAG_SET(nd, FLAG_NCCLASS_NOT)
647
+ #define NCCLASS_SET_SHARE(nd) NCCLASS_FLAG_SET(nd, FLAG_NCCLASS_SHARE)
648
+ #define NCCLASS_CLEAR_NOT(nd) NCCLASS_FLAG_CLEAR(nd, FLAG_NCCLASS_NOT)
649
+ #define IS_NCCLASS_NOT(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_NOT)
650
+ #define IS_NCCLASS_SHARE(nd) IS_NCCLASS_FLAG_ON(nd, FLAG_NCCLASS_SHARE)
651
+
652
+ typedef struct {
653
+ int type;
654
+ /* struct _Node* next; */
655
+ /* unsigned int flags; */
656
+ } NodeBase;
657
+
658
+ typedef struct {
659
+ NodeBase base;
660
+ unsigned int flags;
661
+ BitSet bs;
662
+ BBuf* mbuf; /* multi-byte info or NULL */
663
+ } CClassNode;
664
+
665
+ typedef long OnigStackIndex;
666
+
667
+ typedef struct _OnigStackType {
668
+ unsigned int type;
669
+ union {
670
+ struct {
671
+ UChar *pcode; /* byte code position */
672
+ UChar *pstr; /* string position */
673
+ UChar *pstr_prev; /* previous char position of pstr */
674
+ #ifdef USE_COMBINATION_EXPLOSION_CHECK
675
+ unsigned int state_check;
676
+ #endif
677
+ } state;
678
+ struct {
679
+ int count; /* for OP_REPEAT_INC, OP_REPEAT_INC_NG */
680
+ UChar *pcode; /* byte code position (head of repeated target) */
681
+ int num; /* repeat id */
682
+ } repeat;
683
+ struct {
684
+ OnigStackIndex si; /* index of stack */
685
+ } repeat_inc;
686
+ struct {
687
+ int num; /* memory num */
688
+ UChar *pstr; /* start/end position */
689
+ /* Following information is set, if this stack type is MEM-START */
690
+ OnigStackIndex start; /* prev. info (for backtrack "(...)*" ) */
691
+ OnigStackIndex end; /* prev. info (for backtrack "(...)*" ) */
692
+ } mem;
693
+ struct {
694
+ int num; /* null check id */
695
+ UChar *pstr; /* start position */
696
+ } null_check;
697
+ #ifdef USE_SUBEXP_CALL
698
+ struct {
699
+ UChar *ret_addr; /* byte code position */
700
+ int num; /* null check id */
701
+ UChar *pstr; /* string position */
702
+ } call_frame;
703
+ #endif
704
+ } u;
705
+ } OnigStackType;
706
+
707
+ typedef struct {
708
+ void* stack_p;
709
+ int stack_n;
710
+ OnigOptionType options;
711
+ OnigRegion* region;
712
+ int ptr_num;
713
+ const UChar* start; /* search start position (for \G: BEGIN_POSITION) */
714
+ #ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE
715
+ int best_len; /* for ONIG_OPTION_FIND_LONGEST */
716
+ UChar* best_s;
717
+ #endif
718
+ #ifdef USE_COMBINATION_EXPLOSION_CHECK
719
+ void* state_check_buff;
720
+ int state_check_buff_size;
721
+ #endif
722
+ } OnigMatchArg;
723
+
724
+
725
+ #define IS_CODE_SB_WORD(enc,code) \
726
+ (ONIGENC_IS_CODE_ASCII(code) && ONIGENC_IS_CODE_WORD(enc,code))
727
+
728
+ typedef struct OnigEndCallListItem {
729
+ struct OnigEndCallListItem* next;
730
+ void (*func)(void);
731
+ } OnigEndCallListItemType;
732
+
733
+ extern void onig_add_end_call(void (*func)(void));
734
+
735
+
736
+ #ifdef ONIG_DEBUG
737
+
738
+ typedef struct {
739
+ short int opcode;
740
+ char* name;
741
+ short int arg_type;
742
+ } OnigOpInfoType;
743
+
744
+ extern OnigOpInfoType OnigOpInfo[];
745
+
746
+
747
+ extern void onig_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar** nextp, OnigEncoding enc));
748
+
749
+ #ifdef ONIG_DEBUG_STATISTICS
750
+ extern void onig_statistics_init P_((void));
751
+ extern void onig_print_statistics P_((FILE* f));
752
+ #endif
753
+ #endif
754
+
755
+ extern void onig_warning(const char* s);
756
+ extern UChar* onig_error_code_to_format P_((int code));
757
+ extern void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat, UChar* pat_end, const UChar *fmt, ...));
758
+ extern int onig_bbuf_init P_((BBuf* buf, int size));
759
+ extern int onig_compile P_((regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo));
760
+ extern void onig_transfer P_((regex_t* to, regex_t* from));
761
+ extern int onig_is_code_in_cc P_((OnigEncoding enc, OnigCodePoint code, CClassNode* cc));
762
+ extern int onig_is_code_in_cc_len P_((int enclen, OnigCodePoint code, CClassNode* cc));
763
+
764
+ /* strend hash */
765
+ typedef void hash_table_type;
766
+ #ifdef _WIN32
767
+ # include <windows.h>
768
+ typedef ULONG_PTR hash_data_type;
769
+ #else
770
+ typedef unsigned long hash_data_type;
771
+ #endif
772
+
773
+ extern hash_table_type* onig_st_init_strend_table_with_size P_((int size));
774
+ extern int onig_st_lookup_strend P_((hash_table_type* table, const UChar* str_key, const UChar* end_key, hash_data_type *value));
775
+ extern int onig_st_insert_strend P_((hash_table_type* table, const UChar* str_key, const UChar* end_key, hash_data_type value));
776
+
777
+ typedef int (*ONIGENC_INIT_PROPERTY_LIST_FUNC_TYPE)(void);
778
+
779
+ #endif /* REGINT_H */