1 |
|
2 | import { parse } from './swu-parse';
|
3 | import { swu2code } from '../convert';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | const kind = [0x40001, 0x4efa1, 0x4f2a1];
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | const category = [0x40001, 0x461e1, 0x4bca1, 0x4bfa1, 0x4e8e1, 0x4efa1, 0x4f2a1];
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | const group = [0x40001, 0x40541, 0x40b41, 0x41981, 0x41c81, 0x43241, 0x43d81, 0x445c1, 0x44ce1, 0x45be1, 0x461e1, 0x46841, 0x46fc1, 0x47fe1, 0x485e1, 0x49301, 0x49e41, 0x4a4a1, 0x4afe1, 0x4b521, 0x4bca1, 0x4bfa1, 0x4c3c1, 0x4cfc1, 0x4d621, 0x4e161, 0x4e8e1, 0x4ec41, 0x4efa1, 0x4f2a1];
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | const ranges = {
|
34 | 'all': [0x40001, 0x4f480],
|
35 | 'writing': [0x40001, 0x4efa0],
|
36 | 'hand': [0x40001, 0x461e0],
|
37 | 'movement': [0x461e1, 0x4bca0],
|
38 | 'dynamic': [0x4bca1, 0x4bfa0],
|
39 | 'head': [0x4bfa1, 0x4e8e0],
|
40 | 'hcenter': [0x4bfa1, 0x4e8e0],
|
41 | 'vcenter': [0x4bfa1, 0x4ec40],
|
42 | 'trunk': [0x4e8e1, 0x4ec40],
|
43 | 'limb': [0x4ec41, 0x4efa0],
|
44 | 'location': [0x4efa1, 0x4f2a0],
|
45 | 'punctuation': [0x4f2a1, 0x4f480]
|
46 | }
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | const isType = (swuSym, type) => {
|
60 | const parsed = parse.symbol(swuSym);
|
61 | if (parsed.symbol) {
|
62 | const code = swu2code(parsed.symbol);
|
63 | const range = ranges[type];
|
64 | if (range) {
|
65 | return (range[0] <= code && range[1] >= code);
|
66 | }
|
67 | }
|
68 | return false;
|
69 | }
|
70 |
|
71 | export { kind, category, group, ranges, isType }
|