@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,67 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
import re
|
|
6
|
+
|
|
7
|
+
REG_LINE_GPERF = re.compile('#line .+gperf"')
|
|
8
|
+
REG_HASH_FUNC = re.compile('hash\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+unsigned\s+int\s+len\s*\)')
|
|
9
|
+
REG_STR_AT = re.compile('str\[(\d+)\]')
|
|
10
|
+
REG_RETURN_TYPE = re.compile('^const\s+int\s*\*')
|
|
11
|
+
REG_FOLD_KEY = re.compile('unicode_fold(\d)_key\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+unsigned\s+int\s+len\)')
|
|
12
|
+
REG_ENTRY = re.compile('\{".*?",\s*(-?\d+)\s*\}')
|
|
13
|
+
REG_IF_LEN = re.compile('if\s*\(\s*len\s*<=\s*MAX_WORD_LENGTH.+')
|
|
14
|
+
REG_GET_HASH = re.compile('(?:register\s+)?(?:unsigned\s+)?int\s+key\s*=\s*hash\s*\(str,\s*len\);')
|
|
15
|
+
REG_GET_CODE = re.compile('(?:register\s+)?const\s+char\s*\*\s*s\s*=\s*wordlist\[key\]\.name;')
|
|
16
|
+
REG_CODE_CHECK = re.compile('if\s*\(\*str\s*==\s*\*s\s*&&\s*!strncmp.+\)')
|
|
17
|
+
REG_RETURN_WL = re.compile('return\s+&wordlist\[key\];')
|
|
18
|
+
REG_RETURN_0 = re.compile('return 0;')
|
|
19
|
+
|
|
20
|
+
def parse_line(s, key_len):
|
|
21
|
+
s = s.rstrip()
|
|
22
|
+
|
|
23
|
+
r = re.sub(REG_LINE_GPERF, '', s)
|
|
24
|
+
if r != s: return r
|
|
25
|
+
r = re.sub(REG_HASH_FUNC, 'hash(OnigCodePoint codes[])', s)
|
|
26
|
+
if r != s: return r
|
|
27
|
+
r = re.sub(REG_STR_AT, 'onig_codes_byte_at(codes, \\1)', s)
|
|
28
|
+
if r != s: return r
|
|
29
|
+
r = re.sub(REG_RETURN_TYPE, 'int', s)
|
|
30
|
+
if r != s: return r
|
|
31
|
+
r = re.sub(REG_FOLD_KEY, 'unicode_fold\\1_key(OnigCodePoint codes[])', s)
|
|
32
|
+
if r != s: return r
|
|
33
|
+
r = re.sub(REG_ENTRY, '\\1', s)
|
|
34
|
+
if r != s: return r
|
|
35
|
+
r = re.sub(REG_IF_LEN, 'if (0 == 0)', s)
|
|
36
|
+
if r != s: return r
|
|
37
|
+
r = re.sub(REG_GET_HASH, 'int key = hash(codes);', s)
|
|
38
|
+
if r != s: return r
|
|
39
|
+
r = re.sub(REG_GET_CODE, 'int index = wordlist[key];', s)
|
|
40
|
+
if r != s: return r
|
|
41
|
+
r = re.sub(REG_CODE_CHECK,
|
|
42
|
+
'if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds%d + index, %d) == 0)' % (key_len, key_len), s)
|
|
43
|
+
if r != s: return r
|
|
44
|
+
|
|
45
|
+
r = re.sub(REG_RETURN_WL, 'return index;', s)
|
|
46
|
+
if r != s: return r
|
|
47
|
+
r = re.sub(REG_RETURN_0, 'return -1;', s)
|
|
48
|
+
if r != s: return r
|
|
49
|
+
|
|
50
|
+
return s
|
|
51
|
+
|
|
52
|
+
def parse_file(f, key_len):
|
|
53
|
+
print "/* This file was converted by gperf_fold_key_conv.py\n from gperf output file. */"
|
|
54
|
+
|
|
55
|
+
line = f.readline()
|
|
56
|
+
while line:
|
|
57
|
+
s = parse_line(line, key_len)
|
|
58
|
+
print s
|
|
59
|
+
line = f.readline()
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# main
|
|
63
|
+
argv = sys.argv
|
|
64
|
+
argc = len(argv)
|
|
65
|
+
|
|
66
|
+
key_len = int(argv[1])
|
|
67
|
+
parse_file(sys.stdin, key_len)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
import re
|
|
6
|
+
|
|
7
|
+
REG_LINE_GPERF = re.compile('#line .+gperf"')
|
|
8
|
+
REG_HASH_FUNC = re.compile('hash\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+unsigned\s+int\s+len\s*\)')
|
|
9
|
+
REG_STR_AT = re.compile('str\[(\d+)\]')
|
|
10
|
+
REG_UNFOLD_KEY = re.compile('unicode_unfold_key\s*\(register\s+const\s+char\s*\*\s*str,\s*register\s+unsigned\s+int\s+len\)')
|
|
11
|
+
REG_ENTRY = re.compile('\{".+?",\s*/\*(.+?)\*/\s*(-?\d+),\s*(\d)\}')
|
|
12
|
+
REG_EMPTY_ENTRY = re.compile('\{"",\s*(-?\d+),\s*(\d)\}')
|
|
13
|
+
REG_IF_LEN = re.compile('if\s*\(\s*len\s*<=\s*MAX_WORD_LENGTH.+')
|
|
14
|
+
REG_GET_HASH = re.compile('(?:register\s+)?(?:unsigned\s+)?int\s+key\s*=\s*hash\s*\(str,\s*len\);')
|
|
15
|
+
REG_GET_CODE = re.compile('(?:register\s+)?const\s+char\s*\*\s*s\s*=\s*wordlist\[key\]\.name;')
|
|
16
|
+
REG_CODE_CHECK = re.compile('if\s*\(\*str\s*==\s*\*s\s*&&\s*!strncmp.+\)')
|
|
17
|
+
|
|
18
|
+
def parse_line(s):
|
|
19
|
+
s = s.rstrip()
|
|
20
|
+
|
|
21
|
+
r = re.sub(REG_LINE_GPERF, '', s)
|
|
22
|
+
if r != s: return r
|
|
23
|
+
r = re.sub(REG_HASH_FUNC, 'hash(OnigCodePoint codes[])', s)
|
|
24
|
+
if r != s: return r
|
|
25
|
+
r = re.sub(REG_STR_AT, 'onig_codes_byte_at(codes, \\1)', s)
|
|
26
|
+
if r != s: return r
|
|
27
|
+
r = re.sub(REG_UNFOLD_KEY, 'unicode_unfold_key(OnigCodePoint code)', s)
|
|
28
|
+
if r != s: return r
|
|
29
|
+
r = re.sub(REG_ENTRY, '{\\1, \\2, \\3}', s)
|
|
30
|
+
if r != s: return r
|
|
31
|
+
r = re.sub(REG_EMPTY_ENTRY, '{0xffffffff, \\1, \\2}', s)
|
|
32
|
+
if r != s: return r
|
|
33
|
+
r = re.sub(REG_IF_LEN, 'if (0 == 0)', s)
|
|
34
|
+
if r != s: return r
|
|
35
|
+
r = re.sub(REG_GET_HASH, 'int key = hash(&code);', s)
|
|
36
|
+
if r != s: return r
|
|
37
|
+
r = re.sub(REG_GET_CODE, 'OnigCodePoint gcode = wordlist[key].code;', s)
|
|
38
|
+
if r != s: return r
|
|
39
|
+
r = re.sub(REG_CODE_CHECK, 'if (code == gcode)', s)
|
|
40
|
+
if r != s: return r
|
|
41
|
+
|
|
42
|
+
return s
|
|
43
|
+
|
|
44
|
+
def parse_file(f):
|
|
45
|
+
print "/* This file was converted by gperf_unfold_key_conv.py\n from gperf output file. */"
|
|
46
|
+
|
|
47
|
+
line = f.readline()
|
|
48
|
+
while line:
|
|
49
|
+
s = parse_line(line)
|
|
50
|
+
print s
|
|
51
|
+
line = f.readline()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# main
|
|
55
|
+
parse_file(sys.stdin)
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**********************************************************************
|
|
2
|
+
iso8859_1.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 ENC_IS_ISO_8859_1_CTYPE(code,ctype) \
|
|
33
|
+
((EncISO_8859_1_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
|
|
34
|
+
|
|
35
|
+
static const unsigned short EncISO_8859_1_CtypeTable[256] = {
|
|
36
|
+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
|
|
37
|
+
0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008,
|
|
38
|
+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
|
|
39
|
+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
|
|
40
|
+
0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
|
|
41
|
+
0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
|
|
42
|
+
0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0,
|
|
43
|
+
0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
|
|
44
|
+
0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2,
|
|
45
|
+
0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
|
|
46
|
+
0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
|
|
47
|
+
0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0,
|
|
48
|
+
0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2,
|
|
49
|
+
0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
|
|
50
|
+
0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
|
|
51
|
+
0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008,
|
|
52
|
+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
|
|
53
|
+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
|
|
54
|
+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
|
|
55
|
+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
|
|
56
|
+
0x0284, 0x01a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
|
|
57
|
+
0x00a0, 0x00a0, 0x30e2, 0x01a0, 0x00a0, 0x01a0, 0x00a0, 0x00a0,
|
|
58
|
+
0x00a0, 0x00a0, 0x10a0, 0x10a0, 0x00a0, 0x30e2, 0x00a0, 0x01a0,
|
|
59
|
+
0x00a0, 0x10a0, 0x30e2, 0x01a0, 0x10a0, 0x10a0, 0x10a0, 0x01a0,
|
|
60
|
+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
|
|
61
|
+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
|
|
62
|
+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0,
|
|
63
|
+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2,
|
|
64
|
+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
|
|
65
|
+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
|
|
66
|
+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x00a0,
|
|
67
|
+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
static const OnigPairCaseFoldCodes CaseFoldMap[] = {
|
|
71
|
+
{ 0xc0, 0xe0 },
|
|
72
|
+
{ 0xc1, 0xe1 },
|
|
73
|
+
{ 0xc2, 0xe2 },
|
|
74
|
+
{ 0xc3, 0xe3 },
|
|
75
|
+
{ 0xc4, 0xe4 },
|
|
76
|
+
{ 0xc5, 0xe5 },
|
|
77
|
+
{ 0xc6, 0xe6 },
|
|
78
|
+
{ 0xc7, 0xe7 },
|
|
79
|
+
{ 0xc8, 0xe8 },
|
|
80
|
+
{ 0xc9, 0xe9 },
|
|
81
|
+
{ 0xca, 0xea },
|
|
82
|
+
{ 0xcb, 0xeb },
|
|
83
|
+
{ 0xcc, 0xec },
|
|
84
|
+
{ 0xcd, 0xed },
|
|
85
|
+
{ 0xce, 0xee },
|
|
86
|
+
{ 0xcf, 0xef },
|
|
87
|
+
|
|
88
|
+
{ 0xd0, 0xf0 },
|
|
89
|
+
{ 0xd1, 0xf1 },
|
|
90
|
+
{ 0xd2, 0xf2 },
|
|
91
|
+
{ 0xd3, 0xf3 },
|
|
92
|
+
{ 0xd4, 0xf4 },
|
|
93
|
+
{ 0xd5, 0xf5 },
|
|
94
|
+
{ 0xd6, 0xf6 },
|
|
95
|
+
{ 0xd8, 0xf8 },
|
|
96
|
+
{ 0xd9, 0xf9 },
|
|
97
|
+
{ 0xda, 0xfa },
|
|
98
|
+
{ 0xdb, 0xfb },
|
|
99
|
+
{ 0xdc, 0xfc },
|
|
100
|
+
{ 0xdd, 0xfd },
|
|
101
|
+
{ 0xde, 0xfe }
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
static int
|
|
105
|
+
apply_all_case_fold(OnigCaseFoldType flag,
|
|
106
|
+
OnigApplyAllCaseFoldFunc f, void* arg)
|
|
107
|
+
{
|
|
108
|
+
return onigenc_apply_all_case_fold_with_map(
|
|
109
|
+
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
|
|
110
|
+
flag, f, arg);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
static int
|
|
114
|
+
get_case_fold_codes_by_str(OnigCaseFoldType flag ARG_UNUSED,
|
|
115
|
+
const OnigUChar* p, const OnigUChar* end,
|
|
116
|
+
OnigCaseFoldCodeItem items[])
|
|
117
|
+
{
|
|
118
|
+
if (0x41 <= *p && *p <= 0x5a) {
|
|
119
|
+
items[0].byte_len = 1;
|
|
120
|
+
items[0].code_len = 1;
|
|
121
|
+
items[0].code[0] = (OnigCodePoint )(*p + 0x20);
|
|
122
|
+
if (*p == 0x53 && end > p + 1
|
|
123
|
+
&& (*(p+1) == 0x53 || *(p+1) == 0x73)) { /* SS */
|
|
124
|
+
items[1].byte_len = 2;
|
|
125
|
+
items[1].code_len = 1;
|
|
126
|
+
items[1].code[0] = (OnigCodePoint )0xdf;
|
|
127
|
+
return 2;
|
|
128
|
+
}
|
|
129
|
+
else
|
|
130
|
+
return 1;
|
|
131
|
+
}
|
|
132
|
+
else if (0x61 <= *p && *p <= 0x7a) {
|
|
133
|
+
items[0].byte_len = 1;
|
|
134
|
+
items[0].code_len = 1;
|
|
135
|
+
items[0].code[0] = (OnigCodePoint )(*p - 0x20);
|
|
136
|
+
if (*p == 0x73 && end > p + 1
|
|
137
|
+
&& (*(p+1) == 0x73 || *(p+1) == 0x53)) { /* ss */
|
|
138
|
+
items[1].byte_len = 2;
|
|
139
|
+
items[1].code_len = 1;
|
|
140
|
+
items[1].code[0] = (OnigCodePoint )0xdf;
|
|
141
|
+
return 2;
|
|
142
|
+
}
|
|
143
|
+
else
|
|
144
|
+
return 1;
|
|
145
|
+
}
|
|
146
|
+
else if (0xc0 <= *p && *p <= 0xcf) {
|
|
147
|
+
items[0].byte_len = 1;
|
|
148
|
+
items[0].code_len = 1;
|
|
149
|
+
items[0].code[0] = (OnigCodePoint )(*p + 0x20);
|
|
150
|
+
return 1;
|
|
151
|
+
}
|
|
152
|
+
else if (0xd0 <= *p && *p <= 0xdf) {
|
|
153
|
+
if (*p == 0xdf) {
|
|
154
|
+
items[0].byte_len = 1;
|
|
155
|
+
items[0].code_len = 2;
|
|
156
|
+
items[0].code[0] = (OnigCodePoint )'s';
|
|
157
|
+
items[0].code[1] = (OnigCodePoint )'s';
|
|
158
|
+
|
|
159
|
+
items[1].byte_len = 1;
|
|
160
|
+
items[1].code_len = 2;
|
|
161
|
+
items[1].code[0] = (OnigCodePoint )'S';
|
|
162
|
+
items[1].code[1] = (OnigCodePoint )'S';
|
|
163
|
+
|
|
164
|
+
items[2].byte_len = 1;
|
|
165
|
+
items[2].code_len = 2;
|
|
166
|
+
items[2].code[0] = (OnigCodePoint )'s';
|
|
167
|
+
items[2].code[1] = (OnigCodePoint )'S';
|
|
168
|
+
|
|
169
|
+
items[3].byte_len = 1;
|
|
170
|
+
items[3].code_len = 2;
|
|
171
|
+
items[3].code[0] = (OnigCodePoint )'S';
|
|
172
|
+
items[3].code[1] = (OnigCodePoint )'s';
|
|
173
|
+
|
|
174
|
+
return 4;
|
|
175
|
+
}
|
|
176
|
+
else if (*p != 0xd7) {
|
|
177
|
+
items[0].byte_len = 1;
|
|
178
|
+
items[0].code_len = 1;
|
|
179
|
+
items[0].code[0] = (OnigCodePoint )(*p + 0x20);
|
|
180
|
+
return 1;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else if (0xe0 <= *p && *p <= 0xef) {
|
|
184
|
+
items[0].byte_len = 1;
|
|
185
|
+
items[0].code_len = 1;
|
|
186
|
+
items[0].code[0] = (OnigCodePoint )(*p - 0x20);
|
|
187
|
+
return 1;
|
|
188
|
+
}
|
|
189
|
+
else if (0xf0 <= *p && *p <= 0xfe) {
|
|
190
|
+
if (*p != 0xf7) {
|
|
191
|
+
items[0].byte_len = 1;
|
|
192
|
+
items[0].code_len = 1;
|
|
193
|
+
items[0].code[0] = (OnigCodePoint )(*p - 0x20);
|
|
194
|
+
return 1;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
static int
|
|
202
|
+
mbc_case_fold(OnigCaseFoldType flag, const UChar** pp,
|
|
203
|
+
const UChar* end ARG_UNUSED, UChar* lower)
|
|
204
|
+
{
|
|
205
|
+
const UChar* p = *pp;
|
|
206
|
+
|
|
207
|
+
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
|
|
208
|
+
*lower++ = 's';
|
|
209
|
+
*lower = 's';
|
|
210
|
+
(*pp)++;
|
|
211
|
+
return 2;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
*lower = ONIGENC_ISO_8859_1_TO_LOWER_CASE(*p);
|
|
215
|
+
(*pp)++;
|
|
216
|
+
return 1;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
#if 0
|
|
220
|
+
static int
|
|
221
|
+
is_mbc_ambiguous(OnigCaseFoldType flag,
|
|
222
|
+
const UChar** pp, const UChar* end)
|
|
223
|
+
{
|
|
224
|
+
int v;
|
|
225
|
+
const UChar* p = *pp;
|
|
226
|
+
|
|
227
|
+
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
|
|
228
|
+
(*pp)++;
|
|
229
|
+
return TRUE;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
(*pp)++;
|
|
233
|
+
v = (EncISO_8859_1_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
|
|
234
|
+
if ((v | BIT_CTYPE_LOWER) != 0) {
|
|
235
|
+
/* 0xdf, 0xaa, 0xb5, 0xba are lower case letter, but can't convert. */
|
|
236
|
+
if (*p >= 0xaa && *p <= 0xba)
|
|
237
|
+
return FALSE;
|
|
238
|
+
else
|
|
239
|
+
return TRUE;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return (v != 0 ? TRUE : FALSE);
|
|
243
|
+
}
|
|
244
|
+
#endif
|
|
245
|
+
|
|
246
|
+
static int
|
|
247
|
+
is_code_ctype(OnigCodePoint code, unsigned int ctype)
|
|
248
|
+
{
|
|
249
|
+
if (code < 256)
|
|
250
|
+
return ENC_IS_ISO_8859_1_CTYPE(code, ctype);
|
|
251
|
+
else
|
|
252
|
+
return FALSE;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
OnigEncodingType OnigEncodingISO_8859_1 = {
|
|
256
|
+
onigenc_single_byte_mbc_enc_len,
|
|
257
|
+
"ISO-8859-1", /* name */
|
|
258
|
+
1, /* max enc length */
|
|
259
|
+
1, /* min enc length */
|
|
260
|
+
onigenc_is_mbc_newline_0x0a,
|
|
261
|
+
onigenc_single_byte_mbc_to_code,
|
|
262
|
+
onigenc_single_byte_code_to_mbclen,
|
|
263
|
+
onigenc_single_byte_code_to_mbc,
|
|
264
|
+
mbc_case_fold,
|
|
265
|
+
apply_all_case_fold,
|
|
266
|
+
get_case_fold_codes_by_str,
|
|
267
|
+
onigenc_minimum_property_name_to_ctype,
|
|
268
|
+
is_code_ctype,
|
|
269
|
+
onigenc_not_support_get_ctype_code_range,
|
|
270
|
+
onigenc_single_byte_left_adjust_char_head,
|
|
271
|
+
onigenc_always_true_is_allowed_reverse_match,
|
|
272
|
+
NULL, /* init */
|
|
273
|
+
NULL, /* is_initialized */
|
|
274
|
+
onigenc_always_true_is_valid_mbc_string
|
|
275
|
+
};
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**********************************************************************
|
|
2
|
+
iso8859_10.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 ENC_ISO_8859_10_TO_LOWER_CASE(c) EncISO_8859_10_ToLowerCaseTable[c]
|
|
33
|
+
#define ENC_IS_ISO_8859_10_CTYPE(code,ctype) \
|
|
34
|
+
((EncISO_8859_10_CtypeTable[code] & CTYPE_TO_BIT(ctype)) != 0)
|
|
35
|
+
|
|
36
|
+
static const UChar EncISO_8859_10_ToLowerCaseTable[256] = {
|
|
37
|
+
'\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
|
|
38
|
+
'\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
|
|
39
|
+
'\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
|
|
40
|
+
'\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
|
|
41
|
+
'\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
|
|
42
|
+
'\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
|
|
43
|
+
'\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
|
|
44
|
+
'\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
|
|
45
|
+
'\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
|
|
46
|
+
'\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
|
|
47
|
+
'\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
|
|
48
|
+
'\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
|
|
49
|
+
'\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
|
|
50
|
+
'\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
|
|
51
|
+
'\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
|
|
52
|
+
'\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
|
|
53
|
+
'\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
|
|
54
|
+
'\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
|
|
55
|
+
'\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
|
|
56
|
+
'\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
|
|
57
|
+
'\240', '\261', '\262', '\263', '\264', '\265', '\266', '\247',
|
|
58
|
+
'\270', '\271', '\272', '\273', '\274', '\255', '\276', '\277',
|
|
59
|
+
'\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
|
|
60
|
+
'\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
|
|
61
|
+
'\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
|
|
62
|
+
'\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
|
|
63
|
+
'\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
|
|
64
|
+
'\370', '\371', '\372', '\373', '\374', '\375', '\376', '\337',
|
|
65
|
+
'\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
|
|
66
|
+
'\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
|
|
67
|
+
'\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
|
|
68
|
+
'\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
static const unsigned short EncISO_8859_10_CtypeTable[256] = {
|
|
72
|
+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
|
|
73
|
+
0x4008, 0x420c, 0x4209, 0x4208, 0x4208, 0x4208, 0x4008, 0x4008,
|
|
74
|
+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
|
|
75
|
+
0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008, 0x4008,
|
|
76
|
+
0x4284, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
|
|
77
|
+
0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
|
|
78
|
+
0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0, 0x78b0,
|
|
79
|
+
0x78b0, 0x78b0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x41a0,
|
|
80
|
+
0x41a0, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x7ca2, 0x74a2,
|
|
81
|
+
0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
|
|
82
|
+
0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2, 0x74a2,
|
|
83
|
+
0x74a2, 0x74a2, 0x74a2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x51a0,
|
|
84
|
+
0x41a0, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x78e2, 0x70e2,
|
|
85
|
+
0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
|
|
86
|
+
0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2, 0x70e2,
|
|
87
|
+
0x70e2, 0x70e2, 0x70e2, 0x41a0, 0x41a0, 0x41a0, 0x41a0, 0x4008,
|
|
88
|
+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
|
|
89
|
+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
|
|
90
|
+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
|
|
91
|
+
0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
|
|
92
|
+
0x0284, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x00a0,
|
|
93
|
+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x01a0, 0x34a2, 0x34a2,
|
|
94
|
+
0x00a0, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x01a0,
|
|
95
|
+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x01a0, 0x30e2, 0x30e2,
|
|
96
|
+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
|
|
97
|
+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
|
|
98
|
+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2,
|
|
99
|
+
0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x34a2, 0x30e2,
|
|
100
|
+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
|
|
101
|
+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
|
|
102
|
+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2,
|
|
103
|
+
0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2, 0x30e2
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
static int
|
|
107
|
+
mbc_case_fold(OnigCaseFoldType flag,
|
|
108
|
+
const UChar** pp, const UChar* end ARG_UNUSED, UChar* lower)
|
|
109
|
+
{
|
|
110
|
+
const UChar* p = *pp;
|
|
111
|
+
|
|
112
|
+
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
|
|
113
|
+
*lower++ = 's';
|
|
114
|
+
*lower = 's';
|
|
115
|
+
(*pp)++;
|
|
116
|
+
return 2;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
*lower = ENC_ISO_8859_10_TO_LOWER_CASE(*p);
|
|
120
|
+
(*pp)++;
|
|
121
|
+
return 1;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
#if 0
|
|
125
|
+
static int
|
|
126
|
+
is_mbc_ambiguous(OnigCaseFoldType flag, const UChar** pp, const UChar* end)
|
|
127
|
+
{
|
|
128
|
+
int v;
|
|
129
|
+
const UChar* p = *pp;
|
|
130
|
+
|
|
131
|
+
if (*p == 0xdf && (flag & INTERNAL_ONIGENC_CASE_FOLD_MULTI_CHAR) != 0) {
|
|
132
|
+
(*pp)++;
|
|
133
|
+
return TRUE;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
(*pp)++;
|
|
137
|
+
v = (EncISO_8859_10_CtypeTable[*p] & (BIT_CTYPE_UPPER | BIT_CTYPE_LOWER));
|
|
138
|
+
if ((v | BIT_CTYPE_LOWER) != 0) {
|
|
139
|
+
return TRUE;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return (v != 0 ? TRUE : FALSE);
|
|
143
|
+
}
|
|
144
|
+
#endif
|
|
145
|
+
|
|
146
|
+
static int
|
|
147
|
+
is_code_ctype(OnigCodePoint code, unsigned int ctype)
|
|
148
|
+
{
|
|
149
|
+
if (code < 256)
|
|
150
|
+
return ENC_IS_ISO_8859_10_CTYPE(code, ctype);
|
|
151
|
+
else
|
|
152
|
+
return FALSE;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static const OnigPairCaseFoldCodes CaseFoldMap[] = {
|
|
156
|
+
{ 0xa1, 0xb1 },
|
|
157
|
+
{ 0xa2, 0xb2 },
|
|
158
|
+
{ 0xa3, 0xb3 },
|
|
159
|
+
{ 0xa4, 0xb4 },
|
|
160
|
+
{ 0xa5, 0xb5 },
|
|
161
|
+
{ 0xa6, 0xb6 },
|
|
162
|
+
{ 0xa8, 0xb8 },
|
|
163
|
+
{ 0xa9, 0xb9 },
|
|
164
|
+
{ 0xaa, 0xba },
|
|
165
|
+
{ 0xab, 0xbb },
|
|
166
|
+
{ 0xac, 0xbc },
|
|
167
|
+
{ 0xae, 0xbe },
|
|
168
|
+
{ 0xaf, 0xbf },
|
|
169
|
+
|
|
170
|
+
{ 0xc0, 0xe0 },
|
|
171
|
+
{ 0xc1, 0xe1 },
|
|
172
|
+
{ 0xc2, 0xe2 },
|
|
173
|
+
{ 0xc3, 0xe3 },
|
|
174
|
+
{ 0xc4, 0xe4 },
|
|
175
|
+
{ 0xc5, 0xe5 },
|
|
176
|
+
{ 0xc6, 0xe6 },
|
|
177
|
+
{ 0xc7, 0xe7 },
|
|
178
|
+
{ 0xc8, 0xe8 },
|
|
179
|
+
{ 0xc9, 0xe9 },
|
|
180
|
+
{ 0xca, 0xea },
|
|
181
|
+
{ 0xcb, 0xeb },
|
|
182
|
+
{ 0xcc, 0xec },
|
|
183
|
+
{ 0xcd, 0xed },
|
|
184
|
+
{ 0xce, 0xee },
|
|
185
|
+
{ 0xcf, 0xef },
|
|
186
|
+
|
|
187
|
+
{ 0xd0, 0xf0 },
|
|
188
|
+
{ 0xd1, 0xf1 },
|
|
189
|
+
{ 0xd2, 0xf2 },
|
|
190
|
+
{ 0xd3, 0xf3 },
|
|
191
|
+
{ 0xd4, 0xf4 },
|
|
192
|
+
{ 0xd5, 0xf5 },
|
|
193
|
+
{ 0xd6, 0xf6 },
|
|
194
|
+
{ 0xd7, 0xf7 },
|
|
195
|
+
{ 0xd8, 0xf8 },
|
|
196
|
+
{ 0xd9, 0xf9 },
|
|
197
|
+
{ 0xda, 0xfa },
|
|
198
|
+
{ 0xdb, 0xfb },
|
|
199
|
+
{ 0xdc, 0xfc },
|
|
200
|
+
{ 0xdd, 0xfd },
|
|
201
|
+
{ 0xde, 0xfe }
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
static int
|
|
205
|
+
apply_all_case_fold(OnigCaseFoldType flag,
|
|
206
|
+
OnigApplyAllCaseFoldFunc f, void* arg)
|
|
207
|
+
{
|
|
208
|
+
return onigenc_apply_all_case_fold_with_map(
|
|
209
|
+
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
|
|
210
|
+
flag, f, arg);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
static int
|
|
214
|
+
get_case_fold_codes_by_str(OnigCaseFoldType flag,
|
|
215
|
+
const OnigUChar* p, const OnigUChar* end, OnigCaseFoldCodeItem items[])
|
|
216
|
+
{
|
|
217
|
+
return onigenc_get_case_fold_codes_by_str_with_map(
|
|
218
|
+
sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
|
|
219
|
+
flag, p, end, items);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
OnigEncodingType OnigEncodingISO_8859_10 = {
|
|
223
|
+
onigenc_single_byte_mbc_enc_len,
|
|
224
|
+
"ISO-8859-10", /* name */
|
|
225
|
+
1, /* max enc length */
|
|
226
|
+
1, /* min enc length */
|
|
227
|
+
onigenc_is_mbc_newline_0x0a,
|
|
228
|
+
onigenc_single_byte_mbc_to_code,
|
|
229
|
+
onigenc_single_byte_code_to_mbclen,
|
|
230
|
+
onigenc_single_byte_code_to_mbc,
|
|
231
|
+
mbc_case_fold,
|
|
232
|
+
apply_all_case_fold,
|
|
233
|
+
get_case_fold_codes_by_str,
|
|
234
|
+
onigenc_minimum_property_name_to_ctype,
|
|
235
|
+
is_code_ctype,
|
|
236
|
+
onigenc_not_support_get_ctype_code_range,
|
|
237
|
+
onigenc_single_byte_left_adjust_char_head,
|
|
238
|
+
onigenc_always_true_is_allowed_reverse_match,
|
|
239
|
+
NULL, /* init */
|
|
240
|
+
NULL, /* is_initialized */
|
|
241
|
+
onigenc_always_true_is_valid_mbc_string
|
|
242
|
+
};
|