import P from "parsernostrum" import Grammar from "../serialization/Grammar.js" import BooleanEntity from "./BooleanEntity.js" import IEntity from "./IEntity.js" import StringEntity from "./StringEntity.js" import SymbolEntity from "./SymbolEntity.js" export default class KeyBindingEntity extends IEntity { static attributes = { ...super.attributes, ActionName: StringEntity, bShift: BooleanEntity, bCtrl: BooleanEntity, bAlt: BooleanEntity, bCmd: BooleanEntity, Key: SymbolEntity, } static grammar = this.createGrammar() constructor(values) { super(values) /** @type {InstanceType} */ this.ActionName /** @type {InstanceType} */ this.bShift /** @type {InstanceType} */ this.bCtrl /** @type {InstanceType} */ this.bAlt /** @type {InstanceType} */ this.bCmd /** @type {InstanceType} */ this.Key } /** @returs {P} */ static createGrammar() { return P.alt( SymbolEntity.grammar.map(identifier => new this({ Key: identifier })), Grammar.createEntityGrammar(this), ) } }