MCPcopy Create free account
hub / github.com/effect-app/libs / getParser

Method getParser

repos/effect/packages/effect/src/SchemaAST.ts:1645–1715  ·  view source on GitHub ↗

@internal

(recur: (ast: AST) => SchemaParser.Parser)

Source from the content-addressed store, hash-verified

1643 /** @internal */
1644 getExpected(): string {
1645 return globalThis.String(this.symbol)
1646 }
1647}
1648
1649/**
1650 * The set of primitive types that can appear as a {@link Literal} value.
1651 *
1652 * @see {@link Literal}
1653 *
1654 * @category models
1655 * @since 3.10.0
1656 */
1657export type LiteralValue = string | number | boolean | bigint
1658
1659/**
1660 * AST node matching an exact primitive value (string, number, boolean, or
1661 * bigint).
1662 *
1663 * **Details**
1664 *
1665 * Parsing succeeds only when the input is strictly equal (`===`) to the
1666 * stored `literal`, preserving the input value. Both `0` and `-0` are accepted
1667 * by either zero literal, and parsing preserves the input's sign. Numeric
1668 * literals must be finite. `Infinity`, `-Infinity`, and `NaN` are rejected at
1669 * construction time.
1670 *
1671 * **Example** (Creating a literal AST)
1672 *
1673 * ```ts import.meta.vitest
1674 * import { SchemaAST } from "effect"
1675 *
1676 * const ast = new SchemaAST.Literal("active")
1677 * ast.literal // => "active"
1678 * ```
1679 *
1680 * @see {@link LiteralValue}
1681 * @see {@link isLiteral}
1682 * @category models
1683 * @since 4.0.0
1684 */
1685export interface Literal extends ASTNode {
1686 readonly _tag: "Literal"
1687 readonly literal: LiteralValue
1688 /** @internal */
1689
1690 getParser(): SchemaParser.Parser
1691 /** @internal */
1692
1693 matchPart(s: string, _options: ParseOptions): LiteralValue | undefined
1694 /** @internal */
1695
1696 toCodecJson(): AST
1697 /** @internal */
1698
1699 toCodecStringTree(): AST
1700 /** @internal */
1701
1702 getExpected(): string

Callers

nothing calls this directly

Calls 7

resolveTailThresholdFunction · 0.85
resolveConcurrencyFunction · 0.85
pushMethod · 0.80
someMethod · 0.80
recurFunction · 0.70
mapMethod · 0.65
failMethod · 0.45

Tested by

no test coverage detected