UNPKG

capsule-lint

Version:
118 lines (117 loc) 3.45 kB
export interface FilePosition { offset: number; line: number; column: number; } export interface FileRange { start: FilePosition; end: FilePosition; source: string; } export interface LiteralExpectation { type: "literal"; text: string; ignoreCase: boolean; } export interface ClassParts extends Array<string | ClassParts> { } export interface ClassExpectation { type: "class"; parts: ClassParts; inverted: boolean; ignoreCase: boolean; } export interface AnyExpectation { type: "any"; } export interface EndExpectation { type: "end"; } export interface OtherExpectation { type: "other"; description: string; } export type Expectation = LiteralExpectation | ClassExpectation | AnyExpectation | EndExpectation | OtherExpectation; declare class _PeggySyntaxError extends Error { static buildMessage(expected: Expectation[], found: string | null): string; message: string; expected: Expectation[]; found: string | null; location: FileRange; name: string; constructor(message: string, expected: Expectation[], found: string | null, location: FileRange); format(sources: { source?: any; text: string; }[]): string; } export interface TraceEvent { type: string; rule: string; result?: any; location: FileRange; } export interface ParseOptions { filename?: string; startRule?: "start"; tracer?: any; [key: string]: any; } export type ParseFunction = <Options extends ParseOptions>(input: string, options?: Options) => Options extends { startRule: infer StartRule; } ? StartRule extends "start" ? Start : Start : Start; export declare const parse: ParseFunction; export declare const PeggySyntaxError: typeof _PeggySyntaxError; export type PeggySyntaxError = _PeggySyntaxError; export type Start = (If | List | Assign | Tag | Text)[]; export type Text = string; export type Char = string; export type Tag = string; export type If = Openif | Elseif | Else | Endif; export type Openif = string; export type Elseif = string; export type Else = "<#else>"; export type Endif = "</#if>"; export type List = Openlist | Endlist; export type Openlist = string; export type Endlist = "</#list>"; export type Assign = string; export type TagExpression = any; export type Expression = string; export type UnsafeExpression = [ "!" | null, Variable, [ _, UnsafeOperator, _, Expression ][] ]; export type SafeExpression = [ "!" | null, Variable, [ _, SafeOperator, _, Expression ][] ]; export type Variable = string; export type VariableNotation = ([".", Varname] | ArrayExpression | ModifierExpression | Args)[]; export type ArrayExpression = ["[", Expression, "]"]; export type ModifierExpression = ["?", Modifier, Args | null]; export type Modifier = Varname; export type Args = ["(", Arg | null, [Comma, Arg][], ")"]; export type Arg = [_, Expression, _]; export type SafeOperator = "<" | "gt" | "&gt;" | "gte" | "&gte;" | "lt" | "&lt;" | "lte" | "&lte;" | "=" | "==" | "<=" | "!=" | "+" | "-" | "/" | "*" | "&&" | "||"; export type UnsafeOperator = SafeOperator | ">" | ">="; export type Number_1 = string; export type EncapsulatedString = string; export type Varname = string; export type HtmlEntity = string; export type Comma = [_, ",", _]; export type RequiredWhitespace = string; export type _ = string; export {};