/** * Stores source string in a global repo for use in * serialization and unserialization of Tokens. */ /** * Small class to that methods to extract string information * and retrieve text meta data for particular tokens and token * sequences. */ export declare class Token { path: string; readonly source: string; readonly off: number; readonly length: number; private _line; static fromRange(start: Token, end: Token): Token; toJSON(): { path: string; off: number; len: number; line: number; source: string; }; /** * Does the conversion */ static from(obj: object): Token; constructor(source: string, token_length: number, token_offset: number, line?: number); setPath(path: string): this; setSource(source: string): Token; private getSliceRange; /** * Returns a range object compatible with the LSP specification * for a cursor bounded text range. * * https://microsoft.github.io/language-server-protocol/specifications/specification-current/#range */ range(start?: number, end?: number): { start: { line: number; col: number; }; end: { line: number; col: number; }; }; /** * Return a string slice of the source bounded buy the token * or a portion of the token. */ slice(start?: number, end?: number): string; /** * Return a new Token of the source bounded buy the existing * token or a portion of the existing token. */ token_slice(start?: number, end?: number): Token; toString(): string; get len(): number; get line(): number; get column(): number; blameDiagram(message: string, source_path?: string): string; createError(message: string, source_path?: string): Error; throw(message: any, source?: string): void; /** * Return the source string with the section covered * by this token replaced with the given string. */ replace(replacement_string: string): string; } export declare class KernelToken { type: number; byte_offset: number; byte_length: number; codepoint_offset: number; codepoint_length: number; line: number; static new(): KernelToken; constructor(type: number, byte_offset: number, byte_length: number, codepoint_offset: number, codepoint_length: number); copy(): KernelToken; clone(token: KernelToken): void; reset(): void; } export declare function blame(source: string, offset: number, token_length: number, line: number, column: number): string;