@@ -2,7 +2,7 @@ import { KMX, Osk, TouchLayout, TouchLayoutFileReader, TouchLayoutFileWriter } f
22import { callbacks , IsKeyboardVersion14OrLater , IsKeyboardVersion15OrLater } from "./compiler-globals.js" ;
33import { JavaScript_Key } from "./javascript-strings.js" ;
44import { TRequiredKey , CRequiredKeys , CSpecialText10 , CSpecialText14 , CSpecialText14ZWNJ , CSpecialText14Map } from "./constants.js" ;
5- import { VKeyNames } from "./keymanweb-key-codes.js" ;
5+ import { KeymanWebTouchStandardKeyNames , KMWAdditionalKeyNames , VKeyNames } from "./keymanweb-key-codes.js" ;
66import { KmwCompilerMessages } from "./messages.js" ;
77
88
@@ -45,6 +45,14 @@ function KeyIdType(FId: string): TKeyIdType { // I4142
4545 if ( VKeyNames . find ( key => key . toUpperCase ( ) == FId ) ) {
4646 return TKeyIdType . Key_Constant ;
4747 }
48+
49+ if ( KeymanWebTouchStandardKeyNames . indexOf ( FId ) >= 0 ) {
50+ return TKeyIdType . Key_Constant ;
51+ }
52+
53+ if ( KMWAdditionalKeyNames . indexOf ( FId ) >= 0 ) {
54+ return TKeyIdType . Key_Constant ;
55+ }
4856 }
4957 return TKeyIdType . Key_Invalid ;
5058}
@@ -60,7 +68,7 @@ function CheckKey(
6068 FKeyType : TouchLayout . TouchLayoutKeySp ,
6169 FRequiredKeys : TRequiredKey [ ] ,
6270 FDictionary : string [ ]
63- ) { // I4119
71+ ) : boolean { // I4119
6472
6573 //
6674 // Check that each touch layer has K_LOPT, [K_ROPT,] K_BKSP, K_ENTER
@@ -96,16 +104,18 @@ function CheckKey(
96104 if ( ! ( FKeyType in [ TouchLayout . TouchLayoutKeySp . blank , TouchLayout . TouchLayoutKeySp . spacer ] ) && FNextLayer == '' ) {
97105 callbacks . reportMessage ( KmwCompilerMessages . Warn_TouchLayoutUnidentifiedKey ( { layerId : layer . id } ) ) ;
98106 }
99- return ;
107+ return true ;
100108 }
101109
102110 let FValid = KeyIdType ( FId ) ;
103111
104112 if ( FValid == TKeyIdType . Key_Invalid ) {
105113 callbacks . reportMessage ( KmwCompilerMessages . Error_TouchLayoutInvalidIdentifier ( { keyId : FId , platformName : platformId , layerId : layer . id } ) ) ;
114+ return false ;
106115 }
107116 else if ( FValid == TKeyIdType . Key_Unicode_Multi && ! IsKeyboardVersion15OrLater ( ) ) {
108117 callbacks . reportMessage ( KmwCompilerMessages . Error_TouchLayoutIdentifierRequires15 ( { keyId : FId , platformName : platformId , layerId : layer . id } ) ) ;
118+ return false ;
109119 }
110120
111121 //
@@ -138,6 +148,8 @@ function CheckKey(
138148 } ) ) ;
139149 }
140150 }
151+
152+ return true ;
141153}
142154
143155function CheckDictionaryKeyValidity ( fk : KMX . KEYBOARD , FDictionary : string [ ] ) { // I4142
@@ -196,6 +208,7 @@ export function ValidateLayoutFile(fk: KMX.KEYBOARD, FDebug: boolean, sLayoutFil
196208 return { output :null , result : false } ;
197209 }
198210
211+ let result : boolean = true ;
199212 let FTouchLayoutFont = '' ; // I4872
200213 let pid : keyof TouchLayout . TouchLayoutFile ;
201214 for ( pid in data ) {
@@ -216,23 +229,23 @@ export function ValidateLayoutFile(fk: KMX.KEYBOARD, FDebug: boolean, sLayoutFil
216229 let FRequiredKeys : TRequiredKey [ ] = [ ] ;
217230 for ( let row of layer . row ) {
218231 for ( let key of row . key ) {
219- CheckKey ( pid , platform , layer , key . id , key . text , key . nextlayer , key . sp , FRequiredKeys , FDictionary ) ; // I4119
232+ result = CheckKey ( pid , platform , layer , key . id , key . text , key . nextlayer , key . sp , FRequiredKeys , FDictionary ) && result ; // I4119
220233 if ( key . sk ) {
221234 for ( let subkey of key . sk ) {
222- CheckKey ( pid , platform , layer , subkey . id , subkey . text , subkey . nextlayer , subkey . sp , FRequiredKeys , FDictionary ) ;
235+ result = CheckKey ( pid , platform , layer , subkey . id , subkey . text , subkey . nextlayer , subkey . sp , FRequiredKeys , FDictionary ) && result ;
223236 }
224237 }
225238 let direction : keyof TouchLayout . TouchLayoutFlick ;
226239 if ( key . flick ) {
227240 for ( direction in key . flick ) {
228- CheckKey ( pid , platform , layer , key . flick [ direction ] . id , key . flick [ direction ] . text ,
229- key . flick [ direction ] . nextlayer , key . flick [ direction ] . sp , FRequiredKeys , FDictionary ) ;
241+ result = CheckKey ( pid , platform , layer , key . flick [ direction ] . id , key . flick [ direction ] . text ,
242+ key . flick [ direction ] . nextlayer , key . flick [ direction ] . sp , FRequiredKeys , FDictionary ) && result ;
230243 }
231244 }
232245
233246 if ( key . multitap ) {
234247 for ( let subkey of key . multitap ) {
235- CheckKey ( pid , platform , layer , subkey . id , subkey . text , subkey . nextlayer , subkey . sp , FRequiredKeys , FDictionary ) ;
248+ result = CheckKey ( pid , platform , layer , subkey . id , subkey . text , subkey . nextlayer , subkey . sp , FRequiredKeys , FDictionary ) && result ;
236249 }
237250 }
238251 }
@@ -263,6 +276,6 @@ export function ValidateLayoutFile(fk: KMX.KEYBOARD, FDebug: boolean, sLayoutFil
263276
264277 return {
265278 output : sLayoutFile ,
266- result : true
279+ result
267280 }
268281}
0 commit comments