@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,194 @@
|
|
|
1
|
+
/**********************************************************************
|
|
2
|
+
utf32_le.c - Oniguruma (regular expression library)
|
|
3
|
+
**********************************************************************/
|
|
4
|
+
/*-
|
|
5
|
+
* Copyright (c) 2002-2016 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 "regenc.h"
|
|
31
|
+
|
|
32
|
+
static int
|
|
33
|
+
utf32le_mbc_enc_len(const UChar* p ARG_UNUSED)
|
|
34
|
+
{
|
|
35
|
+
return 4;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static int
|
|
39
|
+
is_valid_mbc_string(const UChar* s, const UChar* end)
|
|
40
|
+
{
|
|
41
|
+
return onigenc_length_check_is_valid_mbc_string(ONIG_ENCODING_UTF32_LE, s, end);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
static int
|
|
45
|
+
utf32le_is_mbc_newline(const UChar* p, const UChar* end)
|
|
46
|
+
{
|
|
47
|
+
if (p + 3 < end) {
|
|
48
|
+
if (*p == 0x0a && *(p+1) == 0 && *(p+2) == 0 && *(p+3) == 0)
|
|
49
|
+
return 1;
|
|
50
|
+
#ifdef USE_UNICODE_ALL_LINE_TERMINATORS
|
|
51
|
+
if ((
|
|
52
|
+
#ifndef USE_CRNL_AS_LINE_TERMINATOR
|
|
53
|
+
*p == 0x0d ||
|
|
54
|
+
#endif
|
|
55
|
+
*p == 0x85)
|
|
56
|
+
&& *(p+1) == 0x00 && (p+2) == 0x00 && *(p+3) == 0x00)
|
|
57
|
+
return 1;
|
|
58
|
+
|
|
59
|
+
if (*(p+1) == 0x20 && (*p == 0x29 || *p == 0x28)
|
|
60
|
+
&& *(p+2) == 0x00 && *(p+3) == 0x00)
|
|
61
|
+
return 1;
|
|
62
|
+
#endif
|
|
63
|
+
}
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
static OnigCodePoint
|
|
68
|
+
utf32le_mbc_to_code(const UChar* p, const UChar* end ARG_UNUSED)
|
|
69
|
+
{
|
|
70
|
+
return (OnigCodePoint )(((p[3] * 256 + p[2]) * 256 + p[1]) * 256 + p[0]);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static int
|
|
74
|
+
utf32le_code_to_mbclen(OnigCodePoint code ARG_UNUSED)
|
|
75
|
+
{
|
|
76
|
+
return 4;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static int
|
|
80
|
+
utf32le_code_to_mbc(OnigCodePoint code, UChar *buf)
|
|
81
|
+
{
|
|
82
|
+
UChar* p = buf;
|
|
83
|
+
|
|
84
|
+
*p++ = (UChar ) (code & 0xff);
|
|
85
|
+
*p++ = (UChar )((code & 0xff00) >> 8);
|
|
86
|
+
*p++ = (UChar )((code & 0xff0000) >>16);
|
|
87
|
+
*p++ = (UChar )((code & 0xff000000) >>24);
|
|
88
|
+
return 4;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
static int
|
|
92
|
+
utf32le_mbc_case_fold(OnigCaseFoldType flag,
|
|
93
|
+
const UChar** pp, const UChar* end, UChar* fold)
|
|
94
|
+
{
|
|
95
|
+
const UChar* p = *pp;
|
|
96
|
+
|
|
97
|
+
if (ONIGENC_IS_ASCII_CODE(*p) && *(p+1) == 0 && *(p+2) == 0 && *(p+3) == 0) {
|
|
98
|
+
#ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI
|
|
99
|
+
if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) != 0) {
|
|
100
|
+
if (*p == 0x49) {
|
|
101
|
+
*fold++ = 0x31;
|
|
102
|
+
*fold++ = 0x01;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
#endif
|
|
107
|
+
*fold++ = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p);
|
|
108
|
+
*fold++ = 0;
|
|
109
|
+
#ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI
|
|
110
|
+
}
|
|
111
|
+
#endif
|
|
112
|
+
|
|
113
|
+
*fold++ = 0;
|
|
114
|
+
*fold = 0;
|
|
115
|
+
*pp += 4;
|
|
116
|
+
return 4;
|
|
117
|
+
}
|
|
118
|
+
else
|
|
119
|
+
return onigenc_unicode_mbc_case_fold(ONIG_ENCODING_UTF32_LE, flag, pp, end,
|
|
120
|
+
fold);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#if 0
|
|
124
|
+
static int
|
|
125
|
+
utf32le_is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
|
|
126
|
+
{
|
|
127
|
+
const UChar* p = *pp;
|
|
128
|
+
|
|
129
|
+
(*pp) += 4;
|
|
130
|
+
|
|
131
|
+
if (*(p+1) == 0 && *(p+2) == 0 && *(p+3) == 0) {
|
|
132
|
+
int c, v;
|
|
133
|
+
|
|
134
|
+
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
|
|
135
|
+
return TRUE;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
c = *p;
|
|
139
|
+
v = ONIGENC_IS_UNICODE_ISO_8859_1_BIT_CTYPE(c,
|
|
140
|
+
(BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
|
|
141
|
+
if ((v | BIT_CTYPE_LOWER) != 0) {
|
|
142
|
+
/* 0xaa, 0xb5, 0xba are lower case letter, but can't convert. */
|
|
143
|
+
if (c >= 0xaa && c <= 0xba)
|
|
144
|
+
return FALSE;
|
|
145
|
+
else
|
|
146
|
+
return TRUE;
|
|
147
|
+
}
|
|
148
|
+
return (v != 0 ? TRUE : FALSE);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return FALSE;
|
|
152
|
+
}
|
|
153
|
+
#endif
|
|
154
|
+
|
|
155
|
+
static UChar*
|
|
156
|
+
utf32le_left_adjust_char_head(const UChar* start, const UChar* s)
|
|
157
|
+
{
|
|
158
|
+
int rem;
|
|
159
|
+
|
|
160
|
+
if (s <= start) return (UChar* )s;
|
|
161
|
+
|
|
162
|
+
rem = (s - start) % 4;
|
|
163
|
+
return (UChar* )(s - rem);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
static int
|
|
167
|
+
utf32le_get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|
168
|
+
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
|
|
169
|
+
{
|
|
170
|
+
return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF32_LE,
|
|
171
|
+
flag, p, end, items);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
OnigEncodingType OnigEncodingUTF32_LE = {
|
|
175
|
+
utf32le_mbc_enc_len,
|
|
176
|
+
"UTF-32LE", /* name */
|
|
177
|
+
4, /* max byte length */
|
|
178
|
+
4, /* min byte length */
|
|
179
|
+
utf32le_is_mbc_newline,
|
|
180
|
+
utf32le_mbc_to_code,
|
|
181
|
+
utf32le_code_to_mbclen,
|
|
182
|
+
utf32le_code_to_mbc,
|
|
183
|
+
utf32le_mbc_case_fold,
|
|
184
|
+
onigenc_unicode_apply_all_case_fold,
|
|
185
|
+
utf32le_get_case_fold_codes_by_str,
|
|
186
|
+
onigenc_unicode_property_name_to_ctype,
|
|
187
|
+
onigenc_unicode_is_code_ctype,
|
|
188
|
+
onigenc_utf16_32_get_ctype_code_range,
|
|
189
|
+
utf32le_left_adjust_char_head,
|
|
190
|
+
onigenc_always_false_is_allowed_reverse_match,
|
|
191
|
+
NULL, /* init */
|
|
192
|
+
NULL, /* is_initialized */
|
|
193
|
+
is_valid_mbc_string
|
|
194
|
+
};
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**********************************************************************
|
|
2
|
+
utf8.c - Oniguruma (regular expression library)
|
|
3
|
+
**********************************************************************/
|
|
4
|
+
/*-
|
|
5
|
+
* Copyright (c) 2002-2016 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 "regenc.h"
|
|
31
|
+
|
|
32
|
+
//#define USE_INVALID_CODE_SCHEME
|
|
33
|
+
|
|
34
|
+
#ifdef USE_INVALID_CODE_SCHEME
|
|
35
|
+
/* virtual codepoint values for invalid encoding byte 0xfe and 0xff */
|
|
36
|
+
#define INVALID_CODE_FE 0xfffffffe
|
|
37
|
+
#define INVALID_CODE_FF 0xffffffff
|
|
38
|
+
#define VALID_CODE_LIMIT 0x7fffffff
|
|
39
|
+
#endif
|
|
40
|
+
|
|
41
|
+
#define utf8_islead(c) ((UChar )((c) & 0xc0) != 0x80)
|
|
42
|
+
#define utf8_istail(c) ((UChar )((c) & 0xc0) == 0x80)
|
|
43
|
+
|
|
44
|
+
static const int EncLen_UTF8[] = {
|
|
45
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
46
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
47
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
48
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
49
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
50
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
51
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
52
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
53
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
54
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
55
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
56
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
57
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
58
|
+
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
|
59
|
+
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
|
60
|
+
4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 1, 1
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
static int
|
|
64
|
+
mbc_enc_len(const UChar* p)
|
|
65
|
+
{
|
|
66
|
+
return EncLen_UTF8[*p];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static int
|
|
70
|
+
is_valid_mbc_string(const UChar* p, const UChar* end)
|
|
71
|
+
{
|
|
72
|
+
int i, len;
|
|
73
|
+
|
|
74
|
+
while (p < end) {
|
|
75
|
+
if (! utf8_islead(*p))
|
|
76
|
+
return FALSE;
|
|
77
|
+
|
|
78
|
+
len = mbc_enc_len(p++);
|
|
79
|
+
if (len > 1) {
|
|
80
|
+
for (i = 1; i < len; i++) {
|
|
81
|
+
if (p == end)
|
|
82
|
+
return FALSE;
|
|
83
|
+
|
|
84
|
+
if (! utf8_istail(*p++))
|
|
85
|
+
return FALSE;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return TRUE;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static int
|
|
94
|
+
is_mbc_newline(const UChar* p, const UChar* end)
|
|
95
|
+
{
|
|
96
|
+
if (p < end) {
|
|
97
|
+
if (*p == 0x0a) return 1;
|
|
98
|
+
|
|
99
|
+
#ifdef USE_UNICODE_ALL_LINE_TERMINATORS
|
|
100
|
+
#ifndef USE_CRNL_AS_LINE_TERMINATOR
|
|
101
|
+
if (*p == 0x0d) return 1;
|
|
102
|
+
#endif
|
|
103
|
+
if (p + 1 < end) {
|
|
104
|
+
if (*(p+1) == 0x85 && *p == 0xc2) /* U+0085 */
|
|
105
|
+
return 1;
|
|
106
|
+
if (p + 2 < end) {
|
|
107
|
+
if ((*(p+2) == 0xa8 || *(p+2) == 0xa9)
|
|
108
|
+
&& *(p+1) == 0x80 && *p == 0xe2) /* U+2028, U+2029 */
|
|
109
|
+
return 1;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
#endif
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
static OnigCodePoint
|
|
119
|
+
mbc_to_code(const UChar* p, const UChar* end)
|
|
120
|
+
{
|
|
121
|
+
int c, len;
|
|
122
|
+
OnigCodePoint n;
|
|
123
|
+
|
|
124
|
+
len = mbc_enc_len(p);
|
|
125
|
+
if (len > end - p) len = end - p;
|
|
126
|
+
|
|
127
|
+
c = *p++;
|
|
128
|
+
if (len > 1) {
|
|
129
|
+
len--;
|
|
130
|
+
n = c & ((1 << (6 - len)) - 1);
|
|
131
|
+
while (len--) {
|
|
132
|
+
c = *p++;
|
|
133
|
+
n = (n << 6) | (c & ((1 << 6) - 1));
|
|
134
|
+
}
|
|
135
|
+
return n;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
#ifdef USE_INVALID_CODE_SCHEME
|
|
139
|
+
if (c > 0xfd) {
|
|
140
|
+
return ((c == 0xfe) ? INVALID_CODE_FE : INVALID_CODE_FF);
|
|
141
|
+
}
|
|
142
|
+
#endif
|
|
143
|
+
return (OnigCodePoint )c;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
static int
|
|
148
|
+
code_to_mbclen(OnigCodePoint code)
|
|
149
|
+
{
|
|
150
|
+
if ((code & 0xffffff80) == 0) return 1;
|
|
151
|
+
else if ((code & 0xfffff800) == 0) return 2;
|
|
152
|
+
else if ((code & 0xffff0000) == 0) return 3;
|
|
153
|
+
else if ((code & 0xffe00000) == 0) return 4;
|
|
154
|
+
else if ((code & 0xfc000000) == 0) return 5;
|
|
155
|
+
else if ((code & 0x80000000) == 0) return 6;
|
|
156
|
+
#ifdef USE_INVALID_CODE_SCHEME
|
|
157
|
+
else if (code == INVALID_CODE_FE) return 1;
|
|
158
|
+
else if (code == INVALID_CODE_FF) return 1;
|
|
159
|
+
#endif
|
|
160
|
+
else
|
|
161
|
+
return ONIGERR_INVALID_CODE_POINT_VALUE;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
static int
|
|
165
|
+
code_to_mbc(OnigCodePoint code, UChar *buf)
|
|
166
|
+
{
|
|
167
|
+
#define UTF8_TRAILS(code, shift) (UChar )((((code) >> (shift)) & 0x3f) | 0x80)
|
|
168
|
+
#define UTF8_TRAIL0(code) (UChar )(((code) & 0x3f) | 0x80)
|
|
169
|
+
|
|
170
|
+
if ((code & 0xffffff80) == 0) {
|
|
171
|
+
*buf = (UChar )code;
|
|
172
|
+
return 1;
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
UChar *p = buf;
|
|
176
|
+
|
|
177
|
+
if ((code & 0xfffff800) == 0) {
|
|
178
|
+
*p++ = (UChar )(((code>>6)& 0x1f) | 0xc0);
|
|
179
|
+
}
|
|
180
|
+
else if ((code & 0xffff0000) == 0) {
|
|
181
|
+
*p++ = (UChar )(((code>>12) & 0x0f) | 0xe0);
|
|
182
|
+
*p++ = UTF8_TRAILS(code, 6);
|
|
183
|
+
}
|
|
184
|
+
else if ((code & 0xffe00000) == 0) {
|
|
185
|
+
*p++ = (UChar )(((code>>18) & 0x07) | 0xf0);
|
|
186
|
+
*p++ = UTF8_TRAILS(code, 12);
|
|
187
|
+
*p++ = UTF8_TRAILS(code, 6);
|
|
188
|
+
}
|
|
189
|
+
else if ((code & 0xfc000000) == 0) {
|
|
190
|
+
*p++ = (UChar )(((code>>24) & 0x03) | 0xf8);
|
|
191
|
+
*p++ = UTF8_TRAILS(code, 18);
|
|
192
|
+
*p++ = UTF8_TRAILS(code, 12);
|
|
193
|
+
*p++ = UTF8_TRAILS(code, 6);
|
|
194
|
+
}
|
|
195
|
+
else if ((code & 0x80000000) == 0) {
|
|
196
|
+
*p++ = (UChar )(((code>>30) & 0x01) | 0xfc);
|
|
197
|
+
*p++ = UTF8_TRAILS(code, 24);
|
|
198
|
+
*p++ = UTF8_TRAILS(code, 18);
|
|
199
|
+
*p++ = UTF8_TRAILS(code, 12);
|
|
200
|
+
*p++ = UTF8_TRAILS(code, 6);
|
|
201
|
+
}
|
|
202
|
+
#ifdef USE_INVALID_CODE_SCHEME
|
|
203
|
+
else if (code == INVALID_CODE_FE) {
|
|
204
|
+
*p = 0xfe;
|
|
205
|
+
return 1;
|
|
206
|
+
}
|
|
207
|
+
else if (code == INVALID_CODE_FF) {
|
|
208
|
+
*p = 0xff;
|
|
209
|
+
return 1;
|
|
210
|
+
}
|
|
211
|
+
#endif
|
|
212
|
+
else {
|
|
213
|
+
return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
*p++ = UTF8_TRAIL0(code);
|
|
217
|
+
return p - buf;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
static int
|
|
222
|
+
mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
|
|
223
|
+
const UChar* end, UChar* fold)
|
|
224
|
+
{
|
|
225
|
+
const UChar* p = *pp;
|
|
226
|
+
|
|
227
|
+
if (ONIGENC_IS_MBC_ASCII(p)) {
|
|
228
|
+
#ifdef USE_UNICODE_CASE_FOLD_TURKISH_AZERI
|
|
229
|
+
if ((flag & ONIGENC_CASE_FOLD_TURKISH_AZERI) != 0) {
|
|
230
|
+
if (*p == 0x49) {
|
|
231
|
+
*fold++ = 0xc4;
|
|
232
|
+
*fold = 0xb1;
|
|
233
|
+
(*pp)++;
|
|
234
|
+
return 2;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
#endif
|
|
238
|
+
|
|
239
|
+
*fold = ONIGENC_ASCII_CODE_TO_LOWER_CASE(*p);
|
|
240
|
+
(*pp)++;
|
|
241
|
+
return 1; /* return byte length of converted char to lower */
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
return onigenc_unicode_mbc_case_fold(ONIG_ENCODING_UTF8, flag,
|
|
245
|
+
pp, end, fold);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
#if 0
|
|
250
|
+
static int
|
|
251
|
+
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
|
|
252
|
+
{
|
|
253
|
+
const UChar* p = *pp;
|
|
254
|
+
|
|
255
|
+
if (ONIGENC_IS_MBC_ASCII(p)) {
|
|
256
|
+
(*pp)++;
|
|
257
|
+
return ONIGENC_IS_ASCII_CODE_CASE_AMBIG(*p);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
(*pp) += enclen(ONIG_ENCODING_UTF8, p);
|
|
261
|
+
|
|
262
|
+
if (*p == 0xc3) {
|
|
263
|
+
int c = *(p + 1);
|
|
264
|
+
if (c >= 0x80) {
|
|
265
|
+
if (c <= (UChar )0x9e) { /* upper */
|
|
266
|
+
if (c == (UChar )0x97) return FALSE;
|
|
267
|
+
return TRUE;
|
|
268
|
+
}
|
|
269
|
+
else if (c >= (UChar )0xa0 && c <= (UChar )0xbe) { /* lower */
|
|
270
|
+
if (c == (UChar )'\267') return FALSE;
|
|
271
|
+
return TRUE;
|
|
272
|
+
}
|
|
273
|
+
else if (c == (UChar )0x9f &&
|
|
274
|
+
(flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
|
|
275
|
+
return TRUE;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return FALSE;
|
|
282
|
+
}
|
|
283
|
+
#endif
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
static int
|
|
287
|
+
get_ctype_code_range(OnigCtype ctype, OnigCodePoint *sb_out,
|
|
288
|
+
const OnigCodePoint* ranges[])
|
|
289
|
+
{
|
|
290
|
+
*sb_out = 0x80;
|
|
291
|
+
return onigenc_unicode_ctype_code_range(ctype, ranges);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
static UChar*
|
|
296
|
+
left_adjust_char_head(const UChar* start, const UChar* s)
|
|
297
|
+
{
|
|
298
|
+
const UChar *p;
|
|
299
|
+
|
|
300
|
+
if (s <= start) return (UChar* )s;
|
|
301
|
+
p = s;
|
|
302
|
+
|
|
303
|
+
while (!utf8_islead(*p) && p > start) p--;
|
|
304
|
+
return (UChar* )p;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
static int
|
|
308
|
+
get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|
309
|
+
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
|
|
310
|
+
{
|
|
311
|
+
return onigenc_unicode_get_case_fold_codes_by_str(ONIG_ENCODING_UTF8,
|
|
312
|
+
flag, p, end, items);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
OnigEncodingType OnigEncodingUTF8 = {
|
|
316
|
+
mbc_enc_len,
|
|
317
|
+
"UTF-8", /* name */
|
|
318
|
+
6, /* max byte length */
|
|
319
|
+
1, /* min byte length */
|
|
320
|
+
is_mbc_newline,
|
|
321
|
+
mbc_to_code,
|
|
322
|
+
code_to_mbclen,
|
|
323
|
+
code_to_mbc,
|
|
324
|
+
mbc_case_fold,
|
|
325
|
+
onigenc_unicode_apply_all_case_fold,
|
|
326
|
+
get_case_fold_codes_by_str,
|
|
327
|
+
onigenc_unicode_property_name_to_ctype,
|
|
328
|
+
onigenc_unicode_is_code_ctype,
|
|
329
|
+
get_ctype_code_range,
|
|
330
|
+
left_adjust_char_head,
|
|
331
|
+
onigenc_always_true_is_allowed_reverse_match,
|
|
332
|
+
NULL, /* init */
|
|
333
|
+
NULL, /* is_initialized */
|
|
334
|
+
is_valid_mbc_string
|
|
335
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
## Makefile.am for Oniguruma
|
|
2
|
+
lib_onig = ../src/libonig.la
|
|
3
|
+
|
|
4
|
+
AM_LDFLAGS = -L$(prefix)/lib
|
|
5
|
+
AM_CFLAGS =
|
|
6
|
+
AM_CPPFLAGS = -I../src -I$(includedir)
|
|
7
|
+
|
|
8
|
+
TESTS = testc testp testcu
|
|
9
|
+
|
|
10
|
+
check_PROGRAMS = testc testp testcu
|
|
11
|
+
|
|
12
|
+
test: testc testp testcu
|
|
13
|
+
@echo "[Oniguruma API, ASCII/EUC-JP check]"
|
|
14
|
+
@./testc | grep RESULT
|
|
15
|
+
@echo "[POSIX API, ASCII/EUC-JP check]"
|
|
16
|
+
@./testp | grep RESULT
|
|
17
|
+
@echo "[Oniguruma API, UTF-16 check]"
|
|
18
|
+
@./testcu | grep RESULT
|
|
19
|
+
|
|
20
|
+
testc_SOURCES = testc.c
|
|
21
|
+
testc_LDADD = $(lib_onig)
|
|
22
|
+
|
|
23
|
+
testp_SOURCES = testc.c
|
|
24
|
+
testp_LDADD = $(lib_onig)
|
|
25
|
+
testp_CFLAGS = -DPOSIX_TEST
|
|
26
|
+
|
|
27
|
+
testcu_SOURCES = testu.c
|
|
28
|
+
testcu_LDADD = $(lib_onig)
|