UNPKG

mathjslab

Version:

MathJSLab - An interpreter with language syntax like MATLAB®/Octave, ISBN 978-65-00-82338-7.

73 lines (72 loc) 2.95 kB
import type { RuntimeExpressionValue } from './AST'; import type { ClassEnumerationDefinition as ClassEnumerationDefinitionBase } from './ClassMember'; import type { ClassDefinition } from './ClassDefinition'; import type { RuntimeDisplay } from './RuntimeDisplay'; type ClassEnumerationDefinition = ClassEnumerationDefinitionBase<ClassDefinition>; /** * Runtime value representing one member of a MATLAB/Octave enumeration class. */ declare class ClassEnumerationValue { /** Runtime type tag used by interpreter predicates. */ static readonly CLASS_ENUMERATION_VALUE = 10; /** Runtime type tag stored on the enumeration value. */ readonly type = 10; /** Optional AST-style parent pointer used by generic value handling. */ parent?: unknown; /** Class that owns the enumeration member. */ readonly classDefinition: ClassDefinition; /** Enumeration member metadata. */ readonly enumeration: ClassEnumerationDefinition; /** Constructor-like arguments attached to the enumeration member. */ readonly args: RuntimeExpressionValue[]; /** * Test whether a value is a class enumeration value. * * @param obj Value to test. * @returns `true` when `obj` is a `ClassEnumerationValue`. */ static readonly isInstanceOf: (obj: unknown) => obj is ClassEnumerationValue; /** * Create an enumeration value. * * @param classDefinition Owning class metadata. * @param enumeration Enumeration member metadata. * @param args Constructor-like argument values. */ constructor(classDefinition: ClassDefinition, enumeration: ClassEnumerationDefinition, args?: RuntimeExpressionValue[]); /** * Create an enumeration value. * * @param classDefinition Owning class metadata. * @param enumeration Enumeration member metadata. * @param args Constructor-like argument values. * @returns Runtime enumeration value. */ static readonly create: (classDefinition: ClassDefinition, enumeration: ClassEnumerationDefinition, args?: RuntimeExpressionValue[]) => ClassEnumerationValue; /** * Copy an enumeration value. * * @param value Value to copy. * @returns New enumeration value wrapper. */ static readonly copy: (value: ClassEnumerationValue) => ClassEnumerationValue; /** * Render the enumeration member name. * * @param value Enumeration value to render. * @param _interpreter Interpreter requesting unparse. * @returns Fully qualified enumeration member name. */ static readonly unparse: (value: ClassEnumerationValue, _interpreter: RuntimeDisplay) => string; /** * Copy this enumeration value. * * @returns New enumeration value wrapper. */ copy(): ClassEnumerationValue; } export { ClassEnumerationValue }; declare const _default: { ClassEnumerationValue: typeof ClassEnumerationValue; }; export default _default;