/** * Tokenizer results. */ export interface ILexToken { type: 'OPEN' | 'CLOSE' | 'REGEX' | 'NAME' | 'CHAR' | 'ESCAPED_CHAR' | 'OTHER_MODIFIER' | 'ASTERISK' | 'END' | 'INVALID_CHAR'; index: number; value: string; } export declare enum Modifier { kZeroOrMore = 0, kOptional = 1, kOneOrMore = 2, kNone = 3 } export declare enum PartType { kFullWildcard = 0, kSegmentWildcard = 1, kRegex = 2, kFixed = 3 } export declare class Part { type: PartType; name: string; prefix: string; value: string; suffix: string; modifier: Modifier; constructor(type: PartType, name: string, prefix: string, value: string, suffix: string, modifier: Modifier); hasCustomName(): boolean; } /** * Tokenize input string. */ export declare function lexer(str: string, lenient?: boolean): Array; /** * Callback type that is invoked for every plain text part of the pattern. * This is intended to be used to apply URL canonicalization to the pattern * itself. This is different from the encode callback used to encode group * values passed to compile, match, etc. */ type EncodePartCallback = (value: string) => string; export interface ParseOptions { /** * Set the default delimiter for repeat parameters. (default: `'/'`) */ delimiter?: string; /** * List of characters to automatically consider prefixes when parsing. */ prefixes?: string; /** * Encoding callback to apply to each plaintext part of the pattern. */ encodePart?: EncodePartCallback; } /** * Parse a string for the raw tokens. */ export declare function parse(str: string, options?: ParseOptions): Array; /** * Create a path regexp from string input. */ export declare function stringToRegexp(path: string, names?: Array, options?: Options & ParseOptions): RegExp; export interface Options { /** * When `true` the regexp will be case insensitive. (default: `false`) */ ignoreCase?: boolean; /** * When `true` the regexp won't allow an optional trailing delimiter to match. (default: `false`) */ strict?: boolean; /** * When `true` the regexp will match to the end of the string. (default: `true`) */ end?: boolean; /** * When `true` the regexp will match from the beginning of the string. (default: `true`) */ start?: boolean; /** * Sets the final character for non-ending optimistic matches. (default: `/`) */ delimiter?: string; /** * List of characters that can also be "end" characters. */ endsWith?: string; /** * Encode path tokens for use in the `RegExp`. */ encode?: (value: string) => string; } export declare function modifierToString(modifier: Modifier): "" | "*" | "+" | "?"; /** * Expose a function for taking tokens and returning a RegExp. */ export declare function partsToRegexp(parts: Array, names?: Array, options?: Options): RegExp; export {}; //# sourceMappingURL=PathToRegexp.d.ts.map