UNPKG

chardata-charset

Version:

CharSet class for the ucdata package

87 lines (86 loc) 3.79 kB
/*! * Copyright 2018 Ron Buckton * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export interface ReadonlyCharSet { readonly size: number; readonly characterClass: string; has(codePoint: number): boolean; has(codePointRange: [number, number]): boolean; has(codePointSet: ReadonlyCharSet): boolean; has(fromCodePoint: number, toCodePoint: number): boolean; union(other: ReadonlyCharSet): CharSet; intersect(other: ReadonlyCharSet): CharSet; except(other: ReadonlyCharSet): CharSet; invert(): CharSet; equals(other: ReadonlyCharSet): boolean; supersetOf(subset: ReadonlyCharSet, proper?: boolean): boolean; subsetOf(superset: ReadonlyCharSet, proper?: boolean): boolean; toStartLengthArray(): number[]; codePoints(): IterableIterator<number>; codePointRanges(): IterableIterator<[number, number]>; [Symbol.iterator](): IterableIterator<number>; } export declare class CharSet { static readonly MIN_CODE_POINT: number; static readonly MAX_CODE_POINT: number; static readonly MAX_ASCII_CODE_POINT: number; private static _empty; private static _any; private static _ascii; private _tree; private _characterClass; constructor(iterable?: Iterable<number | [number, number] | ReadonlyCharSet>); readonly size: number; readonly characterClass: string; static empty(): ReadonlyCharSet; static any(): ReadonlyCharSet; static ascii(): ReadonlyCharSet; static range(fromCodePoint: number, toCodePoint: number): CharSet; static from(iterable: Iterable<number | [number, number] | ReadonlyCharSet>): CharSet; static of(...args: (number | [number, number] | ReadonlyCharSet)[]): CharSet; static fromStartLengthArray(array: ReadonlyArray<number>): CharSet; has(codePoint: number): boolean; has(codePointRange: [number, number]): boolean; has(codePointSet: ReadonlyCharSet): boolean; has(fromCodePoint: number, toCodePoint: number): boolean; add(codePoint: number): this; add(codePointRange: [number, number]): this; add(codePointSet: ReadonlyCharSet): this; add(fromCodePoint: number, toCodePoint: number): this; delete(codePoint: number): boolean; delete(codePointRange: [number, number]): boolean; delete(codePointSet: ReadonlyCharSet): boolean; delete(fromCodePoint: number, toCodePoint: number): boolean; clear(): void; union(other: ReadonlyCharSet): CharSet; intersect(other: ReadonlyCharSet): CharSet; except(other: ReadonlyCharSet): CharSet; invert(): CharSet; equals(other: ReadonlyCharSet): boolean; supersetOf(subset: ReadonlyCharSet, proper?: boolean): boolean; subsetOf(superset: ReadonlyCharSet, proper?: boolean): boolean; toStartLengthArray(): number[]; codePoints(): IterableIterator<number>; codePointRanges(): IterableIterator<[number, number]>; [Symbol.iterator](): IterableIterator<number>; private readonly _debugCodePointRangeCount; private _debugVerify(); private _debugToString(pretty?); } declare global { interface ObjectConstructor { freeze(object: ReadonlyCharSet): ReadonlyCharSet; } }