@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,545 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
import re
|
|
6
|
+
|
|
7
|
+
POSIX_LIST = [
|
|
8
|
+
'NEWLINE', 'Alpha', 'Blank', 'Cntrl', 'Digit', 'Graph', 'Lower',
|
|
9
|
+
'Print', 'Punct', 'Space', 'Upper', 'XDigit', 'Word', 'Alnum', 'ASCII'
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
MAX_CODE_POINT = 0x10ffff
|
|
13
|
+
|
|
14
|
+
UD_FIRST_REG = re.compile("<.+,\s*First>")
|
|
15
|
+
UD_LAST_REG = re.compile("<.+,\s*Last>")
|
|
16
|
+
PR_TOTAL_REG = re.compile("#\s*Total\s+code\s+points:")
|
|
17
|
+
PR_LINE_REG = re.compile("([0-9A-Fa-f]+)(?:..([0-9A-Fa-f]+))?\s*;\s*(\w+)")
|
|
18
|
+
PA_LINE_REG = re.compile("(\w+)\s*;\s*(\w+)")
|
|
19
|
+
PVA_LINE_REG = re.compile("(sc|gc)\s*;\s*(\w+)\s*;\s*(\w+)(?:\s*;\s*(\w+))?")
|
|
20
|
+
BL_LINE_REG = re.compile("([0-9A-Fa-f]+)\.\.([0-9A-Fa-f]+)\s*;\s*(.*)")
|
|
21
|
+
VERSION_REG = re.compile("#\s*.*-(\d\.\d\.\d)\.txt")
|
|
22
|
+
|
|
23
|
+
VERSION_INFO = None
|
|
24
|
+
DIC = { }
|
|
25
|
+
KDIC = { }
|
|
26
|
+
PropIndex = { }
|
|
27
|
+
PROPERTY_NAME_MAX_LEN = 0
|
|
28
|
+
|
|
29
|
+
def normalize_prop_name(name):
|
|
30
|
+
name = re.sub(r'[ _]', '', name)
|
|
31
|
+
name = name.lower()
|
|
32
|
+
return name
|
|
33
|
+
|
|
34
|
+
def fix_block_name(name):
|
|
35
|
+
s = re.sub(r'[- ]+', '_', name)
|
|
36
|
+
return 'In_' + s
|
|
37
|
+
|
|
38
|
+
def check_version_info(s):
|
|
39
|
+
global VERSION_INFO
|
|
40
|
+
m = VERSION_REG.match(s)
|
|
41
|
+
if m is not None:
|
|
42
|
+
VERSION_INFO = m.group(1)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def print_ranges(ranges):
|
|
46
|
+
for (start, end) in ranges:
|
|
47
|
+
print "0x%06x, 0x%06x" % (start, end)
|
|
48
|
+
|
|
49
|
+
print len(ranges)
|
|
50
|
+
|
|
51
|
+
def print_prop_and_index(prop, i):
|
|
52
|
+
print "%-35s %3d" % (prop + ',', i)
|
|
53
|
+
PropIndex[prop] = i
|
|
54
|
+
|
|
55
|
+
print_cache = { }
|
|
56
|
+
|
|
57
|
+
def print_property(prop, data, desc):
|
|
58
|
+
print ''
|
|
59
|
+
print "/* PROPERTY: '%s': %s */" % (prop, desc)
|
|
60
|
+
|
|
61
|
+
prev_prop = dic_find_by_value(print_cache, data)
|
|
62
|
+
if prev_prop is not None:
|
|
63
|
+
print "#define CR_%s CR_%s" % (prop, prev_prop)
|
|
64
|
+
else:
|
|
65
|
+
print_cache[prop] = data
|
|
66
|
+
print "static const OnigCodePoint"
|
|
67
|
+
print "CR_%s[] = { %d," % (prop, len(data))
|
|
68
|
+
for (start, end) in data:
|
|
69
|
+
print "0x%04x, 0x%04x," % (start, end)
|
|
70
|
+
|
|
71
|
+
print "}; /* END of CR_%s */" % prop
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def dic_find_by_value(dic, v):
|
|
75
|
+
for key, val in dic.items():
|
|
76
|
+
if val == v:
|
|
77
|
+
return key
|
|
78
|
+
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def normalize_ranges(in_ranges, sort=False):
|
|
83
|
+
if sort:
|
|
84
|
+
ranges = sorted(in_ranges)
|
|
85
|
+
else:
|
|
86
|
+
ranges = in_ranges
|
|
87
|
+
|
|
88
|
+
r = []
|
|
89
|
+
prev = None
|
|
90
|
+
for (start, end) in ranges:
|
|
91
|
+
if prev >= start - 1:
|
|
92
|
+
(pstart, pend) = r.pop()
|
|
93
|
+
end = max(pend, end)
|
|
94
|
+
start = pstart
|
|
95
|
+
|
|
96
|
+
r.append((start, end))
|
|
97
|
+
prev = end
|
|
98
|
+
|
|
99
|
+
return r
|
|
100
|
+
|
|
101
|
+
def inverse_ranges(in_ranges):
|
|
102
|
+
r = []
|
|
103
|
+
prev = 0x000000
|
|
104
|
+
for (start, end) in in_ranges:
|
|
105
|
+
if prev < start:
|
|
106
|
+
r.append((prev, start - 1))
|
|
107
|
+
|
|
108
|
+
prev = end + 1
|
|
109
|
+
|
|
110
|
+
if prev < MAX_CODE_POINT:
|
|
111
|
+
r.append((prev, MAX_CODE_POINT))
|
|
112
|
+
|
|
113
|
+
return r
|
|
114
|
+
|
|
115
|
+
def add_ranges(r1, r2):
|
|
116
|
+
r = r1 + r2
|
|
117
|
+
return normalize_ranges(r, True)
|
|
118
|
+
|
|
119
|
+
def sub_one_range(one_range, rs):
|
|
120
|
+
r = []
|
|
121
|
+
(s1, e1) = one_range
|
|
122
|
+
n = len(rs)
|
|
123
|
+
for i in range(0, n):
|
|
124
|
+
(s2, e2) = rs[i]
|
|
125
|
+
if s2 >= s1 and s2 <= e1:
|
|
126
|
+
if s2 > s1:
|
|
127
|
+
r.append((s1, s2 - 1))
|
|
128
|
+
if e2 >= e1:
|
|
129
|
+
return r
|
|
130
|
+
|
|
131
|
+
s1 = e2 + 1
|
|
132
|
+
elif s2 < s1 and e2 >= s1:
|
|
133
|
+
if e2 < e1:
|
|
134
|
+
s1 = e2 + 1
|
|
135
|
+
else:
|
|
136
|
+
return r
|
|
137
|
+
|
|
138
|
+
r.append((s1, e1))
|
|
139
|
+
return r
|
|
140
|
+
|
|
141
|
+
def sub_ranges(r1, r2):
|
|
142
|
+
r = []
|
|
143
|
+
for one_range in r1:
|
|
144
|
+
rs = sub_one_range(one_range, r2)
|
|
145
|
+
r.extend(rs)
|
|
146
|
+
|
|
147
|
+
return r
|
|
148
|
+
|
|
149
|
+
def add_ranges_in_dic(dic):
|
|
150
|
+
r = []
|
|
151
|
+
for k, v in dic.items():
|
|
152
|
+
r = r + v
|
|
153
|
+
|
|
154
|
+
return normalize_ranges(r, True)
|
|
155
|
+
|
|
156
|
+
def normalize_ranges_in_dic(dic, sort=False):
|
|
157
|
+
for k, v in dic.items():
|
|
158
|
+
r = normalize_ranges(v, sort)
|
|
159
|
+
dic[k] = r
|
|
160
|
+
|
|
161
|
+
def merge_dic(to_dic, from_dic):
|
|
162
|
+
to_keys = to_dic.keys()
|
|
163
|
+
from_keys = from_dic.keys()
|
|
164
|
+
common = list(set(to_keys) & set(from_keys))
|
|
165
|
+
if len(common) != 0:
|
|
166
|
+
print >> sys.stderr, "merge_dic: collision: %s" % sorted(common)
|
|
167
|
+
|
|
168
|
+
to_dic.update(from_dic)
|
|
169
|
+
|
|
170
|
+
def merge_props(to_props, from_props):
|
|
171
|
+
common = list(set(to_props) & set(from_props))
|
|
172
|
+
if len(common) != 0:
|
|
173
|
+
print >> sys.stderr, "merge_props: collision: %s" % sorted(common)
|
|
174
|
+
|
|
175
|
+
to_props.extend(from_props)
|
|
176
|
+
|
|
177
|
+
def add_range_into_dic(dic, name, start, end):
|
|
178
|
+
d = dic.get(name, None)
|
|
179
|
+
if d is None:
|
|
180
|
+
d = [(start, end)]
|
|
181
|
+
dic[name] = d
|
|
182
|
+
else:
|
|
183
|
+
d.append((start, end))
|
|
184
|
+
|
|
185
|
+
def list_sub(a, b):
|
|
186
|
+
x = set(a) - set(b)
|
|
187
|
+
return list(x)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def parse_unicode_data_file(f):
|
|
191
|
+
dic = { }
|
|
192
|
+
assigned = []
|
|
193
|
+
for line in f:
|
|
194
|
+
s = line.strip()
|
|
195
|
+
if len(s) == 0:
|
|
196
|
+
continue
|
|
197
|
+
if s[0] == '#':
|
|
198
|
+
continue
|
|
199
|
+
|
|
200
|
+
a = s.split(';')
|
|
201
|
+
code = int(a[0], 16)
|
|
202
|
+
desc = a[1]
|
|
203
|
+
prop = a[2]
|
|
204
|
+
if UD_FIRST_REG.match(desc) is not None:
|
|
205
|
+
start = code
|
|
206
|
+
end = None
|
|
207
|
+
elif UD_LAST_REG.match(desc) is not None:
|
|
208
|
+
end = code
|
|
209
|
+
else:
|
|
210
|
+
start = end = code
|
|
211
|
+
|
|
212
|
+
if end is not None:
|
|
213
|
+
assigned.append((start, end))
|
|
214
|
+
add_range_into_dic(dic, prop, start, end)
|
|
215
|
+
if len(prop) == 2:
|
|
216
|
+
add_range_into_dic(dic, prop[0:1], start, end)
|
|
217
|
+
|
|
218
|
+
normalize_ranges_in_dic(dic)
|
|
219
|
+
return dic, assigned
|
|
220
|
+
|
|
221
|
+
def parse_properties(path, klass):
|
|
222
|
+
with open(path, 'r') as f:
|
|
223
|
+
dic = { }
|
|
224
|
+
prop = None
|
|
225
|
+
props = []
|
|
226
|
+
for line in f:
|
|
227
|
+
s = line.strip()
|
|
228
|
+
if len(s) == 0:
|
|
229
|
+
continue
|
|
230
|
+
|
|
231
|
+
if s[0] == '#':
|
|
232
|
+
if VERSION_INFO is None:
|
|
233
|
+
check_version_info(s)
|
|
234
|
+
|
|
235
|
+
m = PR_LINE_REG.match(s)
|
|
236
|
+
if m:
|
|
237
|
+
prop = m.group(3)
|
|
238
|
+
if m.group(2):
|
|
239
|
+
start = int(m.group(1), 16)
|
|
240
|
+
end = int(m.group(2), 16)
|
|
241
|
+
add_range_into_dic(dic, prop, start, end)
|
|
242
|
+
else:
|
|
243
|
+
start = int(m.group(1), 16)
|
|
244
|
+
add_range_into_dic(dic, prop, start, start)
|
|
245
|
+
|
|
246
|
+
elif PR_TOTAL_REG.match(s) is not None:
|
|
247
|
+
KDIC[prop] = klass
|
|
248
|
+
props.append(prop)
|
|
249
|
+
|
|
250
|
+
normalize_ranges_in_dic(dic)
|
|
251
|
+
return (dic, props)
|
|
252
|
+
|
|
253
|
+
def parse_property_aliases(path):
|
|
254
|
+
a = { }
|
|
255
|
+
with open(path, 'r') as f:
|
|
256
|
+
for line in f:
|
|
257
|
+
s = line.strip()
|
|
258
|
+
if len(s) == 0:
|
|
259
|
+
continue
|
|
260
|
+
|
|
261
|
+
m = PA_LINE_REG.match(s)
|
|
262
|
+
if not(m):
|
|
263
|
+
continue
|
|
264
|
+
|
|
265
|
+
if m.group(1) == m.group(2):
|
|
266
|
+
continue
|
|
267
|
+
|
|
268
|
+
a[m.group(1)] = m.group(2)
|
|
269
|
+
|
|
270
|
+
return a
|
|
271
|
+
|
|
272
|
+
def parse_property_value_aliases(path):
|
|
273
|
+
a = { }
|
|
274
|
+
with open(path, 'r') as f:
|
|
275
|
+
for line in f:
|
|
276
|
+
s = line.strip()
|
|
277
|
+
if len(s) == 0:
|
|
278
|
+
continue
|
|
279
|
+
|
|
280
|
+
m = PVA_LINE_REG.match(s)
|
|
281
|
+
if not(m):
|
|
282
|
+
continue
|
|
283
|
+
|
|
284
|
+
cat = m.group(1)
|
|
285
|
+
x2 = m.group(2)
|
|
286
|
+
x3 = m.group(3)
|
|
287
|
+
x4 = m.group(4)
|
|
288
|
+
if cat == 'sc':
|
|
289
|
+
if x2 != x3:
|
|
290
|
+
a[x2] = x3
|
|
291
|
+
if x4 and x4 != x3:
|
|
292
|
+
a[x4] = x3
|
|
293
|
+
else:
|
|
294
|
+
if x2 != x3:
|
|
295
|
+
a[x3] = x2
|
|
296
|
+
if x4 and x4 != x2:
|
|
297
|
+
a[x4] = x2
|
|
298
|
+
|
|
299
|
+
return a
|
|
300
|
+
|
|
301
|
+
def parse_blocks(path):
|
|
302
|
+
dic = { }
|
|
303
|
+
blocks = []
|
|
304
|
+
with open(path, 'r') as f:
|
|
305
|
+
for line in f:
|
|
306
|
+
s = line.strip()
|
|
307
|
+
if len(s) == 0:
|
|
308
|
+
continue
|
|
309
|
+
|
|
310
|
+
m = BL_LINE_REG.match(s)
|
|
311
|
+
if not(m):
|
|
312
|
+
continue
|
|
313
|
+
|
|
314
|
+
start = int(m.group(1), 16)
|
|
315
|
+
end = int(m.group(2), 16)
|
|
316
|
+
block = fix_block_name(m.group(3))
|
|
317
|
+
add_range_into_dic(dic, block, start, end)
|
|
318
|
+
blocks.append(block)
|
|
319
|
+
|
|
320
|
+
noblock = fix_block_name('No_Block')
|
|
321
|
+
dic[noblock] = inverse_ranges(add_ranges_in_dic(dic))
|
|
322
|
+
blocks.append(noblock)
|
|
323
|
+
return dic, blocks
|
|
324
|
+
|
|
325
|
+
def add_primitive_props(assigned):
|
|
326
|
+
DIC['Assigned'] = normalize_ranges(assigned)
|
|
327
|
+
DIC['Any'] = [(0x000000, 0x10ffff)]
|
|
328
|
+
DIC['ASCII'] = [(0x000000, 0x00007f)]
|
|
329
|
+
DIC['NEWLINE'] = [(0x00000a, 0x00000a)]
|
|
330
|
+
DIC['Cn'] = inverse_ranges(DIC['Assigned'])
|
|
331
|
+
DIC['C'].extend(DIC['Cn'])
|
|
332
|
+
DIC['C'] = normalize_ranges(DIC['C'], True)
|
|
333
|
+
|
|
334
|
+
d = []
|
|
335
|
+
d.extend(DIC['Ll'])
|
|
336
|
+
d.extend(DIC['Lt'])
|
|
337
|
+
d.extend(DIC['Lu'])
|
|
338
|
+
DIC['LC'] = normalize_ranges(d, True)
|
|
339
|
+
|
|
340
|
+
def add_posix_props(dic):
|
|
341
|
+
alnum = []
|
|
342
|
+
alnum.extend(dic['Alphabetic'])
|
|
343
|
+
alnum.extend(dic['Nd']) # Nd == Decimal_Number
|
|
344
|
+
alnum = normalize_ranges(alnum, True)
|
|
345
|
+
|
|
346
|
+
blank = [(0x0009, 0x0009)]
|
|
347
|
+
blank.extend(dic['Zs']) # Zs == Space_Separator
|
|
348
|
+
blank = normalize_ranges(blank, True)
|
|
349
|
+
|
|
350
|
+
word = []
|
|
351
|
+
word.extend(dic['Alphabetic'])
|
|
352
|
+
word.extend(dic['M']) # M == Mark
|
|
353
|
+
word.extend(dic['Nd'])
|
|
354
|
+
word.extend(dic['Pc']) # Pc == Connector_Punctuation
|
|
355
|
+
word = normalize_ranges(word, True)
|
|
356
|
+
|
|
357
|
+
graph = sub_ranges(dic['Any'], dic['White_Space'])
|
|
358
|
+
graph = sub_ranges(graph, dic['Cc'])
|
|
359
|
+
graph = sub_ranges(graph, dic['Cs']) # Cs == Surrogate
|
|
360
|
+
graph = sub_ranges(graph, dic['Cn']) # Cn == Unassigned
|
|
361
|
+
graph = normalize_ranges(graph, True)
|
|
362
|
+
|
|
363
|
+
p = []
|
|
364
|
+
p.extend(graph)
|
|
365
|
+
p.extend(dic['Zs'])
|
|
366
|
+
p = normalize_ranges(p, True)
|
|
367
|
+
|
|
368
|
+
dic['Alpha'] = dic['Alphabetic']
|
|
369
|
+
dic['Upper'] = dic['Uppercase']
|
|
370
|
+
dic['Lower'] = dic['Lowercase']
|
|
371
|
+
dic['Punct'] = dic['P'] # P == Punctuation
|
|
372
|
+
dic['Digit'] = dic['Nd']
|
|
373
|
+
dic['XDigit'] = [(0x0030, 0x0039), (0x0041, 0x0046), (0x0061, 0x0066)]
|
|
374
|
+
dic['Alnum'] = alnum
|
|
375
|
+
dic['Space'] = dic['White_Space']
|
|
376
|
+
dic['Blank'] = blank
|
|
377
|
+
dic['Cntrl'] = dic['Cc']
|
|
378
|
+
dic['Word'] = word
|
|
379
|
+
dic['Graph'] = graph
|
|
380
|
+
dic['Print'] = p
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
def set_max_prop_name(name):
|
|
384
|
+
global PROPERTY_NAME_MAX_LEN
|
|
385
|
+
n = len(name)
|
|
386
|
+
if n > PROPERTY_NAME_MAX_LEN:
|
|
387
|
+
PROPERTY_NAME_MAX_LEN = n
|
|
388
|
+
|
|
389
|
+
LIST_COUNTER = 1
|
|
390
|
+
def entry_prop_name(name, index):
|
|
391
|
+
global LIST_COUNTER
|
|
392
|
+
set_max_prop_name(name)
|
|
393
|
+
if OUTPUT_LIST and index >= len(POSIX_LIST):
|
|
394
|
+
print >> UPF, "%3d: %s" % (LIST_COUNTER, name)
|
|
395
|
+
LIST_COUNTER += 1
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
### main ###
|
|
399
|
+
argv = sys.argv
|
|
400
|
+
argc = len(argv)
|
|
401
|
+
|
|
402
|
+
POSIX_ONLY = False
|
|
403
|
+
if argc >= 2:
|
|
404
|
+
if argv[1] == '-posix':
|
|
405
|
+
POSIX_ONLY = True
|
|
406
|
+
|
|
407
|
+
OUTPUT_LIST = not(POSIX_ONLY)
|
|
408
|
+
|
|
409
|
+
with open('UnicodeData.txt', 'r') as f:
|
|
410
|
+
dic, assigned = parse_unicode_data_file(f)
|
|
411
|
+
DIC = dic
|
|
412
|
+
add_primitive_props(assigned)
|
|
413
|
+
|
|
414
|
+
PROPS = DIC.keys()
|
|
415
|
+
PROPS = list_sub(PROPS, POSIX_LIST)
|
|
416
|
+
PROPS = sorted(PROPS)
|
|
417
|
+
|
|
418
|
+
dic, props = parse_properties('DerivedCoreProperties.txt', 'Derived Property')
|
|
419
|
+
merge_dic(DIC, dic)
|
|
420
|
+
merge_props(PROPS, props)
|
|
421
|
+
|
|
422
|
+
dic, props = parse_properties('Scripts.txt', 'Script')
|
|
423
|
+
merge_dic(DIC, dic)
|
|
424
|
+
merge_props(PROPS, props)
|
|
425
|
+
DIC['Unknown'] = inverse_ranges(add_ranges_in_dic(dic))
|
|
426
|
+
|
|
427
|
+
dic, props = parse_properties('PropList.txt', 'Binary Property')
|
|
428
|
+
merge_dic(DIC, dic)
|
|
429
|
+
merge_props(PROPS, props)
|
|
430
|
+
PROPS.append('Unknown')
|
|
431
|
+
KDIC['Unknown'] = 'Script'
|
|
432
|
+
|
|
433
|
+
ALIASES = parse_property_aliases('PropertyAliases.txt')
|
|
434
|
+
a = parse_property_value_aliases('PropertyValueAliases.txt')
|
|
435
|
+
merge_dic(ALIASES, a)
|
|
436
|
+
|
|
437
|
+
dic, BLOCKS = parse_blocks('Blocks.txt')
|
|
438
|
+
merge_dic(DIC, dic)
|
|
439
|
+
|
|
440
|
+
add_posix_props(DIC)
|
|
441
|
+
|
|
442
|
+
s = '''%{
|
|
443
|
+
/* Generated by make_unicode_property_data.py. */
|
|
444
|
+
'''
|
|
445
|
+
print s
|
|
446
|
+
for prop in POSIX_LIST:
|
|
447
|
+
print_property(prop, DIC[prop], "POSIX [[:%s:]]" % prop)
|
|
448
|
+
|
|
449
|
+
print ''
|
|
450
|
+
|
|
451
|
+
if not(POSIX_ONLY):
|
|
452
|
+
for prop in PROPS:
|
|
453
|
+
klass = KDIC.get(prop, None)
|
|
454
|
+
if klass is None:
|
|
455
|
+
n = len(prop)
|
|
456
|
+
if n == 1:
|
|
457
|
+
klass = 'Major Category'
|
|
458
|
+
elif n == 2:
|
|
459
|
+
klass = 'General Category'
|
|
460
|
+
else:
|
|
461
|
+
klass = '-'
|
|
462
|
+
|
|
463
|
+
print_property(prop, DIC[prop], klass)
|
|
464
|
+
|
|
465
|
+
for block in BLOCKS:
|
|
466
|
+
print_property(block, DIC[block], 'Block')
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
print ''
|
|
470
|
+
print "static const OnigCodePoint*\nconst CodeRanges[] = {"
|
|
471
|
+
|
|
472
|
+
for prop in POSIX_LIST:
|
|
473
|
+
print " CR_%s," % prop
|
|
474
|
+
|
|
475
|
+
if not(POSIX_ONLY):
|
|
476
|
+
for prop in PROPS:
|
|
477
|
+
print " CR_%s," % prop
|
|
478
|
+
|
|
479
|
+
for prop in BLOCKS:
|
|
480
|
+
print " CR_%s," % prop
|
|
481
|
+
|
|
482
|
+
s = '''};
|
|
483
|
+
%}
|
|
484
|
+
struct PropertyNameCtype {
|
|
485
|
+
char* name:
|
|
486
|
+
int ctype;
|
|
487
|
+
};
|
|
488
|
+
%%
|
|
489
|
+
'''
|
|
490
|
+
sys.stdout.write(s)
|
|
491
|
+
|
|
492
|
+
if OUTPUT_LIST:
|
|
493
|
+
UPF = open("UNICODE_PROPERTIES", "w")
|
|
494
|
+
if VERSION_INFO is not None:
|
|
495
|
+
print >> UPF, "Unicode Properties (from Unicode Version: %s)" % VERSION_INFO
|
|
496
|
+
print >> UPF, ''
|
|
497
|
+
|
|
498
|
+
index = -1
|
|
499
|
+
for prop in POSIX_LIST:
|
|
500
|
+
index += 1
|
|
501
|
+
entry_prop_name(prop, index)
|
|
502
|
+
prop = normalize_prop_name(prop)
|
|
503
|
+
print_prop_and_index(prop, index)
|
|
504
|
+
|
|
505
|
+
if not(POSIX_ONLY):
|
|
506
|
+
for prop in PROPS:
|
|
507
|
+
index += 1
|
|
508
|
+
entry_prop_name(prop, index)
|
|
509
|
+
prop = normalize_prop_name(prop)
|
|
510
|
+
print_prop_and_index(prop, index)
|
|
511
|
+
|
|
512
|
+
NALIASES = map(lambda (k,v):(normalize_prop_name(k), k, v), ALIASES.items())
|
|
513
|
+
NALIASES = sorted(NALIASES)
|
|
514
|
+
for (nk, k, v) in NALIASES:
|
|
515
|
+
nv = normalize_prop_name(v)
|
|
516
|
+
if PropIndex.get(nk, None) is not None:
|
|
517
|
+
print >> sys.stderr, "ALIASES: already exists: %s => %s" % (k, v)
|
|
518
|
+
continue
|
|
519
|
+
index = PropIndex.get(nv, None)
|
|
520
|
+
if index is None:
|
|
521
|
+
#print >> sys.stderr, "ALIASES: value is not exist: %s => %s" % (k, v)
|
|
522
|
+
continue
|
|
523
|
+
|
|
524
|
+
entry_prop_name(k, index)
|
|
525
|
+
print_prop_and_index(nk, index)
|
|
526
|
+
|
|
527
|
+
for name in BLOCKS:
|
|
528
|
+
index += 1
|
|
529
|
+
entry_prop_name(name, index)
|
|
530
|
+
name = normalize_prop_name(name)
|
|
531
|
+
print_prop_and_index(name, index)
|
|
532
|
+
|
|
533
|
+
print '%%'
|
|
534
|
+
print ''
|
|
535
|
+
if VERSION_INFO is not None:
|
|
536
|
+
print "#define PROPERTY_VERSION %s" % re.sub(r'[\.-]', '_', VERSION_INFO)
|
|
537
|
+
print ''
|
|
538
|
+
|
|
539
|
+
print "#define PROPERTY_NAME_MAX_SIZE %d" % (PROPERTY_NAME_MAX_LEN + 10)
|
|
540
|
+
print "#define CODE_RANGES_NUM %d" % (index + 1)
|
|
541
|
+
|
|
542
|
+
if OUTPUT_LIST:
|
|
543
|
+
UPF.close()
|
|
544
|
+
|
|
545
|
+
sys.exit(0)
|