Interface LanguageService<Specifics>

This services provides some static information about the language/DSL, for which the type system is created.

The main idea for this services is to improve the performance of some other services (mainly validation and type inference) by introducing the concept of "language keys" for language nodes. If rules for validation and type inference are associated to a language key, these rules are applied only to those language nodes which have this language key, not to all language nodes. It is possible to associate rules to multiple language keys. Rules which are associated to no language key, are applied to all language nodes.

Language keys are represented by string values and might by, depending on the DSL implementation/language workbench, class names or $type-property-information of the language node implementations.

Language keys might have sub/super language keys ("sub-type relationship of language keys").

interface LanguageService<Specifics extends TypirSpecifics> {
    getAllSubKeys(languageKey: string): string[];
    getAllSuperKeys(languageKey: string): string[];
    getLanguageNodeKey(
        languageNode: Specifics["LanguageType"],
    ): undefined | string;
    isLanguageNode(node: unknown): node is Specifics["LanguageType"];
}

Type Parameters

Implemented by

Methods

  • Returns all keys, which are direct or indirect sub-keys of the given language key.

    Parameters

    • languageKey: string

      the given language key

    Returns string[]

    the list does not contain the given language key itself

  • Returns all keys, which are direct or indirect super-keys of the given language key.

    Parameters

    • languageKey: string

      the given language key

    Returns string[]

    the list does not contain the given language key itself

  • Returns the language key for a given language node

    Parameters

    • languageNode: Specifics["LanguageType"]

      the given language node

    Returns undefined | string

    the language key or 'undefined', if there is no language key for the given language node