UNPKG

@launchmenu/core

Version:

An environment for visual keyboard controlled applets

48 lines 2.15 kB
import { EmbeddedActionsParser, IRecognitionException, ILexingError } from "chevrotain"; import { IHighlighter } from "./_types/IHighlighter"; import { IHighlightMultiModeLexerDefinition } from "./_types/IHighlightMultiModeLexerDefinition"; import { IHighlightTokenType } from "./_types/IHighlightTokenType"; import { HighlightLexer } from "./HighlightLexer"; import { IHighlightNode } from "./_types/IHighlightNode"; import { IHighlightError } from "./_types/IHighlightError"; import { IHighlightParserConfig } from "./_types/IHighlightParserConfig"; export * from "chevrotain"; export declare abstract class HighlightParser<T> extends EmbeddedActionsParser implements IHighlighter { protected lexer: HighlightLexer; protected config: IHighlightParserConfig | undefined; /** * Creates a new highlight parser * @param vocabulary A data structure containing all the Tokens used by the Parser. * @param config The parser's configuration */ constructor(vocabulary: IHighlightTokenType[] | IHighlightMultiModeLexerDefinition, config?: IHighlightParserConfig); /** * Extracts the highlight data from the given syntax * @param syntax The syntax to highlight * @returns The highlight nodes and possibly syntax and or semantic errors */ highlight(syntax: string): { nodes: IHighlightNode[]; errors: IHighlightError[]; }; /** * Maps a recognition error to a highlight error * @param syntax The syntax the error corresponds to * @param error The error to map * @returns The highlight error */ static mapError(syntax: string, { message, name, token }: IRecognitionException): IHighlightError; /** * Executes the parser and retrieves the result * @param syntax The syntax to be parsed * @returns The parsing result or possibly an error */ execute(syntax: string): { errors: undefined; result: T; } | { errors: (IRecognitionException | ILexingError)[]; result: T | undefined; }; } //# sourceMappingURL=HighlightParser.d.ts.map