@keymanapp/kmc-ldml 18.0.41-alpha → 18.0.45-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/compiler/compiler.d.ts +123 -123
- package/build/src/compiler/compiler.js +307 -310
- package/build/src/compiler/compiler.js.map +1 -1
- package/build/src/compiler/disp.d.ts +11 -11
- package/build/src/compiler/disp.js +82 -85
- package/build/src/compiler/disp.js.map +1 -1
- package/build/src/compiler/empty-compiler.d.ts +37 -37
- package/build/src/compiler/empty-compiler.js +114 -117
- package/build/src/compiler/empty-compiler.js.map +1 -1
- package/build/src/compiler/keymanweb-compiler.d.ts +13 -13
- package/build/src/compiler/keymanweb-compiler.js +95 -98
- package/build/src/compiler/keymanweb-compiler.js.map +1 -1
- package/build/src/compiler/keys.d.ts +53 -53
- package/build/src/compiler/keys.js +417 -420
- package/build/src/compiler/keys.js.map +1 -1
- package/build/src/compiler/layr.d.ts +9 -9
- package/build/src/compiler/layr.js +81 -84
- package/build/src/compiler/layr.js.map +1 -1
- package/build/src/compiler/ldml-compiler-options.d.ts +11 -11
- package/build/src/compiler/ldml-compiler-options.js +3 -6
- package/build/src/compiler/ldml-compiler-options.js.map +1 -1
- package/build/src/compiler/loca.d.ts +15 -15
- package/build/src/compiler/loca.js +59 -62
- package/build/src/compiler/loca.js.map +1 -1
- package/build/src/compiler/messages.d.ts +186 -186
- package/build/src/compiler/messages.js +122 -125
- package/build/src/compiler/messages.js.map +1 -1
- package/build/src/compiler/meta.d.ts +13 -13
- package/build/src/compiler/meta.js +55 -58
- package/build/src/compiler/meta.js.map +1 -1
- package/build/src/compiler/metadata-compiler.d.ts +12 -12
- package/build/src/compiler/metadata-compiler.js +47 -50
- package/build/src/compiler/metadata-compiler.js.map +1 -1
- package/build/src/compiler/section-compiler.d.ts +35 -35
- package/build/src/compiler/section-compiler.js +40 -43
- package/build/src/compiler/section-compiler.js.map +1 -1
- package/build/src/compiler/substitution-tracker.d.ts +47 -47
- package/build/src/compiler/substitution-tracker.js +103 -106
- package/build/src/compiler/substitution-tracker.js.map +1 -1
- package/build/src/compiler/touch-layout-compiler.d.ts +7 -7
- package/build/src/compiler/touch-layout-compiler.js +91 -94
- package/build/src/compiler/touch-layout-compiler.js.map +1 -1
- package/build/src/compiler/tran.d.ts +57 -57
- package/build/src/compiler/tran.js +388 -391
- package/build/src/compiler/tran.js.map +1 -1
- package/build/src/compiler/vars.d.ts +21 -21
- package/build/src/compiler/vars.js +234 -237
- package/build/src/compiler/vars.js.map +1 -1
- package/build/src/compiler/visual-keyboard-compiler.d.ts +8 -8
- package/build/src/compiler/visual-keyboard-compiler.js +68 -71
- package/build/src/compiler/visual-keyboard-compiler.js.map +1 -1
- package/build/src/main.d.ts +3 -3
- package/build/src/main.js +3 -6
- package/build/src/main.js.map +1 -1
- package/build/src/util/util.d.ts +49 -49
- package/build/src/util/util.js +183 -186
- package/build/src/util/util.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,50 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=metadata-compiler.js.map
|
|
50
|
-
//# debugId=2ea0d6b3-d8b2-57fe-a0d7-11c4f312b694
|
|
1
|
+
import { KMX } from '@keymanapp/common-types';
|
|
2
|
+
import KEYMAN_VERSION from "@keymanapp/keyman-version";
|
|
3
|
+
var KMXFile = KMX.KMXFile;
|
|
4
|
+
export class KMXPlusMetadataCompiler {
|
|
5
|
+
/**
|
|
6
|
+
* Look for metadata fields in the KMXPlus data and copy them
|
|
7
|
+
* through to the relevant KMX stores
|
|
8
|
+
* @param kmxplus const KMXPlusData
|
|
9
|
+
*/
|
|
10
|
+
static addKmxMetadata(kmxplus, keyboard, options) {
|
|
11
|
+
// Order of stores is not significant by kmx spec, but kmxplus compiler will
|
|
12
|
+
// always store according to dwSystemID binary order for non-zero
|
|
13
|
+
// dwSystemID, then by dpName binary order, and finally by dpString binary
|
|
14
|
+
// order
|
|
15
|
+
// TSS_NAME = 7
|
|
16
|
+
// TSS_COMPILEDVERSION = 20
|
|
17
|
+
// TSS_KEYBOARDVERSION = 36
|
|
18
|
+
// TSS_TARGETS = 38
|
|
19
|
+
// TSS_NAME: User friendly name of keyboard
|
|
20
|
+
keyboard.stores.push({
|
|
21
|
+
dpName: '&NAME',
|
|
22
|
+
dpString: kmxplus.meta?.name?.value ?? 'unknown', // Empty name should not happen, so ok to use 'unknown' here
|
|
23
|
+
dwSystemID: KMXFile.TSS_NAME
|
|
24
|
+
});
|
|
25
|
+
if (options.shouldAddCompilerVersion) {
|
|
26
|
+
// TSS_COMPILEDVERSION: version of the compiler
|
|
27
|
+
keyboard.stores.push({
|
|
28
|
+
dpName: '',
|
|
29
|
+
dpString: KEYMAN_VERSION.VERSION_WITH_TAG,
|
|
30
|
+
dwSystemID: KMXFile.TSS_COMPILEDVERSION
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
// TSS_KEYBOARDVERSION: Version of the keyboard, should be semver
|
|
34
|
+
keyboard.stores.push({
|
|
35
|
+
dpName: '&KEYBOARDVERSION',
|
|
36
|
+
dpString: kmxplus.meta?.version?.value ?? '1.0', // 1.0 is inferred version
|
|
37
|
+
dwSystemID: KMXFile.TSS_KEYBOARDVERSION
|
|
38
|
+
});
|
|
39
|
+
// TSS_TARGETS: which platforms are supported
|
|
40
|
+
keyboard.stores.push({
|
|
41
|
+
dpName: '&TARGETS',
|
|
42
|
+
dpString: 'desktop', // TODO-LDML: support touch layouts in #7238
|
|
43
|
+
dwSystemID: KMXFile.TSS_TARGETS
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=metadata-compiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata-compiler.js","sources":["../../../src/compiler/metadata-compiler.ts"],"
|
|
1
|
+
{"version":3,"file":"metadata-compiler.js","sourceRoot":"","sources":["../../../src/compiler/metadata-compiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAW,MAAM,yBAAyB,CAAC;AAEvD,OAAO,cAAc,MAAM,2BAA2B,CAAC;AAGvD,IAAO,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;AAG7B,MAAM,OAAO,uBAAuB;IAClC;;;;OAIG;IACI,MAAM,CAAC,cAAc,CAAC,OAAoB,EAAE,QAAkB,EAAE,OAA4B;QACjG,4EAA4E;QAC5E,iEAAiE;QACjE,0EAA0E;QAC1E,QAAQ;QAER,eAAe;QACf,2BAA2B;QAC3B,2BAA2B;QAC3B,mBAAmB;QAEnB,2CAA2C;QAC3C,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;YACnB,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,SAAS,EAAG,4DAA4D;YAC/G,UAAU,EAAE,OAAO,CAAC,QAAQ;SAC7B,CAAC,CAAC;QAEH,IAAG,OAAO,CAAC,wBAAwB,EAAE,CAAC;YACpC,+CAA+C;YAC/C,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;gBACnB,MAAM,EAAE,EAAE;gBACV,QAAQ,EAAE,cAAc,CAAC,gBAAgB;gBACzC,UAAU,EAAE,OAAO,CAAC,mBAAmB;aACxC,CAAC,CAAC;QACL,CAAC;QAED,iEAAiE;QACjE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;YACnB,MAAM,EAAE,kBAAkB;YAC1B,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,KAAK,EAAG,0BAA0B;YAC5E,UAAU,EAAE,OAAO,CAAC,mBAAmB;SACxC,CAAC,CAAC;QAEH,6CAA6C;QAC7C,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;YACnB,MAAM,EAAE,UAAU;YAClB,QAAQ,EAAE,SAAS,EAAK,4CAA4C;YACpE,UAAU,EAAE,OAAO,CAAC,WAAW;SAChC,CAAC,CAAC;IACL,CAAC;CAEF"}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { LDMLKeyboard, KMXPlus, CompilerCallbacks } from "@keymanapp/common-types";
|
|
2
|
-
import { SectionIdent } from '@keymanapp/ldml-keyboard-constants';
|
|
3
|
-
/** newable interface to SectionCompiler c'tor */
|
|
4
|
-
export type SectionCompilerNew = new (source: LDMLKeyboard.LDMLKeyboardXMLSourceFile, callbacks: CompilerCallbacks) => SectionCompiler;
|
|
5
|
-
export declare abstract class SectionCompiler {
|
|
6
|
-
protected readonly keyboard3: LDMLKeyboard.LKKeyboard;
|
|
7
|
-
protected readonly callbacks: CompilerCallbacks;
|
|
8
|
-
constructor(source: LDMLKeyboard.LDMLKeyboardXMLSourceFile, callbacks: CompilerCallbacks);
|
|
9
|
-
abstract get id(): SectionIdent;
|
|
10
|
-
/**
|
|
11
|
-
* This is called before compile.
|
|
12
|
-
* @returns false if this compiler failed to validate.
|
|
13
|
-
*/
|
|
14
|
-
validate(): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Perform the compilation for this section, returning the correct Section subclass
|
|
17
|
-
* object.
|
|
18
|
-
*
|
|
19
|
-
* @param sections any declared dependency sections per dependencies()
|
|
20
|
-
*/
|
|
21
|
-
abstract compile(sections: KMXPlus.DependencySections): KMXPlus.Section;
|
|
22
|
-
/**
|
|
23
|
-
* This is called after all other compile phases have completed,
|
|
24
|
-
* when being called by validate(), and provides an
|
|
25
|
-
* opportunity for late error reporting, for example for invalid strings.
|
|
26
|
-
* @param section the compiled section, if any.
|
|
27
|
-
* @returns false if validate fails
|
|
28
|
-
*/
|
|
29
|
-
postValidate(section?: KMXPlus.Section): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Get the dependencies for this compiler.
|
|
32
|
-
* @returns set of dependent sections
|
|
33
|
-
*/
|
|
34
|
-
get dependencies(): Set<SectionIdent>;
|
|
35
|
-
}
|
|
1
|
+
import { LDMLKeyboard, KMXPlus, CompilerCallbacks } from "@keymanapp/common-types";
|
|
2
|
+
import { SectionIdent } from '@keymanapp/ldml-keyboard-constants';
|
|
3
|
+
/** newable interface to SectionCompiler c'tor */
|
|
4
|
+
export type SectionCompilerNew = new (source: LDMLKeyboard.LDMLKeyboardXMLSourceFile, callbacks: CompilerCallbacks) => SectionCompiler;
|
|
5
|
+
export declare abstract class SectionCompiler {
|
|
6
|
+
protected readonly keyboard3: LDMLKeyboard.LKKeyboard;
|
|
7
|
+
protected readonly callbacks: CompilerCallbacks;
|
|
8
|
+
constructor(source: LDMLKeyboard.LDMLKeyboardXMLSourceFile, callbacks: CompilerCallbacks);
|
|
9
|
+
abstract get id(): SectionIdent;
|
|
10
|
+
/**
|
|
11
|
+
* This is called before compile.
|
|
12
|
+
* @returns false if this compiler failed to validate.
|
|
13
|
+
*/
|
|
14
|
+
validate(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Perform the compilation for this section, returning the correct Section subclass
|
|
17
|
+
* object.
|
|
18
|
+
*
|
|
19
|
+
* @param sections any declared dependency sections per dependencies()
|
|
20
|
+
*/
|
|
21
|
+
abstract compile(sections: KMXPlus.DependencySections): KMXPlus.Section;
|
|
22
|
+
/**
|
|
23
|
+
* This is called after all other compile phases have completed,
|
|
24
|
+
* when being called by validate(), and provides an
|
|
25
|
+
* opportunity for late error reporting, for example for invalid strings.
|
|
26
|
+
* @param section the compiled section, if any.
|
|
27
|
+
* @returns false if validate fails
|
|
28
|
+
*/
|
|
29
|
+
postValidate(section?: KMXPlus.Section): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Get the dependencies for this compiler.
|
|
32
|
+
* @returns set of dependent sections
|
|
33
|
+
*/
|
|
34
|
+
get dependencies(): Set<SectionIdent>;
|
|
35
|
+
}
|
|
36
36
|
//# sourceMappingURL=section-compiler.d.ts.map
|
|
@@ -1,43 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
constants.section.
|
|
35
|
-
constants.section.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=section-compiler.js.map
|
|
43
|
-
//# debugId=be26e017-8a6f-5472-899a-65c563654944
|
|
1
|
+
import { constants } from '@keymanapp/ldml-keyboard-constants';
|
|
2
|
+
export class SectionCompiler {
|
|
3
|
+
keyboard3;
|
|
4
|
+
callbacks;
|
|
5
|
+
constructor(source, callbacks) {
|
|
6
|
+
this.keyboard3 = source.keyboard3;
|
|
7
|
+
this.callbacks = callbacks;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* This is called before compile.
|
|
11
|
+
* @returns false if this compiler failed to validate.
|
|
12
|
+
*/
|
|
13
|
+
validate() {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* This is called after all other compile phases have completed,
|
|
18
|
+
* when being called by validate(), and provides an
|
|
19
|
+
* opportunity for late error reporting, for example for invalid strings.
|
|
20
|
+
* @param section the compiled section, if any.
|
|
21
|
+
* @returns false if validate fails
|
|
22
|
+
*/
|
|
23
|
+
postValidate(section) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the dependencies for this compiler.
|
|
28
|
+
* @returns set of dependent sections
|
|
29
|
+
*/
|
|
30
|
+
get dependencies() {
|
|
31
|
+
const defaults = new Set([
|
|
32
|
+
constants.section.strs,
|
|
33
|
+
constants.section.list,
|
|
34
|
+
constants.section.elem,
|
|
35
|
+
constants.section.vars,
|
|
36
|
+
]);
|
|
37
|
+
return defaults;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=section-compiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-compiler.js","sources":["../../../src/compiler/section-compiler.ts"],"
|
|
1
|
+
{"version":3,"file":"section-compiler.js","sourceRoot":"","sources":["../../../src/compiler/section-compiler.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAI7E,MAAM,OAAgB,eAAe;IAChB,SAAS,CAA0B;IACnC,SAAS,CAAoB;IAEhD,YAAY,MAA8C,EAAE,SAA4B;QACtF,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAID;;;OAGG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAUD;;;;;;OAMG;IACI,YAAY,CAAC,OAAyB;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACH,IAAW,YAAY;QACrB,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAiB;YACvC,SAAS,CAAC,OAAO,CAAC,IAAI;YACtB,SAAS,CAAC,OAAO,CAAC,IAAI;YACtB,SAAS,CAAC,OAAO,CAAC,IAAI;YACtB,SAAS,CAAC,OAAO,CAAC,IAAI;SACvB,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Verb for SubstitutionTracker.add()
|
|
3
|
-
*/
|
|
4
|
-
export declare enum SubstitutionUse {
|
|
5
|
-
/** outputs this marker into context (e.g. transform to= or key to=) */
|
|
6
|
-
emit = 0,
|
|
7
|
-
/** consumes this marker out of the context (e.g. transform from=) */
|
|
8
|
-
consume = 1,
|
|
9
|
-
/** matches the marker, but doesn't consume (e.g. display to=) */
|
|
10
|
-
match = 2,
|
|
11
|
-
/** variable definition: might consume, emit, or match. */
|
|
12
|
-
variable = 3
|
|
13
|
-
}
|
|
14
|
-
type SubstitutionSet = Set<string>;
|
|
15
|
-
/** Tracks usage of markers */
|
|
16
|
-
export declare class SubstitutionTracker {
|
|
17
|
-
/** markers that were emitted */
|
|
18
|
-
emitted: SubstitutionSet;
|
|
19
|
-
/** markers that were consumed and removed from the context */
|
|
20
|
-
consumed: SubstitutionSet;
|
|
21
|
-
/** markers that were matched, but not necessarily consumed */
|
|
22
|
-
matched: SubstitutionSet;
|
|
23
|
-
/** all markers */
|
|
24
|
-
all: SubstitutionSet;
|
|
25
|
-
constructor();
|
|
26
|
-
/**
|
|
27
|
-
*
|
|
28
|
-
* @param verb what kind of use we are adding
|
|
29
|
-
* @param markers list of substitutions to add
|
|
30
|
-
*/
|
|
31
|
-
add(verb: SubstitutionUse, markers: string[]): void;
|
|
32
|
-
}
|
|
33
|
-
/** rollup of several substitution types */
|
|
34
|
-
export declare class Substitutions {
|
|
35
|
-
addSetAndStringSubtitution(verb: SubstitutionUse, str?: string): void;
|
|
36
|
-
/** add a string that can have string var substitutions or markers */
|
|
37
|
-
addStringAndMarkerSubstitution(verb: SubstitutionUse, str?: string): void;
|
|
38
|
-
addStringSubstitution(verb: SubstitutionUse, str?: string): void;
|
|
39
|
-
/** add a string that's just markers */
|
|
40
|
-
addMarkers(verb: SubstitutionUse, str?: string): void;
|
|
41
|
-
markers: SubstitutionTracker;
|
|
42
|
-
set: SubstitutionTracker;
|
|
43
|
-
string: SubstitutionTracker;
|
|
44
|
-
uset: SubstitutionTracker;
|
|
45
|
-
constructor();
|
|
46
|
-
}
|
|
47
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* Verb for SubstitutionTracker.add()
|
|
3
|
+
*/
|
|
4
|
+
export declare enum SubstitutionUse {
|
|
5
|
+
/** outputs this marker into context (e.g. transform to= or key to=) */
|
|
6
|
+
emit = 0,
|
|
7
|
+
/** consumes this marker out of the context (e.g. transform from=) */
|
|
8
|
+
consume = 1,
|
|
9
|
+
/** matches the marker, but doesn't consume (e.g. display to=) */
|
|
10
|
+
match = 2,
|
|
11
|
+
/** variable definition: might consume, emit, or match. */
|
|
12
|
+
variable = 3
|
|
13
|
+
}
|
|
14
|
+
type SubstitutionSet = Set<string>;
|
|
15
|
+
/** Tracks usage of markers */
|
|
16
|
+
export declare class SubstitutionTracker {
|
|
17
|
+
/** markers that were emitted */
|
|
18
|
+
emitted: SubstitutionSet;
|
|
19
|
+
/** markers that were consumed and removed from the context */
|
|
20
|
+
consumed: SubstitutionSet;
|
|
21
|
+
/** markers that were matched, but not necessarily consumed */
|
|
22
|
+
matched: SubstitutionSet;
|
|
23
|
+
/** all markers */
|
|
24
|
+
all: SubstitutionSet;
|
|
25
|
+
constructor();
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param verb what kind of use we are adding
|
|
29
|
+
* @param markers list of substitutions to add
|
|
30
|
+
*/
|
|
31
|
+
add(verb: SubstitutionUse, markers: string[]): void;
|
|
32
|
+
}
|
|
33
|
+
/** rollup of several substitution types */
|
|
34
|
+
export declare class Substitutions {
|
|
35
|
+
addSetAndStringSubtitution(verb: SubstitutionUse, str?: string): void;
|
|
36
|
+
/** add a string that can have string var substitutions or markers */
|
|
37
|
+
addStringAndMarkerSubstitution(verb: SubstitutionUse, str?: string): void;
|
|
38
|
+
addStringSubstitution(verb: SubstitutionUse, str?: string): void;
|
|
39
|
+
/** add a string that's just markers */
|
|
40
|
+
addMarkers(verb: SubstitutionUse, str?: string): void;
|
|
41
|
+
markers: SubstitutionTracker;
|
|
42
|
+
set: SubstitutionTracker;
|
|
43
|
+
string: SubstitutionTracker;
|
|
44
|
+
uset: SubstitutionTracker;
|
|
45
|
+
constructor();
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
48
48
|
//# sourceMappingURL=substitution-tracker.d.ts.map
|
|
@@ -1,106 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
SubstitutionUse[SubstitutionUse["
|
|
11
|
-
/**
|
|
12
|
-
SubstitutionUse[SubstitutionUse["
|
|
13
|
-
/**
|
|
14
|
-
SubstitutionUse[SubstitutionUse["
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
/** markers that were
|
|
21
|
-
|
|
22
|
-
/** markers that were
|
|
23
|
-
|
|
24
|
-
/** markers
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
this.
|
|
100
|
-
this.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=substitution-tracker.js.map
|
|
106
|
-
//# debugId=1fdfe3f8-d593-5e7f-9858-74311b2316dd
|
|
1
|
+
import { MarkerParser, VariableParser } from "@keymanapp/common-types";
|
|
2
|
+
/**
|
|
3
|
+
* Verb for SubstitutionTracker.add()
|
|
4
|
+
*/
|
|
5
|
+
export var SubstitutionUse;
|
|
6
|
+
(function (SubstitutionUse) {
|
|
7
|
+
/** outputs this marker into context (e.g. transform to= or key to=) */
|
|
8
|
+
SubstitutionUse[SubstitutionUse["emit"] = 0] = "emit";
|
|
9
|
+
/** consumes this marker out of the context (e.g. transform from=) */
|
|
10
|
+
SubstitutionUse[SubstitutionUse["consume"] = 1] = "consume";
|
|
11
|
+
/** matches the marker, but doesn't consume (e.g. display to=) */
|
|
12
|
+
SubstitutionUse[SubstitutionUse["match"] = 2] = "match";
|
|
13
|
+
/** variable definition: might consume, emit, or match. */
|
|
14
|
+
SubstitutionUse[SubstitutionUse["variable"] = 3] = "variable";
|
|
15
|
+
})(SubstitutionUse || (SubstitutionUse = {}));
|
|
16
|
+
/** Tracks usage of markers */
|
|
17
|
+
export class SubstitutionTracker {
|
|
18
|
+
/** markers that were emitted */
|
|
19
|
+
emitted;
|
|
20
|
+
/** markers that were consumed and removed from the context */
|
|
21
|
+
consumed;
|
|
22
|
+
/** markers that were matched, but not necessarily consumed */
|
|
23
|
+
matched;
|
|
24
|
+
/** all markers */
|
|
25
|
+
all;
|
|
26
|
+
constructor() {
|
|
27
|
+
this.emitted = new Set();
|
|
28
|
+
this.consumed = new Set();
|
|
29
|
+
this.matched = new Set();
|
|
30
|
+
this.all = new Set();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param verb what kind of use we are adding
|
|
35
|
+
* @param markers list of substitutions to add
|
|
36
|
+
*/
|
|
37
|
+
add(verb, markers) {
|
|
38
|
+
if (!markers.length) {
|
|
39
|
+
return; // skip if empty
|
|
40
|
+
}
|
|
41
|
+
if (verb == SubstitutionUse.emit) {
|
|
42
|
+
markers.forEach((m) => {
|
|
43
|
+
this.emitted.add(m);
|
|
44
|
+
this.all.add(m);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
else if (verb == SubstitutionUse.consume) {
|
|
48
|
+
markers.forEach((m) => {
|
|
49
|
+
this.consumed.add(m);
|
|
50
|
+
this.all.add(m);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else if (verb == SubstitutionUse.match) {
|
|
54
|
+
markers.forEach((m) => {
|
|
55
|
+
this.matched.add(m);
|
|
56
|
+
this.all.add(m);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
else if (verb == SubstitutionUse.variable) {
|
|
60
|
+
markers.forEach((m) => {
|
|
61
|
+
// we don't know, so add it to all three
|
|
62
|
+
this.matched.add(m);
|
|
63
|
+
this.emitted.add(m);
|
|
64
|
+
this.consumed.add(m);
|
|
65
|
+
this.all.add(m);
|
|
66
|
+
});
|
|
67
|
+
/* c8 skip next 3 */
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
throw Error(`Internal error: unsupported verb ${verb} for match`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** rollup of several substitution types */
|
|
75
|
+
export class Substitutions {
|
|
76
|
+
addSetAndStringSubtitution(verb, str) {
|
|
77
|
+
this.set.add(verb, VariableParser.allSetReferences(str));
|
|
78
|
+
this.addStringAndMarkerSubstitution(verb, str);
|
|
79
|
+
}
|
|
80
|
+
/** add a string that can have string var substitutions or markers */
|
|
81
|
+
addStringAndMarkerSubstitution(verb, str) {
|
|
82
|
+
this.addMarkers(verb, str);
|
|
83
|
+
this.addStringSubstitution(verb, str);
|
|
84
|
+
}
|
|
85
|
+
addStringSubstitution(verb, str) {
|
|
86
|
+
this.string.add(verb, VariableParser.allStringReferences(str));
|
|
87
|
+
}
|
|
88
|
+
/** add a string that's just markers */
|
|
89
|
+
addMarkers(verb, str) {
|
|
90
|
+
this.markers.add(verb, MarkerParser.allReferences(str));
|
|
91
|
+
}
|
|
92
|
+
markers;
|
|
93
|
+
set;
|
|
94
|
+
string;
|
|
95
|
+
uset;
|
|
96
|
+
constructor() {
|
|
97
|
+
this.markers = new SubstitutionTracker();
|
|
98
|
+
this.set = new SubstitutionTracker();
|
|
99
|
+
this.string = new SubstitutionTracker();
|
|
100
|
+
this.uset = new SubstitutionTracker();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=substitution-tracker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"substitution-tracker.js","sources":["../../../src/compiler/substitution-tracker.ts"],"
|
|
1
|
+
{"version":3,"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EAAE,GAAG,CAAC,CAAC;IACjD,CAAC;IACD,qEAAqE;IACrE,8BAA8B,CAAC,IAAqB,EAAE,GAAY;QAChE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACxC,CAAC;IACD,qBAAqB,CAAC,IAAqB,EAAE,GAAY;QACvD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;IACjE,CAAC;IACD,uCAAuC;IACvC,UAAU,CAAC,IAAqB,EAAE,GAAY;QAC5C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,CAAsB;IAC7B,GAAG,CAAsB;IACzB,MAAM,CAAsB;IAC5B,IAAI,CAAsB;IAE1B;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,mBAAmB,EAAE,CAAC;QACzC,IAAI,CAAC,GAAG,GAAG,IAAI,mBAAmB,EAAE,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,IAAI,mBAAmB,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,mBAAmB,EAAE,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TouchLayout, LDMLKeyboard } from "@keymanapp/common-types";
|
|
2
|
-
export declare class TouchLayoutCompiler {
|
|
3
|
-
compileToJavascript(source: LDMLKeyboard.LDMLKeyboardXMLSourceFile): TouchLayout.TouchLayoutFile;
|
|
4
|
-
private compileHardwareLayer;
|
|
5
|
-
private translateLayerIdToTouchLayoutLayerId;
|
|
6
|
-
private translateKeyIdentifierToTouch;
|
|
7
|
-
}
|
|
1
|
+
import { TouchLayout, LDMLKeyboard } from "@keymanapp/common-types";
|
|
2
|
+
export declare class TouchLayoutCompiler {
|
|
3
|
+
compileToJavascript(source: LDMLKeyboard.LDMLKeyboardXMLSourceFile): TouchLayout.TouchLayoutFile;
|
|
4
|
+
private compileHardwareLayer;
|
|
5
|
+
private translateLayerIdToTouchLayoutLayerId;
|
|
6
|
+
private translateKeyIdentifierToTouch;
|
|
7
|
+
}
|
|
8
8
|
//# sourceMappingURL=touch-layout-compiler.d.ts.map
|