@keymanapp/common-types 18.0.41-alpha → 18.0.46-alpha
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/build/src/consts/virtual-key-constants.d.ts +191 -191
- package/build/src/consts/virtual-key-constants.js +221 -221
- package/build/src/consts/virtual-key-constants.js.map +1 -1
- package/build/src/keyman-touch-layout/keyman-touch-layout-file-reader.d.ts +5 -5
- package/build/src/keyman-touch-layout/keyman-touch-layout-file-reader.js +72 -72
- package/build/src/keyman-touch-layout/keyman-touch-layout-file-reader.js.map +1 -1
- package/build/src/keyman-touch-layout/keyman-touch-layout-file-writer.d.ts +28 -28
- package/build/src/keyman-touch-layout/keyman-touch-layout-file-writer.js +120 -120
- package/build/src/keyman-touch-layout/keyman-touch-layout-file-writer.js.map +1 -1
- package/build/src/keyman-touch-layout/keyman-touch-layout-file.d.ts +95 -95
- package/build/src/keyman-touch-layout/keyman-touch-layout-file.js +52 -52
- package/build/src/kmx/element-string.d.ts +23 -23
- package/build/src/kmx/element-string.js +125 -125
- package/build/src/kmx/element-string.js.map +1 -1
- package/build/src/kmx/keyman-targets.d.ts +20 -20
- package/build/src/kmx/keyman-targets.js +79 -79
- package/build/src/kmx/keyman-targets.js.map +1 -1
- package/build/src/kmx/kmx-builder.d.ts +32 -32
- package/build/src/kmx/kmx-builder.js +189 -189
- package/build/src/kmx/kmx-builder.js.map +1 -1
- package/build/src/kmx/kmx-file-reader.d.ts +13 -13
- package/build/src/kmx/kmx-file-reader.js +134 -134
- package/build/src/kmx/kmx-file-reader.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-disp.d.ts +18 -18
- package/build/src/kmx/kmx-plus-builder/build-disp.js +27 -27
- package/build/src/kmx/kmx-plus-builder/build-disp.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-elem.d.ts +28 -28
- package/build/src/kmx/kmx-plus-builder/build-elem.js +89 -89
- package/build/src/kmx/kmx-plus-builder/build-elem.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-keys.d.ts +56 -56
- package/build/src/kmx/kmx-plus-builder/build-keys.js +107 -107
- package/build/src/kmx/kmx-plus-builder/build-keys.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-layr.d.ts +53 -53
- package/build/src/kmx/kmx-plus-builder/build-layr.js +101 -101
- package/build/src/kmx/kmx-plus-builder/build-layr.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-list.d.ts +35 -35
- package/build/src/kmx/kmx-plus-builder/build-list.js +66 -66
- package/build/src/kmx/kmx-plus-builder/build-list.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-loca.d.ts +11 -11
- package/build/src/kmx/kmx-plus-builder/build-loca.js +21 -21
- package/build/src/kmx/kmx-plus-builder/build-loca.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-meta.d.ts +16 -16
- package/build/src/kmx/kmx-plus-builder/build-meta.js +20 -20
- package/build/src/kmx/kmx-plus-builder/build-sect.d.ts +15 -15
- package/build/src/kmx/kmx-plus-builder/build-sect.js +15 -15
- package/build/src/kmx/kmx-plus-builder/build-sect.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-strs.d.ts +22 -22
- package/build/src/kmx/kmx-plus-builder/build-strs.js +46 -46
- package/build/src/kmx/kmx-plus-builder/build-strs.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-tran.d.ts +32 -32
- package/build/src/kmx/kmx-plus-builder/build-tran.js +69 -69
- package/build/src/kmx/kmx-plus-builder/build-tran.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-uset.d.ts +30 -30
- package/build/src/kmx/kmx-plus-builder/build-uset.js +60 -60
- package/build/src/kmx/kmx-plus-builder/build-uset.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/build-vars.d.ts +21 -21
- package/build/src/kmx/kmx-plus-builder/build-vars.js +48 -48
- package/build/src/kmx/kmx-plus-builder/build-vars.js.map +1 -1
- package/build/src/kmx/kmx-plus-builder/builder-section.d.ts +9 -9
- package/build/src/kmx/kmx-plus-builder/builder-section.js +2 -2
- package/build/src/kmx/kmx-plus-builder/kmx-plus-builder.d.ts +42 -42
- package/build/src/kmx/kmx-plus-builder/kmx-plus-builder.js +137 -137
- package/build/src/kmx/kmx-plus-builder/kmx-plus-builder.js.map +1 -1
- package/build/src/kmx/kmx-plus.d.ts +322 -322
- package/build/src/kmx/kmx-plus.js +830 -830
- package/build/src/kmx/kmx-plus.js.map +1 -1
- package/build/src/kmx/kmx.d.ts +233 -233
- package/build/src/kmx/kmx.js +302 -302
- package/build/src/kmx/kmx.js.map +1 -1
- package/build/src/kmx/string-list.d.ts +35 -35
- package/build/src/kmx/string-list.js +88 -88
- package/build/src/kmx/string-list.js.map +1 -1
- package/build/src/kpj/keyman-developer-project.d.ts +78 -78
- package/build/src/kpj/keyman-developer-project.js +195 -195
- package/build/src/kpj/keyman-developer-project.js.map +1 -1
- package/build/src/kpj/kpj-file-reader.d.ts +18 -18
- package/build/src/kpj/kpj-file-reader.js +119 -119
- package/build/src/kpj/kpj-file-reader.js.map +1 -1
- package/build/src/kpj/kpj-file.d.ts +39 -39
- package/build/src/kpj/kpj-file.js +10 -10
- package/build/src/kvk/kvk-file-reader.d.ts +4 -4
- package/build/src/kvk/kvk-file-reader.js +37 -37
- package/build/src/kvk/kvk-file-reader.js.map +1 -1
- package/build/src/kvk/kvk-file-writer.d.ts +19 -19
- package/build/src/kvk/kvk-file-writer.js +77 -77
- package/build/src/kvk/kvk-file-writer.js.map +1 -1
- package/build/src/kvk/kvk-file.d.ts +66 -66
- package/build/src/kvk/kvk-file.d.ts.map +1 -1
- package/build/src/kvk/kvk-file.js +90 -90
- package/build/src/kvk/kvk-file.js.map +1 -1
- package/build/src/kvk/kvks-file-reader.d.ts +23 -23
- package/build/src/kvk/kvks-file-reader.js +175 -175
- package/build/src/kvk/kvks-file-reader.js.map +1 -1
- package/build/src/kvk/kvks-file-writer.d.ts +6 -6
- package/build/src/kvk/kvks-file-writer.js +106 -106
- package/build/src/kvk/kvks-file-writer.js.map +1 -1
- package/build/src/kvk/kvks-file.d.ts +43 -43
- package/build/src/kvk/kvks-file.js +9 -9
- package/build/src/kvk/visual-keyboard.d.ts +44 -44
- package/build/src/kvk/visual-keyboard.js +75 -75
- package/build/src/kvk/visual-keyboard.js.map +1 -1
- package/build/src/ldml-keyboard/ldml-keyboard-testdata-xml.d.ts +60 -60
- package/build/src/ldml-keyboard/ldml-keyboard-testdata-xml.js +19 -19
- package/build/src/ldml-keyboard/ldml-keyboard-xml-reader.d.ts +95 -95
- package/build/src/ldml-keyboard/ldml-keyboard-xml-reader.js +409 -409
- package/build/src/ldml-keyboard/ldml-keyboard-xml-reader.js.map +1 -1
- package/build/src/ldml-keyboard/ldml-keyboard-xml.d.ts +170 -170
- package/build/src/ldml-keyboard/ldml-keyboard-xml.js +55 -55
- package/build/src/ldml-keyboard/pattern-parser.d.ts +201 -201
- package/build/src/ldml-keyboard/pattern-parser.js +490 -490
- package/build/src/ldml-keyboard/pattern-parser.js.map +1 -1
- package/build/src/ldml-keyboard/unicodeset-parser-api.d.ts +37 -37
- package/build/src/ldml-keyboard/unicodeset-parser-api.js +27 -27
- package/build/src/main.d.ts +33 -33
- package/build/src/main.js +32 -32
- package/build/src/package/kmp-json-file.d.ts +115 -115
- package/build/src/package/kmp-json-file.js +1 -1
- package/build/src/package/kps-file.d.ts +175 -175
- package/build/src/package/kps-file.js +15 -15
- package/build/src/schema-validators.d.ts +13 -13
- package/build/src/schema-validators.js +25 -25
- package/build/src/schemas/displaymap.schema.d.ts +57 -57
- package/build/src/schemas/displaymap.schema.js +35 -35
- package/build/src/schemas/displaymap.schema.validator.d.mts +2 -2
- package/build/src/schemas/displaymap.schema.validator.mjs +266 -266
- package/build/src/schemas/displaymap.schema.validator.mjs.map +1 -1
- package/build/src/schemas/keyboard_info.schema.d.ts +209 -209
- package/build/src/schemas/keyboard_info.schema.js +98 -98
- package/build/src/schemas/keyboard_info.schema.validator.d.mts +2 -2
- package/build/src/schemas/keyboard_info.schema.validator.mjs +1160 -1160
- package/build/src/schemas/keyboard_info.schema.validator.mjs.map +1 -1
- package/build/src/schemas/keyman-touch-layout.clean.spec.d.ts +227 -227
- package/build/src/schemas/keyman-touch-layout.clean.spec.js +151 -151
- package/build/src/schemas/keyman-touch-layout.clean.spec.validator.d.mts +2 -2
- package/build/src/schemas/keyman-touch-layout.clean.spec.validator.mjs +1094 -1094
- package/build/src/schemas/keyman-touch-layout.clean.spec.validator.mjs.map +1 -1
- package/build/src/schemas/keyman-touch-layout.spec.d.ts +229 -229
- package/build/src/schemas/keyman-touch-layout.spec.js +140 -140
- package/build/src/schemas/keyman-touch-layout.spec.validator.d.mts +2 -2
- package/build/src/schemas/keyman-touch-layout.spec.validator.mjs +1436 -1436
- package/build/src/schemas/keyman-touch-layout.spec.validator.mjs.map +1 -1
- package/build/src/schemas/kmp.schema.d.ts +324 -324
- package/build/src/schemas/kmp.schema.js +353 -353
- package/build/src/schemas/kmp.schema.validator.d.mts +2 -2
- package/build/src/schemas/kmp.schema.validator.mjs +1627 -1627
- package/build/src/schemas/kmp.schema.validator.mjs.map +1 -1
- package/build/src/schemas/kpj-9.0.schema.d.ts +152 -152
- package/build/src/schemas/kpj-9.0.schema.js +131 -131
- package/build/src/schemas/kpj-9.0.schema.validator.d.mts +2 -2
- package/build/src/schemas/kpj-9.0.schema.validator.mjs +655 -655
- package/build/src/schemas/kpj-9.0.schema.validator.mjs.map +1 -1
- package/build/src/schemas/kpj.schema.d.ts +122 -122
- package/build/src/schemas/kpj.schema.js +129 -129
- package/build/src/schemas/kpj.schema.validator.d.mts +2 -2
- package/build/src/schemas/kpj.schema.validator.mjs +515 -515
- package/build/src/schemas/kpj.schema.validator.mjs.map +1 -1
- package/build/src/schemas/kvks.schema.d.ts +160 -160
- package/build/src/schemas/kvks.schema.js +182 -182
- package/build/src/schemas/kvks.schema.validator.d.mts +2 -2
- package/build/src/schemas/kvks.schema.validator.mjs +625 -625
- package/build/src/schemas/kvks.schema.validator.mjs.map +1 -1
- package/build/src/schemas/ldml-keyboard3.schema.d.ts +635 -635
- package/build/src/schemas/ldml-keyboard3.schema.js +696 -696
- package/build/src/schemas/ldml-keyboard3.schema.validator.d.mts +2 -2
- package/build/src/schemas/ldml-keyboard3.schema.validator.mjs +3117 -3117
- package/build/src/schemas/ldml-keyboard3.schema.validator.mjs.map +1 -1
- package/build/src/schemas/ldml-keyboardtest3.schema.d.ts +192 -192
- package/build/src/schemas/ldml-keyboardtest3.schema.js +225 -225
- package/build/src/schemas/ldml-keyboardtest3.schema.validator.d.mts +2 -2
- package/build/src/schemas/ldml-keyboardtest3.schema.validator.mjs +744 -744
- package/build/src/schemas/ldml-keyboardtest3.schema.validator.mjs.map +1 -1
- package/build/src/schemas.d.ts +2300 -2300
- package/build/src/schemas.js +23 -23
- package/build/src/util/common-events.d.ts +44 -44
- package/build/src/util/common-events.js +26 -26
- package/build/src/util/compiler-interfaces.d.ts +371 -371
- package/build/src/util/compiler-interfaces.d.ts.map +1 -1
- package/build/src/util/compiler-interfaces.js +380 -380
- package/build/src/util/compiler-interfaces.js.map +1 -1
- package/build/src/util/errors.d.ts +5 -5
- package/build/src/util/errors.js +5 -5
- package/build/src/util/file-types.d.ts +93 -93
- package/build/src/util/file-types.d.ts.map +1 -1
- package/build/src/util/file-types.js +142 -142
- package/build/src/util/file-types.js.map +1 -1
- package/build/src/util/util.d.ts +98 -98
- package/build/src/util/util.js +368 -368
- package/build/src/util/util.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,202 +1,202 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilities for transform and marker processing
|
|
3
|
-
*/
|
|
4
|
-
/** for use with markers, means an ordering can be determined */
|
|
5
|
-
export interface OrderedStringList {
|
|
6
|
-
/** @returns the ordering of an item (0..), or -1 if not found */
|
|
7
|
-
getItemOrder(item: string): number;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Class for helping with markers
|
|
11
|
-
*/
|
|
12
|
-
export declare class MarkerParser {
|
|
13
|
-
/**
|
|
14
|
-
* A marker id has the same constraint as a key id. TODO-LDML: Needs to be reflected in the spec
|
|
15
|
-
*/
|
|
16
|
-
static readonly ID: RegExp;
|
|
17
|
-
/**
|
|
18
|
-
* Special marker reference referring to any marker
|
|
19
|
-
*/
|
|
20
|
-
static readonly ANY_MARKER = "\\m{.}";
|
|
21
|
-
/**
|
|
22
|
-
* id of the 'any' marker
|
|
23
|
-
*/
|
|
24
|
-
static readonly ANY_MARKER_ID = ".";
|
|
25
|
-
/**
|
|
26
|
-
* Marker sentinel as a string - U+FFFF
|
|
27
|
-
*/
|
|
28
|
-
static readonly SENTINEL: string;
|
|
29
|
-
/** Marker sentinel as a regex match */
|
|
30
|
-
static readonly SENTINEL_MATCH: string;
|
|
31
|
-
/**
|
|
32
|
-
* Marker code as a string - U+0008
|
|
33
|
-
*/
|
|
34
|
-
static readonly MARKER_CODE: string;
|
|
35
|
-
/** Marker code as a regex match */
|
|
36
|
-
static readonly MARKER_CODE_MATCH: string;
|
|
37
|
-
/** Minimum ID (trailing code unit) */
|
|
38
|
-
static readonly MIN_MARKER_INDEX = 1;
|
|
39
|
-
/** Index meaning 'any marker' == `\m{.}` */
|
|
40
|
-
static readonly ANY_MARKER_INDEX = 55295;
|
|
41
|
-
/** Maximum usable marker index */
|
|
42
|
-
static readonly MAX_MARKER_INDEX: number;
|
|
43
|
-
/** Max count of markers */
|
|
44
|
-
static readonly MAX_MARKER_COUNT: number;
|
|
45
|
-
private static anyMarkerMatch;
|
|
46
|
-
/** Expression that matches any marker */
|
|
47
|
-
static readonly ANY_MARKER_MATCH: string;
|
|
48
|
-
/**
|
|
49
|
-
* Pattern for matching a marker reference, OR the special marker \m{.}
|
|
50
|
-
*/
|
|
51
|
-
static readonly REFERENCE: RegExp;
|
|
52
|
-
/**
|
|
53
|
-
* parse a string into marker references
|
|
54
|
-
* @param str input string such as "\m{a} … \m{.}"
|
|
55
|
-
* @returns `[]` or an array of all markers referenced
|
|
56
|
-
*/
|
|
57
|
-
static allReferences(str: string): string[];
|
|
58
|
-
private static markerCodeToString;
|
|
59
|
-
/** @returns string for marker #n */
|
|
60
|
-
static markerOutput(n: number, forMatch?: boolean): string;
|
|
61
|
-
/** @returns all marker strings as sentinel values */
|
|
62
|
-
static toSentinelString(s: string, markers?: OrderedStringList, forMatch?: boolean): string;
|
|
63
|
-
/**
|
|
64
|
-
* NFD a string, respecting markers.
|
|
65
|
-
* @param s input string
|
|
66
|
-
* @param forMatch true if regex, false if individual
|
|
67
|
-
* @returns the normalized string
|
|
68
|
-
*/
|
|
69
|
-
static nfd_markers(s: string, forMatch?: boolean): string;
|
|
70
|
-
/**
|
|
71
|
-
* NFD a safe subset of a string, respecting markers
|
|
72
|
-
* @param s input string
|
|
73
|
-
* @param map output array of marker chars
|
|
74
|
-
* @param forMatch true if used for regexes
|
|
75
|
-
* @returns the updated string
|
|
76
|
-
*/
|
|
77
|
-
static nfd_markers_segment(s: string, map: MarkerMap, forMatch?: boolean): string;
|
|
78
|
-
/** return the string s but with a marker sequence before it */
|
|
79
|
-
static prepend_marker(s: string, marker: number, forMatch?: boolean): string;
|
|
80
|
-
/**
|
|
81
|
-
* Add back all markers in the map to the string
|
|
82
|
-
* @param s input string
|
|
83
|
-
* @param map output: the marker map
|
|
84
|
-
* @param forMatch if true, use regex format
|
|
85
|
-
*/
|
|
86
|
-
static add_back_markers(s: string, map: MarkerMap, forMatch?: boolean): string;
|
|
87
|
-
/**
|
|
88
|
-
* Remove (and parse) markers from a string
|
|
89
|
-
* @param s input string
|
|
90
|
-
* @param map output map containing marker locations
|
|
91
|
-
* @param forMatch true if regex
|
|
92
|
-
* @returns the original string, without any markers
|
|
93
|
-
*/
|
|
94
|
-
static remove_markers(s: string, map: MarkerMap, forMatch?: boolean): string;
|
|
95
|
-
/**
|
|
96
|
-
* analyze the string to see if it begins with a marker
|
|
97
|
-
* @param s input string
|
|
98
|
-
* @param forMatch true if regex
|
|
99
|
-
* @returns parsed marker details
|
|
100
|
-
*/
|
|
101
|
-
static parse_next_marker(s: string, forMatch?: boolean): MarkerResult;
|
|
102
|
-
}
|
|
103
|
-
/** special noncharacter value denoting end of string */
|
|
104
|
-
export declare const MARKER_BEFORE_EOT = "\uFFFE";
|
|
105
|
-
export interface MarkerEntry {
|
|
106
|
-
/** code point 'glued' to, or MARKER_BEFORE_EOT */
|
|
107
|
-
ch?: string;
|
|
108
|
-
/** marker number, 1-based */
|
|
109
|
-
marker?: number;
|
|
110
|
-
/** true if processed */
|
|
111
|
-
processed?: boolean;
|
|
112
|
-
/** true if the end of the entries */
|
|
113
|
-
end?: boolean;
|
|
114
|
-
}
|
|
115
|
-
/** list of marker entries, from remove_markers */
|
|
116
|
-
export type MarkerMap = Array<MarkerEntry>;
|
|
117
|
-
/** return type from parse_next_marker */
|
|
118
|
-
export interface MarkerResult {
|
|
119
|
-
marker?: number;
|
|
120
|
-
match?: string;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Class for helping with markers
|
|
124
|
-
*/
|
|
125
|
-
export declare class VariableParser {
|
|
126
|
-
/**
|
|
127
|
-
* A marker id has the same constraint as a key id. TODO-LDML: Needs to be reflected in the spec
|
|
128
|
-
*/
|
|
129
|
-
static readonly ID: RegExp;
|
|
130
|
-
/**
|
|
131
|
-
* Pattern for matching a string reference `$(str)`
|
|
132
|
-
*/
|
|
133
|
-
static readonly STRING_REFERENCE: RegExp;
|
|
134
|
-
/**
|
|
135
|
-
* Pattern for matching a set reference `$[set]`
|
|
136
|
-
*/
|
|
137
|
-
static readonly SET_REFERENCE: RegExp;
|
|
138
|
-
/**
|
|
139
|
-
* Pattern for matching a capture set reference `($[set])`
|
|
140
|
-
*/
|
|
141
|
-
static readonly CAPTURE_SET_REFERENCE: RegExp;
|
|
142
|
-
/**
|
|
143
|
-
* `$[1:variable]`
|
|
144
|
-
* This regex matches the whole string.
|
|
145
|
-
*/
|
|
146
|
-
static readonly MAPPED_SET_REFERENCE: RegExp;
|
|
147
|
-
/**
|
|
148
|
-
* parse a string into references
|
|
149
|
-
* @param str input string
|
|
150
|
-
* @returns `[]` or an array of all string references referenced
|
|
151
|
-
*/
|
|
152
|
-
static allStringReferences(str: string): string[];
|
|
153
|
-
/**
|
|
154
|
-
* parse a string into references
|
|
155
|
-
* @param str input string
|
|
156
|
-
* @returns `[]` or an array of all string references referenced
|
|
157
|
-
*/
|
|
158
|
-
static allSetReferences(str: string): string[];
|
|
159
|
-
/**
|
|
160
|
-
* Split an input string into a proper set
|
|
161
|
-
* @param str input string
|
|
162
|
-
* @returns
|
|
163
|
-
*/
|
|
164
|
-
static setSplitter(str: string): string[];
|
|
165
|
-
}
|
|
166
|
-
/** for ElementParser.segment() */
|
|
167
|
-
export declare enum ElementType {
|
|
168
|
-
codepoint = ".",
|
|
169
|
-
escaped = "\\",
|
|
170
|
-
uset = "[",
|
|
171
|
-
string = "*"
|
|
172
|
-
}
|
|
173
|
-
/** one portion of a segmented element string */
|
|
174
|
-
export declare class ElementSegment {
|
|
175
|
-
segment: string;
|
|
176
|
-
readonly type: ElementType;
|
|
177
|
-
/**
|
|
178
|
-
* @param segment the string in the segment
|
|
179
|
-
* @param type type of segment. Will be calculated if not provided.
|
|
180
|
-
*/
|
|
181
|
-
constructor(segment: string, type?: ElementType);
|
|
182
|
-
/** unescaped format */
|
|
183
|
-
get unescaped(): string;
|
|
184
|
-
}
|
|
185
|
-
/** Class for helping with Element strings (i.e. reorder) */
|
|
186
|
-
export declare class ElementParser {
|
|
187
|
-
/**
|
|
188
|
-
* Matches any complex UnicodeSet that would otherwise be misinterpreted
|
|
189
|
-
* by `MATCH_ELEMENT_SEGMENTS` due to nested `[]`'s.
|
|
190
|
-
* For example, `[[a-z]-[aeiou]]` could be
|
|
191
|
-
* mis-segmented into `[[a-z]`, `-`, `[aeiou]`, `]` */
|
|
192
|
-
static readonly MATCH_NESTED_SQUARE_BRACKETS: RegExp;
|
|
193
|
-
/** Match (segment) UnicodeSets OR hex escapes OR single Unicode codepoints */
|
|
194
|
-
static readonly MATCH_ELEMENT_SEGMENTS: RegExp;
|
|
195
|
-
/** Does it start with a UnicodeSet? Used to test the segments. */
|
|
196
|
-
static readonly MATCH_USET: RegExp;
|
|
197
|
-
/** Does it start with an escaped char? Used to test the segments. */
|
|
198
|
-
static readonly MATCH_ESCAPED: RegExp;
|
|
199
|
-
/** Split a string into ElementSegments */
|
|
200
|
-
static segment(str: string): ElementSegment[];
|
|
201
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for transform and marker processing
|
|
3
|
+
*/
|
|
4
|
+
/** for use with markers, means an ordering can be determined */
|
|
5
|
+
export interface OrderedStringList {
|
|
6
|
+
/** @returns the ordering of an item (0..), or -1 if not found */
|
|
7
|
+
getItemOrder(item: string): number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Class for helping with markers
|
|
11
|
+
*/
|
|
12
|
+
export declare class MarkerParser {
|
|
13
|
+
/**
|
|
14
|
+
* A marker id has the same constraint as a key id. TODO-LDML: Needs to be reflected in the spec
|
|
15
|
+
*/
|
|
16
|
+
static readonly ID: RegExp;
|
|
17
|
+
/**
|
|
18
|
+
* Special marker reference referring to any marker
|
|
19
|
+
*/
|
|
20
|
+
static readonly ANY_MARKER = "\\m{.}";
|
|
21
|
+
/**
|
|
22
|
+
* id of the 'any' marker
|
|
23
|
+
*/
|
|
24
|
+
static readonly ANY_MARKER_ID = ".";
|
|
25
|
+
/**
|
|
26
|
+
* Marker sentinel as a string - U+FFFF
|
|
27
|
+
*/
|
|
28
|
+
static readonly SENTINEL: string;
|
|
29
|
+
/** Marker sentinel as a regex match */
|
|
30
|
+
static readonly SENTINEL_MATCH: string;
|
|
31
|
+
/**
|
|
32
|
+
* Marker code as a string - U+0008
|
|
33
|
+
*/
|
|
34
|
+
static readonly MARKER_CODE: string;
|
|
35
|
+
/** Marker code as a regex match */
|
|
36
|
+
static readonly MARKER_CODE_MATCH: string;
|
|
37
|
+
/** Minimum ID (trailing code unit) */
|
|
38
|
+
static readonly MIN_MARKER_INDEX = 1;
|
|
39
|
+
/** Index meaning 'any marker' == `\m{.}` */
|
|
40
|
+
static readonly ANY_MARKER_INDEX = 55295;
|
|
41
|
+
/** Maximum usable marker index */
|
|
42
|
+
static readonly MAX_MARKER_INDEX: number;
|
|
43
|
+
/** Max count of markers */
|
|
44
|
+
static readonly MAX_MARKER_COUNT: number;
|
|
45
|
+
private static anyMarkerMatch;
|
|
46
|
+
/** Expression that matches any marker */
|
|
47
|
+
static readonly ANY_MARKER_MATCH: string;
|
|
48
|
+
/**
|
|
49
|
+
* Pattern for matching a marker reference, OR the special marker \m{.}
|
|
50
|
+
*/
|
|
51
|
+
static readonly REFERENCE: RegExp;
|
|
52
|
+
/**
|
|
53
|
+
* parse a string into marker references
|
|
54
|
+
* @param str input string such as "\m{a} … \m{.}"
|
|
55
|
+
* @returns `[]` or an array of all markers referenced
|
|
56
|
+
*/
|
|
57
|
+
static allReferences(str: string): string[];
|
|
58
|
+
private static markerCodeToString;
|
|
59
|
+
/** @returns string for marker #n */
|
|
60
|
+
static markerOutput(n: number, forMatch?: boolean): string;
|
|
61
|
+
/** @returns all marker strings as sentinel values */
|
|
62
|
+
static toSentinelString(s: string, markers?: OrderedStringList, forMatch?: boolean): string;
|
|
63
|
+
/**
|
|
64
|
+
* NFD a string, respecting markers.
|
|
65
|
+
* @param s input string
|
|
66
|
+
* @param forMatch true if regex, false if individual
|
|
67
|
+
* @returns the normalized string
|
|
68
|
+
*/
|
|
69
|
+
static nfd_markers(s: string, forMatch?: boolean): string;
|
|
70
|
+
/**
|
|
71
|
+
* NFD a safe subset of a string, respecting markers
|
|
72
|
+
* @param s input string
|
|
73
|
+
* @param map output array of marker chars
|
|
74
|
+
* @param forMatch true if used for regexes
|
|
75
|
+
* @returns the updated string
|
|
76
|
+
*/
|
|
77
|
+
static nfd_markers_segment(s: string, map: MarkerMap, forMatch?: boolean): string;
|
|
78
|
+
/** return the string s but with a marker sequence before it */
|
|
79
|
+
static prepend_marker(s: string, marker: number, forMatch?: boolean): string;
|
|
80
|
+
/**
|
|
81
|
+
* Add back all markers in the map to the string
|
|
82
|
+
* @param s input string
|
|
83
|
+
* @param map output: the marker map
|
|
84
|
+
* @param forMatch if true, use regex format
|
|
85
|
+
*/
|
|
86
|
+
static add_back_markers(s: string, map: MarkerMap, forMatch?: boolean): string;
|
|
87
|
+
/**
|
|
88
|
+
* Remove (and parse) markers from a string
|
|
89
|
+
* @param s input string
|
|
90
|
+
* @param map output map containing marker locations
|
|
91
|
+
* @param forMatch true if regex
|
|
92
|
+
* @returns the original string, without any markers
|
|
93
|
+
*/
|
|
94
|
+
static remove_markers(s: string, map: MarkerMap, forMatch?: boolean): string;
|
|
95
|
+
/**
|
|
96
|
+
* analyze the string to see if it begins with a marker
|
|
97
|
+
* @param s input string
|
|
98
|
+
* @param forMatch true if regex
|
|
99
|
+
* @returns parsed marker details
|
|
100
|
+
*/
|
|
101
|
+
static parse_next_marker(s: string, forMatch?: boolean): MarkerResult;
|
|
102
|
+
}
|
|
103
|
+
/** special noncharacter value denoting end of string */
|
|
104
|
+
export declare const MARKER_BEFORE_EOT = "\uFFFE";
|
|
105
|
+
export interface MarkerEntry {
|
|
106
|
+
/** code point 'glued' to, or MARKER_BEFORE_EOT */
|
|
107
|
+
ch?: string;
|
|
108
|
+
/** marker number, 1-based */
|
|
109
|
+
marker?: number;
|
|
110
|
+
/** true if processed */
|
|
111
|
+
processed?: boolean;
|
|
112
|
+
/** true if the end of the entries */
|
|
113
|
+
end?: boolean;
|
|
114
|
+
}
|
|
115
|
+
/** list of marker entries, from remove_markers */
|
|
116
|
+
export type MarkerMap = Array<MarkerEntry>;
|
|
117
|
+
/** return type from parse_next_marker */
|
|
118
|
+
export interface MarkerResult {
|
|
119
|
+
marker?: number;
|
|
120
|
+
match?: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Class for helping with markers
|
|
124
|
+
*/
|
|
125
|
+
export declare class VariableParser {
|
|
126
|
+
/**
|
|
127
|
+
* A marker id has the same constraint as a key id. TODO-LDML: Needs to be reflected in the spec
|
|
128
|
+
*/
|
|
129
|
+
static readonly ID: RegExp;
|
|
130
|
+
/**
|
|
131
|
+
* Pattern for matching a string reference `$(str)`
|
|
132
|
+
*/
|
|
133
|
+
static readonly STRING_REFERENCE: RegExp;
|
|
134
|
+
/**
|
|
135
|
+
* Pattern for matching a set reference `$[set]`
|
|
136
|
+
*/
|
|
137
|
+
static readonly SET_REFERENCE: RegExp;
|
|
138
|
+
/**
|
|
139
|
+
* Pattern for matching a capture set reference `($[set])`
|
|
140
|
+
*/
|
|
141
|
+
static readonly CAPTURE_SET_REFERENCE: RegExp;
|
|
142
|
+
/**
|
|
143
|
+
* `$[1:variable]`
|
|
144
|
+
* This regex matches the whole string.
|
|
145
|
+
*/
|
|
146
|
+
static readonly MAPPED_SET_REFERENCE: RegExp;
|
|
147
|
+
/**
|
|
148
|
+
* parse a string into references
|
|
149
|
+
* @param str input string
|
|
150
|
+
* @returns `[]` or an array of all string references referenced
|
|
151
|
+
*/
|
|
152
|
+
static allStringReferences(str: string): string[];
|
|
153
|
+
/**
|
|
154
|
+
* parse a string into references
|
|
155
|
+
* @param str input string
|
|
156
|
+
* @returns `[]` or an array of all string references referenced
|
|
157
|
+
*/
|
|
158
|
+
static allSetReferences(str: string): string[];
|
|
159
|
+
/**
|
|
160
|
+
* Split an input string into a proper set
|
|
161
|
+
* @param str input string
|
|
162
|
+
* @returns
|
|
163
|
+
*/
|
|
164
|
+
static setSplitter(str: string): string[];
|
|
165
|
+
}
|
|
166
|
+
/** for ElementParser.segment() */
|
|
167
|
+
export declare enum ElementType {
|
|
168
|
+
codepoint = ".",
|
|
169
|
+
escaped = "\\",
|
|
170
|
+
uset = "[",
|
|
171
|
+
string = "*"
|
|
172
|
+
}
|
|
173
|
+
/** one portion of a segmented element string */
|
|
174
|
+
export declare class ElementSegment {
|
|
175
|
+
segment: string;
|
|
176
|
+
readonly type: ElementType;
|
|
177
|
+
/**
|
|
178
|
+
* @param segment the string in the segment
|
|
179
|
+
* @param type type of segment. Will be calculated if not provided.
|
|
180
|
+
*/
|
|
181
|
+
constructor(segment: string, type?: ElementType);
|
|
182
|
+
/** unescaped format */
|
|
183
|
+
get unescaped(): string;
|
|
184
|
+
}
|
|
185
|
+
/** Class for helping with Element strings (i.e. reorder) */
|
|
186
|
+
export declare class ElementParser {
|
|
187
|
+
/**
|
|
188
|
+
* Matches any complex UnicodeSet that would otherwise be misinterpreted
|
|
189
|
+
* by `MATCH_ELEMENT_SEGMENTS` due to nested `[]`'s.
|
|
190
|
+
* For example, `[[a-z]-[aeiou]]` could be
|
|
191
|
+
* mis-segmented into `[[a-z]`, `-`, `[aeiou]`, `]` */
|
|
192
|
+
static readonly MATCH_NESTED_SQUARE_BRACKETS: RegExp;
|
|
193
|
+
/** Match (segment) UnicodeSets OR hex escapes OR single Unicode codepoints */
|
|
194
|
+
static readonly MATCH_ELEMENT_SEGMENTS: RegExp;
|
|
195
|
+
/** Does it start with a UnicodeSet? Used to test the segments. */
|
|
196
|
+
static readonly MATCH_USET: RegExp;
|
|
197
|
+
/** Does it start with an escaped char? Used to test the segments. */
|
|
198
|
+
static readonly MATCH_ESCAPED: RegExp;
|
|
199
|
+
/** Split a string into ElementSegments */
|
|
200
|
+
static segment(str: string): ElementSegment[];
|
|
201
|
+
}
|
|
202
202
|
//# sourceMappingURL=pattern-parser.d.ts.map
|