import { ISourceList } from "@cafetextual/util"; /** * Simple line parsing infrastructure. * *

Manages

*/ export default class BaseSimpleParser { protected allLines: Array; protected currentLineIndex: number; protected content: ISourceList; protected value: string; protected pos: number; static TAB: string; getPos(): number; /** * Inits the parser /w text * * @param value a string value, may have muultiple lines seperated by "\\n" character or IContentList * @param charOffset offset for a character * @return returns self for chaining (convenience only) */ init(value: string | ISourceList, charOffset?: number): BaseSimpleParser; setPosition(lineIndex: number, charIndex?: number): void; /** * */ refresh(): void; /** * returns the value of the current line (exposed for testing) */ getCurrentLine(): string; /** * current line index (exposed for testing) */ getCurrentLineIndex(): number; /** * True is there exists a next line (exposed for testing only) */ hasNextLine(v?: string): boolean; nextLine(): boolean; eof(): boolean; /** * skips white space */ ws(token?: string): boolean; wst(): boolean; textValue(fromIndex: number, toIndex: number): string; /** * Matches literal text */ match(str: string): boolean; /** * Returns all the rest of the string */ rest(): string; /** * returns index of matched string from a vector of string */ matchFromList(tokens: Array, andConsume: boolean): number; /** * look ahead --breaks LL0 */ look(v: string): boolean; /** * simple unquoted text extraction */ text(): string; id(): string; pid(token?: string, prefixToken?: string, postfixToken?: string, errorToken?: string): string; count(v: string, token?: string): number; /** * extracts optionally quoted text * @param strict requie */ qtext(strict?: boolean): string; /** * look ahead n characters */ la(n?: number, andConsume?: boolean): string; private consume(n); private isWS(c); /** * Consumes characters until a token in the given vector is matched - does not consume */ matchTokens(tokens: Array, ignoreWS?: boolean): number; toToken(tokens: Array, quoted?: boolean, ignoreWS?: boolean): string; tokenWrapped(prefix: string, suffix: string): string; /** * */ whileTokens(tokens: Array, allowMany?: boolean): string; protected extract(exp: RegExp, until?: string, removeUntil?: boolean, suffix?: string): string; protected next(): string; protected isEscaped(): boolean; /** * debug only * @private */ readonly remainder: string; readonly currentMatch: string; readonly matchStatus: string; eq(char: string, ignoreEscape?: boolean): boolean; protected skipWS(): void; isBefore(i1: number, i2: number): boolean; protected done(): boolean; }