parjs
Version:
Library for building parsers using combinators.
31 lines • 1.03 kB
TypeScript
import type { Parjser } from "./parjser";
import type { CombinatorInput } from "./combinated";
/** A {@link Parjser} or a literal value convertible to a {@link Parjser}. */
/**
* @private Should Not be used from user code. Used to implement implicit parser literals.
* @type {symbol}
*/
export declare const convertibleSymbol: unique symbol;
/**
* A literal type which is implicitly convertible to a parser. This normally includes the `string`
* and `RegExp` types.
*/
export interface ConvertibleScalar<T> {
[convertibleSymbol](): Parjser<T>;
}
declare global {
interface String {
[convertibleSymbol](): Parjser<string>;
}
interface RegExp {
[convertibleSymbol](): Parjser<string[]>;
}
}
/**
* Either a Parjser or a scalar value convertible to one.
*
* @module parjs
*/
export type ImplicitParjser<T> = Parjser<T> | ConvertibleScalar<T>;
export declare function wrapImplicit<V>(scalarOrParjser: ImplicitParjser<V>): CombinatorInput<V>;
//# sourceMappingURL=wrap-implicit.d.ts.map