UNPKG

@zsnout/ithkuil

Version:

A set of tools which can generate and parse romanized Ithkuil text and which can generate Ithkuil script from text and JSON data.

138 lines (137 loc) 5.13 kB
import { WithWYAlternative } from "../generate/helpers/with-wy-alternative.js"; /** A class representing a vowel form. */ export declare class VowelForm<S extends 1 | 2 | 3 | 4 = 1 | 2 | 3 | 4> { /** The sequence of this vowel form. */ readonly sequence: S; /** The degree of this vowel form. */ readonly degree: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; /** Whether or not this vowel form has a glottal stop. */ readonly hasGlottalStop: boolean; /** * Parses a textual vowel form into a `VowelForm` object. * * @param text The vowel form as text. * @returns The vowel form as a `VowelForm` object, or `undefined` if `text` * was not a valid vowel form. * * Note that for sequence 3 vowel forms, either of their alternate forms will * be accepted. `VowelForm.of("ia")` and `VowelForm.of("uä")` are * functionally identical. */ static of(text: keyof typeof VOWEL_FORM_TO_OBJECT_MAP): VowelForm; /** * Parses a textual vowel form into a `VowelForm` object. * * @param text The vowel form as text. * @returns The vowel form as a `VowelForm` object, or `undefined` if `text` * was not a valid vowel form. * * Note that for sequence 3 vowel forms, either of their alternate forms will * be accepted. `VowelForm.of("ia")` and `VowelForm.of("uä")` are * functionally identical. */ static of(text: string): VowelForm | undefined; /** * Parses a textual vowel form into a `VowelForm` object. * * @param text The vowel form as text. * @returns The vowel form as a `VowelForm` object. * * Throws if the vowel form is invalid. * * Note that for sequence 3 vowel forms, either of their alternate forms will * be accepted. `VowelForm.parseOrThrow("ia")` and * `VowelForm.parseOrThrow("uä")` are functionally identical. */ static parseOrThrow(text: keyof typeof VOWEL_FORM_TO_OBJECT_MAP): VowelForm; /** * Parses a textual vowel form into a `VowelForm` object. * * @param text The vowel form as text. * @returns The vowel form as a `VowelForm` object. * * Throws if the vowel form is invalid. * * Note that for sequence 3 vowel forms, either of their alternate forms will * be accepted. `VowelForm.parseOrThrow("ia")` and * `VowelForm.parseOrThrow("uä")` are functionally identical. */ static parseOrThrow(text: string): VowelForm; constructor( /** The sequence of this vowel form. */ sequence: S, /** The degree of this vowel form. */ degree: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9, /** Whether or not this vowel form has a glottal stop. */ hasGlottalStop?: boolean); /** * Converts this vowel form into a string. * * @param isAtEndOfWord Whether or not this vowel form will be used as the * final form in a word. * @returns A string or `WithWYAlternative` representing this vowel form. */ toString(isAtEndOfWord: boolean): S extends 3 ? WithWYAlternative : string; /** * Creates a new `VowelForm` identical to this one, but with a glottal stop. * * @param hasGlottalStop Whether the output `VowelForm` will include a glottal * stop. Defaults to `true`. * @returns The new `VowelForm`. */ withGlottalStop(hasGlottalStop?: boolean): VowelForm<S>; } /** * An object mapping from all non-glottal-stop-including vowel forms to their * corresponding `VowelForm` objects. */ export declare const VOWEL_FORM_TO_OBJECT_MAP: { readonly ae: VowelForm<1>; readonly a: VowelForm<1>; readonly ä: VowelForm<1>; readonly e: VowelForm<1>; readonly i: VowelForm<1>; readonly ëi: VowelForm<1>; readonly ö: VowelForm<1>; readonly o: VowelForm<1>; readonly ü: VowelForm<1>; readonly u: VowelForm<1>; readonly ea: VowelForm<2>; readonly ai: VowelForm<2>; readonly au: VowelForm<2>; readonly ei: VowelForm<2>; readonly eu: VowelForm<2>; readonly ëu: VowelForm<2>; readonly ou: VowelForm<2>; readonly oi: VowelForm<2>; readonly iu: VowelForm<2>; readonly ui: VowelForm<2>; readonly üo: VowelForm<3>; readonly ia: VowelForm<3>; readonly uä: VowelForm<3>; readonly ie: VowelForm<3>; readonly uë: VowelForm<3>; readonly io: VowelForm<3>; readonly üä: VowelForm<3>; readonly iö: VowelForm<3>; readonly üë: VowelForm<3>; readonly eë: VowelForm<3>; readonly uö: VowelForm<3>; readonly öë: VowelForm<3>; readonly uo: VowelForm<3>; readonly öä: VowelForm<3>; readonly ue: VowelForm<3>; readonly ië: VowelForm<3>; readonly ua: VowelForm<3>; readonly iä: VowelForm<3>; readonly üö: VowelForm<4>; readonly ao: VowelForm<4>; readonly aö: VowelForm<4>; readonly eo: VowelForm<4>; readonly eö: VowelForm<4>; readonly oë: VowelForm<4>; readonly öe: VowelForm<4>; readonly oe: VowelForm<4>; readonly öa: VowelForm<4>; readonly oa: VowelForm<4>; };