messageformat
Version:
Intl.MessageFormat / Unicode MessageFormat 2 parser, runtime and polyfill
20 lines (19 loc) • 787 B
TypeScript
import { MessageDataModelError, MessageSyntaxError } from '../errors.ts';
import type * as CST from './types.ts';
export declare class ParseContext {
readonly errors: MessageSyntaxError[];
readonly resource: boolean;
readonly source: string;
constructor(source: string, opt?: {
resource?: boolean;
});
onError(type: Exclude<typeof MessageSyntaxError.prototype.type, 'missing-syntax' | typeof MessageDataModelError.prototype.type>, start: number, end: number): void;
onError(type: 'missing-syntax', start: number, char: string): void;
}
/**
* Parse the string syntax representation of a message into
* its corresponding {@link CST} representation.
*/
export declare function parseCST(source: string, opt?: {
resource?: boolean;
}): CST.Message;