1 |
|
2 | /**
|
3 | * Object of regular expressions for SWU strings in UTF-16
|
4 | *
|
5 | * @alias swu.re
|
6 | * @property {string} symbol - regular expressions for a symbol
|
7 | * @property {string} coord - regular expressions for a coordinate
|
8 | * @property {string} sort - regular expressions for the sorting marker
|
9 | * @property {string} box - regular expression for a signbox marker
|
10 | * @property {string} prefix - regular expression for a sorting marker followed by one or more symbols
|
11 | * @property {string} spatial - regular expression for a symbol followed by a coordinate
|
12 | * @property {string} signbox - regular expression for a signbox marker, max coordinate and zero or more spatial symbols
|
13 | * @property {string} sign - regular expression for an optional prefix followed by a signbox
|
14 | * @property {string} sortable - regular expression for a mandatory prefix followed by a signbox
|
15 | */
|
16 | let re = {
|
17 | 'symbol': '(?:(?:\uD8C0[\uDC01-\uDFFF])|(?:[\uD8C1-\uD8FC][\uDC00-\uDFFF])|(?:\uD8FD[\uDC00-\uDC80]))',
|
18 | 'coord': '(?:\uD836[\uDC0C-\uDDFF]){2}',
|
19 | 'sort': '\uD836\uDC00',
|
20 | 'box': '\uD836[\uDC01-\uDC04]'
|
21 | }
|
22 | re.prefix = `(?:${re.sort}(?:${re.symbol})+)`;
|
23 | re.spatial = `${re.symbol}${re.coord}`;
|
24 | re.signbox = `${re.box}${re.coord}(?:${re.spatial})*`;
|
25 | re.sign = `${re.prefix}?${re.signbox}`;
|
26 | re.sortable = `${re.prefix}${re.signbox}`;
|
27 |
|
28 | export { re }
|