import { ICancellationToken, Result } from "../common"; import { Token } from "../language"; import { LexError } from "."; import { LexSettings } from "./lexSettings"; export type TriedLex = Result; export type ErrorLineMap = Map; export type TLine = TouchedLine | UntouchedLine | TouchedWithErrorLine | ErrorLine; export type TErrorLine = ErrorLine | TouchedWithErrorLine; export declare enum LineKind { Error = "Error", Touched = "Touched", TouchedWithError = "TouchedWithError", Untouched = "Untouched" } export declare enum LineMode { Comment = "Comment", Default = "Default", QuotedIdentifier = "QuotedIdentifier", Text = "Text" } export interface State { readonly lines: ReadonlyArray; readonly locale: string; readonly cancellationToken: ICancellationToken | undefined; readonly isTypeDirectiveAllowed: boolean; } export interface ILexerLine { readonly kind: LineKind; readonly text: string; readonly lineTerminator: string; readonly lineModeStart: LineMode; readonly lineModeEnd: LineMode; readonly tokens: ReadonlyArray; } export interface ErrorLine extends ILexerLine { readonly kind: LineKind.Error; readonly error: LexError.TLexError; } export interface TouchedLine extends ILexerLine { readonly kind: LineKind.Touched; } export interface TouchedWithErrorLine extends ILexerLine { readonly kind: LineKind.TouchedWithError; readonly error: LexError.TLexError; } export interface UntouchedLine extends ILexerLine { readonly kind: LineKind.Untouched; } export interface Range { readonly start: RangePosition; readonly end: RangePosition; } export interface RangePosition { readonly lineNumber: number; readonly lineCodeUnit: number; } export declare function tryLex(settings: LexSettings, text: string): TriedLex; export declare function tryAppendLine(state: State, text: string, lineTerminator: string): TriedLex; export declare function tryUpdateLine(state: State, lineNumber: number, text: string): TriedLex; export declare function tryUpdateRange(state: State, range: Range, text: string): TriedLex; export declare function tryDeleteLine(state: State, lineNumber: number): TriedLex; export declare function equalStates(leftState: State, rightState: State): boolean; export declare function equalLines(leftLines: ReadonlyArray, rightLines: ReadonlyArray): boolean; export declare function equalTokens(leftToken: Token.LineToken, rightToken: Token.LineToken): boolean; export declare function isErrorState(state: State): boolean; export declare function isErrorLine(line: TLine): line is TErrorLine; export declare function errorLineMap(state: State): ErrorLineMap | undefined;