Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Organize into subdirectories.

  • Loading branch information...
commit 8692f6966d6659e7e89154f9ca4e234d8d177aa8 1 parent 77a3e93
@cdleary authored
View
35 Makefile
@@ -1,10 +1,24 @@
+JS_SHELL := jsv -m -n
+CDLRE_UNICODE := generated/unicode.js
+CDLRE_UNICODE_LZW := generated/unicode_lzw.js
+CDLRE_LIB_ARGS := \
+ -f lib/common.js \
+ -f $(CDLRE_UNICODE) \
+ -f lib/unicode.js \
+ -f lib/log.js \
+ -f lib/set.js \
+ -f lib/parser.js \
+ -f lib/matcher.js \
+ -f lib/cdlre.js
+CDLRE_TEST_ARGS := -f test/parser_test.js -f test/cdlre_test.js
+
.PHONY: test
test:
- jsv -m -f common.js -f unicat.js -f unicode.js -f log.js -f set.js -f parser.js -f matcher.js -f cdlre.js -f parser_test.js -f cdlre_test.js -e 'testParser(); testCDLRE();'
+ $(JS_SHELL) $(CDLRE_LIB_ARGS) $(CDLRE_TEST_ARGS) -e 'testParser(); testCDLRE();'
.PHONY: test_cdlre
test_cdlre:
- jsv -m -f common.js -f unicat.js -f unicode.js -f log.js -f set.js -f parser.js -f matcher.js -f cdlre.js -f parser_test.js -f cdlre_test.js -e 'testCDLRE();'
+ $(JS_SHELL) $(CDLRE_LIB_ARGS) $(CDLRE_TEST_ARGS) -e 'testCDLRE();'
.PHONY: hosted
hosted:
@@ -20,10 +34,15 @@ hosted:
ln -s ${PWD}/matcher.js hosted/cdlre/matcher.js
ln -s ${PWD}/unicat.js hosted/cdlre/unicat.js
+.PHONY: unicode
+unicode:
+ echo "var encIdentityEscape = " > $(CDLRE_UNICODE)
+ ./tools/unicat.py >> $(CDLRE_UNICODE)
+ du -sh $(CDLRE_UNICODE)
+
+
.PHONY: lzw
-lzw:
- echo "var encIdentityEscape = " > unicat.js
- ./unicat.py >> unicat.js
- jsv -f lzw.js -f unicat.js -e 'print("var encLZWIdentityEscape = ", uneval(LZW.encode(LZW.compress(encIdentityEscape))), ";")' > unicat_lzw.js
- du -sh unicat.js
- du -sh unicat_lzw.js
+lzw: unicode
+ $(JS_SHELL) -f lib/lzw.js -f $(CDLRE_UNICODE) -e 'print("var encLZWIdentityEscape = ", uneval(LZW.encode(LZW.compress(encIdentityEscape))), ";")' > $(CDLRE_UNICODE_LZW)
+ du -sh $(CDLRE_UNICODE)
+ du -sh $(CDLRE_UNICODE_LZW)
View
0  simple_cli.js → bin/simple_cli.js
File renamed without changes
View
0  unicat.js → generated/unicode.js
File renamed without changes
View
0  cdlre.js → lib/cdlre.js
File renamed without changes
View
0  common.js → lib/common.js
File renamed without changes
View
0  log.js → lib/log.js
File renamed without changes
View
0  lzw.js → lib/lzw.js
File renamed without changes
View
0  matcher.js → lib/matcher.js
File renamed without changes
View
0  parser.js → lib/parser.js
File renamed without changes
View
0  set.js → lib/set.js
File renamed without changes
View
0  unicode.js → lib/unicode.js
File renamed without changes
View
0  unicode_categories.txt → metadata/unicode_categories.txt
File renamed without changes
View
0  cdlre_test.js → test/cdlre_test.js
File renamed without changes
View
0  parser_test.js → test/parser_test.js
File renamed without changes
View
8 unicat.py → tools/unicat.py
@@ -1,8 +1,12 @@
#!/usr/bin/env python3
-"""Convert the union of several unicode categories to a single JS string."""
+"""
+Converts the union of several unicode categories to a single bitmask encoded as
+a JS string.
+"""
import collections
+import os
from subprocess import Popen
TARGET_CATEGORIES = ['Mn', 'Mc', 'Nd', 'Pc', 'Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl']
@@ -10,7 +14,7 @@
# Each index in the bitmap corresponds to a uint16,
# because that's the best we can encode in a unicode character.
bitmap = collections.defaultdict(int)
-with open('unicode_categories.txt') as file:
+with open(os.path.join('metadata', 'unicode_categories.txt')) as file:
for line in file:
hexcode, category, *rest = line.split()
if category not in TARGET_CATEGORIES:
View
0  unipng.py → tools/unipng.py
File renamed without changes
View
BIN  uni.png
Deleted file not rendered
View
1  unicat_lzw.js
@@ -1 +0,0 @@
-var encLZWIdentityEscape = "\0\0\x11\0\0\u0200\0\u8000\x11\x03\0\u0400\x11\0\0\u0400\0\u0400\x11\x03\x11\t\x11\n\x11\v\x11\f\x11\r\x11\f\0\x02\0\u4000\0\0\x11\r\0\u2000\x11\x0E\x11\x15\x11\x15\0 \x11\x03\x11\x02\0\u8000\0\x80\x11\t\x11\x1C\0\u0400\0\x04\0\0\x11\b\x11\x03\0\u4000\x11\x16\x11\x12\x11\x15\0\x02\x11\t\x11\"\0\u2000\x11\0\x11,\x11-\x11-\x11\n\x11$\x11\f\x111\x11(\x11\t\0\u2000\x11$\x11\x18\x115\0\x01\0\u8000\x11&\x11\x03\x11\x14\0\u8000\x114\x11=\x11\x1C\x11<\0\u8000\0\u2000\x11\x02\x11C\x116\x11;\x11\n\0\u2000\x11\x1C\x11J\x11\x03\0\0\0\b\x11)\0\u4000\0\u0200\x11\0\x11>\0\u2000\x11V\x11\0\0\x01\0\u0200\x11\x1A\0\u8000\0\u1000\0\u8000\0\u0800\x11\x03\0\u1000\0@\x11,\x11\n\x11[\x11D\x11\x03\x118\x11]\x11\x16\x11\x15\x11V\x11=\x11#\x11%\x11\x12\x11C\0\u8000\0\x10\x11j\x11t\x11u\x11\v\x11\"\x11\t\x11:\x11s\x11s\x11P\x11P\x11J\x11S\x11E\x11\v\x11L\x11x\0\u8000\x11\x18\0\u1000\0\u0800\x11_\x11D\x11s\x11^\0\u8000\0\u0200\x11\x05\x11\x12\x11\x89\0\u8000\x111\x11Z\0\x80\x11.\x11\n\0\u0800\x11\x02\x11~\x11\x8D\x11/\x11\x03\x11L\x11D\x11\x96\0\u8000\0\x04\x11v\0@\x11v\x11M\x11f\x11\xA7\x11\x92\x11\x87\0\u1000\0\u1000\x11c\0\x01\0\x10\x11p\x11\xAF\x11\0\x11]\x11:\x11>\x11\x11\x11\x03\0\u0100\x11.\x11\xB9\x11\xBA\x11\xBB\x11\xBC\x11\xBD\x11\xBE\x11\xBF\x11\xC0\x11\xC1\x11\xC2\x11\xC3\x11\xC4\x11\xC5\x11\xB9\x11n\x11\x92\x11'\x11g\x11\n\x11\x12\0@\0\u4000\x11\xCF\x111\x11\0\x11;\x11\xC6\x11\xBC\x11\x95\x11\\\x11v\x11>\x11\t\x11\xB6\x11\x95\x11\xD2\x11\xD4\x11\xDE\x11\xDF\x11\xE0\x11\xE1\x11\xE2\x11\xE3\x11\xE4\x11\xE5\x11\xE6\x11\xE7\x11\xE8\x11\xE9\x11\xEA\x11\xEB\x11\xEC\x11\xED\x11\xEE\x11\xEF\x11\xF0\x11\xF1\x11\xF2\x11\xF3\x11\xF4\x11\xF5\x11\xF6\x11\xF7\x11\xF8\x11\xF9\x11\xFA\x11\xFB\x11\xFC\x11\xFD\x11\xFE\x11\xFF\x11\u0100\x11\u0101\x11\u0102\x11\u0103\x11\u0104\x11\u0105\x11\u0106\x11\u0104\x11\xA5\x11\u0109\x11\u010A\x11\u010B\x11\f\x11\xAC\x11c\x11\xA8\x11u\x11]\0\u0800\x11q\x11\x9E\x11\x03\0\x02\x11q\x11`\x11\xC7\x11\x9D\x11<\x11\x9A\x11r\x11\x02\x11\x89\x11>\x11P\x11i\x11\t\x11S\x11<\0@\x11\x81\x11\x91\x11\xA1\x11+\x11\xC0\x11=\x11\u0125\x11\u0107\x11\u012F\x11\u0130\x11\u0131\x11\u0132\x11\u0133\x11\u0134\x11\u0135\x11\u0136\x11\u0137\x11\xE9\x11\x97\x11\u0138\x11\u013B\x11\u013C\x11\u013D\x11\u013E\x11\u013F\x11\u0140\x11\u010F\x11\u0109\x11\xD9\x11\xD9\x11\u0124\x11\0\x11\xA4\x11\xC9\x11\x0F\x11\u0118\x11\u0143\x11\u014B\x11\xDC\x11_\0\0\0@\x11s\x11\xD2\x11\r\x11\xAC\x11[\x11\x84\x11\xC9\x11\u010E\x11J\x11\u012B\x11\r\x11\x8F\x11\u0153\x11r\x11\xBA\x11\u012B\x11\xC7\x11\u0123\0\x01\x11\xD2\x11\xB6\x11\u015D\x11\xA8\0 \x11\u015E\x11\f\x11E\x11\xFE\x11\v\x11\u0169\x11\xBC\x11\x85\x11\x9B\x11\xBE\x11\xCC\x11\x12\x11\u010E\x11\u011A\x11\u0171\x11\x18\x11 \x11\xBA\x11\n\x11\xB8\x11\u0132\x11)\x11\u0141\x11\u0180\x11\u0181\x11\x9C\x11\u010C\x11\u0184\x11u\x11\x11\x11\xBB\x11\f\x11\u017A\x11\u0182\x11\u018B\x11\xC5\x11\u0185\x11\u018E\x11\u018F\x11\u0187\x11\u018C\x11\u0192\x11\u0193\x11\u0194\x11\u0195\x11\u0196\x11\u0197\x11\u0198\x11\u0199\x11\u019A\x11\u019B\x11\u019C\x11\u019D\x11\u019E\x11\u019F\x11\u01A0\x11\u01A1\x11\u01A2\x11\u01A3\x11\u01A4\x11\u01A5\x11\u01A6\x11\u01A7\x11\u01A8\x11\u01A9\x11\u01AA\x11\x9C\x11\u0113\x11\u0161\x11\xB9\x11\xB1\x11\xE2\x11\u010C\x111\x11\u018F\x11\r\x11$\x11\u01B3\x11\f\x11\u01AB\x11\u01B9\x11\u01BA\x11\u01BB\x11\u01BC\x11\u01BD\x11\u01BE\x11\u01BF\x11\u01C0\x11\u01C1\x11\u01C2\x11\u01C3\x11\u01C4\x11\u01C5\x11\u01C6\x11\u01C7\x11\u01C8\x11\u01C9\x11\u01CA\x11\u01CB\x11\u01CC\x11\u01CD\x11\u01CE\x11\u01CF\x11\u01D0\x11\u01D1\x11\u01D2\x11\u01D3\x11\u01D4\x11\u01D5\x11\u01D6\x11\u01D7\x11\u01D8\x11\u01D9\x11\u01DA\x11\u01DB\x11\u018D\x11\u01B4\x11\x0E\x11\u01AE\x11\u01DC\x11\u01E1\x11\u01E2\x11\u01E3\x11\u01E4\x11\u01E5\x11\u01E6\x11\u01E7\x11\u01E8\x11\u01E9\x11\u01EA\x11\u01EB\x11\u01EC\x11\u01ED\x11\u01EE\x11\u01EF\x11\u01F0\x11\u01F1\x11\u01F2\x11\u01F3\x11\u01F4\x11\u01F5\x11\u01F6\x11\u01F7\x11\u01F8\x11\u01F9\x11\u01FA\x11\u01FB\x11\u01FC\x11\u01FD\x11\u01FE\x11\u01FF\x11\u0200\x11\u0201\x11\u0202\x11\u0203\x11\u0204\x11\u0205\x11\u0206\x11\u0207\x11\u0208\x11\u0209\x11\u020A\x11\u020B\x11\u020C\x11\u020D\x11\u020E\x11\u020F\x11\u0210\x11\u0211\x11\u0212\x11\u0213\x11\u0214\x11\u0215\x11\u0216\x11\u0217\x11\u0218\x11\u0219\x11\u021A\x11\u021B\x11\u021C\x11\u021D\x11\u021E\x11\u021F\x11\u0220\x11\u0221\x11\u0222\x11\u0223\x11\u0224\x11\u0225\x11\u0226\x11\u0227\x11\u0228\x11\u0229\x11\u022A\x11\u022B\x11\u022C\x11\u022D\x11\u022E\x11\u022F\x11\u0230\x11\u0231\x11\u0232\x11\u0233\x11\u0234\x11\u0235\x11\u0236\x11\u0237\x11\u0238\x11\u0239\x11\u023A\x11\u023B\x11\u023C\x11\u023D\x11\u023E\x11\u023F\x11\u0240\x11\u0241\x11\u0242\x11\u0243\x11\u0244\x11\u0245\x11\u0246\x11\u0247\x11\u0248\x11\u0249\x11\u024A\x11\u024B\x11\u024C\x11\u024D\x11\u024E\x11\u024F\x11\u0250\x11\u0251\x11\u0252\x11\u0253\x11\u0254\x11\u0255\x11\u0256\x11\u0257\x11\u0258\x11\u0259\x11\u025A\x11\u025B\x11\u025C\x11\u025D\x11\u025E\x11\u025F\x11\u0260\x11\u0261\x11\u0262\x11\u0263\x11\u0264\x11\u0265\x11\u0266\x11\u0267\x11\u0268\x11\u0269\x11\u026A\x11\u026B\x11\u026C\x11\u026D\x11\u026E\x11\u026F\x11\u0270\x11\u0271\x11\u0272\x11\u0273\x11\u0274\x11\u0275\x11\u0276\x11\u0277\x11\u0278\x11\u0279\x11\u027A\x11\u027B\x11\u027C\x11\u027D\x11\u027E\x11\u027F\x11\u0280\x11\u0281\x11\u0282\x11\u0283\x11\u0284\x11\u0285\x11\u0286\x11\u0287\x11\u0288\x11\u0289\x11\u028A\x11\u028B\x11\u028C\x11\u028D\x11\u028E\x11\u028F\x11\u0290\x11\u0291\x11\u0292\x11\u0293\x11\u0294\x11\u0295\x11\u0296\x11\u0297\x11\u0298\x11\u0299\x11\u029A\x11\u029B\x11\u01D2\x11\xA5" ;
Please sign in to comment.
Something went wrong with that request. Please try again.