1 |
|
2 | /**
|
3 | * Object of regular expressions for FSW strings
|
4 | *
|
5 | * @alias fsw.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': 'S[123][0-9a-f]{2}[0-5][0-9a-f]',
|
18 | 'coord': '[0-9]{3}x[0-9]{3}',
|
19 | 'sort': 'A',
|
20 | 'box': '[BLMR]'
|
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 }
|