UNPKG

@bitloops/bl-transpiler

Version:
80 lines 2.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.bitloopsTypeToLangMapping = exports.bitloopsPrimitives = void 0; /** * Bitloops Language CLI * Copyright (C) 2022 Bitloops S.A. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * * For further information you can contact legal(at)bitloops.com. */ const supportedLanguages_js_1 = require("../target/supportedLanguages.js"); exports.bitloopsPrimitives = { string: 'string', bool: 'bool', double: 'double', float: 'float', int32: 'int32', int64: 'int64', uint32: 'uint32', uint64: 'uint64', sint32: 'sint32', sint64: 'sint64', fixed32: 'fixed32', fixed64: 'fixed64', sfixed32: 'sfixed32', sfixed64: 'sfixed64', bytes: 'bytes', regex: 'regex', void: 'void', }; exports.bitloopsTypeToLangMapping = { [supportedLanguages_js_1.SupportedLanguages.TypeScript]: (type) => { switch (type) { case exports.bitloopsPrimitives.string: { return 'string'; } case exports.bitloopsPrimitives.bool: { return 'boolean'; } case exports.bitloopsPrimitives.double: case exports.bitloopsPrimitives.float: case exports.bitloopsPrimitives.int32: case exports.bitloopsPrimitives.int64: case exports.bitloopsPrimitives.uint32: case exports.bitloopsPrimitives.uint64: case exports.bitloopsPrimitives.sint32: case exports.bitloopsPrimitives.sint64: case exports.bitloopsPrimitives.fixed32: case exports.bitloopsPrimitives.fixed64: case exports.bitloopsPrimitives.sfixed32: case exports.bitloopsPrimitives.sfixed64: { return 'number'; } case exports.bitloopsPrimitives.bytes: return 'Uint8Array'; case exports.bitloopsPrimitives.regex: { return 'RegExp'; } case exports.bitloopsPrimitives.void: { return 'void'; } default: { throw new Error(`Invalid primitive type: ${type}`); } } }, }; //# sourceMappingURL=bitloopsPrimitiveToLang.js.map