import { TextDocument } from 'vscode-languageserver-textdocument'; import { IndexMapping } from '../types/IndexMapping'; export declare class StringReader { string: string; cursor: number; end: number; constructor(string: string, cursor?: number, end?: number); get passedString(): string; get remainingString(): string; clone(): StringReader; canRead(length?: number): boolean; /** * Peeks a character at the current cursor. * @param offset The index to offset from cursor. @default 0 */ peek(offset?: number): string; /** * Skips the current character. * @param step The step to skip. @default 1 */ skip(step?: number): this; skipLine(): this; read(): string; readSpace(): string; skipSpace(): this; skipWhiteSpace(): this; /** * @throws {ParsingError} When the value is NaN or have non-number char at the beginning. */ readNumber(): string; /** * @throws {ParsingError} When the value is float or exceeds the range. */ readInt(): number; /** * @deprecated * @throws When the value is float. */ readLong(): bigint; readFloat(): number; /** * @deprecated */ readDouble(): number; /** * @param out Stores a mapping from in-string indices to real indices. */ readUnquotedString(out?: { mapping: IndexMapping; }): string; /** * @throws {ParsingError} If it's not an legal quoted string. * @param out Stores a mapping from in-string indices to real indices. * @param isReadingJson Whether to read the whole JSON string, including quotes and escaping characters. */ readQuotedString(out?: { mapping: IndexMapping; }, looseEscapeCheck?: boolean): string; /** * @throws {ParsingError} * @param terminator Endding quote. Will not be included in the result. * @param out Stores a mapping from in-string indices to real indices. */ private readUntilQuote; /** * @param terminator Endding character. Will not be included in the result. */ readUntilOrEnd(...terminators: string[]): string; readLine(): string; /** * @throws {ParsingError} If it's not an legal quoted string. * @param out Stores a mapping from in-string indices to real indices. * @param isReadingJson Whether to read the whole JSON string, including quotes and escaping characters. */ readString(out?: { mapping: IndexMapping; }, looseEscapeCheck?: boolean): string; /** * @deprecated * @throws {ParsingError} */ readBoolean(): boolean; /** * @throws {ParsingError} (tolerable) When the next char can't match the expected one. */ expect(c: string): this; readRemaining(): string; lastLine(textDoc: TextDocument): this; nextLine(textDoc: TextDocument): this; static canInNumber(c: string): boolean; static isSpace(c: string): boolean; static isWhiteSpace(c: string): boolean; static isLineSeparator(c: string): boolean; /** * Whether the string can be used in unquoted string or not. * @param string A string. */ static canInUnquotedString(string: string): boolean; static isQuote(c: string): c is '"' | "'"; }