module /** */ import { Parjser } from "./parjser" ; import { string } from "./parsers/string" ; import { regexp } from "./parsers/regexp" ; /**
 * A  Parjser or a literal value convertible to a  Parjser .
  private type { symbol } export const convertibleSymbol = Symbol ( "ParjsConvertibleLiteral" ) ; /**
 * 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 [ ] > ; } } module export type ImplicitParjser < T > = Parjser < T > | ConvertibleScalar < T > ; /**
 * A helper for working with implicit parsers.
 */ export namespace ScalarConverter { param scalarOrParjser export function convert < V > ( scalarOrParjser ) { if ( typeof scalarOrParjser === "string" ) { return string ( scalarOrParjser ) as any ; } else if ( scalarOrParjser instanceof RegExp ) { return regexp ( scalarOrParjser ) as any ; } else { return scalarOrParjser as Parjser < V > ; } } }