@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.
- package/binding.gyp +3 -3
- package/configure +8 -6
- package/deps/jq/.travis.yml +184 -35
- package/deps/jq/AUTHORS +31 -30
- package/deps/jq/COPYING +2 -2
- package/deps/jq/KEYS +8 -0
- package/deps/jq/Makefile.am +85 -70
- package/deps/jq/NEWS +5 -4
- package/deps/jq/README.md +18 -9
- package/deps/jq/appveyor.yml +53 -0
- package/deps/jq/compile-ios.sh +5 -5
- package/deps/jq/config/m4/check-math-func.m4 +7 -2
- package/deps/jq/configure.ac +130 -68
- package/deps/jq/docs/Rakefile +14 -135
- package/deps/jq/docs/Rakefile.manual +49 -0
- package/deps/jq/docs/Rakefile.website +76 -0
- package/deps/jq/docs/content/2.download/default.yml +115 -39
- package/deps/jq/docs/content/3.manual/manual.yml +641 -231
- package/deps/jq/docs/content/3.manual/v1.3/manual.yml +130 -130
- package/deps/jq/docs/content/3.manual/v1.4/manual.yml +160 -160
- package/deps/jq/docs/content/3.manual/v1.5/manual.yml +2878 -0
- package/deps/jq/docs/content/3.manual/v1.6/manual.yml +3287 -0
- package/deps/jq/docs/content/index/index.yml +28 -6
- package/deps/jq/docs/public/.htaccess +2 -2
- package/deps/jq/docs/public/css/base.scss +141 -59
- package/deps/jq/docs/public/js/manual-search.js +52 -0
- package/deps/jq/docs/site.yml +1 -10
- package/deps/jq/docs/templates/default.liquid +10 -10
- package/deps/jq/docs/templates/index.liquid +45 -32
- package/deps/jq/docs/templates/manual.liquid +67 -90
- package/deps/jq/docs/templates/shared/_footer.liquid +10 -5
- package/deps/jq/docs/templates/shared/_head.liquid +17 -12
- package/deps/jq/docs/templates/shared/_navbar.liquid +27 -0
- package/deps/jq/jq.1.prebuilt +523 -139
- package/deps/jq/modules/oniguruma/AUTHORS +1 -0
- package/deps/jq/modules/oniguruma/CMakeLists.txt +86 -0
- package/deps/jq/modules/oniguruma/COPYING +28 -0
- package/deps/jq/modules/oniguruma/ChangeLog +0 -0
- package/deps/jq/modules/oniguruma/HISTORY +2138 -0
- package/deps/jq/modules/oniguruma/Makefile.am +33 -0
- package/deps/jq/modules/oniguruma/NEWS +0 -0
- package/deps/jq/modules/oniguruma/README +189 -0
- package/deps/jq/modules/oniguruma/README.ja +195 -0
- package/deps/jq/modules/oniguruma/README.md +203 -0
- package/deps/jq/modules/oniguruma/cmake/dist.cmake +321 -0
- package/deps/jq/modules/oniguruma/compile +348 -0
- package/deps/jq/modules/oniguruma/config.guess +1754 -0
- package/deps/jq/modules/oniguruma/config.sub +1890 -0
- package/deps/jq/modules/oniguruma/configure.ac +87 -0
- package/deps/jq/modules/oniguruma/contributed/libfuzzer-onig.cpp +31 -0
- package/deps/jq/modules/oniguruma/depcomp +791 -0
- package/deps/jq/modules/oniguruma/dist.info +10 -0
- package/deps/jq/modules/oniguruma/doc/API +660 -0
- package/deps/jq/modules/oniguruma/doc/API.ja +667 -0
- package/deps/jq/modules/oniguruma/doc/FAQ +12 -0
- package/deps/jq/modules/oniguruma/doc/FAQ.ja +22 -0
- package/deps/jq/modules/oniguruma/doc/RE +436 -0
- package/deps/jq/modules/oniguruma/doc/RE.ja +448 -0
- package/deps/jq/modules/oniguruma/doc/UNICODE_PROPERTIES +698 -0
- package/deps/jq/modules/oniguruma/index.html +181 -0
- package/deps/jq/modules/oniguruma/index_ja.html +184 -0
- package/deps/jq/modules/oniguruma/install-sh +541 -0
- package/deps/jq/modules/oniguruma/m4/.whatever +0 -0
- package/deps/jq/modules/oniguruma/make_win32.bat +3 -0
- package/deps/jq/modules/oniguruma/make_win64.bat +3 -0
- package/deps/jq/modules/oniguruma/missing +215 -0
- package/deps/jq/modules/oniguruma/onig-config.in +78 -0
- package/deps/jq/modules/oniguruma/oniguruma.pc.cmake.in +13 -0
- package/deps/jq/modules/oniguruma/oniguruma.pc.in +14 -0
- package/deps/jq/modules/oniguruma/sample/CMakeLists.txt +28 -0
- package/deps/jq/modules/oniguruma/sample/Makefile.am +34 -0
- package/deps/jq/modules/oniguruma/sample/bug_fix.c +131 -0
- package/deps/jq/modules/oniguruma/sample/crnl.c +127 -0
- package/deps/jq/modules/oniguruma/sample/encode.c +308 -0
- package/deps/jq/modules/oniguruma/sample/listcap.c +110 -0
- package/deps/jq/modules/oniguruma/sample/names.c +75 -0
- package/deps/jq/modules/oniguruma/sample/posix.c +96 -0
- package/deps/jq/modules/oniguruma/sample/scan.c +88 -0
- package/deps/jq/modules/oniguruma/sample/simple.c +59 -0
- package/deps/jq/modules/oniguruma/sample/sql.c +76 -0
- package/deps/jq/modules/oniguruma/sample/syntax.c +76 -0
- package/deps/jq/modules/oniguruma/sample/user_property.c +87 -0
- package/deps/jq/modules/oniguruma/src/Makefile.am +58 -0
- package/deps/jq/modules/oniguruma/src/Makefile.windows +183 -0
- package/deps/jq/modules/oniguruma/src/ascii.c +61 -0
- package/deps/jq/modules/oniguruma/src/big5.c +190 -0
- package/deps/jq/modules/oniguruma/src/config.h.cmake.in +71 -0
- package/deps/jq/modules/oniguruma/src/config.h.win32 +84 -0
- package/deps/jq/modules/oniguruma/src/config.h.win64 +84 -0
- package/deps/jq/modules/oniguruma/src/cp1251.c +203 -0
- package/deps/jq/modules/oniguruma/src/euc_jp.c +310 -0
- package/deps/jq/modules/oniguruma/src/euc_jp_prop.c +158 -0
- package/deps/jq/modules/oniguruma/src/euc_jp_prop.gperf +27 -0
- package/deps/jq/modules/oniguruma/src/euc_kr.c +188 -0
- package/deps/jq/modules/oniguruma/src/euc_tw.c +171 -0
- package/deps/jq/modules/oniguruma/src/gb18030.c +538 -0
- package/deps/jq/modules/oniguruma/src/gperf_fold_key_conv.py +67 -0
- package/deps/jq/modules/oniguruma/src/gperf_unfold_key_conv.py +55 -0
- package/deps/jq/modules/oniguruma/src/iso8859_1.c +275 -0
- package/deps/jq/modules/oniguruma/src/iso8859_10.c +242 -0
- package/deps/jq/modules/oniguruma/src/iso8859_11.c +99 -0
- package/deps/jq/modules/oniguruma/src/iso8859_13.c +231 -0
- package/deps/jq/modules/oniguruma/src/iso8859_14.c +244 -0
- package/deps/jq/modules/oniguruma/src/iso8859_15.c +238 -0
- package/deps/jq/modules/oniguruma/src/iso8859_16.c +240 -0
- package/deps/jq/modules/oniguruma/src/iso8859_2.c +238 -0
- package/deps/jq/modules/oniguruma/src/iso8859_3.c +238 -0
- package/deps/jq/modules/oniguruma/src/iso8859_4.c +240 -0
- package/deps/jq/modules/oniguruma/src/iso8859_5.c +229 -0
- package/deps/jq/modules/oniguruma/src/iso8859_6.c +99 -0
- package/deps/jq/modules/oniguruma/src/iso8859_7.c +225 -0
- package/deps/jq/modules/oniguruma/src/iso8859_8.c +99 -0
- package/deps/jq/modules/oniguruma/src/iso8859_9.c +231 -0
- package/deps/jq/modules/oniguruma/src/koi8.c +253 -0
- package/deps/jq/modules/oniguruma/src/koi8_r.c +215 -0
- package/deps/jq/modules/oniguruma/src/make_unicode_fold.sh +22 -0
- package/deps/jq/modules/oniguruma/src/make_unicode_fold_data.py +306 -0
- package/deps/jq/modules/oniguruma/src/make_unicode_property.sh +18 -0
- package/deps/jq/modules/oniguruma/src/make_unicode_property_data.py +545 -0
- package/deps/jq/modules/oniguruma/src/mktable.c +1184 -0
- package/deps/jq/modules/oniguruma/src/onig_init.c +45 -0
- package/deps/jq/modules/oniguruma/src/oniggnu.h +85 -0
- package/deps/jq/modules/oniguruma/src/onigposix.h +169 -0
- package/deps/jq/modules/oniguruma/src/oniguruma.h +841 -0
- package/deps/jq/modules/oniguruma/src/regcomp.c +6300 -0
- package/deps/jq/modules/oniguruma/src/regenc.c +917 -0
- package/deps/jq/modules/oniguruma/src/regenc.h +243 -0
- package/deps/jq/modules/oniguruma/src/regerror.c +393 -0
- package/deps/jq/modules/oniguruma/src/regexec.c +3856 -0
- package/deps/jq/modules/oniguruma/src/regext.c +202 -0
- package/deps/jq/modules/oniguruma/src/reggnu.c +147 -0
- package/deps/jq/modules/oniguruma/src/regint.h +779 -0
- package/deps/jq/modules/oniguruma/src/regparse.c +5403 -0
- package/deps/jq/modules/oniguruma/src/regparse.h +351 -0
- package/deps/jq/modules/oniguruma/src/regposerr.c +105 -0
- package/deps/jq/modules/oniguruma/src/regposix.c +306 -0
- package/deps/jq/modules/oniguruma/src/regsyntax.c +315 -0
- package/deps/jq/modules/oniguruma/src/regtrav.c +76 -0
- package/deps/jq/modules/oniguruma/src/regversion.c +57 -0
- package/deps/jq/modules/oniguruma/src/sjis.c +341 -0
- package/deps/jq/modules/oniguruma/src/sjis_prop.c +158 -0
- package/deps/jq/modules/oniguruma/src/sjis_prop.gperf +27 -0
- package/deps/jq/modules/oniguruma/src/st.c +589 -0
- package/deps/jq/modules/oniguruma/src/st.h +68 -0
- package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold1_key.c +2250 -0
- package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold2_key.c +203 -0
- package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold3_key.c +113 -0
- package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_fold_data.c +1225 -0
- package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_property_data.c +24742 -0
- package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_property_data_posix.c +4846 -0
- package/deps/jq/modules/oniguruma/src/unicode-7.0/unicode_unfold_key.c +2571 -0
- package/deps/jq/modules/oniguruma/src/unicode.c +664 -0
- package/deps/jq/modules/oniguruma/src/unicode_fold1_key.c +2548 -0
- package/deps/jq/modules/oniguruma/src/unicode_fold2_key.c +203 -0
- package/deps/jq/modules/oniguruma/src/unicode_fold3_key.c +113 -0
- package/deps/jq/modules/oniguruma/src/unicode_fold_data.c +1366 -0
- package/deps/jq/modules/oniguruma/src/unicode_property_data.c +25306 -0
- package/deps/jq/modules/oniguruma/src/unicode_property_data_posix.c +4940 -0
- package/deps/jq/modules/oniguruma/src/unicode_unfold_key.c +2854 -0
- package/deps/jq/modules/oniguruma/src/utf16_be.c +235 -0
- package/deps/jq/modules/oniguruma/src/utf16_le.c +245 -0
- package/deps/jq/modules/oniguruma/src/utf32_be.c +194 -0
- package/deps/jq/modules/oniguruma/src/utf32_le.c +194 -0
- package/deps/jq/modules/oniguruma/src/utf8.c +335 -0
- package/deps/jq/modules/oniguruma/test/Makefile.am +28 -0
- package/deps/jq/modules/oniguruma/test/testc.c +874 -0
- package/deps/jq/modules/oniguruma/test/testu.c +916 -0
- package/deps/jq/modules/oniguruma/test-driver +153 -0
- package/deps/jq/modules/oniguruma/windows/testc.c +869 -0
- package/deps/jq/scripts/crosscompile +2 -1
- package/deps/jq/scripts/gen_utf8_tables.py +2 -3
- package/deps/jq/scripts/update-website +29 -0
- package/deps/jq/scripts/version +7 -2
- package/deps/jq/sig/jq-release.key +41 -0
- package/deps/jq/sig/v1.3/jq-linux-x86.asc +17 -0
- package/deps/jq/sig/v1.3/jq-linux-x86_64.asc +17 -0
- package/deps/jq/sig/v1.3/jq-osx-x86.asc +17 -0
- package/deps/jq/sig/v1.3/jq-osx-x86_64.asc +17 -0
- package/deps/jq/sig/v1.3/jq-win32.exe.asc +17 -0
- package/deps/jq/sig/v1.3/jq-win64.exe.asc +17 -0
- package/deps/jq/sig/v1.3/sha256sum.txt +6 -0
- package/deps/jq/sig/v1.4/jq-linux-x86.asc +17 -0
- package/deps/jq/sig/v1.4/jq-linux-x86_64.asc +17 -0
- package/deps/jq/sig/v1.4/jq-osx-x86.asc +17 -0
- package/deps/jq/sig/v1.4/jq-osx-x86_64.asc +17 -0
- package/deps/jq/sig/v1.4/jq-solaris11-32.asc +17 -0
- package/deps/jq/sig/v1.4/jq-solaris11-64.asc +17 -0
- package/deps/jq/sig/v1.4/jq-win32.exe.asc +17 -0
- package/deps/jq/sig/v1.4/jq-win64.exe.asc +17 -0
- package/deps/jq/sig/v1.4/sha256sum.txt +8 -0
- package/deps/jq/sig/v1.5/jq-linux32-no-oniguruma.asc +17 -0
- package/deps/jq/sig/v1.5/jq-linux32.asc +17 -0
- package/deps/jq/sig/v1.5/jq-linux64.asc +17 -0
- package/deps/jq/sig/v1.5/jq-osx-amd64.asc +17 -0
- package/deps/jq/sig/v1.5/jq-win32.exe.asc +17 -0
- package/deps/jq/sig/v1.5/jq-win64.exe.asc +17 -0
- package/deps/jq/sig/v1.5/sha256sum.txt +5 -0
- package/deps/jq/sig/v1.5rc1/jq-linux-x86_64-static.asc +17 -0
- package/deps/jq/sig/v1.5rc1/jq-win32.exe.asc +17 -0
- package/deps/jq/sig/v1.5rc1/jq-win64.exe.asc +17 -0
- package/deps/jq/sig/v1.5rc1/sha256sum.txt +3 -0
- package/deps/jq/sig/v1.5rc2/jq-linux-x86.asc +17 -0
- package/deps/jq/sig/v1.5rc2/jq-linux-x86_64.asc +17 -0
- package/deps/jq/sig/v1.5rc2/jq-osx-x86_64.asc +17 -0
- package/deps/jq/sig/v1.5rc2/jq-win32.exe.asc +17 -0
- package/deps/jq/sig/v1.5rc2/jq-win64.exe.asc +17 -0
- package/deps/jq/sig/v1.5rc2/sha256sum.txt +5 -0
- package/deps/jq/sig/v1.6/jq-linux32.asc +16 -0
- package/deps/jq/sig/v1.6/jq-linux64.asc +16 -0
- package/deps/jq/sig/v1.6/jq-osx-amd64.asc +16 -0
- package/deps/jq/sig/v1.6/jq-win32.exe.asc +16 -0
- package/deps/jq/sig/v1.6/jq-win64.exe.asc +16 -0
- package/deps/jq/sig/v1.6/sha256sum.txt +5 -0
- package/deps/jq/{builtin.c → src/builtin.c} +449 -344
- package/deps/jq/{builtin.h → src/builtin.h} +0 -0
- package/deps/jq/src/builtin.jq +311 -0
- package/deps/jq/{bytecode.c → src/bytecode.c} +0 -0
- package/deps/jq/{bytecode.h → src/bytecode.h} +0 -0
- package/deps/jq/{compile.c → src/compile.c} +213 -37
- package/deps/jq/{compile.h → src/compile.h} +7 -2
- package/deps/jq/{exec_stack.h → src/exec_stack.h} +0 -0
- package/deps/jq/{execute.c → src/execute.c} +127 -24
- package/deps/jq/{inject_errors.c → src/inject_errors.c} +0 -0
- package/deps/jq/{jq.h → src/jq.h} +13 -2
- package/deps/jq/{jq_parser.h → src/jq_parser.h} +0 -0
- package/deps/jq/{jq_test.c → src/jq_test.c} +1 -1
- package/deps/jq/{jv.c → src/jv.c} +24 -5
- package/deps/jq/{jv.h → src/jv.h} +46 -11
- package/deps/jq/{jv_alloc.c → src/jv_alloc.c} +0 -0
- package/deps/jq/{jv_alloc.h → src/jv_alloc.h} +0 -0
- package/deps/jq/{jv_aux.c → src/jv_aux.c} +38 -14
- package/deps/jq/{jv_dtoa.c → src/jv_dtoa.c} +4 -5
- package/deps/jq/{jv_dtoa.h → src/jv_dtoa.h} +0 -0
- package/deps/jq/src/jv_file.c +81 -0
- package/deps/jq/{jv_parse.c → src/jv_parse.c} +8 -2
- package/deps/jq/{jv_print.c → src/jv_print.c} +80 -27
- package/deps/jq/{jv_unicode.c → src/jv_unicode.c} +28 -4
- package/deps/jq/{jv_unicode.h → src/jv_unicode.h} +1 -0
- package/deps/jq/{jv_utf8_tables.h → src/jv_utf8_tables.h} +0 -0
- package/deps/jq/{lexer.c → src/lexer.c} +317 -292
- package/deps/jq/{lexer.h → src/lexer.h} +16 -12
- package/deps/jq/{lexer.l → src/lexer.l} +5 -4
- package/deps/jq/src/libm.h +291 -0
- package/deps/jq/{linker.c → src/linker.c} +5 -3
- package/deps/jq/{linker.h → src/linker.h} +0 -0
- package/deps/jq/{locfile.c → src/locfile.c} +1 -1
- package/deps/jq/{locfile.h → src/locfile.h} +0 -0
- package/deps/jq/{main.c → src/main.c} +202 -100
- package/deps/jq/{opcode_list.h → src/opcode_list.h} +4 -0
- package/deps/jq/{parser.c → src/parser.c} +1149 -1069
- package/deps/jq/{parser.h → src/parser.h} +28 -24
- package/deps/jq/{parser.y → src/parser.y} +108 -52
- package/deps/jq/{util.c → src/util.c} +12 -9
- package/deps/jq/{util.h → src/util.h} +0 -0
- package/deps/jq/tests/base64.test +35 -0
- package/deps/jq/tests/base64test +5 -0
- package/deps/jq/tests/jq-f-test.sh +4 -0
- package/deps/jq/tests/jq.test +305 -21
- package/deps/jq/tests/jqtest +1 -1
- package/deps/jq/tests/mantest +1 -1
- package/deps/jq/tests/onig.test +13 -0
- package/deps/jq/tests/onigtest +1 -1
- package/deps/jq/tests/optional.test +20 -0
- package/deps/jq/tests/optionaltest +5 -0
- package/deps/jq/tests/setup +7 -1
- package/deps/jq/tests/shtest +133 -29
- package/deps/jq/tests/utf8-truncate.jq +3 -0
- package/deps/jq/tests/utf8test +10 -0
- package/lib/index.js +7 -1
- package/package.json +3 -3
- package/test/santiy.test.js +24 -0
- package/deps/jq/docs/default_manpage.md +0 -22
- package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.css +0 -1058
- package/deps/jq/docs/public/bootstrap/css/bootstrap-responsive.min.css +0 -9
- package/deps/jq/docs/public/bootstrap/css/bootstrap.css +0 -5224
- package/deps/jq/docs/public/bootstrap/css/bootstrap.min.css +0 -9
- package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings-white.png +0 -0
- package/deps/jq/docs/public/bootstrap/img/glyphicons-halflings.png +0 -0
- package/deps/jq/docs/public/bootstrap/js/bootstrap.js +0 -2027
- package/deps/jq/docs/public/bootstrap/js/bootstrap.min.js +0 -6
- package/deps/jq/docs/templates/shared/_header.liquid +0 -26
- package/deps/jq/jq.1.default +0 -39
- package/deps/jq/jv_file.c +0 -49
- package/deps/jq/libm.h +0 -160
- package/deps/jq/setup.sh +0 -33
- package/reports/jest-port-api.xml +0 -35
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**********************************************************************
|
|
2
|
+
regext.c - Oniguruma (regular expression library)
|
|
3
|
+
**********************************************************************/
|
|
4
|
+
/*-
|
|
5
|
+
* Copyright (c) 2002-2008 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 "regint.h"
|
|
31
|
+
|
|
32
|
+
static void
|
|
33
|
+
conv_ext0be32(const UChar* s, const UChar* end, UChar* conv)
|
|
34
|
+
{
|
|
35
|
+
while (s < end) {
|
|
36
|
+
*conv++ = '\0';
|
|
37
|
+
*conv++ = '\0';
|
|
38
|
+
*conv++ = '\0';
|
|
39
|
+
*conv++ = *s++;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
static void
|
|
44
|
+
conv_ext0le32(const UChar* s, const UChar* end, UChar* conv)
|
|
45
|
+
{
|
|
46
|
+
while (s < end) {
|
|
47
|
+
*conv++ = *s++;
|
|
48
|
+
*conv++ = '\0';
|
|
49
|
+
*conv++ = '\0';
|
|
50
|
+
*conv++ = '\0';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static void
|
|
55
|
+
conv_ext0be(const UChar* s, const UChar* end, UChar* conv)
|
|
56
|
+
{
|
|
57
|
+
while (s < end) {
|
|
58
|
+
*conv++ = '\0';
|
|
59
|
+
*conv++ = *s++;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
static void
|
|
64
|
+
conv_ext0le(const UChar* s, const UChar* end, UChar* conv)
|
|
65
|
+
{
|
|
66
|
+
while (s < end) {
|
|
67
|
+
*conv++ = *s++;
|
|
68
|
+
*conv++ = '\0';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static void
|
|
73
|
+
conv_swap4bytes(const UChar* s, const UChar* end, UChar* conv)
|
|
74
|
+
{
|
|
75
|
+
while (s < end) {
|
|
76
|
+
*conv++ = s[3];
|
|
77
|
+
*conv++ = s[2];
|
|
78
|
+
*conv++ = s[1];
|
|
79
|
+
*conv++ = s[0];
|
|
80
|
+
s += 4;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static void
|
|
85
|
+
conv_swap2bytes(const UChar* s, const UChar* end, UChar* conv)
|
|
86
|
+
{
|
|
87
|
+
while (s < end) {
|
|
88
|
+
*conv++ = s[1];
|
|
89
|
+
*conv++ = s[0];
|
|
90
|
+
s += 2;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
static int
|
|
95
|
+
conv_encoding(OnigEncoding from, OnigEncoding to, const UChar* s, const UChar* end,
|
|
96
|
+
UChar** conv, UChar** conv_end)
|
|
97
|
+
{
|
|
98
|
+
int len = end - s;
|
|
99
|
+
|
|
100
|
+
if (to == ONIG_ENCODING_UTF16_BE) {
|
|
101
|
+
if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) {
|
|
102
|
+
*conv = (UChar* )xmalloc(len * 2);
|
|
103
|
+
CHECK_NULL_RETURN_MEMERR(*conv);
|
|
104
|
+
*conv_end = *conv + (len * 2);
|
|
105
|
+
conv_ext0be(s, end, *conv);
|
|
106
|
+
return 0;
|
|
107
|
+
}
|
|
108
|
+
else if (from == ONIG_ENCODING_UTF16_LE) {
|
|
109
|
+
swap16:
|
|
110
|
+
*conv = (UChar* )xmalloc(len);
|
|
111
|
+
CHECK_NULL_RETURN_MEMERR(*conv);
|
|
112
|
+
*conv_end = *conv + len;
|
|
113
|
+
conv_swap2bytes(s, end, *conv);
|
|
114
|
+
return 0;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else if (to == ONIG_ENCODING_UTF16_LE) {
|
|
118
|
+
if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) {
|
|
119
|
+
*conv = (UChar* )xmalloc(len * 2);
|
|
120
|
+
CHECK_NULL_RETURN_MEMERR(*conv);
|
|
121
|
+
*conv_end = *conv + (len * 2);
|
|
122
|
+
conv_ext0le(s, end, *conv);
|
|
123
|
+
return 0;
|
|
124
|
+
}
|
|
125
|
+
else if (from == ONIG_ENCODING_UTF16_BE) {
|
|
126
|
+
goto swap16;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (to == ONIG_ENCODING_UTF32_BE) {
|
|
130
|
+
if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) {
|
|
131
|
+
*conv = (UChar* )xmalloc(len * 4);
|
|
132
|
+
CHECK_NULL_RETURN_MEMERR(*conv);
|
|
133
|
+
*conv_end = *conv + (len * 4);
|
|
134
|
+
conv_ext0be32(s, end, *conv);
|
|
135
|
+
return 0;
|
|
136
|
+
}
|
|
137
|
+
else if (from == ONIG_ENCODING_UTF32_LE) {
|
|
138
|
+
swap32:
|
|
139
|
+
*conv = (UChar* )xmalloc(len);
|
|
140
|
+
CHECK_NULL_RETURN_MEMERR(*conv);
|
|
141
|
+
*conv_end = *conv + len;
|
|
142
|
+
conv_swap4bytes(s, end, *conv);
|
|
143
|
+
return 0;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else if (to == ONIG_ENCODING_UTF32_LE) {
|
|
147
|
+
if (from == ONIG_ENCODING_ASCII || from == ONIG_ENCODING_ISO_8859_1) {
|
|
148
|
+
*conv = (UChar* )xmalloc(len * 4);
|
|
149
|
+
CHECK_NULL_RETURN_MEMERR(*conv);
|
|
150
|
+
*conv_end = *conv + (len * 4);
|
|
151
|
+
conv_ext0le32(s, end, *conv);
|
|
152
|
+
return 0;
|
|
153
|
+
}
|
|
154
|
+
else if (from == ONIG_ENCODING_UTF32_BE) {
|
|
155
|
+
goto swap32;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return ONIGERR_NOT_SUPPORTED_ENCODING_COMBINATION;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
extern int
|
|
163
|
+
onig_new_deluxe(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
|
|
164
|
+
OnigCompileInfo* ci, OnigErrorInfo* einfo)
|
|
165
|
+
{
|
|
166
|
+
int r;
|
|
167
|
+
UChar *cpat, *cpat_end;
|
|
168
|
+
|
|
169
|
+
if (IS_NOT_NULL(einfo)) einfo->par = (UChar* )NULL;
|
|
170
|
+
|
|
171
|
+
if (ci->pattern_enc != ci->target_enc) {
|
|
172
|
+
r = conv_encoding(ci->pattern_enc, ci->target_enc, pattern, pattern_end,
|
|
173
|
+
&cpat, &cpat_end);
|
|
174
|
+
if (r) return r;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
cpat = (UChar* )pattern;
|
|
178
|
+
cpat_end = (UChar* )pattern_end;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
*reg = (regex_t* )xmalloc(sizeof(regex_t));
|
|
182
|
+
if (IS_NULL(*reg)) {
|
|
183
|
+
r = ONIGERR_MEMORY;
|
|
184
|
+
goto err2;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
r = onig_reg_init(*reg, ci->option, ci->case_fold_flag, ci->target_enc,
|
|
188
|
+
ci->syntax);
|
|
189
|
+
if (r) goto err;
|
|
190
|
+
|
|
191
|
+
r = onig_compile(*reg, cpat, cpat_end, einfo);
|
|
192
|
+
if (r) {
|
|
193
|
+
err:
|
|
194
|
+
onig_free(*reg);
|
|
195
|
+
*reg = NULL;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
err2:
|
|
199
|
+
if (cpat != pattern) xfree(cpat);
|
|
200
|
+
|
|
201
|
+
return r;
|
|
202
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**********************************************************************
|
|
2
|
+
reggnu.c - Oniguruma (regular expression library)
|
|
3
|
+
**********************************************************************/
|
|
4
|
+
/*-
|
|
5
|
+
* Copyright (c) 2002-2008 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 "regint.h"
|
|
31
|
+
|
|
32
|
+
#ifndef ONIGGNU_H
|
|
33
|
+
#include "oniggnu.h"
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
extern void
|
|
37
|
+
re_free_registers(OnigRegion* r)
|
|
38
|
+
{
|
|
39
|
+
/* 0: don't free self */
|
|
40
|
+
onig_region_free(r, 0);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
extern int
|
|
44
|
+
re_adjust_startpos(regex_t* reg, const char* string, int size,
|
|
45
|
+
int startpos, int range)
|
|
46
|
+
{
|
|
47
|
+
if (startpos > 0 && ONIGENC_MBC_MAXLEN(reg->enc) != 1 && startpos < size) {
|
|
48
|
+
UChar *p;
|
|
49
|
+
UChar *s = (UChar* )string + startpos;
|
|
50
|
+
|
|
51
|
+
if (range > 0) {
|
|
52
|
+
p = onigenc_get_right_adjust_char_head(reg->enc, (UChar* )string, s);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
p = ONIGENC_LEFT_ADJUST_CHAR_HEAD(reg->enc, (UChar* )string, s);
|
|
56
|
+
}
|
|
57
|
+
return p - (UChar* )string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return startpos;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
extern int
|
|
64
|
+
re_match(regex_t* reg, const char* str, int size, int pos,
|
|
65
|
+
struct re_registers* regs)
|
|
66
|
+
{
|
|
67
|
+
return onig_match(reg, (UChar* )str, (UChar* )(str + size),
|
|
68
|
+
(UChar* )(str + pos), regs, ONIG_OPTION_NONE);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
extern int
|
|
72
|
+
re_search(regex_t* bufp, const char* string, int size, int startpos, int range,
|
|
73
|
+
struct re_registers* regs)
|
|
74
|
+
{
|
|
75
|
+
return onig_search(bufp, (UChar* )string, (UChar* )(string + size),
|
|
76
|
+
(UChar* )(string + startpos),
|
|
77
|
+
(UChar* )(string + startpos + range),
|
|
78
|
+
regs, ONIG_OPTION_NONE);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
extern int
|
|
82
|
+
re_compile_pattern(const char* pattern, int size, regex_t* reg, char* ebuf)
|
|
83
|
+
{
|
|
84
|
+
int r;
|
|
85
|
+
OnigErrorInfo einfo;
|
|
86
|
+
|
|
87
|
+
r = onig_compile(reg, (UChar* )pattern, (UChar* )(pattern + size), &einfo);
|
|
88
|
+
if (r != ONIG_NORMAL) {
|
|
89
|
+
if (IS_NOT_NULL(ebuf))
|
|
90
|
+
(void )onig_error_code_to_str((UChar* )ebuf, r, &einfo);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return r;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
extern void
|
|
97
|
+
re_free_pattern(regex_t* reg)
|
|
98
|
+
{
|
|
99
|
+
onig_free(reg);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
extern int
|
|
103
|
+
re_alloc_pattern(regex_t** reg)
|
|
104
|
+
{
|
|
105
|
+
*reg = (regex_t* )xmalloc(sizeof(regex_t));
|
|
106
|
+
if (IS_NULL(*reg)) return ONIGERR_MEMORY;
|
|
107
|
+
|
|
108
|
+
return onig_reg_init(*reg, ONIG_OPTION_DEFAULT,
|
|
109
|
+
ONIGENC_CASE_FOLD_DEFAULT,
|
|
110
|
+
OnigEncDefaultCharEncoding,
|
|
111
|
+
OnigDefaultSyntax);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
extern void
|
|
115
|
+
re_set_casetable(const char* table)
|
|
116
|
+
{
|
|
117
|
+
onigenc_set_default_caseconv_table((UChar* )table);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
extern void
|
|
121
|
+
re_mbcinit(int mb_code)
|
|
122
|
+
{
|
|
123
|
+
OnigEncoding enc;
|
|
124
|
+
|
|
125
|
+
switch (mb_code) {
|
|
126
|
+
case RE_MBCTYPE_ASCII:
|
|
127
|
+
enc = ONIG_ENCODING_ASCII;
|
|
128
|
+
break;
|
|
129
|
+
case RE_MBCTYPE_EUC:
|
|
130
|
+
enc = ONIG_ENCODING_EUC_JP;
|
|
131
|
+
break;
|
|
132
|
+
case RE_MBCTYPE_SJIS:
|
|
133
|
+
enc = ONIG_ENCODING_SJIS;
|
|
134
|
+
break;
|
|
135
|
+
case RE_MBCTYPE_UTF8:
|
|
136
|
+
enc = ONIG_ENCODING_UTF8;
|
|
137
|
+
break;
|
|
138
|
+
default:
|
|
139
|
+
return ;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
onig_initialize(0, 0);
|
|
144
|
+
onig_initialize_encoding(enc);
|
|
145
|
+
|
|
146
|
+
onigenc_set_default_encoding(enc);
|
|
147
|
+
}
|