uniorg-parse
Version:
uniorg plugin to parse org-mode
49 lines (48 loc) • 1.66 kB
TypeScript
import type { Position } from 'unist';
import type { VFile } from 'vfile';
export declare class Reader {
#private;
constructor(vfile: VFile);
message(reason: string, offset?: number, ruleId?: string): void;
advance<T extends string | number | RegExpExecArray | null | undefined>(n: T): T;
/**
* Move cursor backwards.
*/
backoff(n: number): void;
match(regex: RegExp): RegExpExecArray | null;
lookingAt(regex: RegExp): RegExpExecArray | null;
forceMatch(regex: RegExp): RegExpExecArray;
forceLookingAt(regex: RegExp): RegExpExecArray;
peek(n: number): string;
line(): string;
rest(): string;
/**
* Returns string at [left, right).
*
* Ignores narrowing.
*/
substring(left: number, right: number): string;
eof(): boolean;
offset(): number;
endOffset(): number;
resetOffset(offset: number): void;
/**
* Narrows buffer to the region [`left`, `right`).
*
* If `preserveOffset` is false (default), also resets cursor to the
* start of the narrowing region.
*/
narrow(left: number, right: number, preserveOffset?: boolean): void;
/**
* Cancels the previous narrowing operation.
*
* If `preserveOffset` is false (default), restores the cursor
* position that was current when the narrowing was invoked.
*/
widen(preserveOffset?: boolean): void;
withNarrow<T>(left: number, right: number, f: () => T): T;
/**
* Converts start and end offsets to a position object according to the unist spec.
*/
positionFromOffsets(startOffset: number, endOffset: number): Position | null;
}