UNPKG

gnablib

Version:

A lean, zero dependency library to provide a useful base for your project.

103 lines (102 loc) 3.9 kB
/*! Copyright 2023-2024 the gnablib contributors MPL-1.1 */ import { IMatchResult } from '../primitive/interfaces/IMatchResult.js'; import type { WindowStr } from '../primitive/WindowStr.js'; import { IBnf } from './interfaces/IBnf.js'; import { IBnfRepeat } from './interfaces/IBnfRepeat.js'; declare const consoleDebugSymbol: unique symbol; export declare class BnfChar implements IBnf { name: string | undefined; readonly ord: number; readonly caseInsensitive?: boolean; constructor(value: string | number | BnfChar, caseInsensitive?: boolean, name?: string); private static smartSensitive; get nonPrintable(): boolean; get length(): [number, number]; get chrHex(): string; get chr(): string; descr(): string; atStartOf(s: WindowStr): IMatchResult; [Symbol.toPrimitive](): string; [consoleDebugSymbol](): string; toString(): string; } export declare class BnfRange implements IBnf, Iterable<BnfChar> { name: string | undefined; readonly start: BnfChar; readonly end: BnfChar; readonly nonPrintable: boolean; constructor(startInc: string | number | BnfChar, endInc: string | number | BnfChar, name?: string); get length(): [number, number]; get rangeLength(): number; [Symbol.iterator](): Iterator<BnfChar>; descr(): string; atStartOf(s: WindowStr): IMatchResult; [Symbol.toPrimitive](): string; [consoleDebugSymbol](): string; toString(): string; } export declare class BnfString implements IBnf, Iterable<BnfChar>, Iterable<IBnf> { name: string | undefined; private readonly _chars; readonly nonPrintable = false; readonly caseInsensitive: boolean | undefined | 'mix'; constructor(value: string | BnfChar[], caseInsensitive?: boolean, name?: string); get length(): [number, number]; [Symbol.iterator](): Iterator<BnfChar>; get str(): string; descr(): string; atStartOf(s: WindowStr): IMatchResult; [Symbol.toPrimitive](): string; [consoleDebugSymbol](): string; toString(): string; } export declare class BnfConcat implements IBnf, Iterable<IBnf> { name: string | undefined; suppressComponents: boolean; readonly items: IBnf[]; readonly nonPrintable: boolean; constructor(...items: IBnf[]); get length(): [number, number]; [Symbol.iterator](): Iterator<IBnf>; descr(asHex?: boolean): string; atStartOf(s: WindowStr): IMatchResult; [Symbol.toPrimitive](): string; [consoleDebugSymbol](): string; toString(): string; } export declare class BnfAlt implements IBnf, Iterable<IBnf> { name: string | undefined; suppressComponents: boolean; readonly items: IBnf[]; readonly nonPrintable = false; constructor(...items: IBnf[]); get length(): [number, number]; [Symbol.iterator](): Iterator<IBnf>; descr(asHex?: boolean): string; atStartOf(s: WindowStr): IMatchResult; [Symbol.toPrimitive](): string; [consoleDebugSymbol](): string; toString(): string; static Split(chars: string, caseInsensitive?: boolean | undefined, name?: string): BnfAlt; } export declare class BnfRepeat implements IBnfRepeat { name: string | undefined; suppressComponents: boolean; readonly min: number; readonly max: number; readonly rule: IBnf; private constructor(); get nonPrintable(): boolean; get length(): [number, number]; descr(asHex?: boolean): string; atStartOf(s: WindowStr): IMatchResult; [Symbol.toPrimitive](): string; [consoleDebugSymbol](): string; toString(): string; static ZeroPlus(rule: IBnf, name?: string): BnfRepeat; static OnePlus(rule: IBnf, name?: string): BnfRepeat; static Optional(rule: IBnf, name?: string): BnfRepeat; static Between(min: number, max: number, rule: IBnf, name?: string): BnfRepeat; static Exactly(count: number, rule: IBnf): BnfRepeat; } export {};