UNPKG

@yellicode/elements

Version:

The meta model API for Yellicode - an extensible code generator.

80 lines (79 loc) 2.63 kB
/* * Copyright (c) 2020 Yellicode * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** * This code was generated by a tool. * * Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. */ import * as elements from './interfaces'; import { SimpleDataType } from './simple-data-type'; var PRIMITIVE_BOOLEAN_ID = "boolean_id"; var PRIMITIVE_INTEGER_ID = "integer_id"; var PRIMITIVE_REAL_ID = "real_id"; var PRIMITIVE_STRING_ID = "string_id"; var PRIMITIVE_OBJECT_ID = "object_id"; /** * Represents the built-in primitive boolean type. */ export var primitiveBooleanType = new SimpleDataType(PRIMITIVE_BOOLEAN_ID, 'boolean', elements.ElementType.primitiveType); /** * Represents the built-in primitive integer type. */ export var primitiveIntegerType = new SimpleDataType(PRIMITIVE_INTEGER_ID, 'integer', elements.ElementType.primitiveType); /** * Represents the built-in primitive real type. */ export var primitiveRealType = new SimpleDataType(PRIMITIVE_REAL_ID, 'real', elements.ElementType.primitiveType); /** * Represents the built-in primitive string type. */ export var primitiveStringType = new SimpleDataType(PRIMITIVE_STRING_ID, 'string', elements.ElementType.primitiveType); /** * Represents the built-in primitive object type. */ export var primitiveObjectType = new SimpleDataType(PRIMITIVE_OBJECT_ID, 'object', elements.ElementType.primitiveType); /** * Asserts that the element is a built in primitive boolean. */ export function isPrimitiveBoolean(element) { if (!element) return false; return element.id === PRIMITIVE_BOOLEAN_ID; } /** * Asserts that the element is a built in primitive integer. */ export function isPrimitiveInteger(element) { if (!element) return false; return element.id === PRIMITIVE_INTEGER_ID; } /** * Asserts that the element is a built in primitive real. */ export function isPrimitiveReal(element) { if (!element) return false; return element.id === PRIMITIVE_REAL_ID; } /** * Asserts that the element is a built in primitive string. */ export function isPrimitiveString(element) { if (!element) return false; return element.id === PRIMITIVE_STRING_ID; } /** * Asserts that the element is a built in primitive object. */ export function isPrimitiveObject(element) { if (!element) return false; return element.id === PRIMITIVE_OBJECT_ID; }