From 70bbf61c8c89f1cb57d5a10f7cb00690139883a4 Mon Sep 17 00:00:00 2001 From: Sabine Date: Sat, 6 Jun 2026 22:43:25 +0200 Subject: [PATCH 1/6] feat(developer): reviewRules: return object instead of string[] messages correct --- .../src/common/web/utils/src/xml-utils.ts | 6 +- .../src/kmc-convert/src/converter-messages.ts | 17 +- .../keylayout-to-kmn-converter.ts | 2 +- .../src/keylayout-to-kmn/kmn-file-writer.ts | 1324 +++++++---------- .../src/kmc-convert/test/data/OutputXName.bb | 1290 ---------------- .../test/keylayout-to-kmn-converter.tests.ts | 22 + .../kmc-convert/test/kmn-file-writer.tests.ts | 84 +- 7 files changed, 581 insertions(+), 2164 deletions(-) delete mode 100644 developer/src/kmc-convert/test/data/OutputXName.bb diff --git a/developer/src/common/web/utils/src/xml-utils.ts b/developer/src/common/web/utils/src/xml-utils.ts index cfe42987dd8..765a5b7167e 100644 --- a/developer/src/common/web/utils/src/xml-utils.ts +++ b/developer/src/common/web/utils/src/xml-utils.ts @@ -6,7 +6,7 @@ * Abstraction for XML reading and writing */ -import { XMLParser, XMLBuilder, XMLMetaData, X2jOptions, XmlBuilderOptions, JPathOrMatcher } from 'fast-xml-parser'; +import { XMLParser, XMLBuilder, XMLMetaData, X2jOptions, XmlBuilderOptions } from 'fast-xml-parser'; import { SymbolUtils } from "./symbol-utils.js"; /** Symbol giving the start offset, in chars, of the node */ @@ -85,8 +85,8 @@ const PARSER_OPTIONS: KeymanXMLParserOptionsBag = { }, 'kvks': { ...PARSER_COMMON_OPTIONS, - tagValueProcessor: (_tagName: string, tagValue: string, _jPathOrMatcher: JPathOrMatcher, _hasAttributes: boolean, isLeafNode: boolean) : unknown => { - if (!isLeafNode) { + tagValueProcessor: (_tagName: string, tagValue: string, _jPath: string, _hasAttributes: boolean, isLeafNode: boolean): string | undefined => { + if (!isLeafNode) { return tagValue?.trim(); // trimmed value } else { return undefined; // no change to leaf nodes diff --git a/developer/src/kmc-convert/src/converter-messages.ts b/developer/src/kmc-convert/src/converter-messages.ts index 2f4bdb47677..2453d008512 100644 --- a/developer/src/kmc-convert/src/converter-messages.ts +++ b/developer/src/kmc-convert/src/converter-messages.ts @@ -6,9 +6,9 @@ import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageSpec as m, CompilerMessageDef as def } from '@keymanapp/developer-utils'; const Namespace = CompilerErrorNamespace.Converter; -//const SevInfo = CompilerErrorSeverity.Info | Namespace; - const SevHint = CompilerErrorSeverity.Hint | Namespace; -const SevWarn = CompilerErrorSeverity.Warn | Namespace; +// const SevInfo = CompilerErrorSeverity.Info | Namespace; +// const SevHint = CompilerErrorSeverity.Hint | Namespace; +// const SevWarn = CompilerErrorSeverity.Warn | Namespace; const SevError = CompilerErrorSeverity.Error | Namespace; // const SevFatal = CompilerErrorSeverity.Fatal | Namespace; @@ -77,15 +77,4 @@ export class ConverterMessages { `Input data could not be parsed.` ); - static WARN_EmptyOutput = SevWarn | 0x000D; - static Warn_EmptyOutput =(o: { keymapIndex: string, key: string, KeyName: string; }) => m( - this.WARN_EmptyOutput, - `Key has empty output (possibly caused by use of html entity) at keyMap index ${def(o.keymapIndex)} on Keycode ${def(o.key)} (${def(o.KeyName)})` - ); - static HINT_EmptyOutput = SevHint | 0x000E; - static Hint_EmptyOutput =(o: { keymapIndex: string, key: string, KeyName: string; }) => m( - this.HINT_EmptyOutput, - `Key has empty output at keyMap index ${def(o.keymapIndex)} on Keycode ${def(o.key)} (${def(o.KeyName)}) possibly caused by use of html entity ` - ); - } diff --git a/developer/src/kmc-convert/src/keylayout-to-kmn/keylayout-to-kmn-converter.ts b/developer/src/kmc-convert/src/keylayout-to-kmn/keylayout-to-kmn-converter.ts index 1bf23189084..7b9e98bf61e 100644 --- a/developer/src/kmc-convert/src/keylayout-to-kmn/keylayout-to-kmn-converter.ts +++ b/developer/src/kmc-convert/src/keylayout-to-kmn/keylayout-to-kmn-converter.ts @@ -135,7 +135,7 @@ export class KeylayoutToKmnConverter { const processedData = await this.convert(jsonO, inputFilename, outputFilename); const kmnFileWriter = new KmnFileWriter(this.callbacks, this.options); - +kmnFileWriter.writeToFile((processedData)); // write to object/ConverterToKmnResult const outputKmn = kmnFileWriter.write(processedData); const result: ConverterToKmnResult = { diff --git a/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts b/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts index 8ac6a501f82..5c3b4b83b4e 100644 --- a/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts +++ b/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts @@ -25,54 +25,71 @@ interface RuleReview { hasWarning_1: boolean; hasWarning_2: boolean; warningMessages: string[]; + extraWarning: string; - type: 'RuleReview'; + type: 'RuleReview' | 'UnavailableModifier' | 'UnavailableSuperior' | + 'DuplicateRule' | 'AmbiguousRule'; isEarlier: boolean; + isLater: boolean; isused: boolean; context: string; - prevDK_modifier: string; - prevDK_key: string; - DK_modifier: string; - DK_key: string; + prevDk_id: number; + dk_prefix: string; + prev_dk_prefix: string; + prevDk_modifier: string; + prevDk_key: string; + textpart: string; + dk_id: number; + Dk_modifier: string; + Dk_key: string; modifier: string; key: string; output: string; }; -//interface UnavailableModifier /*extends RuleReview*/ { -/*interface UnavailableModifier { + +interface UnavailableModifier extends RuleReview { type: 'UnavailableModifier'; + isUnavailable: boolean; +}; +interface UnavailableSuperior extends RuleReview { + type: 'UnavailableSuperior'; + isUnavailable: boolean; +}; +interface DuplicateRules extends RuleReview { + type: 'DuplicateRule'; + hasExtraWarning: boolean; isEarlier: boolean; - isused: boolean; - context: string; - prevDK_modifier: string; - prevDK_key: string; - DK_modifier: string; - DK_key: string; - modifier: string; - key: string; - output: string; - warningMessage: string[]; -};*/ -interface RuleReview { - type: 'RuleReview'; + isLater: boolean; +}; +interface AmbiguousRules extends RuleReview { + type: 'AmbiguousRule'; + hasExtraWarning: boolean; isEarlier: boolean; - isused: boolean; - context: string; - prevDK_modifier: string; - prevDK_key: string; - DK_modifier: string; - DK_key: string; - modifier: string; - key: string; - output: string; - - warningMessages: string[]; + isLater: boolean; + dk_prefix: string; + prev_dk_prefix: string; }; + + export class KmnFileWriter { constructor(private callbacks: CompilerCallbacks, private options: CompilerOptions) { }; + // TODO remove + public writeToFile(dataUkelele: ProcessedData): boolean { + + let data: string = "\n"; + + // add top part of kmn file: STORES + data += this.writeKmnFileHeader(dataUkelele); + + // add bottom part of kmn file: RULES + data += this.writeDataRules(dataUkelele); + + this.callbacks.fs.writeFileSync(dataUkelele.kmnFilename, new TextEncoder().encode(data)); + return true; + } /** * @brief member function to write data from object to a Uint8Array * @param dataUkelele the array holding all keyboard data @@ -428,12 +445,9 @@ export class KmnFileWriter { + "] > " + versionOutputCharacter + "\n"; - } - } } - if ((warnText[0].indexOf("duplicate") < 0) || (warnText[1].indexOf("duplicate") < 0) || (warnText[2].indexOf("duplicate") < 0)) { data += "\n"; } @@ -442,6 +456,137 @@ export class KmnFileWriter { return data; } + /** + * @brief take a child object of RuleReview and return the appropriate warning message + * @param inObj : an object containing all data + * @return outMsg the warning message + */ + public createWarningText(inObj: RuleReview, pos: number = 2): string[] { + const outMsg: string[] = ['', '', '']; + outMsg[0] = inObj.warningMessages[0]; + outMsg[1] = inObj.warningMessages[1]; + outMsg[2] = inObj.warningMessages[2]; + + if (inObj.type === 'AmbiguousRule') { + + // version for dk 5-5 + if (!inObj.prevDk_modifier && !inObj.prevDk_key + && inObj.Dk_modifier && inObj.Dk_key + && !inObj.modifier && !inObj.key + && (inObj.dk_id !== -1)) { + const position = (inObj.isEarlier ? "earlier" : "later"); + const doubletextpreventer = + ('ambiguous rule: ' + position + + ': dk(' + inObj.dk_prefix + + inObj.dk_id + + ") + [" + + inObj.Dk_modifier + + " " + + inObj.Dk_key + + "] > " + + 'dk(' + inObj.prev_dk_prefix + + inObj.prevDk_id + + ") "); + if (outMsg[pos].indexOf(doubletextpreventer) === -1) + outMsg[pos] += doubletextpreventer; + } + + // version for key with no dk_id amb 6-6 + else if (!inObj.prevDk_modifier && !inObj.prevDk_key + && (inObj.dk_id !== -1) + && inObj.modifier && inObj.key && (inObj.output) + && ((inObj.isEarlier === true /*&& inObj.isLater === true*/))) { + const position = (inObj.isEarlier ? "earlier" : "later"); + outMsg[pos] = inObj.warningMessages[2] + + ('ambiguous rule: ' + + position + + ': dk(' + inObj.dk_prefix + + inObj.dk_id + ") + [" + + inObj.modifier + " " + + inObj.key + "] > \'" + + inObj.output + "\' "); + } + // version for 2_2 2_1 + else if ((!inObj.prevDk_modifier && !inObj.prevDk_key) + && inObj.Dk_modifier && inObj.Dk_key + && (inObj.dk_id !== -1)) { + const position = (inObj.isEarlier ? "earlier" : "later"); + const doubletextpreventer = + ("ambiguous rule: " + + position + ": [" + + inObj.Dk_modifier + " " + + inObj.Dk_key + "] > dk(" + inObj.dk_prefix + + inObj.dk_id + ") "); + if (outMsg[pos].indexOf(doubletextpreventer) === -1) + outMsg[pos] += doubletextpreventer; + } + + // version for dk 4-4 2-4 + else if (inObj.Dk_modifier && inObj.Dk_key + && (inObj.dk_id !== -1) + && !inObj.modifier && !inObj.key) { + const position = (inObj.isEarlier ? "earlier" : "later"); + const doubletextpreventer = + ("ambiguous rule: " + + position + ": [" + + inObj.prevDk_modifier + " " + + inObj.prevDk_key + "] > dk(" + inObj.prev_dk_prefix + + inObj.prevDk_id + ") "); + if (outMsg[pos].indexOf(doubletextpreventer) === -1) + outMsg[pos] += doubletextpreventer; + } + + + // version for prev dk // 4_1 4_2 + else if (inObj.prevDk_modifier && inObj.prevDk_key && (inObj.prevDk_id !== -1)) { + const position = (inObj.isEarlier ? "earlier" : "later"); + const doubletextpreventer = + ("ambiguous rule: " + + position + ": [" + + inObj.prevDk_modifier + " " + + inObj.prevDk_key + "] > dk(" + inObj.prev_dk_prefix + + inObj.prevDk_id + ") "); + if (outMsg[pos].indexOf(doubletextpreventer) === -1) + outMsg[pos] += doubletextpreventer; + } + + // version for dk 6-3 or 3-3 + else if (!inObj.prevDk_modifier && !inObj.prevDk_key + && !inObj.Dk_modifier && !inObj.Dk_key + && (inObj.dk_id !== -1) + ) { + const position = (inObj.isEarlier ? "earlier" : "later"); + const doubletextpreventer = + ('ambiguous rule: ' + + position + + ': dk(' + inObj.dk_prefix + + inObj.dk_id + ") + [" + + inObj.modifier + " " + + inObj.key + "] > \'" + + inObj.output + "\' "); + if (outMsg[pos].indexOf(doubletextpreventer) === -1) + outMsg[pos] += doubletextpreventer; + } + + // version for key with no dk_id amb 1-1 + else if (inObj.modifier && inObj.key + && (inObj.output) + && (inObj.dk_id === -1) + && ((inObj.isEarlier === true /*&& inObj.isLater === true*/))) { + const position = (inObj.isEarlier ? "earlier" : "later"); + outMsg[pos] = inObj.warningMessages[2] + + ("ambiguous rule: " + + position + + ": [" + + inObj.modifier + " " + + inObj.key + "] > \'" + + inObj.output + + "\' "); + } + } + return outMsg; + } + /** * @brief member function to review rules for acceptable modifiers, duplicate or ambiguous rules and return an array containing possible warnings. * Keyman can not handle duplicate rules so we need to make sure a rule is written only once by either omitting a duplicate rule or commenting out an ambiguous rule. @@ -451,7 +596,6 @@ export class KmnFileWriter { * @param index the index of a rule in Rule[] * @return a string[] containing possible warnings for a rule */ - public reviewRules(rule: Rule[], index: number): string[] { const resultWarnings: RuleReview = { @@ -466,60 +610,53 @@ export class KmnFileWriter { type: 'RuleReview', isused: false, isEarlier: false, + isLater: false, context: '', - prevDK_modifier: '', - prevDK_key: '', - DK_modifier: '', - DK_key: '', + prevDk_id: -1, + prevDk_modifier: '', + dk_prefix: "A", + prev_dk_prefix: "C", + prevDk_key: '', + textpart: '', + dk_id: -1, + Dk_modifier: '', + Dk_key: '', modifier: '', key: '', output: '', warningMessages: ['', '', ''], + + extraWarning: 'PLEASE CHECK THE FOLLOWING RULE AS IT WILL NOT BE WRITTEN !', }; - /* const resultWarnings: UnavailableModifier = { - type: 'UnavailableModifier', - isused: false, - isEarlier: false, - context: '', - prevDK_modifier: '', - prevDK_key: '', - DK_modifier: '', - DK_key: '', - modifier: '', - key: '', - output: '', - warningMessage: Array(3).fill("") - };*/ - /*const resultAll: RuleReview = { - type: 'RuleReview', - isused: false, + const unavailableModiWarnings = { + type: 'UnavailableModifier', + isUnavailable: true, + warningMessages: ['', '', ''], + } as UnavailableModifier; + + const unavailableSuperiWarnings = { + type: 'UnavailableSuperior', + isUnavailable: true, + warningMessages: ['', '', ''], + } as UnavailableSuperior; + + const duplicateWarnings = { + type: 'DuplicateRule', + isLater: false, isEarlier: false, - context: '', - prevDK_modifier: '', - prevDK_key: '', - DK_modifier: '', - DK_key: '', - modifier: '', - key: '', - output: '', - warningMessage: Array(3).fill("") - };*/ - - /* - resultWarnings.type = ''; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessage[0] = ""; - resultWarnings.warningMessage[1] = ""; - resultWarnings.warningMessage[2] = ""; - */ + hasExtraWarning: false, + warningMessages: ['', '', ''], + } as DuplicateRules; + + + const ambiguousWarnings = { + type: 'AmbiguousRule', + isEarlier: false, + isLater: false, + hasExtraWarning: false, + warningMessages: ['', '', ''], + } as AmbiguousRules; const keylayoutKmnConverter = new KeylayoutToKmnConverter(this.callbacks, this.options); const warningText: string[] = Array(3).fill(""); @@ -528,22 +665,18 @@ export class KmnFileWriter { if ((rule[index].ruleType === "C0") || (rule[index].ruleType === "C1")) { if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierKey)) { - warningText[2] = "unavailable modifier : "; - // resultWarnings.warningMessages[2] = "unavailable modifier : "; - resultWarnings.hasWarning_2 = true; + warningText[2] = "unavailable modifier "; - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[2] = "unavailable modifier : "; + unavailableModiWarnings.isused = true; + unavailableModiWarnings.modifier = rule[index].modifierKey; + unavailableModiWarnings.key = rule[index].key; + unavailableModiWarnings.output = new TextDecoder().decode(rule[index].output); + unavailableModiWarnings.warningMessages[2] = "unavailable modifier "; } } - else if (rule[index].ruleType === "C2") { if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierDeadkey)) { - warningText[1] = "unavailable modifier : "; + warningText[1] = "unavailable modifier "; warningText[2] = "unavailable superior rule ( [" + rule[index].modifierDeadkey + " " + rule[index].deadkey @@ -551,26 +684,18 @@ export class KmnFileWriter { + rule[index].idDeadkey + ") ) : "; - /* resultWarnings.warningMessages[1] = "unavailable modifier : "; - resultWarnings.hasWarning_1 = true; - resultWarnings.warningMessages[2] = "unavailable superior rule ( [" - + rule[index].modifierDeadkey + " " - + rule[index].deadkey - + "] > dk(A" - + rule[index].idDeadkey - + ") ) : "; - resultWarnings.hasWarning_2 = true;*/ + unavailableModiWarnings.isused = true; + unavailableSuperiWarnings.isused = true; + unavailableModiWarnings.textpart = '] > dk(A'; + unavailableModiWarnings.Dk_modifier = rule[index].modifierDeadkey; + unavailableModiWarnings.Dk_key = rule[index].deadkey; + unavailableModiWarnings.modifier = rule[index].modifierKey; + unavailableModiWarnings.key = rule[index].key; + unavailableModiWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[1] = "unavailable modifier : "; - resultWarnings.warningMessages[2] = "unavailable superior rule ( [" + unavailableModiWarnings.warningMessages[1] = "unavailable modifier "; + unavailableSuperiWarnings.warningMessages[2] = "unavailable superior rule ( [" + rule[index].modifierDeadkey + " " + rule[index].deadkey + "] > dk(A" @@ -579,28 +704,23 @@ export class KmnFileWriter { } if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierKey)) { - warningText[2] = "unavailable modifier : "; - - /* resultWarnings.warningMessages[2] = "unavailable modifier : "; - resultWarnings.hasWarning_2 = true;*/ - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[2] = "unavailable modifier : "; + warningText[2] = "unavailable modifier "; + unavailableModiWarnings.isused = true; + unavailableModiWarnings.prevDk_key = rule[index].prevDeadkey; + unavailableModiWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; + unavailableModiWarnings.Dk_modifier = rule[index].modifierDeadkey; + unavailableModiWarnings.Dk_key = rule[index].deadkey; + unavailableModiWarnings.modifier = rule[index].modifierKey; + unavailableModiWarnings.key = rule[index].key; + unavailableModiWarnings.output = new TextDecoder().decode(rule[index].output); + unavailableModiWarnings.warningMessages[2] = "unavailable modifier "; } } else if (rule[index].ruleType === "C3") { if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierPrevDeadkey)) { - warningText[0] = "unavailable modifier : "; + warningText[0] = "unavailable modifier "; warningText[1] = "unavailable superior rule ( [" + rule[index].modifierPrevDeadkey + " " + rule[index].prevDeadkey @@ -612,99 +732,47 @@ export class KmnFileWriter { + rule[index].prevDeadkey + "] > dk(A" + rule[index].idPrevDeadkey - + ") ) and ( dk(A" + - + rule[index].idPrevDeadkey + ") [" - + rule[index].modifierDeadkey + " " - + rule[index].deadkey - + "] > dk(B" - + rule[index].idDeadkey - + ") ) : "; - /* resultWarnings.warningMessages[0] = "unavailable modifier : "; - resultWarnings.hasWarning_0 = true; - - resultWarnings.warningMessages[1] = "unavailable superior rule ( [" - + rule[index].modifierPrevDeadkey + " " - + rule[index].prevDeadkey - + "] > dk(A" - + rule[index].idPrevDeadkey - + ") ) : "; - resultWarnings.hasWarning_1 = true; - resultWarnings.warningMessages[2] = "unavailable superior rules ( [" - + rule[index].modifierPrevDeadkey + " " - + rule[index].prevDeadkey - + "] > dk(A" - + rule[index].idPrevDeadkey - + ") ) and ( dk(A" + - + rule[index].idPrevDeadkey + ") [" - + rule[index].modifierDeadkey + " " - + rule[index].deadkey - + "] > dk(B" - + rule[index].idDeadkey - + ") ) : ";*/ - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); + + ") ) "; - resultWarnings.warningMessages[0] = "unavailable modifier : "; - resultWarnings.warningMessages[1] = "unavailable superior rule ( [" + unavailableSuperiWarnings.warningMessages[0] = "unavailable modifier "; + unavailableSuperiWarnings.warningMessages[1] = "unavailable superior rule ( [" + rule[index].modifierPrevDeadkey + " " + rule[index].prevDeadkey + "] > dk(A" + rule[index].idPrevDeadkey + ") ) : "; - resultWarnings.warningMessages[2] = "unavailable superior rules ( [" + unavailableSuperiWarnings.warningMessages[2] = "unavailable superior rules ( [" + rule[index].modifierPrevDeadkey + " " + rule[index].prevDeadkey + "] > dk(A" + rule[index].idPrevDeadkey - + ") ) and ( dk(A" + - + rule[index].idPrevDeadkey + ") [" - + rule[index].modifierDeadkey + " " - + rule[index].deadkey - + "] > dk(B" - + rule[index].idDeadkey - + ") ) : "; - + + ") ) "; } if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierDeadkey)) { - warningText[1] = "unavailable modifier : "; + warningText[1] = "unavailable modifier "; warningText[2] = "unavailable superior rule ( [" + rule[index].modifierDeadkey + " " + rule[index].deadkey + "] > dk(B" + rule[index].idDeadkey + ") ) : "; - /*resultWarnings.warningMessages[1] = "unavailable modifier : "; - resultWarnings.hasWarning_1 = true; - resultWarnings.warningMessages[2] = "unavailable superior rule ( [" - + rule[index].modifierDeadkey + " " - + rule[index].deadkey - + "] > dk(B" - + rule[index].idDeadkey - + ") ) : "; - resultWarnings.hasWarning_2 = true;*/ - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[1] = "unavailable modifier : "; - resultWarnings.warningMessages[2] = "unavailable superior rule ( [" + unavailableModiWarnings.isused = true; + unavailableSuperiWarnings.isused = true; + unavailableModiWarnings.prevDk_key = rule[index].prevDeadkey; + unavailableModiWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; + + unavailableSuperiWarnings.textpart = '] > dk(B'; + unavailableSuperiWarnings.Dk_modifier = rule[index].modifierDeadkey; + unavailableSuperiWarnings.Dk_key = rule[index].deadkey; + unavailableSuperiWarnings.modifier = rule[index].modifierKey; + unavailableSuperiWarnings.key = rule[index].key; + unavailableSuperiWarnings.output = new TextDecoder().decode(rule[index].output); + unavailableSuperiWarnings.warningMessages[1] = unavailableSuperiWarnings.warningMessages[1] + + "unavailable modifier "; + unavailableSuperiWarnings.warningMessages[2] = "unavailable superior rule ( [" + rule[index].modifierDeadkey + " " + rule[index].deadkey + "] > dk(B" @@ -713,23 +781,21 @@ export class KmnFileWriter { } if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierKey)) { - warningText[2] += "unavailable modifier : "; - /*resultWarnings.warningMessages[2] += "unavailable modifier : "; - resultWarnings.hasWarning_2 = true;*/ - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[2] += "unavailable modifier : "; + warningText[2] += "unavailable modifier "; + + unavailableModiWarnings.isused = true; + unavailableModiWarnings.prevDk_key = rule[index].prevDeadkey; + unavailableModiWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; + unavailableModiWarnings.Dk_modifier = rule[index].modifierDeadkey; + unavailableModiWarnings.Dk_key = rule[index].deadkey; + unavailableModiWarnings.modifier = rule[index].modifierKey; + unavailableModiWarnings.key = rule[index].key; + unavailableModiWarnings.output = new TextDecoder().decode(rule[index].output); + unavailableModiWarnings.warningMessages[2] += "unavailable modifier "; } } + // ------------------------- check ambiguous/duplicate rules ------------------------- if ((rule[index].ruleType === "C0") || (rule[index].ruleType === "C1")) { @@ -774,151 +840,74 @@ export class KmnFileWriter { ); if (amb_4_1.length > 0) { - warningText[2] = warningText[2] - + ("ambiguous rule: later: [" - + amb_4_1[0].modifierPrevDeadkey - + " " - + amb_4_1[0].prevDeadkey - + "] > dk(C" - + amb_2_1[0].idDeadkey - + ") "); - /* resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] + ("ambiguous rule: later: [" - + amb_4_1[0].modifierPrevDeadkey - + " " - + amb_4_1[0].prevDeadkey - + "] > dk(C" - + amb_2_1[0].idDeadkey - + ") "); - resultWarnings.hasWarning_2 = true;*/ - - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] + ("ambiguous rule: later: [" - + amb_4_1[0].modifierPrevDeadkey - + " " - + amb_4_1[0].prevDeadkey - + "] > dk(C" - + amb_2_1[0].idDeadkey - + ") "); + ambiguousWarnings.prevDk_id = amb_4_1[0].idPrevDeadkey; + ambiguousWarnings.prevDk_key = amb_4_1[0].prevDeadkey; + ambiguousWarnings.prevDk_modifier = amb_4_1[0].modifierPrevDeadkey; + + ambiguousWarnings.isEarlier = false; + ambiguousWarnings.isLater = true; + ambiguousWarnings.modifier = amb_4_1[0].modifierKey; + ambiguousWarnings.key = amb_4_1[0].key; + ambiguousWarnings.prev_dk_prefix = 'C'; + ambiguousWarnings.dk_prefix = 'A'; + const tester_amb_4_1 = this.createWarningText(ambiguousWarnings); + ambiguousWarnings.warningMessages = tester_amb_4_1; } if (amb_2_1.length > 0) { - warningText[2] = warningText[2] - + ("ambiguous rule: later: [" - + amb_2_1[0].modifierDeadkey - + " " - + amb_2_1[0].deadkey - + "] > dk(A" - + amb_2_1[0].idDeadkey - + ") "); - /* resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] - + ("ambiguous rule: later: [" - + amb_2_1[0].modifierDeadkey - + " " - + amb_2_1[0].deadkey - + "] > dk(A" - + amb_2_1[0].idDeadkey - + ") "); - resultWarnings.hasWarning_2 = true;*/ - resultWarnings.type = 'RuleReview'; resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] - + ("ambiguous rule: later: [" - + amb_2_1[0].modifierDeadkey - + " " - + amb_2_1[0].deadkey - + "] > dk(A" - + amb_2_1[0].idDeadkey - + ") "); - - + ambiguousWarnings.textpart = '] > dk(A'; + + ambiguousWarnings.prevDk_id = amb_2_1[0].idPrevDeadkey; + ambiguousWarnings.prevDk_modifier = amb_2_1[0].modifierPrevDeadkey; + ambiguousWarnings.prevDk_key = amb_2_1[0].prevDeadkey; + + ambiguousWarnings.dk_id = amb_2_1[0].idDeadkey; + ambiguousWarnings.Dk_modifier = amb_2_1[0].modifierDeadkey; + ambiguousWarnings.Dk_key = amb_2_1[0].deadkey; + + ambiguousWarnings.modifier = amb_2_1[0].modifierKey; + ambiguousWarnings.key = amb_2_1[0].key; + ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_2_1[0].output)).character; + + ambiguousWarnings.prev_dk_prefix = 'C'; + ambiguousWarnings.dk_prefix = 'A'; + ambiguousWarnings.isEarlier = false; + ambiguousWarnings.isLater = true; + const tester_amb_2_1 = this.createWarningText(ambiguousWarnings); + ambiguousWarnings.warningMessages = tester_amb_2_1; } if (amb_1_1.length > 0) { - warningText[2] = warningText[2] - + ("ambiguous rule: earlier: [" - + amb_1_1[0].modifierKey - + " " - + amb_1_1[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(amb_1_1[0].output)).character - + "\' "); - /* resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] - + ("ambiguous rule: earlier: [" - + amb_1_1[0].modifierKey - + " " - + amb_1_1[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(amb_1_1[0].output)).character - + "\' "); - resultWarnings.hasWarning_2 = true;*/ - - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] - + ("ambiguous rule: earlier: [" - + amb_1_1[0].modifierKey - + " " - + amb_1_1[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(amb_1_1[0].output)).character - + "\' "); - + ambiguousWarnings.prevDk_id = amb_1_1[0].idPrevDeadkey; + ambiguousWarnings.prevDk_modifier = amb_1_1[0].modifierPrevDeadkey; + ambiguousWarnings.prevDk_key = amb_1_1[0].prevDeadkey; + + ambiguousWarnings.dk_id = -1;// needed!!! + ambiguousWarnings.prevDk_id = -1;// needed!!! + ambiguousWarnings.Dk_modifier = amb_1_1[0].modifierDeadkey; + ambiguousWarnings.Dk_key = amb_1_1[0].deadkey; + + ambiguousWarnings.prev_dk_prefix = 'C'; + ambiguousWarnings.dk_prefix = 'A'; + ambiguousWarnings.modifier = amb_1_1[0].modifierKey; + ambiguousWarnings.key = amb_1_1[0].key; + ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_1_1[0].output)).character; + ambiguousWarnings.isEarlier = true; ambiguousWarnings.isLater = false; + const tester_amb_1_1 = this.createWarningText(ambiguousWarnings, 2); + ambiguousWarnings.warningMessages = tester_amb_1_1; } if (dup_1_1.length > 0) { - warningText[2] = warningText[2] - + ("duplicate rule: earlier: [" - + dup_1_1[0].modifierKey - + " " - + dup_1_1[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_1_1[0].output)).character - + "\' "); - /* resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] - + ("duplicate rule: earlier: [" - + dup_1_1[0].modifierKey - + " " - + dup_1_1[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_1_1[0].output)).character - + "\' "); - resultWarnings.hasWarning_2 = true;*/ - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] + duplicateWarnings.isused = true; + duplicateWarnings.textpart = '] > \''; + duplicateWarnings.modifier = dup_1_1[0].modifierKey; + duplicateWarnings.key = dup_1_1[0].key; + duplicateWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(dup_1_1[0].output)).character; + duplicateWarnings.isEarlier = true; + duplicateWarnings.warningMessages[2] = duplicateWarnings.warningMessages[2] + ("duplicate rule: earlier: [" + dup_1_1[0].modifierKey + " " @@ -929,11 +918,6 @@ export class KmnFileWriter { } } - /* console.log("compare", ((resultWarnings.warningMessage[0] === warningText[0]) - && (resultWarnings.warningMessage[1] === warningText[1]) - && (resultWarnings.warningMessage[2] === warningText[2])));*/ - - if (rule[index].ruleType === "C2") { // 2-2: + [CAPS K_N] > dk(C11) <-> + [CAPS K_N] > dk(C3) @@ -984,42 +968,17 @@ export class KmnFileWriter { ); if (amb_2_2.length > 0) { - warningText[1] = warningText[1] - + ("ambiguous rule: earlier: [" - + amb_2_2[0].modifierDeadkey - + " " - + amb_2_2[0].deadkey - + "] > dk(C" - + amb_2_2[0].idDeadkey - + ") "); - /*resultWarnings.warningMessages[1] = resultWarnings.warningMessages[1] - + ("ambiguous rule: earlier: [" - + amb_2_2[0].modifierDeadkey - + " " - + amb_2_2[0].deadkey - + "] > dk(C" - + amb_2_2[0].idDeadkey - + ") "); - resultWarnings.hasWarning_1 = true;*/ - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[1] = resultWarnings.warningMessages[1] - + ("ambiguous rule: earlier: [" - + amb_2_2[0].modifierDeadkey - + " " - + amb_2_2[0].deadkey - + "] > dk(C" - + amb_2_2[0].idDeadkey - + ") "); - + ambiguousWarnings.isEarlier = true; + ambiguousWarnings.isLater = false; + ambiguousWarnings.prev_dk_prefix = 'A'; + ambiguousWarnings.dk_prefix = 'C'; + ambiguousWarnings.dk_id = amb_2_2[0].idDeadkey; + ambiguousWarnings.Dk_modifier = amb_2_2[0].modifierDeadkey; + ambiguousWarnings.Dk_key = amb_2_2[0].deadkey; + ambiguousWarnings.modifier = amb_2_2[0].modifierKey; + ambiguousWarnings.key = amb_2_2[0].key; + const tester_amb_2_2 = this.createWarningText(ambiguousWarnings, 1); + ambiguousWarnings.warningMessages = tester_amb_2_2; } if (dup_2_2.length > 0) { @@ -1031,76 +990,33 @@ export class KmnFileWriter { + "] > dk(C" + dup_2_2[0].idDeadkey + ") "); - /* resultWarnings.warningMessages[1] = resultWarnings.warningMessages[1] + ("duplicate rule: earlier: [" - + dup_2_2[0].modifierDeadkey - + " " - + dup_2_2[0].deadkey - + "] > dk(C" - + dup_2_2[0].idDeadkey - + ") "); - resultWarnings.hasWarning_1 = true;*/ resultWarnings.type = 'RuleReview'; resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - - resultWarnings.warningMessages[1] = resultWarnings.warningMessages[1] + ("duplicate rule: earlier: [" - + dup_2_2[0].modifierDeadkey - + " " - + dup_2_2[0].deadkey - + "] > dk(C" - + dup_2_2[0].idDeadkey - + ") "); + duplicateWarnings.textpart = '] > dk(C'; + duplicateWarnings.dk_id = dup_2_2[0].idDeadkey; + duplicateWarnings.Dk_modifier = dup_2_2[0].modifierDeadkey; + duplicateWarnings.Dk_key = dup_2_2[0].deadkey; + duplicateWarnings.isEarlier = true; + duplicateWarnings.warningMessages[1] = duplicateWarnings.warningMessages[1] + + ("duplicate rule: earlier: [" + + dup_2_2[0].modifierDeadkey + + " " + + dup_2_2[0].deadkey + + "] > dk(C" + + dup_2_2[0].idDeadkey + + ") "); } if (amb_3_3.length > 0) { - warningText[2] = warningText[2] - + ("ambiguous rule: earlier: dk(A" - + amb_3_3[0].idDeadkey - + ") + [" - + amb_3_3[0].modifierKey - + " " - + amb_3_3[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(amb_3_3[0].output)).character - + "\' "); - /* resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] - + ("ambiguous rule: earlier: dk(A" - + amb_3_3[0].idDeadkey - + ") + [" - + amb_3_3[0].modifierKey - + " " - + amb_3_3[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(amb_3_3[0].output)).character - + "\' "); - resultWarnings.hasWarning_2 = true;*/ - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] - + ("ambiguous rule: earlier: dk(A" - + amb_3_3[0].idDeadkey - + ") + [" - + amb_3_3[0].modifierKey - + " " - + amb_3_3[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(amb_3_3[0].output)).character - + "\' "); + ambiguousWarnings.dk_prefix = 'A'; + ambiguousWarnings.dk_id = amb_3_3[0].idDeadkey; + ambiguousWarnings.modifier = amb_3_3[0].modifierKey; + ambiguousWarnings.key = amb_3_3[0].key; + ambiguousWarnings.isEarlier = true; + ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_3_3[0].output)).character; + const tester_amb_3_3 = this.createWarningText(ambiguousWarnings, 2); + ambiguousWarnings.warningMessages = tester_amb_3_3; } if (dup_3_3.length > 0) { @@ -1114,27 +1030,16 @@ export class KmnFileWriter { + "] > \'" + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_3_3[0].output)).character + "\' "); - /* resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] + ("duplicate rule: earlier: dk(A" - + dup_3_3[0].idDeadkey - + ") + [" - + dup_3_3[0].modifierKey - + " " - + dup_3_3[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_3_3[0].output)).character - + "\' "); - resultWarnings.hasWarning_2 = true;*/ resultWarnings.type = 'RuleReview'; resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] + ("duplicate rule: earlier: dk(A" + duplicateWarnings.textpart = '] > \''; + duplicateWarnings.dk_id = dup_3_3[0].idDeadkey; + duplicateWarnings.modifier = dup_3_3[0].modifierKey; + duplicateWarnings.key = dup_3_3[0].key; + duplicateWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(dup_3_3[0].output)).character; + duplicateWarnings.isEarlier = true; + duplicateWarnings.warningMessages[2] = duplicateWarnings.warningMessages[2] + ("duplicate rule: earlier: dk(A" + dup_3_3[0].idDeadkey + ") + [" + dup_3_3[0].modifierKey @@ -1147,42 +1052,17 @@ export class KmnFileWriter { } if (amb_4_2.length > 0) { - warningText[0] = warningText[0] - + ("ambiguous rule: later: [" - + amb_4_2[0].modifierPrevDeadkey - + " " - + amb_4_2[0].prevDeadkey - + "] > dk(C" - + amb_4_2[0].idPrevDeadkey - + ") "); - /* resultWarnings.warningMessages[0] = resultWarnings.warningMessages[0] - + ("ambiguous rule: later: [" - + amb_4_2[0].modifierPrevDeadkey - + " " - + amb_4_2[0].prevDeadkey - + "] > dk(C" - + amb_4_2[0].idPrevDeadkey - + ") "); - resultWarnings.hasWarning_0 = true;*/ - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[0] = resultWarnings.warningMessages[0] - + ("ambiguous rule: later: [" - + amb_4_2[0].modifierPrevDeadkey - + " " - + amb_4_2[0].prevDeadkey - + "] > dk(C" - + amb_4_2[0].idPrevDeadkey - + ") "); + ambiguousWarnings.prevDk_id = amb_4_2[0].idPrevDeadkey; + ambiguousWarnings.prevDk_key = amb_4_2[0].prevDeadkey; + ambiguousWarnings.prevDk_modifier = amb_4_2[0].modifierPrevDeadkey; + ambiguousWarnings.prev_dk_prefix = 'C'; + ambiguousWarnings.dk_prefix = 'A'; + ambiguousWarnings.modifier = amb_4_2[0].modifierKey; + ambiguousWarnings.key = amb_4_2[0].key; + ambiguousWarnings.isLater = true; + const tester_amb_4_2 = this.createWarningText(ambiguousWarnings, 0); + ambiguousWarnings.warningMessages = tester_amb_4_2; } } @@ -1279,84 +1159,28 @@ export class KmnFileWriter { ); if (amb_2_4.length > 0) { - warningText[0] = warningText[0] - + ("ambiguous rule: earlier: [" - + amb_2_4[0].modifierDeadkey - + " " - + amb_2_4[0].deadkey - + "] > dk(A" - + amb_2_4[0].idDeadkey - + ") "); - /*resultWarnings.warningMessages[0] = resultWarnings.warningMessages[0] + ("ambiguous rule: earlier: [" - + amb_2_4[0].modifierDeadkey - + " " - + amb_2_4[0].deadkey - + "] > dk(A" - + amb_2_4[0].idDeadkey - + ") "); - resultWarnings.hasWarning_0 = true;*/ - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[0] = resultWarnings.warningMessages[0] + ("ambiguous rule: earlier: [" - + amb_2_4[0].modifierDeadkey - + " " - + amb_2_4[0].deadkey - + "] > dk(A" - + amb_2_4[0].idDeadkey - + ") "); + ambiguousWarnings.prev_dk_prefix = 'C'; + ambiguousWarnings.dk_prefix = 'A'; + ambiguousWarnings.dk_id = amb_2_4[0].idDeadkey; + ambiguousWarnings.Dk_modifier = amb_2_4[0].modifierDeadkey; + ambiguousWarnings.Dk_key = amb_2_4[0].deadkey; + ambiguousWarnings.modifier = amb_2_4[0].modifierKey; + ambiguousWarnings.key = amb_2_4[0].key; + ambiguousWarnings.isEarlier = true; + const tester_amb_2_4 = this.createWarningText(ambiguousWarnings, 0); + ambiguousWarnings.warningMessages = tester_amb_2_4; } if (amb_6_3.length > 0) { - warningText[1] = warningText[1] - + ("ambiguous rule: earlier: dk(C" - + amb_6_3[0].idDeadkey - + ") + [" - + amb_6_3[0].modifierKey - + " " - + amb_6_3[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(amb_6_3[0].output)).character - + "\' "); - /*resultWarnings.warningMessages[1] = resultWarnings.warningMessages[1] - + ("ambiguous rule: earlier: dk(C" - + amb_6_3[0].idDeadkey - + ") + [" - + amb_6_3[0].modifierKey - + " " - + amb_6_3[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(amb_6_3[0].output)).character - + "\' "); - resultWarnings.hasWarning_1 = true;*/ - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[1] = resultWarnings.warningMessages[1] - + ("ambiguous rule: earlier: dk(C" - + amb_6_3[0].idDeadkey - + ") + [" - + amb_6_3[0].modifierKey - + " " - + amb_6_3[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(amb_6_3[0].output)).character - + "\' "); + ambiguousWarnings.dk_prefix = 'C'; + ambiguousWarnings.dk_id = amb_6_3[0].idDeadkey; + ambiguousWarnings.modifier = amb_6_3[0].modifierKey; + ambiguousWarnings.key = amb_6_3[0].key; + ambiguousWarnings.isEarlier = true; + ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_6_3[0].output)).character; + const tester_amb_6_3 = this.createWarningText(ambiguousWarnings, 1); + ambiguousWarnings.warningMessages = tester_amb_6_3; } if (dup_6_3.length > 0) { @@ -1370,28 +1194,16 @@ export class KmnFileWriter { + "] > \'" + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_6_3[0].output)).character + "\' "); - /* resultWarnings.warningMessages[1] = resultWarnings.warningMessages[1] - + ("duplicate rule: earlier: dk(C" - + dup_6_3[0].idDeadkey - + ") + [" - + dup_6_3[0].modifierKey - + " " - + dup_6_3[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_6_3[0].output)).character - + "\' "); - resultWarnings.hasWarning_1 = true;*/ resultWarnings.type = 'RuleReview'; resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[1] = resultWarnings.warningMessages[1] + ambiguousWarnings.textpart = ''; + ambiguousWarnings.dk_id = dup_6_3[0].idDeadkey; + duplicateWarnings.modifier = dup_6_3[0].modifierKey; + duplicateWarnings.key = dup_6_3[0].key; + duplicateWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(dup_6_3[0].output)).character; + duplicateWarnings.isEarlier = true; + duplicateWarnings.warningMessages[1] = duplicateWarnings.warningMessages[1] + ("duplicate rule: earlier: dk(C" + dup_6_3[0].idDeadkey + ") + [" @@ -1404,39 +1216,22 @@ export class KmnFileWriter { } if (amb_4_4.length > 0) { - warningText[0] = warningText[0] - + ("ambiguous rule: earlier: [" - + amb_4_4[0].modifierPrevDeadkey - + " " - + amb_4_4[0].prevDeadkey - + "] > dk(C" - + amb_4_4[0].idPrevDeadkey - + ") "); - /* resultWarnings.warningMessages[0] = resultWarnings.warningMessages[0] + ("ambiguous rule: earlier: [" - + amb_4_4[0].modifierPrevDeadkey - + " " - + amb_4_4[0].prevDeadkey - + "] > dk(C" - + amb_4_4[0].idPrevDeadkey - + ") "); - resultWarnings.hasWarning_0 = true;*/ resultWarnings.type = 'RuleReview'; resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[0] = resultWarnings.warningMessages[0] + ("ambiguous rule: earlier: [" - + amb_4_4[0].modifierPrevDeadkey - + " " - + amb_4_4[0].prevDeadkey - + "] > dk(C" - + amb_4_4[0].idPrevDeadkey - + ") "); + ambiguousWarnings.textpart = '] > dk(C'; + ambiguousWarnings.prevDk_id = amb_4_4[0].idPrevDeadkey; + resultWarnings.prevDk_key = amb_4_4[0].prevDeadkey; + resultWarnings.prevDk_modifier = amb_4_4[0].modifierPrevDeadkey; + ambiguousWarnings.isEarlier = true; + ambiguousWarnings.prev_dk_prefix = 'C'; + ambiguousWarnings.dk_prefix = 'C'; + ambiguousWarnings.dk_id = amb_4_4[0].idDeadkey; + ambiguousWarnings.Dk_modifier = amb_4_4[0].modifierDeadkey; + ambiguousWarnings.Dk_key = amb_4_4[0].deadkey; + const tester_amb_4_4 = this.createWarningText(ambiguousWarnings, 0); + ambiguousWarnings.warningMessages = tester_amb_4_4; + } if (dup_4_4.length > 0) { @@ -1448,25 +1243,18 @@ export class KmnFileWriter { + "] > dk(C" + dup_4_4[0].idPrevDeadkey + ") "); - /* resultWarnings.warningMessages[0] = resultWarnings.warningMessages[0] + ("duplicate rule: earlier: [" - + dup_4_4[0].modifierPrevDeadkey - + " " - + dup_4_4[0].prevDeadkey - + "] > dk(C" - + dup_4_4[0].idPrevDeadkey - + ") "); - resultWarnings.hasWarning_0 = true;*/ resultWarnings.type = 'RuleReview'; resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; + resultWarnings.prevDk_key = rule[index].prevDeadkey; + resultWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; + resultWarnings.Dk_modifier = rule[index].modifierDeadkey; + resultWarnings.Dk_key = rule[index].deadkey; resultWarnings.modifier = rule[index].modifierKey; resultWarnings.key = rule[index].key; resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[0] = resultWarnings.warningMessages[0] + ("duplicate rule: earlier: [" + duplicateWarnings.isEarlier = true; + duplicateWarnings.warningMessages[0] = duplicateWarnings.warningMessages[0] + ("duplicate rule: earlier: [" + dup_4_4[0].modifierPrevDeadkey + " " + dup_4_4[0].prevDeadkey @@ -1476,45 +1264,16 @@ export class KmnFileWriter { } if (amb_5_5.length > 0) { - warningText[1] = warningText[1] - + ("ambiguous rule: earlier: dk(B" - + amb_5_5[0].idPrevDeadkey - + ") + [" - + amb_5_5[0].modifierDeadkey - + " " - + amb_5_5[0].deadkey - + "] > dk(B" - + amb_5_5[0].idDeadkey - + ") "); - /* resultWarnings.warningMessages[1] = resultWarnings.warningMessages[1] + ("ambiguous rule: earlier: dk(B" - + amb_5_5[0].idPrevDeadkey - + ") + [" - + amb_5_5[0].modifierDeadkey - + " " - + amb_5_5[0].deadkey - + "] > dk(B" - + amb_5_5[0].idDeadkey - + ") "); - resultWarnings.hasWarning_1 = true;*/ - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[1] = resultWarnings.warningMessages[1] + ("ambiguous rule: earlier: dk(B" - + amb_5_5[0].idPrevDeadkey - + ") + [" - + amb_5_5[0].modifierDeadkey - + " " - + amb_5_5[0].deadkey - + "] > dk(B" - + amb_5_5[0].idDeadkey - + ") "); + ambiguousWarnings.warningMessages[2] = ''; + ambiguousWarnings.prevDk_id = amb_5_5[0].idPrevDeadkey; + ambiguousWarnings.prev_dk_prefix = 'B'; + ambiguousWarnings.dk_prefix = 'B'; + ambiguousWarnings.dk_id = amb_5_5[0].idDeadkey; + ambiguousWarnings.Dk_modifier = amb_5_5[0].modifierDeadkey; + ambiguousWarnings.Dk_key = amb_5_5[0].deadkey; + ambiguousWarnings.isEarlier = true; + const tester_amb_5_5 = this.createWarningText(ambiguousWarnings, 1); + ambiguousWarnings.warningMessages = tester_amb_5_5; } if (dup_5_5.length > 0) { @@ -1528,27 +1287,18 @@ export class KmnFileWriter { + "] > dk(B" + dup_5_5[0].idDeadkey + ") "); - /* resultWarnings.warningMessages[1] = resultWarnings.warningMessages[1] + ("duplicate rule: earlier: dk(B" - + dup_5_5[0].idPrevDeadkey - + ") + [" - + dup_5_5[0].modifierDeadkey - + " " - + dup_5_5[0].deadkey - + "] > dk(B" - + dup_5_5[0].idDeadkey - + ") "); - resultWarnings.hasWarning_1 = true;*/ - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[1] = resultWarnings.warningMessages[1] + ("duplicate rule: earlier: dk(B" + + resultWarnings.type = 'RuleReview'; + resultWarnings.isused = true; + resultWarnings.prevDk_key = rule[index].prevDeadkey; + resultWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; + resultWarnings.Dk_modifier = rule[index].modifierDeadkey; + resultWarnings.Dk_key = rule[index].deadkey; + resultWarnings.modifier = rule[index].modifierKey; + resultWarnings.key = rule[index].key; + resultWarnings.output = new TextDecoder().decode(rule[index].output); + duplicateWarnings.isEarlier = true; + duplicateWarnings.warningMessages[1] = duplicateWarnings.warningMessages[1] + ("duplicate rule: earlier: dk(B" + dup_5_5[0].idPrevDeadkey + ") + [" + dup_5_5[0].modifierDeadkey @@ -1557,44 +1307,21 @@ export class KmnFileWriter { + "] > dk(B" + dup_5_5[0].idDeadkey + ") "); - + } if (amb_6_6.length > 0) { - warningText[2] = warningText[2] - + ("ambiguous rule: earlier: dk(B" - + amb_6_6[0].idDeadkey - + ") + [" - + amb_6_6[0].modifierKey - + " " - + amb_6_6[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(amb_6_6[0].output)).character - + "\' "); - resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] + ("ambiguous rule: earlier: dk(B" - + amb_6_6[0].idDeadkey - + ") + [" - + amb_6_6[0].modifierKey - + " " - + amb_6_6[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(amb_6_6[0].output)).character - + "\' "); - resultWarnings.hasWarning_2 = true; - /* resultAll - resultWarnings.type = ''; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessage[0] = ""; - resultWarnings.warningMessage[1] = ""; - resultWarnings.warningMessage[2] = ""; - */ + ambiguousWarnings.isused = true; + ambiguousWarnings.dk_id = amb_6_6[0].idDeadkey;// needed!!! + ambiguousWarnings.Dk_modifier = amb_6_6[0].modifierDeadkey; + ambiguousWarnings.Dk_key = amb_6_6[0].deadkey; + ambiguousWarnings.modifier = amb_6_6[0].modifierKey; + ambiguousWarnings.key = amb_6_6[0].key; + ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_6_6[0].output)).character; + ambiguousWarnings.isEarlier = true; + ambiguousWarnings.dk_prefix = 'B'; + const tester_amb_6_6 = this.createWarningText(ambiguousWarnings); + ambiguousWarnings.warningMessages = tester_amb_6_6; } if (dup_6_6.length > 0) { @@ -1608,27 +1335,18 @@ export class KmnFileWriter { + "] > \'" + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_6_6[0].output)).character + "\' "); - /* resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] + ("duplicate rule: earlier: dk(B" - + dup_6_6[0].idDeadkey - + ") + [" - + dup_6_6[0].modifierKey - + " " - + dup_6_6[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_6_6[0].output)).character - + "\' "); - resultWarnings.hasWarning_2 = true;*/ - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] + ("duplicate rule: earlier: dk(B" + + resultWarnings.type = 'RuleReview'; + resultWarnings.isused = true; + resultWarnings.prevDk_key = rule[index].prevDeadkey; + resultWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; + resultWarnings.Dk_modifier = rule[index].modifierDeadkey; + resultWarnings.Dk_key = rule[index].deadkey; + resultWarnings.modifier = rule[index].modifierKey; + resultWarnings.key = rule[index].key; + resultWarnings.output = new TextDecoder().decode(rule[index].output); + duplicateWarnings.isEarlier = true; + duplicateWarnings.warningMessages[2] = duplicateWarnings.warningMessages[2] + ("duplicate rule: earlier: dk(B" + dup_6_6[0].idDeadkey + ") + [" + dup_6_6[0].modifierKey @@ -1647,75 +1365,61 @@ export class KmnFileWriter { // assuming that if a C0/C1 and a C2/C3 rule is ambiguous the user prefers to use the C2/C3 rule over the C0/C1 rule // if both happens, nothing would be written, therefore this messsage - const extraWarning = "PLEASE CHECK THE FOLLOWING RULE AS IT WILL NOT BE WRITTEN ! "; - /* resultAll - resultWarnings.type = ''; - resultWarnings.isused = true; - resultWarnings.prevDK_key = rule[index].prevDeadkey; - resultWarnings.prevDK_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.DK_modifier = rule[index].modifierDeadkey; - resultWarnings.DK_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - resultWarnings.warningMessage[0] = ""; - resultWarnings.warningMessage[1] = ""; - resultWarnings.warningMessage[2] = ""; - */ - - if (warningText[0] !== "") { - warningText[0] = "c WARNING: " + warningText[0] + "here: "; - + const extraWarning = "PLEASE CHECK THAT RULE AS IT WILL NOT BE WRITTEN !"; + + + /* if ((warningText[0].indexOf("earlier:") > 0) && (warningText[0].indexOf("later:") > 0)) { - warningText[0] = warningText[0] + extraWarning; + warningText[0] = warningText[0] + extraWarning; } - } - if (resultWarnings.warningMessages[0]) { - resultWarnings.warningMessages[0] = "c WARNING: " + resultWarnings.warningMessages[0] + "here: "; - - if ((resultWarnings.warningMessages[0].indexOf("earlier:") > 0) && (resultWarnings.warningMessages[0].indexOf("later:") > 0)) { - resultWarnings.warningMessages[0] = resultWarnings.warningMessages[0] + extraWarning; + */ + if (ambiguousWarnings.warningMessages[0]) { + if ((ambiguousWarnings.warningMessages[0].indexOf("earlier:") > 0) && (ambiguousWarnings.warningMessages[0].indexOf("later:") > 0)) { + ambiguousWarnings.warningMessages[0] = ambiguousWarnings.warningMessages[0] + extraWarning; } } - if (warningText[1] !== "") { - warningText[1] = "c WARNING: " + warningText[1] + "here: "; - if ((warningText[1].indexOf("earlier:") > 0) && (warningText[1].indexOf("later:") > 0)) { - warningText[1] = warningText[1] + extraWarning; - } - } - if (resultWarnings.warningMessages[1] !== "") { - resultWarnings.warningMessages[1] = "c WARNING: " + resultWarnings.warningMessages[1] + "here: "; - if ((resultWarnings.warningMessages[1].indexOf("earlier:") > 0) && (resultWarnings.warningMessages[1].indexOf("later:") > 0)) { - resultWarnings.warningMessages[1] = resultWarnings.warningMessages[1] + extraWarning; + /* + if ((warningText[1].indexOf("earlier:") > 0) && (warningText[1].indexOf("later:") > 0)) { + warningText[1] = warningText[1] + extraWarning; + } + */ + if (ambiguousWarnings.warningMessages[1] !== "") { + if ((ambiguousWarnings.warningMessages[1].indexOf("earlier:") > 0) && (ambiguousWarnings.warningMessages[1].indexOf("later:") > 0)) { + ambiguousWarnings.warningMessages[1] = ambiguousWarnings.warningMessages[1] + extraWarning; } } - if (warningText[2] !== "") { - warningText[2] = "c WARNING: " + warningText[2] + "here: "; - - if ((warningText[2].indexOf("earlier:") > 0) && (warningText[2].indexOf("later:") > 0)) { - warningText[2] = warningText[2] + extraWarning; + /* if ((warningText[2].indexOf("earlier:") > 0) && (warningText[2].indexOf("later:") > 0)) { + warningText[2] = warningText[2] + extraWarning; + } + */ + if (ambiguousWarnings.warningMessages[2] !== "") { + if ((ambiguousWarnings.warningMessages[2].indexOf("earlier:") > 0) && (ambiguousWarnings.warningMessages[2].indexOf("later:") > 0)) { + ambiguousWarnings.warningMessages[2] = ambiguousWarnings.warningMessages[2] + extraWarning; } } - if (resultWarnings.warningMessages[2] !== "") { - resultWarnings.warningMessages[2] = "c WARNING: " + resultWarnings.warningMessages[2] + "here: "; + const completeWarning0 = unavailableSuperiWarnings.warningMessages[0] + + duplicateWarnings.warningMessages[0] + + ambiguousWarnings.warningMessages[0] + + unavailableModiWarnings.warningMessages[0]; - if ((resultWarnings.warningMessages[2].indexOf("earlier:") > 0) && (resultWarnings.warningMessages[2].indexOf("later:") > 0)) { - resultWarnings.warningMessages[2] = resultWarnings.warningMessages[2] + extraWarning; - } - } + const completeWarning1 = unavailableSuperiWarnings.warningMessages[1] + + duplicateWarnings.warningMessages[1] + + ambiguousWarnings.warningMessages[1] + + unavailableModiWarnings.warningMessages[1]; - /* - warningText[0] = resultWarnings.warningMessage[0] - warningText[1] = resultWarnings.warningMessage[1] - warningText[2] =resultWarnings.warningMessage[2]*/ + const completeWarning2 = unavailableSuperiWarnings.warningMessages[2] + + duplicateWarnings.warningMessages[2] + + ambiguousWarnings.warningMessages[2] + + unavailableModiWarnings.warningMessages[2]; + + completeWarning0 ? (warningText[0] = "c WARNING: " + completeWarning0 + " here: ") : warningText[0] = ''; + completeWarning1 ? (warningText[1] = "c WARNING: " + completeWarning1 + " here: ") : warningText[1] = ''; + completeWarning2 ? (warningText[2] = "c WARNING: " + completeWarning2 + " here: ") : warningText[2] = ''; - warningText[0] = resultWarnings.warningMessages[0]; - warningText[1] = resultWarnings.warningMessages[1]; - warningText[2] = resultWarnings.warningMessages[2]; return warningText; } @@ -1772,7 +1476,7 @@ export class KmnFileWriter { msg_control = "Use of a control character "; } else { - out.character = this.convertToUnicodeCharacter(ctr);; + out.character = this.convertToUnicodeCharacter(ctr); } // add a warning message diff --git a/developer/src/kmc-convert/test/data/OutputXName.bb b/developer/src/kmc-convert/test/data/OutputXName.bb deleted file mode 100644 index 6e45decf3b7..00000000000 --- a/developer/src/kmc-convert/test/data/OutputXName.bb +++ /dev/null @@ -1,1290 +0,0 @@ - -c .................................................................................................................. -c .................................................................................................................. -c Keyman keyboard generated by kmn-convert version: 19.0.230 -c from Ukelele file: C:\Projects\keyman\keyman\developer\src\kmc-convert\test\data\Test.keylayout -c .................................................................................................................. -c .................................................................................................................. - -store(&TARGETS) 'desktop' - -begin Unicode > use(main) - -group(main) using keys - - -+ [NCAPS K_A] > 'A' -+ [CAPS K_A] > 'A' -+ [NCAPS SHIFT K_A] > 'A' -+ [SHIFT CAPS K_A] > 'A' -+ [NCAPS RALT CTRL K_A] > '😀' -+ [NCAPS CTRL K_A] > '😀' -+ [NCAPS SHIFT RALT K_A] > 'Å' -+ [NCAPS RALT K_A] > 'å' -c WARNING: ambiguous rule: earlier: [CAPS K_A] > 'A' here: + [CAPS K_A] > 'å' -+ [CAPS RALT K_A] > 'Å' - -+ [NCAPS K_S] > 's' -+ [CAPS K_S] > 'S' -+ [NCAPS SHIFT K_S] > 'S' -+ [SHIFT CAPS K_S] > 'S' -+ [NCAPS RALT CTRL K_S] > '😁' -+ [NCAPS CTRL K_S] > '😁' -+ [NCAPS SHIFT RALT K_S] > '¯' -+ [NCAPS RALT K_S] > 'ß' -c WARNING: ambiguous rule: earlier: [CAPS K_S] > 'S' here: + [CAPS K_S] > 'ß' -+ [CAPS RALT K_S] > 'ß' - -+ [NCAPS K_D] > 'd' -+ [CAPS K_D] > 'D' -+ [NCAPS SHIFT K_D] > 'D' -+ [SHIFT CAPS K_D] > 'D' -+ [NCAPS RALT CTRL K_D] > 'ሴ' -+ [NCAPS CTRL K_D] > 'ሴ' -+ [NCAPS SHIFT RALT K_D] > '˘' -+ [NCAPS RALT K_D] > '∂' -c WARNING: ambiguous rule: earlier: [CAPS K_D] > 'D' here: + [CAPS K_D] > '∂' -+ [CAPS RALT K_D] > '∂' - -+ [NCAPS K_F] > 'f' -+ [CAPS K_F] > 'F' -+ [NCAPS SHIFT K_F] > 'F' -+ [SHIFT CAPS K_F] > 'F' -+ [NCAPS RALT CTRL K_F] > 'ሴ' -+ [NCAPS CTRL K_F] > 'ሴ' -+ [NCAPS SHIFT RALT K_F] > '˙' -+ [NCAPS RALT K_F] > 'ƒ' -c WARNING: ambiguous rule: earlier: [CAPS K_F] > 'F' here: + [CAPS K_F] > 'ƒ' -+ [CAPS RALT K_F] > 'ƒ' - -+ [NCAPS K_H] > 'h' -+ [CAPS K_H] > '@' -+ [NCAPS SHIFT K_H] > 'H' -+ [SHIFT CAPS K_H] > 'H' -+ [NCAPS RALT CTRL K_H] > '😎' -+ [NCAPS CTRL K_H] > '😎' -+ [NCAPS SHIFT RALT K_H] > '¸' -+ [NCAPS RALT K_H] > '∆' -c WARNING: ambiguous rule: earlier: [CAPS K_H] > '@' here: + [CAPS K_H] > '∆' -c WARNING: ambiguous rule: earlier: [NCAPS RALT K_H] > '∆' here: + [NCAPS RALT K_H] > 'ẞ' -+ [CAPS RALT K_H] > '€' - -+ [NCAPS K_G] > 'g' -+ [CAPS K_G] > 'G' -+ [NCAPS SHIFT K_G] > 'G' -+ [SHIFT CAPS K_G] > 'G' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_G] > U+0007 -c WARNING: Use of a control character + [NCAPS CTRL K_G] > U+0007 -+ [NCAPS SHIFT RALT K_G] > '˚' -+ [NCAPS RALT K_G] > '∞' -c WARNING: ambiguous rule: earlier: [CAPS K_G] > 'G' here: + [CAPS K_G] > '∞' -+ [CAPS RALT K_G] > '∞' - -+ [NCAPS K_Z] > 'z' -+ [CAPS K_Z] > 'Z' -+ [NCAPS SHIFT K_Z] > 'Z' -+ [SHIFT CAPS K_Z] > 'Z' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_Z] > U+0017 -c WARNING: Use of a control character + [NCAPS CTRL K_Z] > U+0017 -+ [NCAPS K_SPACE] > ' ' -+ [CAPS K_SPACE] > ' ' -+ [NCAPS SHIFT K_SPACE] > ' ' -+ [SHIFT CAPS K_SPACE] > ' ' -+ [NCAPS RALT CTRL K_SPACE] > ' ' -+ [NCAPS CTRL K_SPACE] > ' ' - -+ [NCAPS SHIFT RALT K_Z] > ' ' - -+ [NCAPS SHIFT RALT K_9] > ' ' - -+ [NCAPS SHIFT RALT K_COMMA] > ' ' -+ [NCAPS RALT K_Z] > '∑' -c WARNING: ambiguous rule: earlier: [CAPS K_Z] > 'Z' here: + [CAPS K_Z] > '∑' -+ [CAPS RALT K_Z] > '∑' - -+ [NCAPS K_X] > 'x' -+ [CAPS K_X] > 'X' -+ [NCAPS SHIFT K_X] > 'X' -+ [SHIFT CAPS K_X] > 'X' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_X] > U+0018 -c WARNING: Use of a control character + [NCAPS CTRL K_X] > U+0018 -+ [NCAPS SHIFT RALT K_X] > '‡' -+ [NCAPS RALT K_X] > '†' -c WARNING: ambiguous rule: earlier: [CAPS K_X] > 'X' here: + [CAPS K_X] > '†' -+ [CAPS RALT K_X] > '†' - -+ [NCAPS K_C] > 'c' -+ [CAPS K_C] > 'C' -+ [NCAPS SHIFT K_C] > 'C' -+ [SHIFT CAPS K_C] > 'C' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_C] > U+0003 -c WARNING: Use of a control character + [NCAPS CTRL K_C] > U+0003 -+ [NCAPS SHIFT RALT K_C] > 'Á' -+ [NCAPS RALT K_C] > '©' -c WARNING: ambiguous rule: earlier: [CAPS K_C] > 'C' here: + [CAPS K_C] > '©' -+ [CAPS RALT K_C] > '©' - -+ [NCAPS K_V] > 'v' -+ [CAPS K_V] > 'V' -+ [NCAPS SHIFT K_V] > 'V' -+ [SHIFT CAPS K_V] > 'V' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_V] > U+0016 -c WARNING: Use of a control character + [NCAPS CTRL K_V] > U+0016 -+ [NCAPS SHIFT RALT K_V] > 'É' -+ [NCAPS RALT K_V] > '√' -c WARNING: ambiguous rule: earlier: [CAPS K_V] > 'V' here: + [CAPS K_V] > '√' -+ [CAPS RALT K_V] > '√' - -+ [NCAPS K_BKQUOTE] > '\' -+ [CAPS K_BKQUOTE] > '\' -+ [NCAPS SHIFT K_BKQUOTE] > '|' -+ [SHIFT CAPS K_BKQUOTE] > '|' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_BKQUOTE] > U+001C -c WARNING: Use of a control character + [NCAPS CTRL K_BKQUOTE] > U+001C -+ [NCAPS SHIFT RALT K_BKQUOTE] > 'ı' -+ [NCAPS RALT K_BKQUOTE] > '`' -c WARNING: ambiguous rule: earlier: [CAPS K_BKQUOTE] > '\' here: + [CAPS K_BKQUOTE] > '`' -+ [CAPS RALT K_BKQUOTE] > '`' - -+ [NCAPS K_B] > 'b' -+ [CAPS K_B] > 'B' -+ [NCAPS SHIFT K_B] > 'B' -+ [SHIFT CAPS K_B] > 'B' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_B] > U+0002 -c WARNING: Use of a control character + [NCAPS CTRL K_B] > U+0002 -+ [NCAPS SHIFT RALT K_B] > 'Í' -+ [NCAPS RALT K_B] > '∫' -c WARNING: ambiguous rule: earlier: [CAPS K_B] > 'B' here: + [CAPS K_B] > '∫' -+ [CAPS RALT K_B] > '∫' - -+ [NCAPS K_Q] > 'q' -+ [CAPS K_Q] > 'Q' -+ [NCAPS SHIFT K_Q] > 'Q' -+ [SHIFT CAPS K_Q] > 'Q' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_Q] > U+0011 -c WARNING: Use of a control character + [NCAPS CTRL K_Q] > U+0011 -+ [NCAPS SHIFT RALT K_Q] > '‚' -+ [NCAPS RALT K_Q] > '„' -c WARNING: ambiguous rule: earlier: [CAPS K_Q] > 'Q' here: + [CAPS K_Q] > '„' -+ [CAPS RALT K_Q] > '„' - -+ [NCAPS K_W] > 'w' -+ [CAPS K_W] > 'W' -+ [NCAPS SHIFT K_W] > 'W' -+ [SHIFT CAPS K_W] > 'W' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_W] > U+001A -c WARNING: Use of a control character + [NCAPS CTRL K_W] > U+001A -+ [NCAPS SHIFT RALT K_W] > 'À' -+ [NCAPS RALT K_W] > 'Ω' -c WARNING: ambiguous rule: earlier: [CAPS K_W] > 'W' here: + [CAPS K_W] > 'Ω' -+ [CAPS RALT K_W] > 'Ω' -+ [NCAPS K_E] > 'e' -+ [CAPS K_E] > 'E' -+ [NCAPS SHIFT K_E] > 'E' -+ [SHIFT CAPS K_E] > 'E' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_E] > U+0005 -c WARNING: Use of a control character + [NCAPS CTRL K_E] > U+0005 -+ [NCAPS SHIFT RALT K_E] > 'È' -+ [NCAPS RALT K_E] > '€' -c WARNING: ambiguous rule: earlier: [CAPS K_E] > 'E' here: + [CAPS K_E] > '€' -+ [CAPS RALT K_E] > '€' - -+ [NCAPS K_R] > 'r' -+ [CAPS K_R] > 'R' -+ [NCAPS SHIFT K_R] > 'R' -+ [SHIFT CAPS K_R] > 'R' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_R] > U+0012 -c WARNING: Use of a control character + [NCAPS CTRL K_R] > U+0012 -+ [NCAPS SHIFT RALT K_R] > 'Ì' -+ [NCAPS RALT K_R] > '®' -c WARNING: ambiguous rule: earlier: [CAPS K_R] > 'R' here: + [CAPS K_R] > '®' -+ [CAPS RALT K_R] > '®' -+ [NCAPS K_Y] > 'y' -+ [CAPS K_Y] > 'Y' -+ [NCAPS SHIFT K_Y] > 'Y' -+ [SHIFT CAPS K_Y] > 'Y' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_Y] > U+0019 -c WARNING: Use of a control character + [NCAPS CTRL K_Y] > U+0019 -+ [NCAPS SHIFT RALT K_Y] > 'Æ' -+ [NCAPS RALT K_Y] > 'æ' -c WARNING: ambiguous rule: earlier: [CAPS K_Y] > 'Y' here: + [CAPS K_Y] > 'æ' -+ [CAPS RALT K_Y] > 'Æ' - -+ [NCAPS K_T] > 't' -+ [CAPS K_T] > 'T' -+ [NCAPS SHIFT K_T] > 'T' -+ [SHIFT CAPS K_T] > 'T' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_T] > U+0014 -c WARNING: Use of a control character + [NCAPS CTRL K_T] > U+0014 -+ [NCAPS SHIFT RALT K_T] > 'Ò' -+ [NCAPS RALT K_T] > '™' -c WARNING: ambiguous rule: earlier: [CAPS K_T] > 'T' here: + [CAPS K_T] > '™' -+ [CAPS RALT K_T] > '™' - -+ [NCAPS K_1] > '1' -+ [CAPS K_1] > '1' -+ [NCAPS SHIFT K_1] > '!' -+ [SHIFT CAPS K_1] > '!' -+ [NCAPS RALT CTRL K_1] > '1' -+ [NCAPS CTRL K_1] > '1' -+ [NCAPS SHIFT RALT K_1] > '»' -+ [NCAPS RALT K_1] > '«' -c WARNING: ambiguous rule: earlier: [CAPS K_1] > '1' here: + [CAPS K_1] > '«' -+ [CAPS RALT K_1] > '«' - -+ [NCAPS K_2] > '2' -+ [CAPS K_2] > '2' -+ [NCAPS SHIFT K_2] > '"' -+ [SHIFT CAPS K_2] > '"' -+ [NCAPS RALT CTRL K_2] > '2' -+ [NCAPS CTRL K_2] > '2' -+ [NCAPS SHIFT RALT K_2] > '”' -+ [NCAPS RALT K_2] > '“' -c WARNING: ambiguous rule: earlier: [CAPS K_2] > '2' here: + [CAPS K_2] > '“' -+ [CAPS RALT K_2] > '“' - -+ [NCAPS K_3] > '3' -+ [CAPS K_3] > '3' -+ [NCAPS SHIFT K_3] > '£' -+ [SHIFT CAPS K_3] > '£' -+ [NCAPS RALT CTRL K_3] > '3' -+ [NCAPS CTRL K_3] > '3' -+ [NCAPS SHIFT RALT K_3] > '’' -+ [NCAPS RALT K_3] > '‘' -c WARNING: ambiguous rule: earlier: [CAPS K_3] > '3' here: + [CAPS K_3] > '‘' -+ [CAPS RALT K_3] > '‘' - -+ [NCAPS K_4] > '4' -+ [CAPS K_4] > '4' -+ [NCAPS SHIFT K_4] > '$' -+ [SHIFT CAPS K_4] > '$' -+ [NCAPS RALT CTRL K_4] > '4' -+ [NCAPS CTRL K_4] > '4' -+ [NCAPS SHIFT RALT K_4] > '¢' -+ [NCAPS RALT K_4] > '¥' -c WARNING: ambiguous rule: earlier: [CAPS K_4] > '4' here: + [CAPS K_4] > '¥' -+ [CAPS RALT K_4] > '¥' - -+ [NCAPS K_6] > '6' -+ [CAPS K_6] > '6' -+ [NCAPS SHIFT K_6] > '&' -+ [SHIFT CAPS K_6] > '&' -+ [NCAPS RALT CTRL K_6] > '6' -+ [NCAPS CTRL K_6] > '6' -+ [NCAPS SHIFT RALT K_6] > '›' -+ [NCAPS RALT K_6] > '‹' -c WARNING: ambiguous rule: earlier: [CAPS K_6] > '6' here: + [CAPS K_6] > '‹' -+ [CAPS RALT K_6] > '‹' - -+ [NCAPS K_5] > '5' -+ [CAPS K_5] > '5' -+ [NCAPS SHIFT K_5] > '%' -+ [SHIFT CAPS K_5] > '%' -+ [NCAPS RALT CTRL K_5] > '5' -+ [NCAPS CTRL K_5] > '5' -+ [NCAPS SHIFT RALT K_5] > '‰' -+ [NCAPS RALT K_5] > '~' -c WARNING: ambiguous rule: earlier: [CAPS K_5] > '5' here: + [CAPS K_5] > '~' -+ [CAPS RALT K_5] > '~' -c WARNING: ambiguous rule: later: [CAPS K_EQUAL] > dk(A3) here: + [CAPS K_EQUAL] > 'ì' -+ [NCAPS SHIFT K_EQUAL] > '^' -+ [SHIFT CAPS K_EQUAL] > '^' -+ [NCAPS RALT CTRL K_EQUAL] > '=' -+ [NCAPS CTRL K_EQUAL] > '=' -+ [NCAPS SHIFT RALT K_EQUAL] > '±' -c WARNING: ambiguous rule: later: [NCAPS RALT K_EQUAL] > dk(A2) here: + [NCAPS RALT K_EQUAL] > 'ˆ' -+ [CAPS RALT K_EQUAL] > 'ˆ' - -+ [NCAPS K_9] > '9' -c WARNING: ambiguous rule: later: [CAPS K_9] > dk(A5) here: + [CAPS K_9] > '9' -+ [NCAPS SHIFT K_9] > ')' -+ [SHIFT CAPS K_9] > ')' -+ [NCAPS RALT CTRL K_9] > '9' -+ [NCAPS CTRL K_9] > '9' -c WARNING: ambiguous rule: later: [NCAPS RALT K_9] > dk(A4) here: + [NCAPS RALT K_9] > '`' -+ [CAPS RALT K_9] > '`' - -+ [NCAPS K_7] > '7' -+ [CAPS K_7] > '7' -+ [NCAPS SHIFT K_7] > '/' -+ [SHIFT CAPS K_7] > '/' -+ [NCAPS RALT CTRL K_7] > '7' -+ [NCAPS CTRL K_7] > '7' -+ [NCAPS SHIFT RALT K_7] > '⁄' -+ [NCAPS RALT K_7] > '÷' -c WARNING: ambiguous rule: earlier: [CAPS K_7] > '7' here: + [CAPS K_7] > '÷' -+ [CAPS RALT K_7] > '÷' - -+ [NCAPS K_HYPHEN] > "'" -+ [CAPS K_HYPHEN] > "'" -+ [NCAPS SHIFT K_HYPHEN] > '?' -+ [SHIFT CAPS K_HYPHEN] > '?' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_HYPHEN] > U+001F -c WARNING: Use of a control character + [NCAPS CTRL K_HYPHEN] > U+001F -+ [NCAPS SHIFT RALT K_HYPHEN] > '¿' -+ [NCAPS RALT K_HYPHEN] > '¡' -c WARNING: ambiguous rule: earlier: [CAPS K_HYPHEN] > ''' here: + [CAPS K_HYPHEN] > '¡' -+ [CAPS RALT K_HYPHEN] > '¡' - -+ [NCAPS K_8] > '8' -c WARNING: ambiguous rule: later: [CAPS K_8] > dk(C13) ambiguous rule: later: [CAPS K_8] > dk(A13) here: + [CAPS K_8] > '8' -+ [NCAPS SHIFT K_8] > '(' -+ [SHIFT CAPS K_8] > '(' -+ [NCAPS RALT CTRL K_8] > '8' -+ [NCAPS CTRL K_8] > '8' -+ [NCAPS SHIFT RALT K_8] > '' -c WARNING: ambiguous rule: later: [NCAPS RALT K_8] > dk(C12) ambiguous rule: later: [NCAPS RALT K_8] > dk(A12) here: + [NCAPS RALT K_8] > '´' -+ [CAPS RALT K_8] > '´' - -+ [NCAPS K_0] > '0' -+ [CAPS K_0] > '0' -+ [NCAPS SHIFT K_0] > '=' -+ [SHIFT CAPS K_0] > '=' -+ [NCAPS RALT CTRL K_0] > '0' -+ [NCAPS CTRL K_0] > '0' -+ [NCAPS SHIFT RALT K_0] > '≈' -+ [NCAPS RALT K_0] > '≠' -c WARNING: ambiguous rule: earlier: [CAPS K_0] > '0' here: + [CAPS K_0] > '≠' -+ [CAPS RALT K_0] > '≠' - -+ [NCAPS K_RBRKT] > '+' -+ [CAPS K_RBRKT] > '+' -+ [NCAPS SHIFT K_RBRKT] > '*' -+ [SHIFT CAPS K_RBRKT] > '*' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_RBRKT] > U+001D -c WARNING: Use of a control character + [NCAPS CTRL K_RBRKT] > U+001D -+ [NCAPS SHIFT RALT K_RBRKT] > '}' -+ [NCAPS RALT K_RBRKT] > ']' -c WARNING: ambiguous rule: earlier: [CAPS K_RBRKT] > '+' here: + [CAPS K_RBRKT] > ']' -+ [CAPS RALT K_RBRKT] > ']' -+ [NCAPS K_O] > 'o' -+ [CAPS K_O] > 'O' -+ [NCAPS SHIFT K_O] > 'O' -+ [SHIFT CAPS K_O] > 'O' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_O] > U+000F -c WARNING: Use of a control character + [NCAPS CTRL K_O] > U+000F -+ [NCAPS SHIFT RALT K_O] > 'Ø' -+ [NCAPS RALT K_O] > 'ø' -c WARNING: ambiguous rule: earlier: [CAPS K_O] > 'O' here: + [CAPS K_O] > 'ø' -+ [CAPS RALT K_O] > 'Ø' -+ [NCAPS K_U] > 'u' -c WARNING: ambiguous rule: later: [CAPS K_U] > dk(A9) here: + [CAPS K_U] > 'U' -+ [NCAPS SHIFT K_U] > 'U' -+ [SHIFT CAPS K_U] > 'U' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_U] > U+0015 -c WARNING: Use of a control character + [NCAPS CTRL K_U] > U+0015 -+ [NCAPS SHIFT RALT K_U] > 'Ù' -c WARNING: ambiguous rule: later: [NCAPS RALT K_U] > dk(A8) here: + [NCAPS RALT K_U] > '¨' -+ [CAPS RALT K_U] > '¨' - -+ [NCAPS K_LBRKT] > 'è' -+ [CAPS K_LBRKT] > 'è' -+ [NCAPS SHIFT K_LBRKT] > 'é' -+ [SHIFT CAPS K_LBRKT] > 'é' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_LBRKT] > U+001E -c WARNING: Use of a control character + [NCAPS CTRL K_LBRKT] > U+001E -+ [NCAPS SHIFT RALT K_LBRKT] > '{' -+ [NCAPS RALT K_LBRKT] > '[' -c WARNING: ambiguous rule: earlier: [CAPS K_LBRKT] > 'è' here: + [CAPS K_LBRKT] > '[' -+ [CAPS RALT K_LBRKT] > '[' -+ [NCAPS K_I] > 'i' -+ [CAPS K_I] > 'I' -+ [NCAPS SHIFT K_I] > 'I' -+ [SHIFT CAPS K_I] > 'I' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_I] > U+0009 -c WARNING: Use of a control character + [NCAPS CTRL K_I] > U+0009 -+ [NCAPS SHIFT RALT K_I] > 'Œ' -+ [NCAPS RALT K_I] > 'œ' -c WARNING: ambiguous rule: earlier: [CAPS K_I] > 'I' here: + [CAPS K_I] > 'œ' -+ [CAPS RALT K_I] > 'Œ' - -+ [NCAPS K_P] > 'p' -+ [CAPS K_P] > 'P' -+ [NCAPS SHIFT K_P] > 'P' -+ [SHIFT CAPS K_P] > 'P' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_P] > U+0010 -c WARNING: Use of a control character + [NCAPS CTRL K_P] > U+0010 -+ [NCAPS SHIFT RALT K_P] > '∏' -+ [NCAPS RALT K_P] > 'π' -c WARNING: ambiguous rule: earlier: [CAPS K_P] > 'P' here: + [CAPS K_P] > 'π' -+ [CAPS RALT K_P] > '∏' - -+ [NCAPS K_L] > 'l' -+ [CAPS K_L] > 'L' -+ [NCAPS SHIFT K_L] > 'L' -+ [SHIFT CAPS K_L] > 'L' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_L] > U+000C -c WARNING: Use of a control character + [NCAPS CTRL K_L] > U+000C -+ [NCAPS SHIFT RALT K_L] > 'ˇ' -+ [NCAPS RALT K_L] > '¬' -c WARNING: ambiguous rule: earlier: [CAPS K_L] > 'L' here: + [CAPS K_L] > '¬' -+ [CAPS RALT K_L] > '¬' - -+ [NCAPS K_J] > 'j' -+ [CAPS K_J] > 'J' -+ [NCAPS SHIFT K_J] > 'J' -+ [SHIFT CAPS K_J] > 'J' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_J] > U+000A -c WARNING: Use of a control character + [NCAPS CTRL K_J] > U+000A -+ [NCAPS SHIFT RALT K_J] > '˝' -+ [NCAPS RALT K_J] > 'ª' -c WARNING: ambiguous rule: earlier: [CAPS K_J] > 'J' here: + [CAPS K_J] > 'ª' -+ [CAPS RALT K_J] > 'ª' - -+ [NCAPS K_QUOTE] > 'à' -+ [CAPS K_QUOTE] > 'à' -+ [NCAPS SHIFT K_QUOTE] > '°' -+ [SHIFT CAPS K_QUOTE] > '°' -+ [NCAPS RALT CTRL K_QUOTE] > '%' -+ [NCAPS CTRL K_QUOTE] > '%' -+ [NCAPS SHIFT RALT K_QUOTE] > '∞' -+ [NCAPS RALT K_QUOTE] > '#' -c WARNING: ambiguous rule: earlier: [CAPS K_QUOTE] > 'à' here: + [CAPS K_QUOTE] > '#' -+ [CAPS RALT K_QUOTE] > '#' - -+ [NCAPS K_K] > 'k' -+ [CAPS K_K] > 'K' -+ [NCAPS SHIFT K_K] > 'K' -+ [SHIFT CAPS K_K] > 'K' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_K] > U+000B -c WARNING: Use of a control character + [NCAPS CTRL K_K] > U+000B -+ [NCAPS SHIFT RALT K_K] > '˛' -+ [NCAPS RALT K_K] > 'º' -c WARNING: ambiguous rule: earlier: [CAPS K_K] > 'K' here: + [CAPS K_K] > 'º' -+ [CAPS RALT K_K] > 'º' - -+ [NCAPS K_COLON] > 'ò' -+ [CAPS K_COLON] > 'ò' -+ [NCAPS SHIFT K_COLON] > 'ç' -+ [SHIFT CAPS K_COLON] > 'ç' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_COLON] > U+000D -c WARNING: Use of a control character + [NCAPS CTRL K_COLON] > U+000D -+ [NCAPS SHIFT RALT K_COLON] > 'Ç' -+ [NCAPS RALT K_COLON] > '@' -c WARNING: ambiguous rule: earlier: [CAPS K_COLON] > 'ò' here: + [CAPS K_COLON] > '@' -+ [CAPS RALT K_COLON] > '@' - -+ [NCAPS K_BKSLASH] > 'ù' -+ [CAPS K_BKSLASH] > 'ù' -+ [NCAPS SHIFT K_BKSLASH] > '§' -+ [SHIFT CAPS K_BKSLASH] > '§' -+ [NCAPS RALT CTRL K_BKSLASH] > '°' -+ [NCAPS CTRL K_BKSLASH] > '°' -+ [NCAPS SHIFT RALT K_BKSLASH] > '◊' -+ [NCAPS RALT K_BKSLASH] > '¶' -c WARNING: ambiguous rule: earlier: [CAPS K_BKSLASH] > 'ù' here: + [CAPS K_BKSLASH] > '¶' -+ [CAPS RALT K_BKSLASH] > '¶' - -+ [NCAPS K_COMMA] > ',' -+ [CAPS K_COMMA] > ',' -+ [NCAPS SHIFT K_COMMA] > ';' -+ [SHIFT CAPS K_COMMA] > ';' -+ [NCAPS RALT CTRL K_COMMA] > '.' -+ [NCAPS CTRL K_COMMA] > '.' -+ [NCAPS RALT K_COMMA] > '…' -c WARNING: ambiguous rule: earlier: [CAPS K_COMMA] > ',' here: + [CAPS K_COMMA] > '…' -+ [CAPS RALT K_COMMA] > '…' - -+ [NCAPS K_SLASH] > '-' -+ [CAPS K_SLASH] > '-' -+ [NCAPS SHIFT K_SLASH] > '_' -+ [SHIFT CAPS K_SLASH] > '_' -+ [NCAPS RALT CTRL K_SLASH] > '!' -+ [NCAPS CTRL K_SLASH] > '!' -+ [NCAPS SHIFT RALT K_SLASH] > '—' -+ [NCAPS RALT K_SLASH] > '–' -c WARNING: ambiguous rule: earlier: [CAPS K_SLASH] > '-' here: + [CAPS K_SLASH] > '–' -+ [CAPS RALT K_SLASH] > '–' -+ [NCAPS K_N] > 'n' -c WARNING: ambiguous rule: later: [CAPS K_N] > dk(A11) here: + [CAPS K_N] > 'N' -+ [NCAPS SHIFT K_N] > 'N' -+ [SHIFT CAPS K_N] > 'N' -c WARNING: Use of a control character + [NCAPS RALT CTRL K_N] > U+000E -c WARNING: Use of a control character + [NCAPS CTRL K_N] > U+000E -+ [NCAPS SHIFT RALT K_N] > 'Ó' -c WARNING: ambiguous rule: later: [NCAPS RALT K_N] > dk(A10) here: + [NCAPS RALT K_N] > '˜' -+ [CAPS RALT K_N] > '˜' - -+ [NCAPS K_M] > 'm' -+ [CAPS K_M] > 'M' -+ [NCAPS SHIFT K_M] > 'M' -+ [SHIFT CAPS K_M] > 'M' -+ [NCAPS RALT CTRL K_M] > '?' -+ [NCAPS CTRL K_M] > '?' -+ [NCAPS SHIFT RALT K_M] > 'Ú' -+ [NCAPS RALT K_M] > 'µ' -c WARNING: ambiguous rule: earlier: [CAPS K_M] > 'M' here: + [CAPS K_M] > 'µ' -+ [CAPS RALT K_M] > 'µ' - -+ [NCAPS K_PERIOD] > '.' -+ [CAPS K_PERIOD] > '.' -+ [NCAPS SHIFT K_PERIOD] > ':' -+ [SHIFT CAPS K_PERIOD] > ':' -+ [NCAPS RALT CTRL K_PERIOD] > '/' -+ [NCAPS CTRL K_PERIOD] > '/' -+ [NCAPS SHIFT RALT K_PERIOD] > '·' -+ [NCAPS RALT K_PERIOD] > '•' -c WARNING: ambiguous rule: earlier: [CAPS K_PERIOD] > '.' here: + [CAPS K_PERIOD] > '•' -+ [CAPS RALT K_PERIOD] > '•' - -+ [NCAPS SHIFT RALT K_SPACE] > ' ' -+ [NCAPS RALT K_SPACE] > ' ' -c WARNING: ambiguous rule: earlier: [CAPS K_SPACE] > ' ' here: + [CAPS K_SPACE] > ' ' -+ [CAPS RALT K_SPACE] > ' ' -+ [NCAPS K_EQUAL] > dk(A1) -dk(A1) + [NCAPS K_SPACE] > 'ˆ' - -dk(A1) + [CAPS K_SPACE] > 'ˆ' - -dk(A1) + [NCAPS SHIFT K_SPACE] > 'ˆ' - -dk(A1) + [SHIFT CAPS K_SPACE] > 'ˆ' - -dk(A1) + [NCAPS RALT CTRL K_SPACE] > 'ˆ' - -dk(A1) + [NCAPS CTRL K_SPACE] > 'ˆ' - -dk(A1) + [NCAPS SHIFT RALT K_Z] > 'ˆ' - -dk(A1) + [NCAPS SHIFT RALT K_9] > 'ˆ' - -dk(A1) + [NCAPS SHIFT RALT K_COMMA] > 'ˆ' - -dk(A1) + [CAPS K_A] > 'Â' - -dk(A1) + [NCAPS SHIFT K_A] > 'Â' - -dk(A1) + [SHIFT CAPS K_A] > 'Â' - -dk(A1) + [NCAPS K_E] > 'ê' - -dk(A1) + [NCAPS K_I] > 'î' - -dk(A1) + [NCAPS K_O] > 'ô' - -dk(A1) + [NCAPS K_U] > 'û' - -dk(A1) + [CAPS K_E] > 'Ê' - -dk(A1) + [NCAPS SHIFT K_E] > 'Ê' - -dk(A1) + [SHIFT CAPS K_E] > 'Ê' - -dk(A1) + [CAPS K_I] > 'Î' - -dk(A1) + [NCAPS SHIFT K_I] > 'Î' - -dk(A1) + [SHIFT CAPS K_I] > 'Î' - -dk(A1) + [CAPS K_O] > 'Ô' - -dk(A1) + [NCAPS SHIFT K_O] > 'Ô' - -dk(A1) + [SHIFT CAPS K_O] > 'Ô' - -dk(A1) + [CAPS K_U] > 'Û' - -dk(A1) + [NCAPS SHIFT K_U] > 'Û' - -dk(A1) + [SHIFT CAPS K_U] > 'Û' - -dk(A1) + [NCAPS K_A] > 'â' - -+ [NCAPS RALT K_EQUAL] > dk(A2) -dk(A2) + [NCAPS K_SPACE] > 'ˆ' - -dk(A2) + [CAPS K_SPACE] > 'ˆ' - -dk(A2) + [NCAPS SHIFT K_SPACE] > 'ˆ' - -dk(A2) + [SHIFT CAPS K_SPACE] > 'ˆ' - -dk(A2) + [NCAPS RALT CTRL K_SPACE] > 'ˆ' - -dk(A2) + [NCAPS CTRL K_SPACE] > 'ˆ' - -dk(A2) + [NCAPS SHIFT RALT K_Z] > 'ˆ' - -dk(A2) + [NCAPS SHIFT RALT K_9] > 'ˆ' - -dk(A2) + [NCAPS SHIFT RALT K_COMMA] > 'ˆ' - -dk(A2) + [CAPS K_A] > 'Â' - -dk(A2) + [NCAPS SHIFT K_A] > 'Â' - -dk(A2) + [SHIFT CAPS K_A] > 'Â' - -dk(A2) + [NCAPS K_E] > 'ê' - -dk(A2) + [NCAPS K_I] > 'î' - -dk(A2) + [NCAPS K_O] > 'ô' - -dk(A2) + [NCAPS K_U] > 'û' - -dk(A2) + [CAPS K_E] > 'Ê' - -dk(A2) + [NCAPS SHIFT K_E] > 'Ê' - -dk(A2) + [SHIFT CAPS K_E] > 'Ê' - -dk(A2) + [CAPS K_I] > 'Î' - -dk(A2) + [NCAPS SHIFT K_I] > 'Î' - -dk(A2) + [SHIFT CAPS K_I] > 'Î' - -dk(A2) + [CAPS K_O] > 'Ô' - -dk(A2) + [NCAPS SHIFT K_O] > 'Ô' - -dk(A2) + [SHIFT CAPS K_O] > 'Ô' - -dk(A2) + [CAPS K_U] > 'Û' - -dk(A2) + [NCAPS SHIFT K_U] > 'Û' - -dk(A2) + [SHIFT CAPS K_U] > 'Û' - -dk(A2) + [NCAPS K_A] > 'â' - -+ [CAPS K_EQUAL] > dk(A3) -dk(A3) + [NCAPS K_SPACE] > 'ˆ' - -dk(A3) + [CAPS K_SPACE] > 'ˆ' - -dk(A3) + [NCAPS SHIFT K_SPACE] > 'ˆ' - -dk(A3) + [SHIFT CAPS K_SPACE] > 'ˆ' - -dk(A3) + [NCAPS RALT CTRL K_SPACE] > 'ˆ' - -dk(A3) + [NCAPS CTRL K_SPACE] > 'ˆ' - -dk(A3) + [NCAPS SHIFT RALT K_Z] > 'ˆ' - -dk(A3) + [NCAPS SHIFT RALT K_9] > 'ˆ' - -dk(A3) + [NCAPS SHIFT RALT K_COMMA] > 'ˆ' - -dk(A3) + [CAPS K_A] > 'Â' - -dk(A3) + [NCAPS SHIFT K_A] > 'Â' - -dk(A3) + [SHIFT CAPS K_A] > 'Â' - -dk(A3) + [NCAPS K_E] > 'ê' - -dk(A3) + [NCAPS K_I] > 'î' - -dk(A3) + [NCAPS K_O] > 'ô' - -dk(A3) + [NCAPS K_U] > 'û' - -dk(A3) + [CAPS K_E] > 'Ê' - -dk(A3) + [NCAPS SHIFT K_E] > 'Ê' - -dk(A3) + [SHIFT CAPS K_E] > 'Ê' - -dk(A3) + [CAPS K_I] > 'Î' - -dk(A3) + [NCAPS SHIFT K_I] > 'Î' - -dk(A3) + [SHIFT CAPS K_I] > 'Î' - -dk(A3) + [CAPS K_O] > 'Ô' - -dk(A3) + [NCAPS SHIFT K_O] > 'Ô' - -dk(A3) + [SHIFT CAPS K_O] > 'Ô' - -dk(A3) + [CAPS K_U] > 'Û' - -dk(A3) + [NCAPS SHIFT K_U] > 'Û' - -dk(A3) + [SHIFT CAPS K_U] > 'Û' - -dk(A3) + [NCAPS K_A] > 'â' - -+ [NCAPS RALT K_9] > dk(A4) -dk(A4) + [NCAPS K_SPACE] > '`' - -dk(A4) + [CAPS K_SPACE] > '`' - -dk(A4) + [NCAPS SHIFT K_SPACE] > '`' - -dk(A4) + [SHIFT CAPS K_SPACE] > '`' - -dk(A4) + [NCAPS RALT CTRL K_SPACE] > '`' - -dk(A4) + [NCAPS CTRL K_SPACE] > '`' - -dk(A4) + [NCAPS SHIFT RALT K_Z] > '`' - -dk(A4) + [NCAPS SHIFT RALT K_9] > '`' - -dk(A4) + [NCAPS SHIFT RALT K_COMMA] > '`' - -dk(A4) + [CAPS K_A] > 'À' - -dk(A4) + [NCAPS SHIFT K_A] > 'À' - -dk(A4) + [SHIFT CAPS K_A] > 'À' - -dk(A4) + [NCAPS K_E] > 'è' - -dk(A4) + [NCAPS K_I] > 'ì' - -dk(A4) + [NCAPS K_O] > 'ò' - -dk(A4) + [NCAPS K_U] > 'ù' - -dk(A4) + [CAPS K_E] > 'È' - -dk(A4) + [NCAPS SHIFT K_E] > 'È' - -dk(A4) + [SHIFT CAPS K_E] > 'È' - -dk(A4) + [CAPS K_I] > 'Ì' - -dk(A4) + [NCAPS SHIFT K_I] > 'Ì' - -dk(A4) + [SHIFT CAPS K_I] > 'Ì' - -dk(A4) + [CAPS K_O] > 'Ò' - -dk(A4) + [NCAPS SHIFT K_O] > 'Ò' - -dk(A4) + [SHIFT CAPS K_O] > 'Ò' - -dk(A4) + [CAPS K_U] > 'Ù' - -dk(A4) + [NCAPS SHIFT K_U] > 'Ù' - -dk(A4) + [SHIFT CAPS K_U] > 'Ù' - -dk(A4) + [NCAPS K_A] > 'à' - -+ [CAPS K_9] > dk(A5) -dk(A5) + [NCAPS K_SPACE] > '`' - -dk(A5) + [CAPS K_SPACE] > '`' - -dk(A5) + [NCAPS SHIFT K_SPACE] > '`' - -dk(A5) + [SHIFT CAPS K_SPACE] > '`' - -dk(A5) + [NCAPS RALT CTRL K_SPACE] > '`' - -dk(A5) + [NCAPS CTRL K_SPACE] > '`' - -dk(A5) + [NCAPS SHIFT RALT K_Z] > '`' - -dk(A5) + [NCAPS SHIFT RALT K_9] > '`' - -dk(A5) + [NCAPS SHIFT RALT K_COMMA] > '`' - -dk(A5) + [CAPS K_A] > 'À' - -dk(A5) + [NCAPS SHIFT K_A] > 'À' - -dk(A5) + [SHIFT CAPS K_A] > 'À' - -dk(A5) + [NCAPS K_E] > 'è' - -dk(A5) + [NCAPS K_I] > 'ì' - -dk(A5) + [NCAPS K_O] > 'ò' - -dk(A5) + [NCAPS K_U] > 'ù' - -dk(A5) + [CAPS K_E] > 'È' - -dk(A5) + [NCAPS SHIFT K_E] > 'È' - -dk(A5) + [SHIFT CAPS K_E] > 'È' - -dk(A5) + [CAPS K_I] > 'Ì' - -dk(A5) + [NCAPS SHIFT K_I] > 'Ì' - -dk(A5) + [SHIFT CAPS K_I] > 'Ì' - -dk(A5) + [CAPS K_O] > 'Ò' - -dk(A5) + [NCAPS SHIFT K_O] > 'Ò' - -dk(A5) + [SHIFT CAPS K_O] > 'Ò' - -dk(A5) + [CAPS K_U] > 'Ù' - -dk(A5) + [NCAPS SHIFT K_U] > 'Ù' - -dk(A5) + [SHIFT CAPS K_U] > 'Ù' - -dk(A5) + [NCAPS K_A] > 'à' - -+ [NCAPS RALT K_8] > dk(A12) -dk(A12) + [NCAPS K_SPACE] > '´' - -dk(A12) + [CAPS K_SPACE] > '´' - -dk(A12) + [NCAPS SHIFT K_SPACE] > '´' - -dk(A12) + [SHIFT CAPS K_SPACE] > '´' - -dk(A12) + [NCAPS RALT CTRL K_SPACE] > '´' - -dk(A12) + [NCAPS CTRL K_SPACE] > '´' - -dk(A12) + [NCAPS SHIFT RALT K_Z] > '´' - -dk(A12) + [NCAPS SHIFT RALT K_9] > '´' - -dk(A12) + [NCAPS SHIFT RALT K_COMMA] > '´' - -dk(A12) + [CAPS K_A] > 'Á' - -dk(A12) + [NCAPS SHIFT K_A] > 'Á' - -dk(A12) + [SHIFT CAPS K_A] > 'Á' - -dk(A12) + [NCAPS K_E] > 'é' - -dk(A12) + [NCAPS K_I] > 'í' - -dk(A12) + [NCAPS K_O] > 'ó' - -dk(A12) + [NCAPS K_U] > 'ú' - -dk(A12) + [CAPS K_E] > 'É' - -dk(A12) + [NCAPS SHIFT K_E] > 'É' - -dk(A12) + [SHIFT CAPS K_E] > 'É' - -dk(A12) + [CAPS K_I] > 'Í' - -dk(A12) + [NCAPS SHIFT K_I] > 'Í' - -dk(A12) + [SHIFT CAPS K_I] > 'Í' - -dk(A12) + [CAPS K_O] > 'Ó' - -dk(A12) + [NCAPS SHIFT K_O] > 'Ó' - -dk(A12) + [SHIFT CAPS K_O] > 'Ó' - -dk(A12) + [CAPS K_U] > 'Ú' - -dk(A12) + [NCAPS SHIFT K_U] > 'Ú' - -dk(A12) + [SHIFT CAPS K_U] > 'Ú' - -dk(A12) + [NCAPS K_A] > 'á' - -+ [CAPS K_8] > dk(A13) -dk(A13) + [NCAPS K_SPACE] > '´' - -dk(A13) + [CAPS K_SPACE] > '´' - -dk(A13) + [NCAPS SHIFT K_SPACE] > '´' - -dk(A13) + [SHIFT CAPS K_SPACE] > '´' - -dk(A13) + [NCAPS RALT CTRL K_SPACE] > '´' - -dk(A13) + [NCAPS CTRL K_SPACE] > '´' - -dk(A13) + [NCAPS SHIFT RALT K_Z] > '´' - -dk(A13) + [NCAPS SHIFT RALT K_9] > '´' - -dk(A13) + [NCAPS SHIFT RALT K_COMMA] > '´' - -dk(A13) + [CAPS K_A] > 'Á' - -dk(A13) + [NCAPS SHIFT K_A] > 'Á' - -dk(A13) + [SHIFT CAPS K_A] > 'Á' - -dk(A13) + [NCAPS K_E] > 'é' - -dk(A13) + [NCAPS K_I] > 'í' - -dk(A13) + [NCAPS K_O] > 'ó' - -dk(A13) + [NCAPS K_U] > 'ú' - -dk(A13) + [CAPS K_E] > 'É' - -dk(A13) + [NCAPS SHIFT K_E] > 'É' - -dk(A13) + [SHIFT CAPS K_E] > 'É' - -dk(A13) + [CAPS K_I] > 'Í' - -dk(A13) + [NCAPS SHIFT K_I] > 'Í' - -dk(A13) + [SHIFT CAPS K_I] > 'Í' - -dk(A13) + [CAPS K_O] > 'Ó' - -dk(A13) + [NCAPS SHIFT K_O] > 'Ó' - -dk(A13) + [SHIFT CAPS K_O] > 'Ó' - -dk(A13) + [CAPS K_U] > 'Ú' - -dk(A13) + [NCAPS SHIFT K_U] > 'Ú' - -dk(A13) + [SHIFT CAPS K_U] > 'Ú' - -dk(A13) + [NCAPS K_A] > 'á' - -+ [NCAPS RALT K_U] > dk(A8) -dk(A8) + [NCAPS K_SPACE] > '¨' - -dk(A8) + [CAPS K_SPACE] > '¨' - -dk(A8) + [NCAPS SHIFT K_SPACE] > '¨' - -dk(A8) + [SHIFT CAPS K_SPACE] > '¨' - -dk(A8) + [NCAPS RALT CTRL K_SPACE] > '¨' - -dk(A8) + [NCAPS CTRL K_SPACE] > '¨' - -dk(A8) + [NCAPS SHIFT RALT K_Z] > '¨' - -dk(A8) + [NCAPS SHIFT RALT K_9] > '¨' - -dk(A8) + [NCAPS SHIFT RALT K_COMMA] > '¨' - -dk(A8) + [CAPS K_A] > 'Ä' - -dk(A8) + [NCAPS SHIFT K_A] > 'Ä' - -dk(A8) + [SHIFT CAPS K_A] > 'Ä' - -dk(A8) + [NCAPS K_E] > 'ë' - -dk(A8) + [NCAPS K_I] > 'ï' - -dk(A8) + [NCAPS K_O] > 'ö' - -dk(A8) + [NCAPS K_U] > 'ü' - -dk(A8) + [NCAPS K_Y] > 'ÿ' - -dk(A8) + [CAPS K_E] > 'Ë' - -dk(A8) + [NCAPS SHIFT K_E] > 'Ë' - -dk(A8) + [SHIFT CAPS K_E] > 'Ë' - -dk(A8) + [CAPS K_I] > 'Ï' - -dk(A8) + [NCAPS SHIFT K_I] > 'Ï' - -dk(A8) + [SHIFT CAPS K_I] > 'Ï' - -dk(A8) + [CAPS K_O] > 'Ö' - -dk(A8) + [NCAPS SHIFT K_O] > 'Ö' - -dk(A8) + [SHIFT CAPS K_O] > 'Ö' - -dk(A8) + [CAPS K_U] > 'Ü' - -dk(A8) + [NCAPS SHIFT K_U] > 'Ü' - -dk(A8) + [SHIFT CAPS K_U] > 'Ü' - -dk(A8) + [CAPS K_Y] > 'Ÿ' - -dk(A8) + [NCAPS SHIFT K_Y] > 'Ÿ' - -dk(A8) + [SHIFT CAPS K_Y] > 'Ÿ' - -dk(A8) + [NCAPS K_A] > 'ä' - -+ [CAPS K_U] > dk(A9) -dk(A9) + [NCAPS K_SPACE] > '¨' - -dk(A9) + [CAPS K_SPACE] > '¨' - -dk(A9) + [NCAPS SHIFT K_SPACE] > '¨' - -dk(A9) + [SHIFT CAPS K_SPACE] > '¨' - -dk(A9) + [NCAPS RALT CTRL K_SPACE] > '¨' - -dk(A9) + [NCAPS CTRL K_SPACE] > '¨' - -dk(A9) + [NCAPS SHIFT RALT K_Z] > '¨' - -dk(A9) + [NCAPS SHIFT RALT K_9] > '¨' - -dk(A9) + [NCAPS SHIFT RALT K_COMMA] > '¨' - -dk(A9) + [CAPS K_A] > 'Ä' - -dk(A9) + [NCAPS SHIFT K_A] > 'Ä' - -dk(A9) + [SHIFT CAPS K_A] > 'Ä' - -dk(A9) + [NCAPS K_E] > 'ë' - -dk(A9) + [NCAPS K_I] > 'ï' - -dk(A9) + [NCAPS K_O] > 'ö' - -dk(A9) + [NCAPS K_U] > 'ü' - -dk(A9) + [NCAPS K_Y] > 'ÿ' - -dk(A9) + [CAPS K_E] > 'Ë' - -dk(A9) + [NCAPS SHIFT K_E] > 'Ë' - -dk(A9) + [SHIFT CAPS K_E] > 'Ë' - -dk(A9) + [CAPS K_I] > 'Ï' - -dk(A9) + [NCAPS SHIFT K_I] > 'Ï' - -dk(A9) + [SHIFT CAPS K_I] > 'Ï' - -dk(A9) + [CAPS K_O] > 'Ö' - -dk(A9) + [NCAPS SHIFT K_O] > 'Ö' - -dk(A9) + [SHIFT CAPS K_O] > 'Ö' - -dk(A9) + [CAPS K_U] > 'Ü' - -dk(A9) + [NCAPS SHIFT K_U] > 'Ü' - -dk(A9) + [SHIFT CAPS K_U] > 'Ü' - -dk(A9) + [CAPS K_Y] > 'Ÿ' - -dk(A9) + [NCAPS SHIFT K_Y] > 'Ÿ' - -dk(A9) + [SHIFT CAPS K_Y] > 'Ÿ' - -dk(A9) + [NCAPS K_A] > 'ä' - -+ [NCAPS RALT K_N] > dk(A10) -dk(A10) + [NCAPS K_SPACE] > '˜' - -dk(A10) + [CAPS K_SPACE] > '˜' - -dk(A10) + [NCAPS SHIFT K_SPACE] > '˜' - -dk(A10) + [SHIFT CAPS K_SPACE] > '˜' - -dk(A10) + [NCAPS RALT CTRL K_SPACE] > '˜' - -dk(A10) + [NCAPS CTRL K_SPACE] > '˜' - -dk(A10) + [NCAPS SHIFT RALT K_Z] > '˜' - -dk(A10) + [NCAPS SHIFT RALT K_9] > '˜' - -dk(A10) + [NCAPS SHIFT RALT K_COMMA] > '˜' - -dk(A10) + [CAPS K_A] > 'Ã' - -dk(A10) + [NCAPS SHIFT K_A] > 'Ã' - -dk(A10) + [SHIFT CAPS K_A] > 'Ã' - -dk(A10) + [NCAPS K_N] > 'ñ' - -dk(A10) + [NCAPS K_O] > 'õ' - -dk(A10) + [CAPS K_N] > 'Ñ' - -dk(A10) + [NCAPS SHIFT K_N] > 'Ñ' - -dk(A10) + [SHIFT CAPS K_N] > 'Ñ' - -dk(A10) + [CAPS K_O] > 'Õ' - -dk(A10) + [NCAPS SHIFT K_O] > 'Õ' - -dk(A10) + [SHIFT CAPS K_O] > 'Õ' - -dk(A10) + [NCAPS K_A] > 'ã' - -+ [CAPS K_N] > dk(A11) -dk(A11) + [NCAPS K_SPACE] > '˜' - -dk(A11) + [CAPS K_SPACE] > '˜' - -dk(A11) + [NCAPS SHIFT K_SPACE] > '˜' - -dk(A11) + [SHIFT CAPS K_SPACE] > '˜' - -dk(A11) + [NCAPS RALT CTRL K_SPACE] > '˜' - -dk(A11) + [NCAPS CTRL K_SPACE] > '˜' - -dk(A11) + [NCAPS SHIFT RALT K_Z] > '˜' - -dk(A11) + [NCAPS SHIFT RALT K_9] > '˜' - -dk(A11) + [NCAPS SHIFT RALT K_COMMA] > '˜' - -dk(A11) + [CAPS K_A] > 'Ã' - -dk(A11) + [NCAPS SHIFT K_A] > 'Ã' - -dk(A11) + [SHIFT CAPS K_A] > 'Ã' - -dk(A11) + [NCAPS K_N] > 'ñ' - -dk(A11) + [NCAPS K_O] > 'õ' - -dk(A11) + [CAPS K_N] > 'Ñ' - -dk(A11) + [NCAPS SHIFT K_N] > 'Ñ' - -dk(A11) + [SHIFT CAPS K_N] > 'Ñ' - -dk(A11) + [CAPS K_O] > 'Õ' - -dk(A11) + [NCAPS SHIFT K_O] > 'Õ' - -dk(A11) + [SHIFT CAPS K_O] > 'Õ' - -dk(A11) + [NCAPS K_A] > 'ã' - -c WARNING: ambiguous rule: earlier: [NCAPS RALT K_8] > dk(A12) here: + [NCAPS RALT K_8] > dk(A12) -dk(A12) + [NCAPS RALT K_U] > dk(B8) -dk(B8) + [NCAPS K_SPACE] > 'ˆ' - -dk(B8) + [CAPS K_SPACE] > 'ˆ' - -dk(B8) + [NCAPS SHIFT K_SPACE] > 'ˆ' - -dk(B8) + [SHIFT CAPS K_SPACE] > 'ˆ' - -dk(B8) + [NCAPS RALT CTRL K_SPACE] > 'ˆ' - -dk(B8) + [NCAPS CTRL K_SPACE] > 'ˆ' - -dk(B8) + [NCAPS SHIFT RALT K_Z] > 'ˆ' - -dk(B8) + [NCAPS SHIFT RALT K_9] > 'ˆ' - -dk(B8) + [NCAPS SHIFT RALT K_COMMA] > 'ˆ' - -dk(B8) + [CAPS K_A] > 'Â' - -dk(B8) + [NCAPS SHIFT K_A] > 'Â' - -dk(B8) + [SHIFT CAPS K_A] > 'Â' - -dk(B8) + [NCAPS K_E] > 'ê' - -dk(B8) + [NCAPS K_I] > 'î' - -dk(B8) + [NCAPS K_O] > 'ô' - -dk(B8) + [NCAPS K_U] > 'û' - -dk(B8) + [CAPS K_E] > 'Ê' - -dk(B8) + [NCAPS SHIFT K_E] > 'Ê' - -dk(B8) + [SHIFT CAPS K_E] > 'Ê' - -dk(B8) + [CAPS K_I] > 'Î' - -dk(B8) + [NCAPS SHIFT K_I] > 'Î' - -dk(B8) + [SHIFT CAPS K_I] > 'Î' - -dk(B8) + [CAPS K_O] > 'Ô' - -dk(B8) + [NCAPS SHIFT K_O] > 'Ô' - -dk(B8) + [SHIFT CAPS K_O] > 'Ô' - -dk(B8) + [CAPS K_U] > 'Û' - -dk(B8) + [NCAPS SHIFT K_U] > 'Û' - -dk(B8) + [SHIFT CAPS K_U] > 'Û' - -dk(B8) + [NCAPS K_A] > 'â' - -dk(A12) + [CAPS K_U] > dk(B9) -dk(B9) + [NCAPS K_SPACE] > 'ˆ' - -dk(B9) + [CAPS K_SPACE] > 'ˆ' - -dk(B9) + [NCAPS SHIFT K_SPACE] > 'ˆ' - -dk(B9) + [SHIFT CAPS K_SPACE] > 'ˆ' - -dk(B9) + [NCAPS RALT CTRL K_SPACE] > 'ˆ' - -dk(B9) + [NCAPS CTRL K_SPACE] > 'ˆ' - -dk(B9) + [NCAPS SHIFT RALT K_Z] > 'ˆ' - -dk(B9) + [NCAPS SHIFT RALT K_9] > 'ˆ' - -dk(B9) + [NCAPS SHIFT RALT K_COMMA] > 'ˆ' - -dk(B9) + [CAPS K_A] > 'Â' - -dk(B9) + [NCAPS SHIFT K_A] > 'Â' - -dk(B9) + [SHIFT CAPS K_A] > 'Â' - -dk(B9) + [NCAPS K_E] > 'ê' - -dk(B9) + [NCAPS K_I] > 'î' - -dk(B9) + [NCAPS K_O] > 'ô' - -dk(B9) + [NCAPS K_U] > 'û' - -dk(B9) + [CAPS K_E] > 'Ê' - -dk(B9) + [NCAPS SHIFT K_E] > 'Ê' - -dk(B9) + [SHIFT CAPS K_E] > 'Ê' - -dk(B9) + [CAPS K_I] > 'Î' - -dk(B9) + [NCAPS SHIFT K_I] > 'Î' - -dk(B9) + [SHIFT CAPS K_I] > 'Î' - -dk(B9) + [CAPS K_O] > 'Ô' - -dk(B9) + [NCAPS SHIFT K_O] > 'Ô' - -dk(B9) + [SHIFT CAPS K_O] > 'Ô' - -dk(B9) + [CAPS K_U] > 'Û' - -dk(B9) + [NCAPS SHIFT K_U] > 'Û' - -dk(B9) + [SHIFT CAPS K_U] > 'Û' - -dk(B9) + [NCAPS K_A] > 'â' - -c WARNING: ambiguous rule: earlier: [CAPS K_8] > dk(A13) here: + [CAPS K_8] > dk(A13) -dk(A13) + [NCAPS RALT K_U] > dk(B8) - -dk(A13) + [CAPS K_U] > dk(B9) - diff --git a/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts b/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts index 54b2c3d3ae1..628142d10c2 100644 --- a/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts +++ b/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts @@ -20,6 +20,28 @@ describe('KeylayoutToKmnConverter', function () { before(function () { compilerTestCallbacks.clear(); }); +describe('RunFILES', function () { + this.timeout(10000); // allow longer time for these tests + const sut = new KeylayoutToKmnConverter(compilerTestCallbacks, compilerTestOptions); + [ + [makePathToFixture('../data/Polish.keylayout')], + [makePathToFixture('../data/Spanish.keylayout')], + [makePathToFixture('../data/French.keylayout')], + // [makePathToFixture('../data/German_complete_reduced.keylayout')], + // [makePathToFixture('../data/German_standard.keylayout')], + [makePathToFixture('../data/Italian_command.keylayout')], + [makePathToFixture('../data/Italian.keylayout')], + [makePathToFixture('../data/Latin_American.keylayout')], + [makePathToFixture('../data/Swiss_French.keylayout')], + [makePathToFixture('../data/Swiss_German.keylayout')], + [makePathToFixture('../data/US.keylayout')], + ].forEach(function (files) { + it(files + " should give no errors ", async function () { + sut.run(files[0]); + assert.isTrue(compilerTestCallbacks.messages.length === 0); + }); + }); + }); describe('RunSpecialTestFiles', function () { const sut = new KeylayoutToKmnConverter(compilerTestCallbacks, compilerTestOptions); diff --git a/developer/src/kmc-convert/test/kmn-file-writer.tests.ts b/developer/src/kmc-convert/test/kmn-file-writer.tests.ts index 8b841b6dad8..d3d19abbe8d 100644 --- a/developer/src/kmc-convert/test/kmn-file-writer.tests.ts +++ b/developer/src/kmc-convert/test/kmn-file-writer.tests.ts @@ -105,43 +105,34 @@ describe('KmnFileWriter', function () { }); }); + describe('reviewRules messages', function () { const sutW = new KmnFileWriter(compilerTestCallbacks, compilerTestOptions); - [/* + [ [[new Rule("C0", '', '', 0, 0, '', '', 0, 0, 'UNAVAILABLE', 'K_A', new TextEncoder().encode('A'))], [''], [''], - ['c WARNING: unavailable modifier : here: ']], + ['c WARNING: unavailable modifier here: ']], [[new Rule("C1", '', '', 0, 0, 'CAPS', 'K_EQUAL', 0, 0, 'UNAVAILABLE', 'K_B', new TextEncoder().encode('B'))], [''], [''], - ['c WARNING: unavailable modifier : here: ']], + ['c WARNING: unavailable modifier here: ']], [[new Rule("C2", '', '', 0, 0, 'CAPS', 'K_EQUAL', 0, 0, 'UNAVAILABLE', 'K_C', new TextEncoder().encode('C'),)], [''], [''], - ['c WARNING: unavailable modifier : here: ']], + ['c WARNING: unavailable modifier here: ']], [[new Rule("C2", '', '', 0, 0, 'UNAVAILABLE_dk', 'K_EQUAL', 0, 0, 'UNAVAILABLE', 'K_C', new TextEncoder().encode('C'),)], [''], - ['c WARNING: unavailable modifier : here: '], - ['c WARNING: unavailable modifier : here: ']], + ['c WARNING: unavailable modifier here: '], + ['c WARNING: unavailable superior rule ( [UNAVAILABLE_dk K_EQUAL] > dk(A0) ) : unavailable modifier here: ']], [[new Rule("C3", 'UNAVAILABLE_prev_dk', 'K_D', 0, 0, 'UNAVAILABLE_dk', 'K_EQUAL', 0, 0, 'SHIFT', 'K_C', new TextEncoder().encode('D'),)], - ['c WARNING: unavailable modifier : here: '], - ['c WARNING: unavailable modifier : here: '], - ['c WARNING: unavailable superior rule ( [UNAVAILABLE_dk K_EQUAL] > dk(B0) ) : here: ']], - -*/ - - [[new Rule("C3", 'UNAVAILABLE_prev_dk', 'K_D', 0, 0, 'UNAVAILABLE_dk', 'K_EQUAL', 0, 0, 'UNAVAIL', 'K_C', new TextEncoder().encode('D'),)], - ['c WARNING: unavailable modifier : here: '], - ['c WARNING: unavailable modifier : here: '], - ['c WARNING: unavailable superior rule ( [UNAVAILABLE_dk K_EQUAL] > dk(B0) ) : unavailable modifier : here: ']], - - - + ['c WARNING: unavailable modifier here: '], + ['c WARNING: unavailable superior rule ( [UNAVAILABLE_prev_dk K_D] > dk(A0) ) : unavailable modifier here: '], + ['c WARNING: unavailable superior rule ( [UNAVAILABLE_dk K_EQUAL] > dk(B0) ) : here: ']], [[new Rule("C3", 'CAPS', 'K_D', 0, 0, 'RALT', 'K_EQUAL', 0, 0, 'SHIFT', 'K_C', new TextEncoder().encode('D'),)], [''], @@ -149,9 +140,9 @@ describe('KmnFileWriter', function () { ['']], [[new Rule("C3", 'X', 'K_X', 0, 0, 'Y', 'K_Y', 0, 0, 'SHIFT', 'K_Z', new TextEncoder().encode('D'),)], - ['c WARNING: unavailable modifier : here: '], - ['c WARNING: unavailable modifier : here: '], - ['c WARNING: unavailable superior rule ( [Y K_Y] > dk(B0) ) : here: ']], + ['c WARNING: unavailable modifier here: '], + ['c WARNING: unavailable superior rule ( [X K_X] > dk(A0) ) : unavailable modifier here: '], + ['c WARNING: unavailable superior rule ( [Y K_Y] > dk(B0) ) : here: ']], ].forEach(function (values: (string[] | Rule[])[], index: number) { it(('rule " ' + (values[0][0] as Rule).ruleType as string + ' "') + 'should create "' + values[1] + ' | ' + values[2] + ' | ' + values[3] + '"', async function () { @@ -163,6 +154,7 @@ describe('KmnFileWriter', function () { }); }); + describe('reviewRules messages duplicate and ambiguous', function () { const sutW = new KmnFileWriter(compilerTestCallbacks, compilerTestOptions); [ @@ -170,9 +162,9 @@ describe('KmnFileWriter', function () { [[ new Rule("C3", 'LALT', 'K_A', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C3", 'LALT', 'K_A', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')),], - ['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '], - ["c WARNING: duplicate rule: earlier: dk(B0) + [SHIFT K_B] > dk(B0) here: "], - ["c WARNING: duplicate rule: earlier: dk(B0) + [CAPS K_C] > 'X' here: "]], + ['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '], + ["c WARNING: duplicate rule: earlier: dk(B0) + [SHIFT K_B] > dk(B0) here: "], + ["c WARNING: duplicate rule: earlier: dk(B0) + [CAPS K_C] > 'X' here: "]], //6-6 dup [[ @@ -180,7 +172,7 @@ describe('KmnFileWriter', function () { new Rule("C3", 'CTRL', 'K_D', 0, 0, 'NCAPS', 'K_E', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')),], [''], [""], - ["c WARNING: duplicate rule: earlier: dk(B0) + [CAPS K_C] > 'X' here: "]], + ["c WARNING: duplicate rule: earlier: dk(B0) + [CAPS K_C] > 'X' here: "]], //6-6 amb [[ @@ -188,29 +180,29 @@ describe('KmnFileWriter', function () { new Rule("C3", 'CTRL', 'K_D', 0, 0, 'NCAPS', 'K_E', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('Y')),], [''], [""], - ["c WARNING: ambiguous rule: earlier: dk(B0) + [CAPS K_C] > 'X' here: "]], + ["c WARNING: ambiguous rule: earlier: dk(B0) + [CAPS K_C] > 'X' here: "]], // 5-5 amb [[ new Rule("C3", 'LALT', 'K_A', 0, 0, 'NCAPS', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C3", 'LALT', 'K_A', 0, 0, 'NCAPS', 'K_B', 0, 1, 'RALT', 'K_F', new TextEncoder().encode('X')),], - ['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '], - ["c WARNING: ambiguous rule: earlier: dk(B0) + [NCAPS K_B] > dk(B0) here: "], [''], + ['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '], + ["c WARNING: ambiguous rule: earlier: dk(B0) + [NCAPS K_B] > dk(B0) here: "], [''], ], // 5-5 dup [[ new Rule("C3", 'LALT', 'K_A', 0, 0, 'NCAPS', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C3", 'LALT', 'K_A', 0, 0, 'NCAPS', 'K_B', 0, 0, 'RALT', 'K_F', new TextEncoder().encode('X')),], - ['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '], - ["c WARNING: duplicate rule: earlier: dk(B0) + [NCAPS K_B] > dk(B0) here: "], + ['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '], + ["c WARNING: duplicate rule: earlier: dk(B0) + [NCAPS K_B] > dk(B0) here: "], ['']], // 4-2 amb [[ new Rule("C3", 'LALT', 'K_A', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C2", '', '', 0, 0, 'LALT', 'K_A', 0, 0, 'RALT', 'K_F', new TextEncoder().encode('X')),], - ['c WARNING: ambiguous rule: later: [LALT K_A] > dk(C0) here: '], + ['c WARNING: ambiguous rule: later: [LALT K_A] > dk(C0) here: '], [''], ['']], @@ -218,7 +210,7 @@ describe('KmnFileWriter', function () { [[ new Rule("C3", 'LALT', 'K_A', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C3", 'LALT', 'K_A', 1, 1, 'NCAPS', 'K_E', 0, 0, 'RALT', 'K_F', new TextEncoder().encode('Y')),], - ['c WARNING: ambiguous rule: earlier: [LALT K_A] > dk(C0) here: '], + ['c WARNING: ambiguous rule: earlier: [LALT K_A] > dk(C0) here: '], [""], [''],], @@ -226,7 +218,7 @@ describe('KmnFileWriter', function () { [[ new Rule("C3", 'LALT', 'K_A', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C3", 'LALT', 'K_A', 0, 0, 'NCAPS', 'K_E', 0, 0, 'RALT', 'K_F', new TextEncoder().encode('X')),], - ['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '], + ['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '], [''], ['']], @@ -234,7 +226,7 @@ describe('KmnFileWriter', function () { [[ new Rule("C3", 'LALT', 'K_A', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C2", '', '', 0, 0, 'LALT', 'K_A', 0, 0, 'RALT', 'K_F', new TextEncoder().encode('Y')),], - ['c WARNING: ambiguous rule: later: [LALT K_A] > dk(C0) here: '], + ['c WARNING: ambiguous rule: later: [LALT K_A] > dk(C0) here: '], [''], ['']], @@ -243,7 +235,7 @@ describe('KmnFileWriter', function () { new Rule("C2", '', '', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C3", 'CTRL', 'K_D', 0, 0, 'NCAPS', 'K_E', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')),], [''], - ["c WARNING: duplicate rule: earlier: dk(C0) + [CAPS K_C] > 'X' here: "], + ["c WARNING: duplicate rule: earlier: dk(C0) + [CAPS K_C] > 'X' here: "], [''],], // 6-3 amb @@ -251,14 +243,14 @@ describe('KmnFileWriter', function () { new Rule("C2", '', '', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C3", 'CTRL', 'K_D', 0, 0, 'NCAPS', 'K_E', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('Y')),], [''], - ["c WARNING: ambiguous rule: earlier: dk(C0) + [CAPS K_C] > 'X' here: "], + ["c WARNING: ambiguous rule: earlier: dk(C0) + [CAPS K_C] > 'X' here: "], [''],], // 2-4 amb [[ new Rule("C2", '', '', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C3", 'SHIFT', 'K_B', 0, 0, 'NCAPS', 'K_E', 0, 0, 'RALT', 'K_F', new TextEncoder().encode('Y')),], - ['c WARNING: ambiguous rule: earlier: [SHIFT K_B] > dk(A0) here: '], + ['c WARNING: ambiguous rule: earlier: [SHIFT K_B] > dk(A0) here: '], [''], ['']], @@ -267,7 +259,7 @@ describe('KmnFileWriter', function () { new Rule("C2", '', '', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C2", '', '', 0, 0, 'SHIFT', 'K_B', 1, 1, 'RALT', 'K_F', new TextEncoder().encode('Y')),], [''], - ['c WARNING: ambiguous rule: earlier: [SHIFT K_B] > dk(C0) here: '], + ['c WARNING: ambiguous rule: earlier: [SHIFT K_B] > dk(C0) here: '], ['']], // 2-2 dup @@ -275,7 +267,7 @@ describe('KmnFileWriter', function () { new Rule("C2", '', '', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C2", '', '', 0, 0, 'SHIFT', 'K_B', 0, 0, 'RALT', 'K_F', new TextEncoder().encode('Y')),], [''], - ['c WARNING: duplicate rule: earlier: [SHIFT K_B] > dk(C0) here: '], + ['c WARNING: duplicate rule: earlier: [SHIFT K_B] > dk(C0) here: '], ['']], // 3-3 dup @@ -284,7 +276,7 @@ describe('KmnFileWriter', function () { new Rule("C2", '', '', 0, 0, 'NCAPS', 'K_E', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')),], [''], [''], - ["c WARNING: duplicate rule: earlier: dk(A0) + [CAPS K_C] > 'X' here: "]], + ["c WARNING: duplicate rule: earlier: dk(A0) + [CAPS K_C] > 'X' here: "]], // 3-3 amb [[ @@ -292,7 +284,7 @@ describe('KmnFileWriter', function () { new Rule("C2", '', '', 0, 0, 'NCAPS', 'K_E', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('Y')),], [''], [''], - ["c WARNING: ambiguous rule: earlier: dk(A0) + [CAPS K_C] > 'X' here: "]], + ["c WARNING: ambiguous rule: earlier: dk(A0) + [CAPS K_C] > 'X' here: "]], // 2-1 amb [[ @@ -300,7 +292,7 @@ describe('KmnFileWriter', function () { new Rule("C0", '', '', 0, 0, '', '', 0, 0, 'RALT', 'K_B', new TextEncoder().encode('Y'))], [''], [''], - ['c WARNING: ambiguous rule: later: [RALT K_B] > dk(A0) here: ']], + ['c WARNING: ambiguous rule: later: [RALT K_B] > dk(A0) here: ']], // 1-1 amb [[ @@ -308,7 +300,7 @@ describe('KmnFileWriter', function () { new Rule("C0", '', '', 0, 0, '', '', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('Y'))], [''], [''], - ["c WARNING: ambiguous rule: earlier: [CAPS K_C] > 'X' here: "]], + ["c WARNING: ambiguous rule: earlier: [CAPS K_C] > 'X' here: "]], // 1-1 amb [[ @@ -316,7 +308,7 @@ describe('KmnFileWriter', function () { new Rule("C0", '', '', 0, 0, '', '', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X'))], [''], [''], - ["c WARNING: duplicate rule: earlier: [CAPS K_C] > 'X' here: "]], + ["c WARNING: duplicate rule: earlier: [CAPS K_C] > 'X' here: "]], ].forEach(function (values: (string[] | Rule[])[], index: number) { it('rule ' + (values[0][0] as Rule).ruleType as string + ' should create " ' + ' "' + values[1] + ' | ' + values[2] + ' | ' + values[3] + '"', async function () { @@ -337,7 +329,7 @@ describe('KmnFileWriter', function () { ], [''], [''], - ["c WARNING: ambiguous rule: later: [RALT K_B] > dk(A0) ambiguous rule: earlier: [RALT K_B] > 'X' here: PLEASE CHECK THE FOLLOWING RULE AS IT WILL NOT BE WRITTEN ! "]], + ["c WARNING: ambiguous rule: later: [RALT K_B] > dk(A0) ambiguous rule: earlier: [RALT K_B] > 'X' PLEASE CHECK THE FOLLOWING RULE AS IT WILL NOT BE WRITTEN ! here: "]], ].forEach(function (values: (string[] | Rule[])[], index: number) { it(('rule ' + (values[0][0] as Rule).ruleType as string + ' should create " ' + ' "') + values[1] + ' | ' + values[2] + ' | ' + values[3] + '"', async function () { const result: string[] = sutW.unitTestEndpoints.reviewRules(values[0] as Rule[], 2); From 0a5dbe3fa96a959306191c7190803e21561b13f6 Mon Sep 17 00:00:00 2001 From: Sabine Date: Wed, 24 Jun 2026 16:18:01 +0200 Subject: [PATCH 2/6] feat(developer): reviewRules: return object instead of string[] --- .../src/common/web/utils/src/xml-utils.ts | 6 +- .../keylayout-to-kmn-converter.ts | 2 +- .../src/keylayout-to-kmn/kmn-file-writer.ts | 918 ++++++------------ .../test/keylayout-to-kmn-converter.tests.ts | 22 - .../kmc-convert/test/kmn-file-writer.tests.ts | 2 +- 5 files changed, 275 insertions(+), 675 deletions(-) diff --git a/developer/src/common/web/utils/src/xml-utils.ts b/developer/src/common/web/utils/src/xml-utils.ts index 765a5b7167e..0f73771fb6d 100644 --- a/developer/src/common/web/utils/src/xml-utils.ts +++ b/developer/src/common/web/utils/src/xml-utils.ts @@ -6,7 +6,7 @@ * Abstraction for XML reading and writing */ -import { XMLParser, XMLBuilder, XMLMetaData, X2jOptions, XmlBuilderOptions } from 'fast-xml-parser'; +import { XMLParser, XMLBuilder, XMLMetaData, X2jOptions, XmlBuilderOptions,JPathOrMatcher } from 'fast-xml-parser'; import { SymbolUtils } from "./symbol-utils.js"; /** Symbol giving the start offset, in chars, of the node */ @@ -85,8 +85,8 @@ const PARSER_OPTIONS: KeymanXMLParserOptionsBag = { }, 'kvks': { ...PARSER_COMMON_OPTIONS, - tagValueProcessor: (_tagName: string, tagValue: string, _jPath: string, _hasAttributes: boolean, isLeafNode: boolean): string | undefined => { - if (!isLeafNode) { + tagValueProcessor: (_tagName: string, tagValue: string, _jPathOrMatcher: JPathOrMatcher, _hasAttributes: boolean, isLeafNode: boolean) : unknown => { + if (!isLeafNode) { return tagValue?.trim(); // trimmed value } else { return undefined; // no change to leaf nodes diff --git a/developer/src/kmc-convert/src/keylayout-to-kmn/keylayout-to-kmn-converter.ts b/developer/src/kmc-convert/src/keylayout-to-kmn/keylayout-to-kmn-converter.ts index 7b9e98bf61e..1bf23189084 100644 --- a/developer/src/kmc-convert/src/keylayout-to-kmn/keylayout-to-kmn-converter.ts +++ b/developer/src/kmc-convert/src/keylayout-to-kmn/keylayout-to-kmn-converter.ts @@ -135,7 +135,7 @@ export class KeylayoutToKmnConverter { const processedData = await this.convert(jsonO, inputFilename, outputFilename); const kmnFileWriter = new KmnFileWriter(this.callbacks, this.options); -kmnFileWriter.writeToFile((processedData)); + // write to object/ConverterToKmnResult const outputKmn = kmnFileWriter.write(processedData); const result: ConverterToKmnResult = { diff --git a/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts b/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts index 5c3b4b83b4e..79414e2ff68 100644 --- a/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts +++ b/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts @@ -16,59 +16,36 @@ interface MessageCharacter { message: string; character: string; }; -// Todo-kmc-convert edit interface + interface RuleReview { - warningMessage_0: string; - warningMessages_1: string; - warningMessages_2: string; - hasWarning_0: boolean; - hasWarning_1: boolean; - hasWarning_2: boolean; warningMessages: string[]; extraWarning: string; - - type: 'RuleReview' | 'UnavailableModifier' | 'UnavailableSuperior' | + type: 'RuleReview' | 'UnavailableModifier' | 'UnavailableSuperiorRule' | 'DuplicateRule' | 'AmbiguousRule'; - isEarlier: boolean; - isLater: boolean; - isused: boolean; - context: string; - prevDk_id: number; - dk_prefix: string; - prev_dk_prefix: string; + compare_type: string; + earlier_later: [boolean, boolean]; + dk_bothPrefix_prevdk_dk: [string, string];// todo rename to dk_prefix prevDk_modifier: string; prevDk_key: string; - textpart: string; - dk_id: number; + dk_bothId_prevdk_dk: [number, number];// todo rename to dk_id Dk_modifier: string; Dk_key: string; modifier: string; key: string; output: string; - }; interface UnavailableModifier extends RuleReview { type: 'UnavailableModifier'; - isUnavailable: boolean; }; -interface UnavailableSuperior extends RuleReview { - type: 'UnavailableSuperior'; - isUnavailable: boolean; +interface UnavailableSuperiorRule extends RuleReview { + type: 'UnavailableSuperiorRule'; }; interface DuplicateRules extends RuleReview { type: 'DuplicateRule'; - hasExtraWarning: boolean; - isEarlier: boolean; - isLater: boolean; }; interface AmbiguousRules extends RuleReview { type: 'AmbiguousRule'; - hasExtraWarning: boolean; - isEarlier: boolean; - isLater: boolean; - dk_prefix: string; - prev_dk_prefix: string; }; @@ -76,20 +53,6 @@ export class KmnFileWriter { constructor(private callbacks: CompilerCallbacks, private options: CompilerOptions) { }; - // TODO remove - public writeToFile(dataUkelele: ProcessedData): boolean { - - let data: string = "\n"; - - // add top part of kmn file: STORES - data += this.writeKmnFileHeader(dataUkelele); - - // add bottom part of kmn file: RULES - data += this.writeDataRules(dataUkelele); - - this.callbacks.fs.writeFileSync(dataUkelele.kmnFilename, new TextEncoder().encode(data)); - return true; - } /** * @brief member function to write data from object to a Uint8Array * @param dataUkelele the array holding all keyboard data @@ -459,131 +422,134 @@ export class KmnFileWriter { /** * @brief take a child object of RuleReview and return the appropriate warning message * @param inObj : an object containing all data - * @return outMsg the warning message + * @return outMsg the warning message */ - public createWarningText(inObj: RuleReview, pos: number = 2): string[] { - const outMsg: string[] = ['', '', '']; - outMsg[0] = inObj.warningMessages[0]; - outMsg[1] = inObj.warningMessages[1]; - outMsg[2] = inObj.warningMessages[2]; - - if (inObj.type === 'AmbiguousRule') { - - // version for dk 5-5 - if (!inObj.prevDk_modifier && !inObj.prevDk_key - && inObj.Dk_modifier && inObj.Dk_key - && !inObj.modifier && !inObj.key - && (inObj.dk_id !== -1)) { - const position = (inObj.isEarlier ? "earlier" : "later"); - const doubletextpreventer = - ('ambiguous rule: ' + position - + ': dk(' + inObj.dk_prefix - + inObj.dk_id - + ") + [" - + inObj.Dk_modifier - + " " - + inObj.Dk_key - + "] > " - + 'dk(' + inObj.prev_dk_prefix - + inObj.prevDk_id - + ") "); - if (outMsg[pos].indexOf(doubletextpreventer) === -1) - outMsg[pos] += doubletextpreventer; - } + public createWarningText(inObj: RuleReview, pos: number): string[] { + + const outMsg = [...inObj.warningMessages]; - // version for key with no dk_id amb 6-6 - else if (!inObj.prevDk_modifier && !inObj.prevDk_key - && (inObj.dk_id !== -1) - && inObj.modifier && inObj.key && (inObj.output) - && ((inObj.isEarlier === true /*&& inObj.isLater === true*/))) { - const position = (inObj.isEarlier ? "earlier" : "later"); - outMsg[pos] = inObj.warningMessages[2] - + ('ambiguous rule: ' - + position - + ': dk(' + inObj.dk_prefix - + inObj.dk_id + ") + [" - + inObj.modifier + " " - + inObj.key + "] > \'" - + inObj.output + "\' "); + if (inObj.compare_type === 'unav_C0_C1') { + outMsg[pos] = "unavailable modifier "; + } + + if (inObj.compare_type === 'unav_C2') { + // if the dk is unavailable, the dependant C0 rules and theIr modifiers need to get a warning 'unavailable superior rule ' + if (inObj.Dk_modifier) { + outMsg[1] = "unavailable modifier "; + outMsg[2] = "unavailable superior rule ( [" + + inObj.Dk_modifier + " " + + inObj.Dk_key + + "] > dk(" + + inObj.dk_bothPrefix_prevdk_dk[1] + + inObj.dk_bothId_prevdk_dk[1] + + ") ) : "; } - // version for 2_2 2_1 - else if ((!inObj.prevDk_modifier && !inObj.prevDk_key) - && inObj.Dk_modifier && inObj.Dk_key - && (inObj.dk_id !== -1)) { - const position = (inObj.isEarlier ? "earlier" : "later"); - const doubletextpreventer = - ("ambiguous rule: " - + position + ": [" - + inObj.Dk_modifier + " " - + inObj.Dk_key + "] > dk(" + inObj.dk_prefix - + inObj.dk_id + ") "); - if (outMsg[pos].indexOf(doubletextpreventer) === -1) - outMsg[pos] += doubletextpreventer; + + if (inObj.modifier) { + outMsg[2] = "unavailable modifier "; } + } - // version for dk 4-4 2-4 - else if (inObj.Dk_modifier && inObj.Dk_key - && (inObj.dk_id !== -1) - && !inObj.modifier && !inObj.key) { - const position = (inObj.isEarlier ? "earlier" : "later"); - const doubletextpreventer = - ("ambiguous rule: " - + position + ": [" - + inObj.prevDk_modifier + " " - + inObj.prevDk_key + "] > dk(" + inObj.prev_dk_prefix - + inObj.prevDk_id + ") "); - if (outMsg[pos].indexOf(doubletextpreventer) === -1) - outMsg[pos] += doubletextpreventer; + if (inObj.compare_type === 'unav_C3') { + + // if the dk is unavailable, the dependant C0 rules and theIr modifiers need to get a warning 'unavailable superior rule ' + if (inObj.prevDk_modifier) { + outMsg[0] = "unavailable modifier "; + outMsg[1] = "unavailable superior rule ( [" + + inObj.prevDk_modifier + " " + + inObj.prevDk_key + + "] > dk(" + + inObj.dk_bothPrefix_prevdk_dk[1] + + inObj.dk_bothId_prevdk_dk[1] + + ") ) : "; } - // version for prev dk // 4_1 4_2 - else if (inObj.prevDk_modifier && inObj.prevDk_key && (inObj.prevDk_id !== -1)) { - const position = (inObj.isEarlier ? "earlier" : "later"); - const doubletextpreventer = - ("ambiguous rule: " - + position + ": [" - + inObj.prevDk_modifier + " " - + inObj.prevDk_key + "] > dk(" + inObj.prev_dk_prefix - + inObj.prevDk_id + ") "); - if (outMsg[pos].indexOf(doubletextpreventer) === -1) - outMsg[pos] += doubletextpreventer; + // if the dk is unavailable, the dependant C0 rules and theIr modifiers need to get a warning 'unavailable superior rule ' + if (inObj.Dk_modifier) { + outMsg[1] += "unavailable modifier "; + outMsg[2] = "unavailable superior rule ( [" + + inObj.Dk_modifier + " " + + inObj.Dk_key + + "] > dk(" + + inObj.dk_bothPrefix_prevdk_dk[1] + + inObj.dk_bothId_prevdk_dk[1] + + ") ) : "; } - // version for dk 6-3 or 3-3 - else if (!inObj.prevDk_modifier && !inObj.prevDk_key - && !inObj.Dk_modifier && !inObj.Dk_key - && (inObj.dk_id !== -1) - ) { - const position = (inObj.isEarlier ? "earlier" : "later"); - const doubletextpreventer = - ('ambiguous rule: ' + - position - + ': dk(' + inObj.dk_prefix - + inObj.dk_id + ") + [" - + inObj.modifier + " " - + inObj.key + "] > \'" - + inObj.output + "\' "); - if (outMsg[pos].indexOf(doubletextpreventer) === -1) - outMsg[pos] += doubletextpreventer; + if (inObj.modifier) { + outMsg[2] = "unavailable modifier "; } + } - // version for key with no dk_id amb 1-1 - else if (inObj.modifier && inObj.key - && (inObj.output) - && (inObj.dk_id === -1) - && ((inObj.isEarlier === true /*&& inObj.isLater === true*/))) { - const position = (inObj.isEarlier ? "earlier" : "later"); - outMsg[pos] = inObj.warningMessages[2] - + ("ambiguous rule: " - + position + - ": [" - + inObj.modifier + " " - + inObj.key + "] > \'" - + inObj.output - + "\' "); - } + if (inObj.compare_type === 'amb_1_1' || inObj.compare_type === 'dup_1_1') { + + outMsg[pos] = inObj.warningMessages[2] + + ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + "rule: " + + (inObj.earlier_later[0] ? "earlier" : "later") + + ": [" + inObj.modifier + " " + inObj.key + "] > \'" + + inObj.output + "\' "; } + + + if (inObj.compare_type === 'amb_2_2' || inObj.compare_type === 'dup_2_2' + || inObj.compare_type === 'amb_2_1' + || inObj.compare_type === 'amb_2_4') { + + const textsegment = ( + ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + "rule: " + + (inObj.earlier_later[0] ? "earlier" : "later") + + ": [" + inObj.Dk_modifier + " " + inObj.Dk_key + "] > dk(" + + inObj.dk_bothPrefix_prevdk_dk[1] + inObj.dk_bothId_prevdk_dk[1] + ") "); + + if (outMsg[pos].indexOf(textsegment) === -1) + outMsg[pos] += textsegment; + } + + + if (inObj.compare_type === 'amb_4_4' || inObj.compare_type === 'dup_4_4' + || inObj.compare_type === 'amb_4_1' + || inObj.compare_type === 'amb_4_2') { + + const textsegment = ( + ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + "rule: " + + (inObj.earlier_later[0] ? "earlier" : "later") + ": [" + + inObj.prevDk_modifier + " " + inObj.prevDk_key + "] > dk(" + + inObj.dk_bothPrefix_prevdk_dk[0] + inObj.dk_bothId_prevdk_dk[0] + ") "); + + if (outMsg[pos].indexOf(textsegment) === -1) + outMsg[pos] += textsegment; + } + + + if (inObj.compare_type === 'amb_5_5' || inObj.compare_type === 'dup_5_5') { + + const textsegment = ( + ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + 'rule: ' + + (inObj.earlier_later[0] ? "earlier" : "later") + + ': dk(' + inObj.dk_bothPrefix_prevdk_dk[1] + inObj.dk_bothId_prevdk_dk[1] + ") + [" + + inObj.Dk_modifier + " " + inObj.Dk_key + "] > " + + 'dk(' + inObj.dk_bothPrefix_prevdk_dk[0] + inObj.dk_bothId_prevdk_dk[0] + ") "); + + if (outMsg[pos].indexOf(textsegment) === -1) + outMsg[pos] += textsegment; + } + + + if (inObj.compare_type === 'amb_6_3' || inObj.compare_type === 'dup_6_3' + || inObj.compare_type === 'amb_3_3' || inObj.compare_type === 'dup_3_3' + || inObj.compare_type === 'amb_6_6' || inObj.compare_type === 'dup_6_6') { + + const textsegment = ( + ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + 'rule: ' + + (inObj.earlier_later[0] ? "earlier" : "later") + + ': dk(' + inObj.dk_bothPrefix_prevdk_dk[1] + inObj.dk_bothId_prevdk_dk[1] + ") + [" + + inObj.modifier + " " + inObj.key + "] > \'" + inObj.output + "\' "); + + if (outMsg[pos].indexOf(textsegment) === -1) + outMsg[pos] += textsegment; + } + return outMsg; } @@ -598,63 +564,23 @@ export class KmnFileWriter { */ public reviewRules(rule: Rule[], index: number): string[] { - const resultWarnings: RuleReview = { - - warningMessage_0: '', - warningMessages_1: '', - warningMessages_2: '', - hasWarning_0: false, - hasWarning_1: false, - hasWarning_2: false, - - type: 'RuleReview', - isused: false, - isEarlier: false, - isLater: false, - context: '', - prevDk_id: -1, - prevDk_modifier: '', - dk_prefix: "A", - prev_dk_prefix: "C", - prevDk_key: '', - textpart: '', - dk_id: -1, - Dk_modifier: '', - Dk_key: '', - modifier: '', - key: '', - output: '', - warningMessages: ['', '', ''], - - extraWarning: 'PLEASE CHECK THE FOLLOWING RULE AS IT WILL NOT BE WRITTEN !', - }; - const unavailableModiWarnings = { type: 'UnavailableModifier', - isUnavailable: true, warningMessages: ['', '', ''], } as UnavailableModifier; const unavailableSuperiWarnings = { - type: 'UnavailableSuperior', - isUnavailable: true, + type: 'UnavailableSuperiorRule', warningMessages: ['', '', ''], - } as UnavailableSuperior; + } as UnavailableSuperiorRule; const duplicateWarnings = { type: 'DuplicateRule', - isLater: false, - isEarlier: false, - hasExtraWarning: false, warningMessages: ['', '', ''], } as DuplicateRules; - const ambiguousWarnings = { type: 'AmbiguousRule', - isEarlier: false, - isLater: false, - hasExtraWarning: false, warningMessages: ['', '', ''], } as AmbiguousRules; @@ -665,134 +591,56 @@ export class KmnFileWriter { if ((rule[index].ruleType === "C0") || (rule[index].ruleType === "C1")) { if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierKey)) { - warningText[2] = "unavailable modifier "; - - unavailableModiWarnings.isused = true; - unavailableModiWarnings.modifier = rule[index].modifierKey; - unavailableModiWarnings.key = rule[index].key; - unavailableModiWarnings.output = new TextDecoder().decode(rule[index].output); - unavailableModiWarnings.warningMessages[2] = "unavailable modifier "; + unavailableModiWarnings.compare_type = 'unav_C0_C1'; + unavailableModiWarnings.warningMessages = this.createWarningText(unavailableModiWarnings, 2); } } - else if (rule[index].ruleType === "C2") { - if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierDeadkey)) { - warningText[1] = "unavailable modifier "; - warningText[2] = "unavailable superior rule ( [" - + rule[index].modifierDeadkey + " " - + rule[index].deadkey - + "] > dk(A" - + rule[index].idDeadkey - + ") ) : "; - unavailableModiWarnings.isused = true; - unavailableSuperiWarnings.isused = true; - unavailableModiWarnings.textpart = '] > dk(A'; - unavailableModiWarnings.Dk_modifier = rule[index].modifierDeadkey; - unavailableModiWarnings.Dk_key = rule[index].deadkey; - unavailableModiWarnings.modifier = rule[index].modifierKey; - unavailableModiWarnings.key = rule[index].key; - unavailableModiWarnings.output = new TextDecoder().decode(rule[index].output); - - unavailableModiWarnings.warningMessages[1] = "unavailable modifier "; - unavailableSuperiWarnings.warningMessages[2] = "unavailable superior rule ( [" - + rule[index].modifierDeadkey + " " - + rule[index].deadkey - + "] > dk(A" - + rule[index].idDeadkey - + ") ) : "; + else if (rule[index].ruleType === "C2") { + if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierDeadkey)) { + unavailableSuperiWarnings.compare_type = 'unav_C2'; + unavailableSuperiWarnings.dk_bothPrefix_prevdk_dk = ['C', 'A']; + unavailableSuperiWarnings.dk_bothId_prevdk_dk = [rule[0].idPrevDeadkey, rule[0].idDeadkey]; + unavailableSuperiWarnings.Dk_modifier = rule[index].modifierDeadkey; + unavailableSuperiWarnings.Dk_key = rule[index].deadkey; + unavailableSuperiWarnings.warningMessages = this.createWarningText(unavailableSuperiWarnings, 2); } if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierKey)) { - warningText[2] = "unavailable modifier "; - unavailableModiWarnings.isused = true; - unavailableModiWarnings.prevDk_key = rule[index].prevDeadkey; - unavailableModiWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; - unavailableModiWarnings.Dk_modifier = rule[index].modifierDeadkey; - unavailableModiWarnings.Dk_key = rule[index].deadkey; + unavailableModiWarnings.compare_type = 'unav_C2'; unavailableModiWarnings.modifier = rule[index].modifierKey; unavailableModiWarnings.key = rule[index].key; - unavailableModiWarnings.output = new TextDecoder().decode(rule[index].output); - unavailableModiWarnings.warningMessages[2] = "unavailable modifier "; + unavailableModiWarnings.warningMessages = this.createWarningText(unavailableModiWarnings, 2); } } - else if (rule[index].ruleType === "C3") { + else if (rule[index].ruleType === "C3") { if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierPrevDeadkey)) { - warningText[0] = "unavailable modifier "; - warningText[1] = "unavailable superior rule ( [" - + rule[index].modifierPrevDeadkey + " " - + rule[index].prevDeadkey - + "] > dk(A" - + rule[index].idPrevDeadkey - + ") ) : "; - warningText[2] = "unavailable superior rules ( [" - + rule[index].modifierPrevDeadkey + " " - + rule[index].prevDeadkey - + "] > dk(A" - + rule[index].idPrevDeadkey - + ") ) "; - - - unavailableSuperiWarnings.warningMessages[0] = "unavailable modifier "; - unavailableSuperiWarnings.warningMessages[1] = "unavailable superior rule ( [" - + rule[index].modifierPrevDeadkey + " " - + rule[index].prevDeadkey - + "] > dk(A" - + rule[index].idPrevDeadkey - + ") ) : "; - unavailableSuperiWarnings.warningMessages[2] = "unavailable superior rules ( [" - + rule[index].modifierPrevDeadkey + " " - + rule[index].prevDeadkey - + "] > dk(A" - + rule[index].idPrevDeadkey - + ") ) "; + unavailableSuperiWarnings.compare_type = 'unav_C3'; + unavailableSuperiWarnings.dk_bothPrefix_prevdk_dk = ['C', 'A']; + unavailableSuperiWarnings.dk_bothId_prevdk_dk = [rule[0].idPrevDeadkey, rule[0].idDeadkey]; + unavailableSuperiWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; + unavailableSuperiWarnings.prevDk_key = rule[index].prevDeadkey; + unavailableSuperiWarnings.warningMessages = this.createWarningText(unavailableSuperiWarnings, 2); } if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierDeadkey)) { - warningText[1] = "unavailable modifier "; - warningText[2] = "unavailable superior rule ( [" - + rule[index].modifierDeadkey + " " - + rule[index].deadkey - + "] > dk(B" - + rule[index].idDeadkey - + ") ) : "; - - unavailableModiWarnings.isused = true; - unavailableSuperiWarnings.isused = true; - unavailableModiWarnings.prevDk_key = rule[index].prevDeadkey; - unavailableModiWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; - - unavailableSuperiWarnings.textpart = '] > dk(B'; + unavailableSuperiWarnings.compare_type = 'unav_C3'; + unavailableSuperiWarnings.prevDk_modifier = ''; + unavailableSuperiWarnings.dk_bothPrefix_prevdk_dk = ['', 'B']; + unavailableSuperiWarnings.dk_bothId_prevdk_dk = [rule[0].idPrevDeadkey, rule[0].idDeadkey]; unavailableSuperiWarnings.Dk_modifier = rule[index].modifierDeadkey; unavailableSuperiWarnings.Dk_key = rule[index].deadkey; - unavailableSuperiWarnings.modifier = rule[index].modifierKey; - unavailableSuperiWarnings.key = rule[index].key; - unavailableSuperiWarnings.output = new TextDecoder().decode(rule[index].output); - unavailableSuperiWarnings.warningMessages[1] = unavailableSuperiWarnings.warningMessages[1] - + "unavailable modifier "; - unavailableSuperiWarnings.warningMessages[2] = "unavailable superior rule ( [" - + rule[index].modifierDeadkey + " " - + rule[index].deadkey - + "] > dk(B" - + rule[index].idDeadkey - + ") ) : "; + unavailableSuperiWarnings.warningMessages = this.createWarningText(unavailableSuperiWarnings, 2); } if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierKey)) { - warningText[2] += "unavailable modifier "; - - unavailableModiWarnings.isused = true; - unavailableModiWarnings.prevDk_key = rule[index].prevDeadkey; - unavailableModiWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; - unavailableModiWarnings.Dk_modifier = rule[index].modifierDeadkey; - unavailableModiWarnings.Dk_key = rule[index].deadkey; + unavailableModiWarnings.compare_type = 'unav_C3'; unavailableModiWarnings.modifier = rule[index].modifierKey; unavailableModiWarnings.key = rule[index].key; - unavailableModiWarnings.output = new TextDecoder().decode(rule[index].output); - unavailableModiWarnings.warningMessages[2] += "unavailable modifier "; - + unavailableModiWarnings.warningMessages = this.createWarningText(unavailableModiWarnings, 2); } } @@ -840,84 +688,45 @@ export class KmnFileWriter { ); if (amb_4_1.length > 0) { - ambiguousWarnings.prevDk_id = amb_4_1[0].idPrevDeadkey; - ambiguousWarnings.prevDk_key = amb_4_1[0].prevDeadkey; + ambiguousWarnings.compare_type = 'amb_4_1'; + ambiguousWarnings.earlier_later = [false, true]; + ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['C', 'A']; + ambiguousWarnings.dk_bothId_prevdk_dk = [amb_4_1[0].idPrevDeadkey, amb_4_1[0].idDeadkey]; ambiguousWarnings.prevDk_modifier = amb_4_1[0].modifierPrevDeadkey; - - ambiguousWarnings.isEarlier = false; - ambiguousWarnings.isLater = true; - ambiguousWarnings.modifier = amb_4_1[0].modifierKey; - ambiguousWarnings.key = amb_4_1[0].key; - ambiguousWarnings.prev_dk_prefix = 'C'; - ambiguousWarnings.dk_prefix = 'A'; - const tester_amb_4_1 = this.createWarningText(ambiguousWarnings); - ambiguousWarnings.warningMessages = tester_amb_4_1; + ambiguousWarnings.prevDk_key = amb_4_1[0].prevDeadkey; + ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 2); } if (amb_2_1.length > 0) { - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - ambiguousWarnings.textpart = '] > dk(A'; - - ambiguousWarnings.prevDk_id = amb_2_1[0].idPrevDeadkey; - ambiguousWarnings.prevDk_modifier = amb_2_1[0].modifierPrevDeadkey; - ambiguousWarnings.prevDk_key = amb_2_1[0].prevDeadkey; - - ambiguousWarnings.dk_id = amb_2_1[0].idDeadkey; + ambiguousWarnings.compare_type = 'amb_2_1'; + ambiguousWarnings.earlier_later = [false, true]; + ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['C', 'A']; + ambiguousWarnings.dk_bothId_prevdk_dk = [amb_2_1[0].idPrevDeadkey, amb_2_1[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_2_1[0].modifierDeadkey; ambiguousWarnings.Dk_key = amb_2_1[0].deadkey; - - ambiguousWarnings.modifier = amb_2_1[0].modifierKey; - ambiguousWarnings.key = amb_2_1[0].key; - ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_2_1[0].output)).character; - - ambiguousWarnings.prev_dk_prefix = 'C'; - ambiguousWarnings.dk_prefix = 'A'; - ambiguousWarnings.isEarlier = false; - ambiguousWarnings.isLater = true; - const tester_amb_2_1 = this.createWarningText(ambiguousWarnings); - ambiguousWarnings.warningMessages = tester_amb_2_1; + ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 2); } if (amb_1_1.length > 0) { - ambiguousWarnings.prevDk_id = amb_1_1[0].idPrevDeadkey; - ambiguousWarnings.prevDk_modifier = amb_1_1[0].modifierPrevDeadkey; - ambiguousWarnings.prevDk_key = amb_1_1[0].prevDeadkey; - - ambiguousWarnings.dk_id = -1;// needed!!! - ambiguousWarnings.prevDk_id = -1;// needed!!! - ambiguousWarnings.Dk_modifier = amb_1_1[0].modifierDeadkey; - ambiguousWarnings.Dk_key = amb_1_1[0].deadkey; - - ambiguousWarnings.prev_dk_prefix = 'C'; - ambiguousWarnings.dk_prefix = 'A'; + ambiguousWarnings.compare_type = 'amb_1_1'; + ambiguousWarnings.earlier_later = [true, false]; ambiguousWarnings.modifier = amb_1_1[0].modifierKey; ambiguousWarnings.key = amb_1_1[0].key; ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_1_1[0].output)).character; - ambiguousWarnings.isEarlier = true; ambiguousWarnings.isLater = false; - const tester_amb_1_1 = this.createWarningText(ambiguousWarnings, 2); - ambiguousWarnings.warningMessages = tester_amb_1_1; + ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 2); } if (dup_1_1.length > 0) { - resultWarnings.type = 'RuleReview'; - duplicateWarnings.isused = true; - duplicateWarnings.textpart = '] > \''; + duplicateWarnings.compare_type = 'dup_1_1'; + duplicateWarnings.earlier_later = [true, false]; duplicateWarnings.modifier = dup_1_1[0].modifierKey; duplicateWarnings.key = dup_1_1[0].key; duplicateWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(dup_1_1[0].output)).character; - duplicateWarnings.isEarlier = true; - duplicateWarnings.warningMessages[2] = duplicateWarnings.warningMessages[2] - + ("duplicate rule: earlier: [" - + dup_1_1[0].modifierKey - + " " - + dup_1_1[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_1_1[0].output)).character - + "\' "); + duplicateWarnings.warningMessages = this.createWarningText(duplicateWarnings, 2); } } + if (rule[index].ruleType === "C2") { // 2-2: + [CAPS K_N] > dk(C11) <-> + [CAPS K_N] > dk(C3) @@ -968,104 +777,59 @@ export class KmnFileWriter { ); if (amb_2_2.length > 0) { - ambiguousWarnings.isEarlier = true; - ambiguousWarnings.isLater = false; - ambiguousWarnings.prev_dk_prefix = 'A'; - ambiguousWarnings.dk_prefix = 'C'; - ambiguousWarnings.dk_id = amb_2_2[0].idDeadkey; + ambiguousWarnings.compare_type = 'amb_2_2'; + ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['', 'C']; + ambiguousWarnings.dk_bothId_prevdk_dk = [amb_2_2[0].idPrevDeadkey, amb_2_2[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_2_2[0].modifierDeadkey; ambiguousWarnings.Dk_key = amb_2_2[0].deadkey; - ambiguousWarnings.modifier = amb_2_2[0].modifierKey; - ambiguousWarnings.key = amb_2_2[0].key; - const tester_amb_2_2 = this.createWarningText(ambiguousWarnings, 1); - ambiguousWarnings.warningMessages = tester_amb_2_2; + ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 1); } if (dup_2_2.length > 0) { - warningText[1] = warningText[1] - + ("duplicate rule: earlier: [" - + dup_2_2[0].modifierDeadkey - + " " - + dup_2_2[0].deadkey - + "] > dk(C" - + dup_2_2[0].idDeadkey - + ") "); - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - duplicateWarnings.textpart = '] > dk(C'; - duplicateWarnings.dk_id = dup_2_2[0].idDeadkey; + duplicateWarnings.compare_type = 'dup_2_2'; + duplicateWarnings.earlier_later = [true, false]; + duplicateWarnings.dk_bothPrefix_prevdk_dk = ['', 'C']; + duplicateWarnings.dk_bothId_prevdk_dk = [dup_2_2[0].idPrevDeadkey, dup_2_2[0].idDeadkey]; duplicateWarnings.Dk_modifier = dup_2_2[0].modifierDeadkey; duplicateWarnings.Dk_key = dup_2_2[0].deadkey; - duplicateWarnings.isEarlier = true; - duplicateWarnings.warningMessages[1] = duplicateWarnings.warningMessages[1] - + ("duplicate rule: earlier: [" - + dup_2_2[0].modifierDeadkey - + " " - + dup_2_2[0].deadkey - + "] > dk(C" - + dup_2_2[0].idDeadkey - + ") "); + duplicateWarnings.warningMessages = this.createWarningText(duplicateWarnings, 1); } if (amb_3_3.length > 0) { - ambiguousWarnings.dk_prefix = 'A'; - ambiguousWarnings.dk_id = amb_3_3[0].idDeadkey; + ambiguousWarnings.compare_type = 'amb_3_3'; + ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['', 'A']; + ambiguousWarnings.dk_bothId_prevdk_dk = [amb_3_3[0].idPrevDeadkey, amb_3_3[0].idDeadkey]; ambiguousWarnings.modifier = amb_3_3[0].modifierKey; ambiguousWarnings.key = amb_3_3[0].key; - ambiguousWarnings.isEarlier = true; ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_3_3[0].output)).character; - const tester_amb_3_3 = this.createWarningText(ambiguousWarnings, 2); - ambiguousWarnings.warningMessages = tester_amb_3_3; + ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 2); } if (dup_3_3.length > 0) { - warningText[2] = warningText[2] - + ("duplicate rule: earlier: dk(A" - + dup_3_3[0].idDeadkey - + ") + [" - + dup_3_3[0].modifierKey - + " " - + dup_3_3[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_3_3[0].output)).character - + "\' "); - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - duplicateWarnings.textpart = '] > \''; - duplicateWarnings.dk_id = dup_3_3[0].idDeadkey; + duplicateWarnings.compare_type = 'dup_3_3'; + duplicateWarnings.earlier_later = [true, false]; + duplicateWarnings.dk_bothId_prevdk_dk = [dup_3_3[0].idPrevDeadkey, dup_3_3[0].idDeadkey]; + duplicateWarnings.dk_bothPrefix_prevdk_dk = ['', 'A']; duplicateWarnings.modifier = dup_3_3[0].modifierKey; duplicateWarnings.key = dup_3_3[0].key; duplicateWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(dup_3_3[0].output)).character; - duplicateWarnings.isEarlier = true; - duplicateWarnings.warningMessages[2] = duplicateWarnings.warningMessages[2] + ("duplicate rule: earlier: dk(A" - + dup_3_3[0].idDeadkey - + ") + [" - + dup_3_3[0].modifierKey - + " " - + dup_3_3[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_3_3[0].output)).character - + "\' "); - + duplicateWarnings.warningMessages = this.createWarningText(duplicateWarnings, 2); } if (amb_4_2.length > 0) { - - ambiguousWarnings.prevDk_id = amb_4_2[0].idPrevDeadkey; - ambiguousWarnings.prevDk_key = amb_4_2[0].prevDeadkey; + ambiguousWarnings.compare_type = 'amb_4_2'; + ambiguousWarnings.earlier_later = [false, true]; + ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['C', '']; + ambiguousWarnings.dk_bothId_prevdk_dk = [amb_4_2[0].idPrevDeadkey, amb_4_2[0].idDeadkey]; ambiguousWarnings.prevDk_modifier = amb_4_2[0].modifierPrevDeadkey; - ambiguousWarnings.prev_dk_prefix = 'C'; - ambiguousWarnings.dk_prefix = 'A'; - ambiguousWarnings.modifier = amb_4_2[0].modifierKey; - ambiguousWarnings.key = amb_4_2[0].key; - ambiguousWarnings.isLater = true; - const tester_amb_4_2 = this.createWarningText(ambiguousWarnings, 0); - ambiguousWarnings.warningMessages = tester_amb_4_2; + ambiguousWarnings.prevDk_key = amb_4_2[0].prevDeadkey; + ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 0); } } + if (rule[index].ruleType === "C3") { // 2-4 + [CAPS K_N] > dk(C11) <-> + [CAPS K_N] > dk(B11) @@ -1148,213 +912,106 @@ export class KmnFileWriter { ); // 6-6 dk(C11) + [SHIFT CAPS K_A] > 'Ã' <-> dk(C11) + [SHIFT CAPS K_A] > 'Ã' - const dup_6_6 = - rule.filter((curr, idx) => - (curr.ruleType === "C3") - && curr.idDeadkey === rule[index].idDeadkey - && curr.modifierKey === rule[index].modifierKey - && curr.key === rule[index].key - && (new TextDecoder().decode(curr.output) === new TextDecoder().decode(rule[index].output)) - && idx < index - ); + const dup_6_6 = rule.filter((curr, idx) => + (curr.ruleType === "C3") + && curr.idDeadkey === rule[index].idDeadkey + && curr.modifierKey === rule[index].modifierKey + && curr.key === rule[index].key + && (new TextDecoder().decode(curr.output) === new TextDecoder().decode(rule[index].output)) + && idx < index + ); if (amb_2_4.length > 0) { - - ambiguousWarnings.prev_dk_prefix = 'C'; - ambiguousWarnings.dk_prefix = 'A'; - ambiguousWarnings.dk_id = amb_2_4[0].idDeadkey; + ambiguousWarnings.compare_type = 'amb_2_4'; + ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['', 'A']; + ambiguousWarnings.dk_bothId_prevdk_dk = [amb_2_4[0].idPrevDeadkey, amb_2_4[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_2_4[0].modifierDeadkey; ambiguousWarnings.Dk_key = amb_2_4[0].deadkey; - ambiguousWarnings.modifier = amb_2_4[0].modifierKey; - ambiguousWarnings.key = amb_2_4[0].key; - ambiguousWarnings.isEarlier = true; - const tester_amb_2_4 = this.createWarningText(ambiguousWarnings, 0); - ambiguousWarnings.warningMessages = tester_amb_2_4; + ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 0); } if (amb_6_3.length > 0) { - ambiguousWarnings.dk_prefix = 'C'; - ambiguousWarnings.dk_id = amb_6_3[0].idDeadkey; + ambiguousWarnings.compare_type = 'amb_6_3'; + ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['', 'C']; + ambiguousWarnings.dk_bothId_prevdk_dk = [amb_6_3[0].idPrevDeadkey, amb_6_3[0].idDeadkey]; ambiguousWarnings.modifier = amb_6_3[0].modifierKey; ambiguousWarnings.key = amb_6_3[0].key; - ambiguousWarnings.isEarlier = true; ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_6_3[0].output)).character; - const tester_amb_6_3 = this.createWarningText(ambiguousWarnings, 1); - ambiguousWarnings.warningMessages = tester_amb_6_3; + ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 1); } if (dup_6_3.length > 0) { - warningText[1] = warningText[1] - + ("duplicate rule: earlier: dk(C" - + dup_6_3[0].idDeadkey - + ") + [" - + dup_6_3[0].modifierKey - + " " - + dup_6_3[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_6_3[0].output)).character - + "\' "); - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - ambiguousWarnings.textpart = ''; - ambiguousWarnings.dk_id = dup_6_3[0].idDeadkey; + duplicateWarnings.compare_type = 'dup_6_3'; + duplicateWarnings.earlier_later = [true, false]; + duplicateWarnings.dk_bothPrefix_prevdk_dk = ['', 'C']; + duplicateWarnings.dk_bothId_prevdk_dk = [dup_6_3[0].idPrevDeadkey, dup_6_3[0].idDeadkey]; duplicateWarnings.modifier = dup_6_3[0].modifierKey; duplicateWarnings.key = dup_6_3[0].key; duplicateWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(dup_6_3[0].output)).character; - duplicateWarnings.isEarlier = true; - duplicateWarnings.warningMessages[1] = duplicateWarnings.warningMessages[1] - + ("duplicate rule: earlier: dk(C" - + dup_6_3[0].idDeadkey - + ") + [" - + dup_6_3[0].modifierKey - + " " - + dup_6_3[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_6_3[0].output)).character - + "\' "); + duplicateWarnings.warningMessages = this.createWarningText(duplicateWarnings, 1); } if (amb_4_4.length > 0) { - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - ambiguousWarnings.textpart = '] > dk(C'; - ambiguousWarnings.prevDk_id = amb_4_4[0].idPrevDeadkey; - resultWarnings.prevDk_key = amb_4_4[0].prevDeadkey; - resultWarnings.prevDk_modifier = amb_4_4[0].modifierPrevDeadkey; - ambiguousWarnings.isEarlier = true; - ambiguousWarnings.prev_dk_prefix = 'C'; - ambiguousWarnings.dk_prefix = 'C'; - ambiguousWarnings.dk_id = amb_4_4[0].idDeadkey; - ambiguousWarnings.Dk_modifier = amb_4_4[0].modifierDeadkey; - ambiguousWarnings.Dk_key = amb_4_4[0].deadkey; - const tester_amb_4_4 = this.createWarningText(ambiguousWarnings, 0); - ambiguousWarnings.warningMessages = tester_amb_4_4; - + ambiguousWarnings.compare_type = 'amb_4_4'; + ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['C', '']; + ambiguousWarnings.dk_bothId_prevdk_dk = [amb_4_4[0].idPrevDeadkey, amb_4_4[0].idDeadkey]; + ambiguousWarnings.prevDk_modifier = amb_4_4[0].modifierPrevDeadkey; + ambiguousWarnings.prevDk_key = amb_4_4[0].prevDeadkey; + ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 0); } if (dup_4_4.length > 0) { - warningText[0] = warningText[0] - + ("duplicate rule: earlier: [" - + dup_4_4[0].modifierPrevDeadkey - + " " - + dup_4_4[0].prevDeadkey - + "] > dk(C" - + dup_4_4[0].idPrevDeadkey - + ") "); - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDk_key = rule[index].prevDeadkey; - resultWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.Dk_modifier = rule[index].modifierDeadkey; - resultWarnings.Dk_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - duplicateWarnings.isEarlier = true; - duplicateWarnings.warningMessages[0] = duplicateWarnings.warningMessages[0] + ("duplicate rule: earlier: [" - + dup_4_4[0].modifierPrevDeadkey - + " " - + dup_4_4[0].prevDeadkey - + "] > dk(C" - + dup_4_4[0].idPrevDeadkey - + ") "); + duplicateWarnings.compare_type = 'dup_4_4'; + duplicateWarnings.earlier_later = [true, false]; + duplicateWarnings.dk_bothPrefix_prevdk_dk = ['C', '']; + duplicateWarnings.dk_bothId_prevdk_dk = [dup_4_4[0].idPrevDeadkey, dup_4_4[0].idDeadkey]; + duplicateWarnings.prevDk_modifier = dup_4_4[0].modifierPrevDeadkey; + duplicateWarnings.prevDk_key = dup_4_4[0].prevDeadkey; + duplicateWarnings.warningMessages = this.createWarningText(duplicateWarnings, 0); } if (amb_5_5.length > 0) { - ambiguousWarnings.warningMessages[2] = ''; - ambiguousWarnings.prevDk_id = amb_5_5[0].idPrevDeadkey; - ambiguousWarnings.prev_dk_prefix = 'B'; - ambiguousWarnings.dk_prefix = 'B'; - ambiguousWarnings.dk_id = amb_5_5[0].idDeadkey; + ambiguousWarnings.compare_type = 'amb_5_5'; + ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['B', 'B']; + ambiguousWarnings.dk_bothId_prevdk_dk = [amb_5_5[0].idPrevDeadkey, amb_5_5[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_5_5[0].modifierDeadkey; ambiguousWarnings.Dk_key = amb_5_5[0].deadkey; - ambiguousWarnings.isEarlier = true; - const tester_amb_5_5 = this.createWarningText(ambiguousWarnings, 1); - ambiguousWarnings.warningMessages = tester_amb_5_5; + ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 1); } if (dup_5_5.length > 0) { - warningText[1] = warningText[1] - + ("duplicate rule: earlier: dk(B" - + dup_5_5[0].idPrevDeadkey - + ") + [" - + dup_5_5[0].modifierDeadkey - + " " - + dup_5_5[0].deadkey - + "] > dk(B" - + dup_5_5[0].idDeadkey - + ") "); - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDk_key = rule[index].prevDeadkey; - resultWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.Dk_modifier = rule[index].modifierDeadkey; - resultWarnings.Dk_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - duplicateWarnings.isEarlier = true; - duplicateWarnings.warningMessages[1] = duplicateWarnings.warningMessages[1] + ("duplicate rule: earlier: dk(B" - + dup_5_5[0].idPrevDeadkey - + ") + [" - + dup_5_5[0].modifierDeadkey - + " " - + dup_5_5[0].deadkey - + "] > dk(B" - + dup_5_5[0].idDeadkey - + ") "); - + duplicateWarnings.compare_type = 'dup_5_5'; + duplicateWarnings.earlier_later = [true, false]; + duplicateWarnings.dk_bothPrefix_prevdk_dk = ['B', 'B']; + duplicateWarnings.Dk_modifier = rule[index].modifierDeadkey; + duplicateWarnings.Dk_key = rule[index].deadkey; + duplicateWarnings.warningMessages = this.createWarningText(duplicateWarnings, 1); } if (amb_6_6.length > 0) { - ambiguousWarnings.isused = true; - ambiguousWarnings.dk_id = amb_6_6[0].idDeadkey;// needed!!! - ambiguousWarnings.Dk_modifier = amb_6_6[0].modifierDeadkey; - ambiguousWarnings.Dk_key = amb_6_6[0].deadkey; + ambiguousWarnings.compare_type = 'amb_6_6'; + ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['', 'B']; + ambiguousWarnings.dk_bothId_prevdk_dk = [amb_6_6[0].idPrevDeadkey, amb_6_6[0].idDeadkey]; ambiguousWarnings.modifier = amb_6_6[0].modifierKey; ambiguousWarnings.key = amb_6_6[0].key; ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_6_6[0].output)).character; - ambiguousWarnings.isEarlier = true; - ambiguousWarnings.dk_prefix = 'B'; - const tester_amb_6_6 = this.createWarningText(ambiguousWarnings); - ambiguousWarnings.warningMessages = tester_amb_6_6; + ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 2); } if (dup_6_6.length > 0) { - warningText[2] = warningText[2] - + ("duplicate rule: earlier: dk(B" - + dup_6_6[0].idDeadkey - + ") + [" - + dup_6_6[0].modifierKey - + " " - + dup_6_6[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_6_6[0].output)).character - + "\' "); - - resultWarnings.type = 'RuleReview'; - resultWarnings.isused = true; - resultWarnings.prevDk_key = rule[index].prevDeadkey; - resultWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; - resultWarnings.Dk_modifier = rule[index].modifierDeadkey; - resultWarnings.Dk_key = rule[index].deadkey; - resultWarnings.modifier = rule[index].modifierKey; - resultWarnings.key = rule[index].key; - resultWarnings.output = new TextDecoder().decode(rule[index].output); - duplicateWarnings.isEarlier = true; - duplicateWarnings.warningMessages[2] = duplicateWarnings.warningMessages[2] + ("duplicate rule: earlier: dk(B" - + dup_6_6[0].idDeadkey - + ") + [" - + dup_6_6[0].modifierKey - + " " - + dup_6_6[0].key - + "] > \'" - + this.writeCharacterOrUnicode(new TextDecoder().decode(dup_6_6[0].output)).character - + "\' "); + duplicateWarnings.compare_type = 'dup_6_6'; + duplicateWarnings.earlier_later = [true, false]; + duplicateWarnings.dk_bothPrefix_prevdk_dk = ['', 'B']; + duplicateWarnings.dk_bothId_prevdk_dk = [dup_6_6[0].idPrevDeadkey, dup_6_6[0].idDeadkey]; + duplicateWarnings.modifier = dup_6_6[0].modifierKey; + duplicateWarnings.key = dup_6_6[0].key; + duplicateWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(dup_6_6[0].output)).character; + duplicateWarnings.warningMessages = this.createWarningText(duplicateWarnings, 2); } } @@ -1367,59 +1024,24 @@ export class KmnFileWriter { const extraWarning = "PLEASE CHECK THAT RULE AS IT WILL NOT BE WRITTEN !"; - - /* - if ((warningText[0].indexOf("earlier:") > 0) && (warningText[0].indexOf("later:") > 0)) { - warningText[0] = warningText[0] + extraWarning; - } - */ - if (ambiguousWarnings.warningMessages[0]) { - if ((ambiguousWarnings.warningMessages[0].indexOf("earlier:") > 0) && (ambiguousWarnings.warningMessages[0].indexOf("later:") > 0)) { - ambiguousWarnings.warningMessages[0] = ambiguousWarnings.warningMessages[0] + extraWarning; - } - } - - /* - if ((warningText[1].indexOf("earlier:") > 0) && (warningText[1].indexOf("later:") > 0)) { - warningText[1] = warningText[1] + extraWarning; - } - */ - if (ambiguousWarnings.warningMessages[1] !== "") { - if ((ambiguousWarnings.warningMessages[1].indexOf("earlier:") > 0) && (ambiguousWarnings.warningMessages[1].indexOf("later:") > 0)) { - ambiguousWarnings.warningMessages[1] = ambiguousWarnings.warningMessages[1] + extraWarning; - } - } - - /* if ((warningText[2].indexOf("earlier:") > 0) && (warningText[2].indexOf("later:") > 0)) { - warningText[2] = warningText[2] + extraWarning; - } - */ - if (ambiguousWarnings.warningMessages[2] !== "") { - if ((ambiguousWarnings.warningMessages[2].indexOf("earlier:") > 0) && (ambiguousWarnings.warningMessages[2].indexOf("later:") > 0)) { - ambiguousWarnings.warningMessages[2] = ambiguousWarnings.warningMessages[2] + extraWarning; + for (let i = 0; i < 3; i++) { + if (ambiguousWarnings.warningMessages[i] !== "") { + if ((ambiguousWarnings.warningMessages[i].indexOf("earlier:") > -1) && (ambiguousWarnings.warningMessages[i].indexOf("later:") > -1)) { + ambiguousWarnings.warningMessages[i] = ambiguousWarnings.warningMessages[i] + extraWarning; + } } } - const completeWarning0 = unavailableSuperiWarnings.warningMessages[0] - + duplicateWarnings.warningMessages[0] - + ambiguousWarnings.warningMessages[0] - + unavailableModiWarnings.warningMessages[0]; - - const completeWarning1 = unavailableSuperiWarnings.warningMessages[1] - + duplicateWarnings.warningMessages[1] - + ambiguousWarnings.warningMessages[1] - + unavailableModiWarnings.warningMessages[1]; - - const completeWarning2 = unavailableSuperiWarnings.warningMessages[2] - + duplicateWarnings.warningMessages[2] - + ambiguousWarnings.warningMessages[2] - + unavailableModiWarnings.warningMessages[2]; - - completeWarning0 ? (warningText[0] = "c WARNING: " + completeWarning0 + " here: ") : warningText[0] = ''; - completeWarning1 ? (warningText[1] = "c WARNING: " + completeWarning1 + " here: ") : warningText[1] = ''; - completeWarning2 ? (warningText[2] = "c WARNING: " + completeWarning2 + " here: ") : warningText[2] = ''; + for (let i = 0; i < 3; i++) { + const completeWarning = + unavailableSuperiWarnings.warningMessages[i] + + duplicateWarnings.warningMessages[i] + + ambiguousWarnings.warningMessages[i] + + unavailableModiWarnings.warningMessages[i]; + completeWarning ? (warningText[i] = "c WARNING: " + completeWarning + " here: ") : warningText[i] = ''; + } return warningText; } diff --git a/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts b/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts index 628142d10c2..54b2c3d3ae1 100644 --- a/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts +++ b/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts @@ -20,28 +20,6 @@ describe('KeylayoutToKmnConverter', function () { before(function () { compilerTestCallbacks.clear(); }); -describe('RunFILES', function () { - this.timeout(10000); // allow longer time for these tests - const sut = new KeylayoutToKmnConverter(compilerTestCallbacks, compilerTestOptions); - [ - [makePathToFixture('../data/Polish.keylayout')], - [makePathToFixture('../data/Spanish.keylayout')], - [makePathToFixture('../data/French.keylayout')], - // [makePathToFixture('../data/German_complete_reduced.keylayout')], - // [makePathToFixture('../data/German_standard.keylayout')], - [makePathToFixture('../data/Italian_command.keylayout')], - [makePathToFixture('../data/Italian.keylayout')], - [makePathToFixture('../data/Latin_American.keylayout')], - [makePathToFixture('../data/Swiss_French.keylayout')], - [makePathToFixture('../data/Swiss_German.keylayout')], - [makePathToFixture('../data/US.keylayout')], - ].forEach(function (files) { - it(files + " should give no errors ", async function () { - sut.run(files[0]); - assert.isTrue(compilerTestCallbacks.messages.length === 0); - }); - }); - }); describe('RunSpecialTestFiles', function () { const sut = new KeylayoutToKmnConverter(compilerTestCallbacks, compilerTestOptions); diff --git a/developer/src/kmc-convert/test/kmn-file-writer.tests.ts b/developer/src/kmc-convert/test/kmn-file-writer.tests.ts index d3d19abbe8d..7857ae2765b 100644 --- a/developer/src/kmc-convert/test/kmn-file-writer.tests.ts +++ b/developer/src/kmc-convert/test/kmn-file-writer.tests.ts @@ -329,7 +329,7 @@ describe('KmnFileWriter', function () { ], [''], [''], - ["c WARNING: ambiguous rule: later: [RALT K_B] > dk(A0) ambiguous rule: earlier: [RALT K_B] > 'X' PLEASE CHECK THE FOLLOWING RULE AS IT WILL NOT BE WRITTEN ! here: "]], + ["c WARNING: ambiguous rule: later: [RALT K_B] > dk(A0) ambiguous rule: earlier: [RALT K_B] > 'X' PLEASE CHECK THAT RULE AS IT WILL NOT BE WRITTEN ! here: "]], ].forEach(function (values: (string[] | Rule[])[], index: number) { it(('rule ' + (values[0][0] as Rule).ruleType as string + ' should create " ' + ' "') + values[1] + ' | ' + values[2] + ' | ' + values[3] + '"', async function () { const result: string[] = sutW.unitTestEndpoints.reviewRules(values[0] as Rule[], 2); From e7db3742027f4c2be38176cd24dd4824b075d1e0 Mon Sep 17 00:00:00 2001 From: Sabine Date: Thu, 25 Jun 2026 16:35:15 +0200 Subject: [PATCH 3/6] feat(developer): createWarningTextbrush up e.g. rename variables --- .../src/common/web/utils/src/xml-utils.ts | 2 +- .../src/keylayout-to-kmn/kmn-file-writer.ts | 153 +++++++++--------- 2 files changed, 82 insertions(+), 73 deletions(-) diff --git a/developer/src/common/web/utils/src/xml-utils.ts b/developer/src/common/web/utils/src/xml-utils.ts index 0f73771fb6d..cfe42987dd8 100644 --- a/developer/src/common/web/utils/src/xml-utils.ts +++ b/developer/src/common/web/utils/src/xml-utils.ts @@ -6,7 +6,7 @@ * Abstraction for XML reading and writing */ -import { XMLParser, XMLBuilder, XMLMetaData, X2jOptions, XmlBuilderOptions,JPathOrMatcher } from 'fast-xml-parser'; +import { XMLParser, XMLBuilder, XMLMetaData, X2jOptions, XmlBuilderOptions, JPathOrMatcher } from 'fast-xml-parser'; import { SymbolUtils } from "./symbol-utils.js"; /** Symbol giving the start offset, in chars, of the node */ diff --git a/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts b/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts index 79414e2ff68..82fc86cf396 100644 --- a/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts +++ b/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts @@ -24,10 +24,12 @@ interface RuleReview { 'DuplicateRule' | 'AmbiguousRule'; compare_type: string; earlier_later: [boolean, boolean]; - dk_bothPrefix_prevdk_dk: [string, string];// todo rename to dk_prefix + // dk_id[0]: prev_dk; dk_id[1]: dk; + dk_id: [number, number]; + // dk_prefix[0]: prev_dk_prefix; dk_prefix[1]: dk_prefix; + dk_prefix: [string, string]; prevDk_modifier: string; prevDk_key: string; - dk_bothId_prevdk_dk: [number, number];// todo rename to dk_id Dk_modifier: string; Dk_key: string; modifier: string; @@ -241,7 +243,6 @@ export class KmnFileWriter { // If it`s a ctrl character we print out the Unicode Codepoint else we print out the Unicode Character let versionOutputCharacter; const warnText = this.reviewRules(uniqueDataRules, k); - const outputCharacter = new TextDecoder().decode(uniqueDataRules[k].output); // TODO-kmc-convert: after merge of PR 14569 use functions from util instead of the ones in this class // const outputUnicodeCharacter = util.convertToUnicodeCharacter(outputCharacter); @@ -420,28 +421,34 @@ export class KmnFileWriter { } /** - * @brief take a child object of RuleReview and return the appropriate warning message - * @param inObj : an object containing all data - * @return outMsg the warning message + * @brief take a child object of RuleReview and return the appropriate warning message array + * @param inObj : an object containing filtered data for a specified comparison + * @param posWarning : index specifying to which element of the warning message array a warning message will be added: + * outMsg[0]: Warning for part 1 of a rule (e.g. modifier_prev_dk + key_prev_dk > prev_dk) + * outMsg[1]: Warning for part 2 of a rule (e.g. (prev_dk +) modifier_dk + key_dk > dk) + * outMsg[2]: Warning for part 3 of a rule (e.g. (dk +) modifier+key > output) + * see here on parts of a rule: + * https://docs.google.com/document/d/12J3NGO6RxIthCpZDTR8FYSRjiMgXJDLwPY2z9xqKzJ0/edit?tab=t.0#heading=h.16sx096j6jmy + * @return outMsg the warning message array for all parts */ - public createWarningText(inObj: RuleReview, pos: number): string[] { + public createWarningText(inObj: RuleReview, posWarning: number = 2): string[] { const outMsg = [...inObj.warningMessages]; if (inObj.compare_type === 'unav_C0_C1') { - outMsg[pos] = "unavailable modifier "; + outMsg[posWarning] = "unavailable modifier "; } if (inObj.compare_type === 'unav_C2') { - // if the dk is unavailable, the dependant C0 rules and theIr modifiers need to get a warning 'unavailable superior rule ' + // if the dk is unavailable, the modifiers of the dependant C0 rule will get a warning 'unavailable superior rule ' if (inObj.Dk_modifier) { outMsg[1] = "unavailable modifier "; outMsg[2] = "unavailable superior rule ( [" + inObj.Dk_modifier + " " + inObj.Dk_key + "] > dk(" - + inObj.dk_bothPrefix_prevdk_dk[1] - + inObj.dk_bothId_prevdk_dk[1] + + inObj.dk_prefix[1] + + inObj.dk_id[1] + ") ) : "; } @@ -452,28 +459,28 @@ export class KmnFileWriter { if (inObj.compare_type === 'unav_C3') { - // if the dk is unavailable, the dependant C0 rules and theIr modifiers need to get a warning 'unavailable superior rule ' + // if the dk is unavailable, the modifiers of the dependant C0 rule will get a warning 'unavailable superior rule ' if (inObj.prevDk_modifier) { outMsg[0] = "unavailable modifier "; outMsg[1] = "unavailable superior rule ( [" + inObj.prevDk_modifier + " " + inObj.prevDk_key + "] > dk(" - + inObj.dk_bothPrefix_prevdk_dk[1] - + inObj.dk_bothId_prevdk_dk[1] + + inObj.dk_prefix[0] + + inObj.dk_id[0] + ") ) : "; } - // if the dk is unavailable, the dependant C0 rules and theIr modifiers need to get a warning 'unavailable superior rule ' + // if the dk is unavailable, the modifiers of the dependant C0 rule will get a warning 'unavailable superior rule ' if (inObj.Dk_modifier) { outMsg[1] += "unavailable modifier "; outMsg[2] = "unavailable superior rule ( [" + inObj.Dk_modifier + " " + inObj.Dk_key + "] > dk(" - + inObj.dk_bothPrefix_prevdk_dk[1] - + inObj.dk_bothId_prevdk_dk[1] + + inObj.dk_prefix[1] + + inObj.dk_id[1] + ") ) : "; } @@ -484,7 +491,7 @@ export class KmnFileWriter { if (inObj.compare_type === 'amb_1_1' || inObj.compare_type === 'dup_1_1') { - outMsg[pos] = inObj.warningMessages[2] + outMsg[posWarning] = inObj.warningMessages[posWarning] + ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + "rule: " + (inObj.earlier_later[0] ? "earlier" : "later") + ": [" + inObj.modifier + " " + inObj.key + "] > \'" @@ -500,10 +507,10 @@ export class KmnFileWriter { ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + "rule: " + (inObj.earlier_later[0] ? "earlier" : "later") + ": [" + inObj.Dk_modifier + " " + inObj.Dk_key + "] > dk(" - + inObj.dk_bothPrefix_prevdk_dk[1] + inObj.dk_bothId_prevdk_dk[1] + ") "); + + inObj.dk_prefix[1] + inObj.dk_id[1] + ") "); - if (outMsg[pos].indexOf(textsegment) === -1) - outMsg[pos] += textsegment; + if (outMsg[posWarning].indexOf(textsegment) === -1) + outMsg[posWarning] += textsegment; } @@ -515,10 +522,10 @@ export class KmnFileWriter { ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + "rule: " + (inObj.earlier_later[0] ? "earlier" : "later") + ": [" + inObj.prevDk_modifier + " " + inObj.prevDk_key + "] > dk(" - + inObj.dk_bothPrefix_prevdk_dk[0] + inObj.dk_bothId_prevdk_dk[0] + ") "); + + inObj.dk_prefix[0] + inObj.dk_id[0] + ") "); - if (outMsg[pos].indexOf(textsegment) === -1) - outMsg[pos] += textsegment; + if (outMsg[posWarning].indexOf(textsegment) === -1) + outMsg[posWarning] += textsegment; } @@ -527,12 +534,12 @@ export class KmnFileWriter { const textsegment = ( ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + 'rule: ' + (inObj.earlier_later[0] ? "earlier" : "later") - + ': dk(' + inObj.dk_bothPrefix_prevdk_dk[1] + inObj.dk_bothId_prevdk_dk[1] + ") + [" + + ': dk(' + inObj.dk_prefix[1] + inObj.dk_id[1] + ") + [" + inObj.Dk_modifier + " " + inObj.Dk_key + "] > " - + 'dk(' + inObj.dk_bothPrefix_prevdk_dk[0] + inObj.dk_bothId_prevdk_dk[0] + ") "); + + 'dk(' + inObj.dk_prefix[0] + inObj.dk_id[0] + ") "); - if (outMsg[pos].indexOf(textsegment) === -1) - outMsg[pos] += textsegment; + if (outMsg[1].indexOf(textsegment) === -1) + outMsg[1] += textsegment; } @@ -543,11 +550,11 @@ export class KmnFileWriter { const textsegment = ( ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + 'rule: ' + (inObj.earlier_later[0] ? "earlier" : "later") - + ': dk(' + inObj.dk_bothPrefix_prevdk_dk[1] + inObj.dk_bothId_prevdk_dk[1] + ") + [" + + ': dk(' + inObj.dk_prefix[1] + inObj.dk_id[1] + ") + [" + inObj.modifier + " " + inObj.key + "] > \'" + inObj.output + "\' "); - if (outMsg[pos].indexOf(textsegment) === -1) - outMsg[pos] += textsegment; + if (outMsg[posWarning].indexOf(textsegment) === -1) + outMsg[posWarning] += textsegment; } return outMsg; @@ -592,7 +599,7 @@ export class KmnFileWriter { if ((rule[index].ruleType === "C0") || (rule[index].ruleType === "C1")) { if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierKey)) { unavailableModiWarnings.compare_type = 'unav_C0_C1'; - unavailableModiWarnings.warningMessages = this.createWarningText(unavailableModiWarnings, 2); + unavailableModiWarnings.warningMessages = this.createWarningText(unavailableModiWarnings); } } @@ -600,18 +607,18 @@ export class KmnFileWriter { else if (rule[index].ruleType === "C2") { if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierDeadkey)) { unavailableSuperiWarnings.compare_type = 'unav_C2'; - unavailableSuperiWarnings.dk_bothPrefix_prevdk_dk = ['C', 'A']; - unavailableSuperiWarnings.dk_bothId_prevdk_dk = [rule[0].idPrevDeadkey, rule[0].idDeadkey]; + unavailableSuperiWarnings.dk_prefix = ['C', 'A']; + unavailableSuperiWarnings.dk_id = [rule[index].idPrevDeadkey, rule[index].idDeadkey]; unavailableSuperiWarnings.Dk_modifier = rule[index].modifierDeadkey; unavailableSuperiWarnings.Dk_key = rule[index].deadkey; - unavailableSuperiWarnings.warningMessages = this.createWarningText(unavailableSuperiWarnings, 2); + unavailableSuperiWarnings.warningMessages = this.createWarningText(unavailableSuperiWarnings); } if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierKey)) { unavailableModiWarnings.compare_type = 'unav_C2'; unavailableModiWarnings.modifier = rule[index].modifierKey; unavailableModiWarnings.key = rule[index].key; - unavailableModiWarnings.warningMessages = this.createWarningText(unavailableModiWarnings, 2); + unavailableModiWarnings.warningMessages = this.createWarningText(unavailableModiWarnings); } } @@ -619,8 +626,8 @@ export class KmnFileWriter { else if (rule[index].ruleType === "C3") { if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierPrevDeadkey)) { unavailableSuperiWarnings.compare_type = 'unav_C3'; - unavailableSuperiWarnings.dk_bothPrefix_prevdk_dk = ['C', 'A']; - unavailableSuperiWarnings.dk_bothId_prevdk_dk = [rule[0].idPrevDeadkey, rule[0].idDeadkey]; + unavailableSuperiWarnings.dk_prefix = ['A', '']; + unavailableSuperiWarnings.dk_id = [rule[index].idPrevDeadkey, rule[index].idDeadkey]; unavailableSuperiWarnings.prevDk_modifier = rule[index].modifierPrevDeadkey; unavailableSuperiWarnings.prevDk_key = rule[index].prevDeadkey; unavailableSuperiWarnings.warningMessages = this.createWarningText(unavailableSuperiWarnings, 2); @@ -629,8 +636,8 @@ export class KmnFileWriter { if (!keylayoutKmnConverter.isAcceptableKeymanModifier(rule[index].modifierDeadkey)) { unavailableSuperiWarnings.compare_type = 'unav_C3'; unavailableSuperiWarnings.prevDk_modifier = ''; - unavailableSuperiWarnings.dk_bothPrefix_prevdk_dk = ['', 'B']; - unavailableSuperiWarnings.dk_bothId_prevdk_dk = [rule[0].idPrevDeadkey, rule[0].idDeadkey]; + unavailableSuperiWarnings.dk_prefix = ['', 'B']; + unavailableSuperiWarnings.dk_id = [rule[index].idPrevDeadkey, rule[index].idDeadkey]; unavailableSuperiWarnings.Dk_modifier = rule[index].modifierDeadkey; unavailableSuperiWarnings.Dk_key = rule[index].deadkey; unavailableSuperiWarnings.warningMessages = this.createWarningText(unavailableSuperiWarnings, 2); @@ -690,8 +697,8 @@ export class KmnFileWriter { if (amb_4_1.length > 0) { ambiguousWarnings.compare_type = 'amb_4_1'; ambiguousWarnings.earlier_later = [false, true]; - ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['C', 'A']; - ambiguousWarnings.dk_bothId_prevdk_dk = [amb_4_1[0].idPrevDeadkey, amb_4_1[0].idDeadkey]; + ambiguousWarnings.dk_prefix = ['C', 'A']; + ambiguousWarnings.dk_id = [amb_4_1[0].idPrevDeadkey, amb_4_1[0].idDeadkey]; ambiguousWarnings.prevDk_modifier = amb_4_1[0].modifierPrevDeadkey; ambiguousWarnings.prevDk_key = amb_4_1[0].prevDeadkey; ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 2); @@ -700,8 +707,8 @@ export class KmnFileWriter { if (amb_2_1.length > 0) { ambiguousWarnings.compare_type = 'amb_2_1'; ambiguousWarnings.earlier_later = [false, true]; - ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['C', 'A']; - ambiguousWarnings.dk_bothId_prevdk_dk = [amb_2_1[0].idPrevDeadkey, amb_2_1[0].idDeadkey]; + ambiguousWarnings.dk_prefix = ['C', 'A']; + ambiguousWarnings.dk_id = [amb_2_1[0].idPrevDeadkey, amb_2_1[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_2_1[0].modifierDeadkey; ambiguousWarnings.Dk_key = amb_2_1[0].deadkey; ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 2); @@ -779,8 +786,8 @@ export class KmnFileWriter { if (amb_2_2.length > 0) { ambiguousWarnings.compare_type = 'amb_2_2'; ambiguousWarnings.earlier_later = [true, false]; - ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['', 'C']; - ambiguousWarnings.dk_bothId_prevdk_dk = [amb_2_2[0].idPrevDeadkey, amb_2_2[0].idDeadkey]; + ambiguousWarnings.dk_prefix = ['', 'C']; + ambiguousWarnings.dk_id = [amb_2_2[0].idPrevDeadkey, amb_2_2[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_2_2[0].modifierDeadkey; ambiguousWarnings.Dk_key = amb_2_2[0].deadkey; ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 1); @@ -789,8 +796,8 @@ export class KmnFileWriter { if (dup_2_2.length > 0) { duplicateWarnings.compare_type = 'dup_2_2'; duplicateWarnings.earlier_later = [true, false]; - duplicateWarnings.dk_bothPrefix_prevdk_dk = ['', 'C']; - duplicateWarnings.dk_bothId_prevdk_dk = [dup_2_2[0].idPrevDeadkey, dup_2_2[0].idDeadkey]; + duplicateWarnings.dk_prefix = ['', 'C']; + duplicateWarnings.dk_id = [dup_2_2[0].idPrevDeadkey, dup_2_2[0].idDeadkey]; duplicateWarnings.Dk_modifier = dup_2_2[0].modifierDeadkey; duplicateWarnings.Dk_key = dup_2_2[0].deadkey; duplicateWarnings.warningMessages = this.createWarningText(duplicateWarnings, 1); @@ -799,8 +806,8 @@ export class KmnFileWriter { if (amb_3_3.length > 0) { ambiguousWarnings.compare_type = 'amb_3_3'; ambiguousWarnings.earlier_later = [true, false]; - ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['', 'A']; - ambiguousWarnings.dk_bothId_prevdk_dk = [amb_3_3[0].idPrevDeadkey, amb_3_3[0].idDeadkey]; + ambiguousWarnings.dk_prefix = ['', 'A']; + ambiguousWarnings.dk_id = [amb_3_3[0].idPrevDeadkey, amb_3_3[0].idDeadkey]; ambiguousWarnings.modifier = amb_3_3[0].modifierKey; ambiguousWarnings.key = amb_3_3[0].key; ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_3_3[0].output)).character; @@ -810,8 +817,8 @@ export class KmnFileWriter { if (dup_3_3.length > 0) { duplicateWarnings.compare_type = 'dup_3_3'; duplicateWarnings.earlier_later = [true, false]; - duplicateWarnings.dk_bothId_prevdk_dk = [dup_3_3[0].idPrevDeadkey, dup_3_3[0].idDeadkey]; - duplicateWarnings.dk_bothPrefix_prevdk_dk = ['', 'A']; + duplicateWarnings.dk_id = [dup_3_3[0].idPrevDeadkey, dup_3_3[0].idDeadkey]; + duplicateWarnings.dk_prefix = ['', 'A']; duplicateWarnings.modifier = dup_3_3[0].modifierKey; duplicateWarnings.key = dup_3_3[0].key; duplicateWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(dup_3_3[0].output)).character; @@ -821,8 +828,8 @@ export class KmnFileWriter { if (amb_4_2.length > 0) { ambiguousWarnings.compare_type = 'amb_4_2'; ambiguousWarnings.earlier_later = [false, true]; - ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['C', '']; - ambiguousWarnings.dk_bothId_prevdk_dk = [amb_4_2[0].idPrevDeadkey, amb_4_2[0].idDeadkey]; + ambiguousWarnings.dk_prefix = ['C', '']; + ambiguousWarnings.dk_id = [amb_4_2[0].idPrevDeadkey, amb_4_2[0].idDeadkey]; ambiguousWarnings.prevDk_modifier = amb_4_2[0].modifierPrevDeadkey; ambiguousWarnings.prevDk_key = amb_4_2[0].prevDeadkey; ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 0); @@ -924,8 +931,8 @@ export class KmnFileWriter { if (amb_2_4.length > 0) { ambiguousWarnings.compare_type = 'amb_2_4'; ambiguousWarnings.earlier_later = [true, false]; - ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['', 'A']; - ambiguousWarnings.dk_bothId_prevdk_dk = [amb_2_4[0].idPrevDeadkey, amb_2_4[0].idDeadkey]; + ambiguousWarnings.dk_prefix = ['', 'A']; + ambiguousWarnings.dk_id = [amb_2_4[0].idPrevDeadkey, amb_2_4[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_2_4[0].modifierDeadkey; ambiguousWarnings.Dk_key = amb_2_4[0].deadkey; ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 0); @@ -934,8 +941,8 @@ export class KmnFileWriter { if (amb_6_3.length > 0) { ambiguousWarnings.compare_type = 'amb_6_3'; ambiguousWarnings.earlier_later = [true, false]; - ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['', 'C']; - ambiguousWarnings.dk_bothId_prevdk_dk = [amb_6_3[0].idPrevDeadkey, amb_6_3[0].idDeadkey]; + ambiguousWarnings.dk_prefix = ['', 'C']; + ambiguousWarnings.dk_id = [amb_6_3[0].idPrevDeadkey, amb_6_3[0].idDeadkey]; ambiguousWarnings.modifier = amb_6_3[0].modifierKey; ambiguousWarnings.key = amb_6_3[0].key; ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_6_3[0].output)).character; @@ -945,8 +952,8 @@ export class KmnFileWriter { if (dup_6_3.length > 0) { duplicateWarnings.compare_type = 'dup_6_3'; duplicateWarnings.earlier_later = [true, false]; - duplicateWarnings.dk_bothPrefix_prevdk_dk = ['', 'C']; - duplicateWarnings.dk_bothId_prevdk_dk = [dup_6_3[0].idPrevDeadkey, dup_6_3[0].idDeadkey]; + duplicateWarnings.dk_prefix = ['', 'C']; + duplicateWarnings.dk_id = [dup_6_3[0].idPrevDeadkey, dup_6_3[0].idDeadkey]; duplicateWarnings.modifier = dup_6_3[0].modifierKey; duplicateWarnings.key = dup_6_3[0].key; duplicateWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(dup_6_3[0].output)).character; @@ -956,8 +963,8 @@ export class KmnFileWriter { if (amb_4_4.length > 0) { ambiguousWarnings.compare_type = 'amb_4_4'; ambiguousWarnings.earlier_later = [true, false]; - ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['C', '']; - ambiguousWarnings.dk_bothId_prevdk_dk = [amb_4_4[0].idPrevDeadkey, amb_4_4[0].idDeadkey]; + ambiguousWarnings.dk_prefix = ['C', '']; + ambiguousWarnings.dk_id = [amb_4_4[0].idPrevDeadkey, amb_4_4[0].idDeadkey]; ambiguousWarnings.prevDk_modifier = amb_4_4[0].modifierPrevDeadkey; ambiguousWarnings.prevDk_key = amb_4_4[0].prevDeadkey; ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 0); @@ -966,8 +973,8 @@ export class KmnFileWriter { if (dup_4_4.length > 0) { duplicateWarnings.compare_type = 'dup_4_4'; duplicateWarnings.earlier_later = [true, false]; - duplicateWarnings.dk_bothPrefix_prevdk_dk = ['C', '']; - duplicateWarnings.dk_bothId_prevdk_dk = [dup_4_4[0].idPrevDeadkey, dup_4_4[0].idDeadkey]; + duplicateWarnings.dk_prefix = ['C', '']; + duplicateWarnings.dk_id = [dup_4_4[0].idPrevDeadkey, dup_4_4[0].idDeadkey]; duplicateWarnings.prevDk_modifier = dup_4_4[0].modifierPrevDeadkey; duplicateWarnings.prevDk_key = dup_4_4[0].prevDeadkey; duplicateWarnings.warningMessages = this.createWarningText(duplicateWarnings, 0); @@ -976,17 +983,19 @@ export class KmnFileWriter { if (amb_5_5.length > 0) { ambiguousWarnings.compare_type = 'amb_5_5'; ambiguousWarnings.earlier_later = [true, false]; - ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['B', 'B']; - ambiguousWarnings.dk_bothId_prevdk_dk = [amb_5_5[0].idPrevDeadkey, amb_5_5[0].idDeadkey]; + ambiguousWarnings.dk_prefix = ['B', 'B']; + ambiguousWarnings.dk_id = [amb_5_5[0].idPrevDeadkey, amb_5_5[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_5_5[0].modifierDeadkey; ambiguousWarnings.Dk_key = amb_5_5[0].deadkey; - ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings, 1); + ambiguousWarnings.warningMessages = this.createWarningText(ambiguousWarnings); } if (dup_5_5.length > 0) { duplicateWarnings.compare_type = 'dup_5_5'; duplicateWarnings.earlier_later = [true, false]; - duplicateWarnings.dk_bothPrefix_prevdk_dk = ['B', 'B']; + duplicateWarnings.dk_prefix = ['B', 'B']; + duplicateWarnings.dk_id = [dup_5_5[0].idPrevDeadkey, dup_5_5[0].idDeadkey]; + duplicateWarnings.Dk_modifier = rule[index].modifierDeadkey; duplicateWarnings.Dk_key = rule[index].deadkey; duplicateWarnings.warningMessages = this.createWarningText(duplicateWarnings, 1); @@ -995,8 +1004,8 @@ export class KmnFileWriter { if (amb_6_6.length > 0) { ambiguousWarnings.compare_type = 'amb_6_6'; ambiguousWarnings.earlier_later = [true, false]; - ambiguousWarnings.dk_bothPrefix_prevdk_dk = ['', 'B']; - ambiguousWarnings.dk_bothId_prevdk_dk = [amb_6_6[0].idPrevDeadkey, amb_6_6[0].idDeadkey]; + ambiguousWarnings.dk_prefix = ['', 'B']; + ambiguousWarnings.dk_id = [amb_6_6[0].idPrevDeadkey, amb_6_6[0].idDeadkey]; ambiguousWarnings.modifier = amb_6_6[0].modifierKey; ambiguousWarnings.key = amb_6_6[0].key; ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_6_6[0].output)).character; @@ -1006,8 +1015,8 @@ export class KmnFileWriter { if (dup_6_6.length > 0) { duplicateWarnings.compare_type = 'dup_6_6'; duplicateWarnings.earlier_later = [true, false]; - duplicateWarnings.dk_bothPrefix_prevdk_dk = ['', 'B']; - duplicateWarnings.dk_bothId_prevdk_dk = [dup_6_6[0].idPrevDeadkey, dup_6_6[0].idDeadkey]; + duplicateWarnings.dk_prefix = ['', 'B']; + duplicateWarnings.dk_id = [dup_6_6[0].idPrevDeadkey, dup_6_6[0].idDeadkey]; duplicateWarnings.modifier = dup_6_6[0].modifierKey; duplicateWarnings.key = dup_6_6[0].key; duplicateWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(dup_6_6[0].output)).character; From 49c07a413ff90381c021581dfc90b01b21b32cd8 Mon Sep 17 00:00:00 2001 From: Sabine Date: Thu, 25 Jun 2026 18:00:23 +0200 Subject: [PATCH 4/6] feat(developer): returntype of reviewRules changed to object --- .../src/keylayout-to-kmn/kmn-file-writer.ts | 24 +++++++++++-------- .../test/keylayout-to-kmn-converter.tests.ts | 1 - .../kmc-convert/test/kmn-file-writer.tests.ts | 20 ++++++++-------- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts b/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts index 82fc86cf396..3ffe0bf79bc 100644 --- a/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts +++ b/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts @@ -21,7 +21,7 @@ interface RuleReview { warningMessages: string[]; extraWarning: string; type: 'RuleReview' | 'UnavailableModifier' | 'UnavailableSuperiorRule' | - 'DuplicateRule' | 'AmbiguousRule'; + 'DuplicateRule' | 'AmbiguousRule' | 'WarningTextSet'; compare_type: string; earlier_later: [boolean, boolean]; // dk_id[0]: prev_dk; dk_id[1]: dk; @@ -49,7 +49,9 @@ interface DuplicateRules extends RuleReview { interface AmbiguousRules extends RuleReview { type: 'AmbiguousRule'; }; - +interface WarningTextSet extends RuleReview { + type: 'WarningTextSet'; +}; export class KmnFileWriter { @@ -177,7 +179,7 @@ export class KmnFileWriter { // use of Unicode Character vs Unicode Codepoint; // If it`s a ctrl character we print out the Unicode Codepoint else we print out the Unicode Character let versionOutputCharacter; - const warnText = this.reviewRules(uniqueDataRules, k); + const warnText = this.reviewRules(uniqueDataRules, k).warningMessages; const outputCharacter = new TextDecoder().decode(uniqueDataRules[k].output); // TODO-kmc-convert: after merge of PR 14569 use functions from util instead of the ones in this class @@ -242,7 +244,7 @@ export class KmnFileWriter { // use of Unicode Character vs Unicode Codepoint; // If it`s a ctrl character we print out the Unicode Codepoint else we print out the Unicode Character let versionOutputCharacter; - const warnText = this.reviewRules(uniqueDataRules, k); + const warnText = this.reviewRules(uniqueDataRules, k).warningMessages; const outputCharacter = new TextDecoder().decode(uniqueDataRules[k].output); // TODO-kmc-convert: after merge of PR 14569 use functions from util instead of the ones in this class // const outputUnicodeCharacter = util.convertToUnicodeCharacter(outputCharacter); @@ -329,7 +331,7 @@ export class KmnFileWriter { // If it`s a ctrl character we print out the Unicode Codepoint else we print out the Unicode Character let versionOutputCharacter; - const warnText = this.reviewRules(uniqueDataRules, k); + const warnText = this.reviewRules(uniqueDataRules, k).warningMessages; const outputCharacter = new TextDecoder().decode(uniqueDataRules[k].output); // TODO-kmc-convert: after merge of PR 14569 use functions from util instead of the ones in this class @@ -569,7 +571,7 @@ export class KmnFileWriter { * @param index the index of a rule in Rule[] * @return a string[] containing possible warnings for a rule */ - public reviewRules(rule: Rule[], index: number): string[] { + public reviewRules(rule: Rule[], index: number): RuleReview { const unavailableModiWarnings = { type: 'UnavailableModifier', @@ -591,8 +593,11 @@ export class KmnFileWriter { warningMessages: ['', '', ''], } as AmbiguousRules; + const resultWarningTextSet = { + warningMessages: ['', '', ''], + } as WarningTextSet; + const keylayoutKmnConverter = new KeylayoutToKmnConverter(this.callbacks, this.options); - const warningText: string[] = Array(3).fill(""); // ------------------------- check unavailable modifiers ------------------------- @@ -1048,11 +1053,10 @@ export class KmnFileWriter { + ambiguousWarnings.warningMessages[i] + unavailableModiWarnings.warningMessages[i]; - completeWarning ? (warningText[i] = "c WARNING: " + completeWarning + " here: ") : warningText[i] = ''; - + completeWarning ? (resultWarningTextSet.warningMessages[i] = "c WARNING: " + completeWarning + " here: ") : resultWarningTextSet.warningMessages[i] = ''; } - return warningText; + return resultWarningTextSet; } /** diff --git a/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts b/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts index 9658d033cdd..e86c1331673 100644 --- a/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts +++ b/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts @@ -61,7 +61,6 @@ describe('KeylayoutToKmnConverter', function () { ].forEach(function (files) { it(files + " should give no errors ", async function () { sut.run(makePathToFixture(files[0])); - // assert.isTrue(compilerTestCallbacks.messages.length === 1 && compilerTestCallbacks.messages[0].code === 5292037); assert.isTrue(compilerTestCallbacks.messages.length === 0); await sut.run(makePathToFixture(files[0])); assert.equal(compilerTestCallbacks.messages.length, 0); diff --git a/developer/src/kmc-convert/test/kmn-file-writer.tests.ts b/developer/src/kmc-convert/test/kmn-file-writer.tests.ts index 7857ae2765b..89528238a44 100644 --- a/developer/src/kmc-convert/test/kmn-file-writer.tests.ts +++ b/developer/src/kmc-convert/test/kmn-file-writer.tests.ts @@ -124,29 +124,29 @@ describe('KmnFileWriter', function () { [''], ['c WARNING: unavailable modifier here: ']], - [[new Rule("C2", '', '', 0, 0, 'UNAVAILABLE_dk', 'K_EQUAL', 0, 0, 'UNAVAILABLE', 'K_C', new TextEncoder().encode('C'),)], + [[new Rule("C2", '', '', 1, 1, 'UNAVAILABLE_dk', 'K_EQUAL', 2, 2, 'UNAVAILABLE', 'K_C', new TextEncoder().encode('C'),)], [''], ['c WARNING: unavailable modifier here: '], - ['c WARNING: unavailable superior rule ( [UNAVAILABLE_dk K_EQUAL] > dk(A0) ) : unavailable modifier here: ']], + ['c WARNING: unavailable superior rule ( [UNAVAILABLE_dk K_EQUAL] > dk(A2) ) : unavailable modifier here: ']], - [[new Rule("C3", 'UNAVAILABLE_prev_dk', 'K_D', 0, 0, 'UNAVAILABLE_dk', 'K_EQUAL', 0, 0, 'SHIFT', 'K_C', new TextEncoder().encode('D'),)], + [[new Rule("C3", 'UNAVAILABLE_prev_dk', 'K_D', 1, 1, 'UNAVAILABLE_dk', 'K_EQUAL', 0, 0, 'SHIFT', 'K_C', new TextEncoder().encode('D'),)], ['c WARNING: unavailable modifier here: '], - ['c WARNING: unavailable superior rule ( [UNAVAILABLE_prev_dk K_D] > dk(A0) ) : unavailable modifier here: '], + ['c WARNING: unavailable superior rule ( [UNAVAILABLE_prev_dk K_D] > dk(A1) ) : unavailable modifier here: '], ['c WARNING: unavailable superior rule ( [UNAVAILABLE_dk K_EQUAL] > dk(B0) ) : here: ']], - [[new Rule("C3", 'CAPS', 'K_D', 0, 0, 'RALT', 'K_EQUAL', 0, 0, 'SHIFT', 'K_C', new TextEncoder().encode('D'),)], + [[new Rule("C3", 'CAPS', 'K_D',1, 1, 'RALT', 'K_EQUAL', 0, 0, 'SHIFT', 'K_C', new TextEncoder().encode('D'),)], [''], [''], ['']], - [[new Rule("C3", 'X', 'K_X', 0, 0, 'Y', 'K_Y', 0, 0, 'SHIFT', 'K_Z', new TextEncoder().encode('D'),)], + [[new Rule("C3", 'X', 'K_X', 1, 1, 'Y', 'K_Y', 0, 0, 'SHIFT', 'K_Z', new TextEncoder().encode('D'),)], ['c WARNING: unavailable modifier here: '], - ['c WARNING: unavailable superior rule ( [X K_X] > dk(A0) ) : unavailable modifier here: '], + ['c WARNING: unavailable superior rule ( [X K_X] > dk(A1) ) : unavailable modifier here: '], ['c WARNING: unavailable superior rule ( [Y K_Y] > dk(B0) ) : here: ']], ].forEach(function (values: (string[] | Rule[])[], index: number) { it(('rule " ' + (values[0][0] as Rule).ruleType as string + ' "') + 'should create "' + values[1] + ' | ' + values[2] + ' | ' + values[3] + '"', async function () { - const result: string[] = sutW.unitTestEndpoints.reviewRules(values[0] as Rule[], 0); + const result: string[] = sutW.unitTestEndpoints.reviewRules(values[0] as Rule[], 0).warningMessages; assert.equal(result[0], values[1][0]); assert.equal(result[1], values[2][0]); assert.equal(result[2], values[3][0]); @@ -312,7 +312,7 @@ describe('KmnFileWriter', function () { ].forEach(function (values: (string[] | Rule[])[], index: number) { it('rule ' + (values[0][0] as Rule).ruleType as string + ' should create " ' + ' "' + values[1] + ' | ' + values[2] + ' | ' + values[3] + '"', async function () { - const result: string[] = sutW.unitTestEndpoints.reviewRules(values[0] as Rule[], 1); + const result: string[] = sutW.unitTestEndpoints.reviewRules(values[0] as Rule[], 1).warningMessages; assert.equal(result[0], values[1][0]); assert.equal(result[1], values[2][0]); assert.equal(result[2], values[3][0]); @@ -332,7 +332,7 @@ describe('KmnFileWriter', function () { ["c WARNING: ambiguous rule: later: [RALT K_B] > dk(A0) ambiguous rule: earlier: [RALT K_B] > 'X' PLEASE CHECK THAT RULE AS IT WILL NOT BE WRITTEN ! here: "]], ].forEach(function (values: (string[] | Rule[])[], index: number) { it(('rule ' + (values[0][0] as Rule).ruleType as string + ' should create " ' + ' "') + values[1] + ' | ' + values[2] + ' | ' + values[3] + '"', async function () { - const result: string[] = sutW.unitTestEndpoints.reviewRules(values[0] as Rule[], 2); + const result: string[] = sutW.unitTestEndpoints.reviewRules(values[0] as Rule[], 2).warningMessages; assert.equal(result[0], values[1][0]); assert.equal(result[1], values[2][0]); assert.equal(result[2], values[3][0]); From 1fab2540228abdebbecd485e8f375dbbc16047c3 Mon Sep 17 00:00:00 2001 From: Sabine Date: Fri, 26 Jun 2026 09:27:48 +0200 Subject: [PATCH 5/6] feat(developer): dup_5_5, amb_5_5 swap dk and prev_dk output --- .../src/keylayout-to-kmn/kmn-file-writer.ts | 10 +++++----- .../test/keylayout-to-kmn-converter.tests.ts | 8 ++++---- .../src/kmc-convert/test/kmn-file-writer.tests.ts | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts b/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts index 3ffe0bf79bc..0916056f32d 100644 --- a/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts +++ b/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts @@ -536,9 +536,9 @@ export class KmnFileWriter { const textsegment = ( ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + 'rule: ' + (inObj.earlier_later[0] ? "earlier" : "later") - + ': dk(' + inObj.dk_prefix[1] + inObj.dk_id[1] + ") + [" + + ': dk(' + inObj.dk_prefix[0] + inObj.dk_id[0] + ") + [" + inObj.Dk_modifier + " " + inObj.Dk_key + "] > " - + 'dk(' + inObj.dk_prefix[0] + inObj.dk_id[0] + ") "); + + 'dk(' + inObj.dk_prefix[1] + inObj.dk_id[1] + ") "); if (outMsg[1].indexOf(textsegment) === -1) outMsg[1] += textsegment; @@ -712,7 +712,7 @@ export class KmnFileWriter { if (amb_2_1.length > 0) { ambiguousWarnings.compare_type = 'amb_2_1'; ambiguousWarnings.earlier_later = [false, true]; - ambiguousWarnings.dk_prefix = ['C', 'A']; + ambiguousWarnings.dk_prefix = ['', 'A']; ambiguousWarnings.dk_id = [amb_2_1[0].idPrevDeadkey, amb_2_1[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_2_1[0].modifierDeadkey; ambiguousWarnings.Dk_key = amb_2_1[0].deadkey; @@ -988,7 +988,7 @@ export class KmnFileWriter { if (amb_5_5.length > 0) { ambiguousWarnings.compare_type = 'amb_5_5'; ambiguousWarnings.earlier_later = [true, false]; - ambiguousWarnings.dk_prefix = ['B', 'B']; + ambiguousWarnings.dk_prefix = ['C', 'B']; ambiguousWarnings.dk_id = [amb_5_5[0].idPrevDeadkey, amb_5_5[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_5_5[0].modifierDeadkey; ambiguousWarnings.Dk_key = amb_5_5[0].deadkey; @@ -998,7 +998,7 @@ export class KmnFileWriter { if (dup_5_5.length > 0) { duplicateWarnings.compare_type = 'dup_5_5'; duplicateWarnings.earlier_later = [true, false]; - duplicateWarnings.dk_prefix = ['B', 'B']; + duplicateWarnings.dk_prefix = ['C', 'B']; duplicateWarnings.dk_id = [dup_5_5[0].idPrevDeadkey, dup_5_5[0].idDeadkey]; duplicateWarnings.Dk_modifier = rule[index].modifierDeadkey; diff --git a/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts b/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts index e86c1331673..8ed4f88e73b 100644 --- a/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts +++ b/developer/src/kmc-convert/test/keylayout-to-kmn-converter.tests.ts @@ -64,9 +64,9 @@ describe('KeylayoutToKmnConverter', function () { assert.isTrue(compilerTestCallbacks.messages.length === 0); await sut.run(makePathToFixture(files[0])); assert.equal(compilerTestCallbacks.messages.length, 0); - }); - }); - }); + }); + }); + }); describe('RunTestFiles resulting in errors ', function () { const sut = new KeylayoutToKmnConverter(compilerTestCallbacks, compilerTestOptions); [ @@ -96,7 +96,7 @@ describe('KeylayoutToKmnConverter', function () { ['../data/Test_undefinedAction.keylayout'], ].forEach(function (files) { it(files + " should give Error: undefined action detected", async function () { - sut.run(makePathToFixture(files[0])); + sut.run(makePathToFixture(files[0])); assert.equal(compilerTestCallbacks.messages.length, 1); assert.equal(compilerTestCallbacks.messages[0].code, 5292040); }); diff --git a/developer/src/kmc-convert/test/kmn-file-writer.tests.ts b/developer/src/kmc-convert/test/kmn-file-writer.tests.ts index 89528238a44..ff4f58a7b6d 100644 --- a/developer/src/kmc-convert/test/kmn-file-writer.tests.ts +++ b/developer/src/kmc-convert/test/kmn-file-writer.tests.ts @@ -134,7 +134,7 @@ describe('KmnFileWriter', function () { ['c WARNING: unavailable superior rule ( [UNAVAILABLE_prev_dk K_D] > dk(A1) ) : unavailable modifier here: '], ['c WARNING: unavailable superior rule ( [UNAVAILABLE_dk K_EQUAL] > dk(B0) ) : here: ']], - [[new Rule("C3", 'CAPS', 'K_D',1, 1, 'RALT', 'K_EQUAL', 0, 0, 'SHIFT', 'K_C', new TextEncoder().encode('D'),)], + [[new Rule("C3", 'CAPS', 'K_D', 1, 1, 'RALT', 'K_EQUAL', 0, 0, 'SHIFT', 'K_C', new TextEncoder().encode('D'),)], [''], [''], ['']], @@ -163,7 +163,7 @@ describe('KmnFileWriter', function () { new Rule("C3", 'LALT', 'K_A', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C3", 'LALT', 'K_A', 0, 0, 'SHIFT', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')),], ['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '], - ["c WARNING: duplicate rule: earlier: dk(B0) + [SHIFT K_B] > dk(B0) here: "], + ["c WARNING: duplicate rule: earlier: dk(C0) + [SHIFT K_B] > dk(B0) here: "], ["c WARNING: duplicate rule: earlier: dk(B0) + [CAPS K_C] > 'X' here: "]], //6-6 dup @@ -187,7 +187,7 @@ describe('KmnFileWriter', function () { new Rule("C3", 'LALT', 'K_A', 0, 0, 'NCAPS', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C3", 'LALT', 'K_A', 0, 0, 'NCAPS', 'K_B', 0, 1, 'RALT', 'K_F', new TextEncoder().encode('X')),], ['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '], - ["c WARNING: ambiguous rule: earlier: dk(B0) + [NCAPS K_B] > dk(B0) here: "], [''], + ["c WARNING: ambiguous rule: earlier: dk(C0) + [NCAPS K_B] > dk(B0) here: "], [''], ], // 5-5 dup @@ -195,7 +195,7 @@ describe('KmnFileWriter', function () { new Rule("C3", 'LALT', 'K_A', 0, 0, 'NCAPS', 'K_B', 0, 0, 'CAPS', 'K_C', new TextEncoder().encode('X')), new Rule("C3", 'LALT', 'K_A', 0, 0, 'NCAPS', 'K_B', 0, 0, 'RALT', 'K_F', new TextEncoder().encode('X')),], ['c WARNING: duplicate rule: earlier: [LALT K_A] > dk(C0) here: '], - ["c WARNING: duplicate rule: earlier: dk(B0) + [NCAPS K_B] > dk(B0) here: "], + ["c WARNING: duplicate rule: earlier: dk(C0) + [NCAPS K_B] > dk(B0) here: "], ['']], // 4-2 amb From 688e222c21e915e3258cce61ca6075c168c157c5 Mon Sep 17 00:00:00 2001 From: Sabine Date: Fri, 26 Jun 2026 11:23:02 +0200 Subject: [PATCH 6/6] feat(developer): exchange earlier_later: [boolean, boolean] with isEarlier: boolean; --- .../src/keylayout-to-kmn/kmn-file-writer.ts | 108 +++++++++--------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts b/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts index 0916056f32d..bfc1f9743a5 100644 --- a/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts +++ b/developer/src/kmc-convert/src/keylayout-to-kmn/kmn-file-writer.ts @@ -23,7 +23,7 @@ interface RuleReview { type: 'RuleReview' | 'UnavailableModifier' | 'UnavailableSuperiorRule' | 'DuplicateRule' | 'AmbiguousRule' | 'WarningTextSet'; compare_type: string; - earlier_later: [boolean, boolean]; + isEarlier: boolean; // dk_id[0]: prev_dk; dk_id[1]: dk; dk_id: [number, number]; // dk_prefix[0]: prev_dk_prefix; dk_prefix[1]: dk_prefix; @@ -438,24 +438,24 @@ export class KmnFileWriter { const outMsg = [...inObj.warningMessages]; if (inObj.compare_type === 'unav_C0_C1') { - outMsg[posWarning] = "unavailable modifier "; + outMsg[posWarning] = 'unavailable modifier '; } if (inObj.compare_type === 'unav_C2') { // if the dk is unavailable, the modifiers of the dependant C0 rule will get a warning 'unavailable superior rule ' if (inObj.Dk_modifier) { - outMsg[1] = "unavailable modifier "; - outMsg[2] = "unavailable superior rule ( [" - + inObj.Dk_modifier + " " + outMsg[1] = 'unavailable modifier '; + outMsg[2] = 'unavailable superior rule ( [' + + inObj.Dk_modifier + ' ' + inObj.Dk_key - + "] > dk(" + + '] > dk(' + inObj.dk_prefix[1] + inObj.dk_id[1] - + ") ) : "; + + ') ) : '; } if (inObj.modifier) { - outMsg[2] = "unavailable modifier "; + outMsg[2] = 'unavailable modifier '; } } @@ -463,41 +463,41 @@ export class KmnFileWriter { // if the dk is unavailable, the modifiers of the dependant C0 rule will get a warning 'unavailable superior rule ' if (inObj.prevDk_modifier) { - outMsg[0] = "unavailable modifier "; - outMsg[1] = "unavailable superior rule ( [" - + inObj.prevDk_modifier + " " + outMsg[0] = 'unavailable modifier '; + outMsg[1] = 'unavailable superior rule ( [' + + inObj.prevDk_modifier + ' ' + inObj.prevDk_key - + "] > dk(" + + '] > dk(' + inObj.dk_prefix[0] + inObj.dk_id[0] - + ") ) : "; + + ') ) : '; } // if the dk is unavailable, the modifiers of the dependant C0 rule will get a warning 'unavailable superior rule ' if (inObj.Dk_modifier) { - outMsg[1] += "unavailable modifier "; - outMsg[2] = "unavailable superior rule ( [" - + inObj.Dk_modifier + " " + outMsg[1] += 'unavailable modifier '; + outMsg[2] = 'unavailable superior rule ( [' + + inObj.Dk_modifier + ' ' + inObj.Dk_key - + "] > dk(" + + '] > dk(' + inObj.dk_prefix[1] + inObj.dk_id[1] - + ") ) : "; + + ') ) : '; } if (inObj.modifier) { - outMsg[2] = "unavailable modifier "; + outMsg[2] = 'unavailable modifier '; } } if (inObj.compare_type === 'amb_1_1' || inObj.compare_type === 'dup_1_1') { outMsg[posWarning] = inObj.warningMessages[posWarning] - + ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + "rule: " - + (inObj.earlier_later[0] ? "earlier" : "later") - + ": [" + inObj.modifier + " " + inObj.key + "] > \'" - + inObj.output + "\' "; + + ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + 'rule: ' + + (inObj.isEarlier ? 'earlier' : 'later') + + ': [' + inObj.modifier + ' ' + inObj.key + '] > \'' + + inObj.output + '\' '; } @@ -506,10 +506,10 @@ export class KmnFileWriter { || inObj.compare_type === 'amb_2_4') { const textsegment = ( - ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + "rule: " - + (inObj.earlier_later[0] ? "earlier" : "later") - + ": [" + inObj.Dk_modifier + " " + inObj.Dk_key + "] > dk(" - + inObj.dk_prefix[1] + inObj.dk_id[1] + ") "); + ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + 'rule: ' + + (inObj.isEarlier ? 'earlier' : 'later') + + ': [' + inObj.Dk_modifier + ' ' + inObj.Dk_key + '] > dk(' + + inObj.dk_prefix[1] + inObj.dk_id[1] + ') '); if (outMsg[posWarning].indexOf(textsegment) === -1) outMsg[posWarning] += textsegment; @@ -521,10 +521,10 @@ export class KmnFileWriter { || inObj.compare_type === 'amb_4_2') { const textsegment = ( - ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + "rule: " - + (inObj.earlier_later[0] ? "earlier" : "later") + ": [" - + inObj.prevDk_modifier + " " + inObj.prevDk_key + "] > dk(" - + inObj.dk_prefix[0] + inObj.dk_id[0] + ") "); + ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + 'rule: ' + + (inObj.isEarlier ? 'earlier' : 'later') + + ': [' + inObj.prevDk_modifier + ' ' + inObj.prevDk_key + '] > dk(' + + inObj.dk_prefix[0] + inObj.dk_id[0] + ') '); if (outMsg[posWarning].indexOf(textsegment) === -1) outMsg[posWarning] += textsegment; @@ -535,7 +535,7 @@ export class KmnFileWriter { const textsegment = ( ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + 'rule: ' - + (inObj.earlier_later[0] ? "earlier" : "later") + + (inObj.isEarlier ? 'earlier' : 'later') + ': dk(' + inObj.dk_prefix[0] + inObj.dk_id[0] + ") + [" + inObj.Dk_modifier + " " + inObj.Dk_key + "] > " + 'dk(' + inObj.dk_prefix[1] + inObj.dk_id[1] + ") "); @@ -550,10 +550,11 @@ export class KmnFileWriter { || inObj.compare_type === 'amb_6_6' || inObj.compare_type === 'dup_6_6') { const textsegment = ( - ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + 'rule: ' + - (inObj.earlier_later[0] ? "earlier" : "later") + ((inObj.type === 'AmbiguousRule') ? 'ambiguous ' : 'duplicate ') + 'rule: ' + + (inObj.isEarlier ? 'earlier' : 'later') + ': dk(' + inObj.dk_prefix[1] + inObj.dk_id[1] + ") + [" - + inObj.modifier + " " + inObj.key + "] > \'" + inObj.output + "\' "); + + inObj.modifier + " " + inObj.key + "] > \'" + + inObj.output + "\' "); if (outMsg[posWarning].indexOf(textsegment) === -1) outMsg[posWarning] += textsegment; @@ -701,7 +702,7 @@ export class KmnFileWriter { if (amb_4_1.length > 0) { ambiguousWarnings.compare_type = 'amb_4_1'; - ambiguousWarnings.earlier_later = [false, true]; + ambiguousWarnings.isEarlier = false; ambiguousWarnings.dk_prefix = ['C', 'A']; ambiguousWarnings.dk_id = [amb_4_1[0].idPrevDeadkey, amb_4_1[0].idDeadkey]; ambiguousWarnings.prevDk_modifier = amb_4_1[0].modifierPrevDeadkey; @@ -711,7 +712,7 @@ export class KmnFileWriter { if (amb_2_1.length > 0) { ambiguousWarnings.compare_type = 'amb_2_1'; - ambiguousWarnings.earlier_later = [false, true]; + ambiguousWarnings.isEarlier = false; ambiguousWarnings.dk_prefix = ['', 'A']; ambiguousWarnings.dk_id = [amb_2_1[0].idPrevDeadkey, amb_2_1[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_2_1[0].modifierDeadkey; @@ -721,7 +722,7 @@ export class KmnFileWriter { if (amb_1_1.length > 0) { ambiguousWarnings.compare_type = 'amb_1_1'; - ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.isEarlier = true; ambiguousWarnings.modifier = amb_1_1[0].modifierKey; ambiguousWarnings.key = amb_1_1[0].key; ambiguousWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(amb_1_1[0].output)).character; @@ -730,7 +731,7 @@ export class KmnFileWriter { if (dup_1_1.length > 0) { duplicateWarnings.compare_type = 'dup_1_1'; - duplicateWarnings.earlier_later = [true, false]; + duplicateWarnings.isEarlier = true; duplicateWarnings.modifier = dup_1_1[0].modifierKey; duplicateWarnings.key = dup_1_1[0].key; duplicateWarnings.output = this.writeCharacterOrUnicode(new TextDecoder().decode(dup_1_1[0].output)).character; @@ -790,7 +791,7 @@ export class KmnFileWriter { if (amb_2_2.length > 0) { ambiguousWarnings.compare_type = 'amb_2_2'; - ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.isEarlier = true; ambiguousWarnings.dk_prefix = ['', 'C']; ambiguousWarnings.dk_id = [amb_2_2[0].idPrevDeadkey, amb_2_2[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_2_2[0].modifierDeadkey; @@ -800,7 +801,7 @@ export class KmnFileWriter { if (dup_2_2.length > 0) { duplicateWarnings.compare_type = 'dup_2_2'; - duplicateWarnings.earlier_later = [true, false]; + duplicateWarnings.isEarlier = true; duplicateWarnings.dk_prefix = ['', 'C']; duplicateWarnings.dk_id = [dup_2_2[0].idPrevDeadkey, dup_2_2[0].idDeadkey]; duplicateWarnings.Dk_modifier = dup_2_2[0].modifierDeadkey; @@ -810,7 +811,7 @@ export class KmnFileWriter { if (amb_3_3.length > 0) { ambiguousWarnings.compare_type = 'amb_3_3'; - ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.isEarlier = true; ambiguousWarnings.dk_prefix = ['', 'A']; ambiguousWarnings.dk_id = [amb_3_3[0].idPrevDeadkey, amb_3_3[0].idDeadkey]; ambiguousWarnings.modifier = amb_3_3[0].modifierKey; @@ -821,7 +822,7 @@ export class KmnFileWriter { if (dup_3_3.length > 0) { duplicateWarnings.compare_type = 'dup_3_3'; - duplicateWarnings.earlier_later = [true, false]; + duplicateWarnings.isEarlier = true; duplicateWarnings.dk_id = [dup_3_3[0].idPrevDeadkey, dup_3_3[0].idDeadkey]; duplicateWarnings.dk_prefix = ['', 'A']; duplicateWarnings.modifier = dup_3_3[0].modifierKey; @@ -832,7 +833,7 @@ export class KmnFileWriter { if (amb_4_2.length > 0) { ambiguousWarnings.compare_type = 'amb_4_2'; - ambiguousWarnings.earlier_later = [false, true]; + ambiguousWarnings.isEarlier = false; ambiguousWarnings.dk_prefix = ['C', '']; ambiguousWarnings.dk_id = [amb_4_2[0].idPrevDeadkey, amb_4_2[0].idDeadkey]; ambiguousWarnings.prevDk_modifier = amb_4_2[0].modifierPrevDeadkey; @@ -935,7 +936,7 @@ export class KmnFileWriter { if (amb_2_4.length > 0) { ambiguousWarnings.compare_type = 'amb_2_4'; - ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.isEarlier = true; ambiguousWarnings.dk_prefix = ['', 'A']; ambiguousWarnings.dk_id = [amb_2_4[0].idPrevDeadkey, amb_2_4[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_2_4[0].modifierDeadkey; @@ -945,7 +946,7 @@ export class KmnFileWriter { if (amb_6_3.length > 0) { ambiguousWarnings.compare_type = 'amb_6_3'; - ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.isEarlier = true; ambiguousWarnings.dk_prefix = ['', 'C']; ambiguousWarnings.dk_id = [amb_6_3[0].idPrevDeadkey, amb_6_3[0].idDeadkey]; ambiguousWarnings.modifier = amb_6_3[0].modifierKey; @@ -956,7 +957,7 @@ export class KmnFileWriter { if (dup_6_3.length > 0) { duplicateWarnings.compare_type = 'dup_6_3'; - duplicateWarnings.earlier_later = [true, false]; + duplicateWarnings.isEarlier = true; duplicateWarnings.dk_prefix = ['', 'C']; duplicateWarnings.dk_id = [dup_6_3[0].idPrevDeadkey, dup_6_3[0].idDeadkey]; duplicateWarnings.modifier = dup_6_3[0].modifierKey; @@ -967,7 +968,7 @@ export class KmnFileWriter { if (amb_4_4.length > 0) { ambiguousWarnings.compare_type = 'amb_4_4'; - ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.isEarlier = true; ambiguousWarnings.dk_prefix = ['C', '']; ambiguousWarnings.dk_id = [amb_4_4[0].idPrevDeadkey, amb_4_4[0].idDeadkey]; ambiguousWarnings.prevDk_modifier = amb_4_4[0].modifierPrevDeadkey; @@ -977,7 +978,7 @@ export class KmnFileWriter { if (dup_4_4.length > 0) { duplicateWarnings.compare_type = 'dup_4_4'; - duplicateWarnings.earlier_later = [true, false]; + duplicateWarnings.isEarlier = true; duplicateWarnings.dk_prefix = ['C', '']; duplicateWarnings.dk_id = [dup_4_4[0].idPrevDeadkey, dup_4_4[0].idDeadkey]; duplicateWarnings.prevDk_modifier = dup_4_4[0].modifierPrevDeadkey; @@ -987,7 +988,7 @@ export class KmnFileWriter { if (amb_5_5.length > 0) { ambiguousWarnings.compare_type = 'amb_5_5'; - ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.isEarlier = true; ambiguousWarnings.dk_prefix = ['C', 'B']; ambiguousWarnings.dk_id = [amb_5_5[0].idPrevDeadkey, amb_5_5[0].idDeadkey]; ambiguousWarnings.Dk_modifier = amb_5_5[0].modifierDeadkey; @@ -997,10 +998,9 @@ export class KmnFileWriter { if (dup_5_5.length > 0) { duplicateWarnings.compare_type = 'dup_5_5'; - duplicateWarnings.earlier_later = [true, false]; + duplicateWarnings.isEarlier = true; duplicateWarnings.dk_prefix = ['C', 'B']; duplicateWarnings.dk_id = [dup_5_5[0].idPrevDeadkey, dup_5_5[0].idDeadkey]; - duplicateWarnings.Dk_modifier = rule[index].modifierDeadkey; duplicateWarnings.Dk_key = rule[index].deadkey; duplicateWarnings.warningMessages = this.createWarningText(duplicateWarnings, 1); @@ -1008,7 +1008,7 @@ export class KmnFileWriter { if (amb_6_6.length > 0) { ambiguousWarnings.compare_type = 'amb_6_6'; - ambiguousWarnings.earlier_later = [true, false]; + ambiguousWarnings.isEarlier = true; ambiguousWarnings.dk_prefix = ['', 'B']; ambiguousWarnings.dk_id = [amb_6_6[0].idPrevDeadkey, amb_6_6[0].idDeadkey]; ambiguousWarnings.modifier = amb_6_6[0].modifierKey; @@ -1019,7 +1019,7 @@ export class KmnFileWriter { if (dup_6_6.length > 0) { duplicateWarnings.compare_type = 'dup_6_6'; - duplicateWarnings.earlier_later = [true, false]; + duplicateWarnings.isEarlier = true; duplicateWarnings.dk_prefix = ['', 'B']; duplicateWarnings.dk_id = [dup_6_6[0].idPrevDeadkey, dup_6_6[0].idDeadkey]; duplicateWarnings.modifier = dup_6_6[0].modifierKey;