Comparing version 0.6.8 to 0.6.9
@@ -16,2 +16,7 @@ # Changelog | ||
# 0.6.9 | ||
- **New Feature** | ||
- expose modules without lib/es6 prefix, closes #32 (@gcanti) | ||
# 0.6.8 | ||
@@ -18,0 +23,0 @@ |
@@ -1,2 +0,2 @@ | ||
import * as P from './Parser'; | ||
import * as P from './Parser' | ||
/** | ||
@@ -6,3 +6,3 @@ * @category model | ||
*/ | ||
export declare type Char = string; | ||
export declare type Char = string | ||
/** | ||
@@ -15,3 +15,3 @@ * The `char` parser constructor returns a parser which matches only the | ||
*/ | ||
export declare const char: (c: Char) => P.Parser<Char, Char>; | ||
export declare const char: (c: Char) => P.Parser<Char, Char> | ||
/** | ||
@@ -24,3 +24,3 @@ * The `notChar` parser constructor makes a parser which will match any | ||
*/ | ||
export declare const notChar: (c: Char) => P.Parser<Char, Char>; | ||
export declare const notChar: (c: Char) => P.Parser<Char, Char> | ||
/** | ||
@@ -32,3 +32,3 @@ * Matches any one character from the provided string. | ||
*/ | ||
export declare const oneOf: (s: string) => P.Parser<Char, Char>; | ||
export declare const oneOf: (s: string) => P.Parser<Char, Char> | ||
/** | ||
@@ -40,3 +40,3 @@ * Matches a single character which isn't a character from the provided string. | ||
*/ | ||
export declare const notOneOf: (s: string) => P.Parser<Char, Char>; | ||
export declare const notOneOf: (s: string) => P.Parser<Char, Char> | ||
/** | ||
@@ -49,3 +49,3 @@ * Takes a `Parser<Char, string>` and matches it zero or more times, returning | ||
*/ | ||
export declare const many: (parser: P.Parser<Char, Char>) => P.Parser<Char, string>; | ||
export declare const many: (parser: P.Parser<Char, Char>) => P.Parser<Char, string> | ||
/** | ||
@@ -58,3 +58,3 @@ * Takes a `Parser<Char, string>` and matches it one or more times, returning | ||
*/ | ||
export declare const many1: (parser: P.Parser<Char, Char>) => P.Parser<Char, string>; | ||
export declare const many1: (parser: P.Parser<Char, Char>) => P.Parser<Char, string> | ||
/** | ||
@@ -66,3 +66,3 @@ * Matches a single digit. | ||
*/ | ||
export declare const digit: P.Parser<Char, Char>; | ||
export declare const digit: P.Parser<Char, Char> | ||
/** | ||
@@ -74,3 +74,3 @@ * Matches a single whitespace character. | ||
*/ | ||
export declare const space: P.Parser<Char, Char>; | ||
export declare const space: P.Parser<Char, Char> | ||
/** | ||
@@ -82,3 +82,3 @@ * Matches a single letter, digit or underscore character. | ||
*/ | ||
export declare const alphanum: P.Parser<Char, Char>; | ||
export declare const alphanum: P.Parser<Char, Char> | ||
/** | ||
@@ -89,3 +89,3 @@ * Matches a single ASCII letter. | ||
*/ | ||
export declare const letter: P.Parser<string, string>; | ||
export declare const letter: P.Parser<string, string> | ||
/** | ||
@@ -97,3 +97,3 @@ * Matches a single upper case ASCII letter. | ||
*/ | ||
export declare const upper: P.Parser<Char, Char>; | ||
export declare const upper: P.Parser<Char, Char> | ||
/** | ||
@@ -105,3 +105,3 @@ * Matches a single lower case ASCII letter. | ||
*/ | ||
export declare const lower: P.Parser<Char, Char>; | ||
export declare const lower: P.Parser<Char, Char> | ||
/** | ||
@@ -113,3 +113,3 @@ * Matches a single character which isn't a digit. | ||
*/ | ||
export declare const notDigit: P.Parser<Char, Char>; | ||
export declare const notDigit: P.Parser<Char, Char> | ||
/** | ||
@@ -121,3 +121,3 @@ * Matches a single character which isn't whitespace. | ||
*/ | ||
export declare const notSpace: P.Parser<Char, Char>; | ||
export declare const notSpace: P.Parser<Char, Char> | ||
/** | ||
@@ -129,3 +129,3 @@ * Matches a single character which isn't a letter, digit or underscore. | ||
*/ | ||
export declare const notAlphanum: P.Parser<Char, Char>; | ||
export declare const notAlphanum: P.Parser<Char, Char> | ||
/** | ||
@@ -137,3 +137,3 @@ * Matches a single character which isn't an ASCII letter. | ||
*/ | ||
export declare const notLetter: P.Parser<Char, Char>; | ||
export declare const notLetter: P.Parser<Char, Char> | ||
/** | ||
@@ -145,3 +145,3 @@ * Matches a single character which isn't an upper case ASCII letter. | ||
*/ | ||
export declare const notUpper: P.Parser<Char, Char>; | ||
export declare const notUpper: P.Parser<Char, Char> | ||
/** | ||
@@ -153,2 +153,2 @@ * Matches a single character which isn't a lower case ASCII letter. | ||
*/ | ||
export declare const notLower: P.Parser<Char, Char>; | ||
export declare const notLower: P.Parser<Char, Char> |
/** | ||
* @since 0.6.0 | ||
*/ | ||
import { Either } from 'fp-ts/es6/Either'; | ||
import { Char } from './char'; | ||
import { Parser } from './Parser'; | ||
import { Either } from 'fp-ts/es6/Either' | ||
import { Char } from './char' | ||
import { Parser } from './Parser' | ||
/** | ||
@@ -12,2 +12,2 @@ * Returns a pretty printed error message using `@babel/code-frame` | ||
*/ | ||
export declare const run: <A>(p: Parser<Char, A>, source: string) => Either<string, A>; | ||
export declare const run: <A>(p: Parser<Char, A>, source: string) => Either<string, A> |
/** | ||
* @since 0.6.0 | ||
*/ | ||
import * as char from './char'; | ||
import * as parser from './Parser'; | ||
import * as parseResult from './ParseResult'; | ||
import * as stream from './Stream'; | ||
import * as string from './string'; | ||
export { | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
char, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
parser, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
parseResult, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
stream, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
string }; | ||
import * as char from './char' | ||
import * as parser from './Parser' | ||
import * as parseResult from './ParseResult' | ||
import * as stream from './Stream' | ||
import * as string from './string' | ||
export { | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
char, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
parser, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
parseResult, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
stream, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
string | ||
} |
/** | ||
* @since 0.6.0 | ||
*/ | ||
import { Alt2 } from 'fp-ts/es6/Alt'; | ||
import { Alternative2 } from 'fp-ts/es6/Alternative'; | ||
import { Applicative2 } from 'fp-ts/es6/Applicative'; | ||
import { Functor2 } from 'fp-ts/es6/Functor'; | ||
import { Monad2 } from 'fp-ts/es6/Monad'; | ||
import { Monoid } from 'fp-ts/es6/Monoid'; | ||
import * as NEA from 'fp-ts/es6/NonEmptyArray'; | ||
import { Semigroup } from 'fp-ts/es6/Semigroup'; | ||
import { Predicate, Lazy } from 'fp-ts/es6/function'; | ||
import { ParseResult } from './ParseResult'; | ||
import { Stream } from './Stream'; | ||
import { Alt2 } from 'fp-ts/es6/Alt' | ||
import { Alternative2 } from 'fp-ts/es6/Alternative' | ||
import { Applicative2 } from 'fp-ts/es6/Applicative' | ||
import { Functor2 } from 'fp-ts/es6/Functor' | ||
import { Monad2 } from 'fp-ts/es6/Monad' | ||
import { Monoid } from 'fp-ts/es6/Monoid' | ||
import * as NEA from 'fp-ts/es6/NonEmptyArray' | ||
import { Semigroup } from 'fp-ts/es6/Semigroup' | ||
import { Predicate, Lazy } from 'fp-ts/es6/function' | ||
import { ParseResult } from './ParseResult' | ||
import { Stream } from './Stream' | ||
/** | ||
@@ -20,3 +20,3 @@ * @category model | ||
export interface Parser<I, A> { | ||
(i: Stream<I>): ParseResult<I, A>; | ||
(i: Stream<I>): ParseResult<I, A> | ||
} | ||
@@ -32,3 +32,3 @@ /** | ||
*/ | ||
export declare const succeed: <I, A>(a: A) => Parser<I, A>; | ||
export declare const succeed: <I, A>(a: A) => Parser<I, A> | ||
/** | ||
@@ -40,3 +40,3 @@ * The `fail` parser will just fail immediately without consuming any input | ||
*/ | ||
export declare const fail: <I, A = never>() => Parser<I, A>; | ||
export declare const fail: <I, A = never>() => Parser<I, A> | ||
/** | ||
@@ -49,3 +49,3 @@ * The `failAt` parser will fail immediately without consuming any input, | ||
*/ | ||
export declare const failAt: <I, A = never>(i: Stream<I>) => Parser<I, A>; | ||
export declare const failAt: <I, A = never>(i: Stream<I>) => Parser<I, A> | ||
/** | ||
@@ -60,3 +60,3 @@ * The `sat` parser constructor takes a predicate function, and will consume | ||
*/ | ||
export declare const sat: <I>(predicate: Predicate<I>) => Parser<I, I>; | ||
export declare const sat: <I>(predicate: Predicate<I>) => Parser<I, I> | ||
/** | ||
@@ -70,3 +70,3 @@ * A parser combinator which returns the provided parser unchanged, except | ||
*/ | ||
export declare const expected: <I, A>(p: Parser<I, A>, message: string) => Parser<I, A>; | ||
export declare const expected: <I, A>(p: Parser<I, A>, message: string) => Parser<I, A> | ||
/** | ||
@@ -79,3 +79,3 @@ * The `item` parser consumes a single value, regardless of what it is, | ||
*/ | ||
export declare const item: <I>() => Parser<I, I>; | ||
export declare const item: <I>() => Parser<I, I> | ||
/** | ||
@@ -89,3 +89,3 @@ * The `cut` parser combinator takes a parser and produces a new parser for | ||
*/ | ||
export declare const cut: <I, A>(p: Parser<I, A>) => Parser<I, A>; | ||
export declare const cut: <I, A>(p: Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -99,3 +99,3 @@ * Takes two parsers `p1` and `p2`, returning a parser which will match | ||
*/ | ||
export declare const cutWith: <I, A, B>(p1: Parser<I, A>, p2: Parser<I, B>) => Parser<I, B>; | ||
export declare const cutWith: <I, A, B>(p1: Parser<I, A>, p2: Parser<I, B>) => Parser<I, B> | ||
/** | ||
@@ -113,3 +113,3 @@ * The `seq` combinator takes a parser, and a function which will receive | ||
*/ | ||
export declare const seq: <I, A, B>(fa: Parser<I, A>, f: (a: A) => Parser<I, B>) => Parser<I, B>; | ||
export declare const seq: <I, A, B>(fa: Parser<I, A>, f: (a: A) => Parser<I, B>) => Parser<I, B> | ||
/** | ||
@@ -128,3 +128,3 @@ * The `either` combinator takes two parsers, runs the first on the input | ||
*/ | ||
export declare const either: <I, A>(p: Parser<I, A>, f: () => Parser<I, A>) => Parser<I, A>; | ||
export declare const either: <I, A>(p: Parser<I, A>, f: () => Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -140,3 +140,3 @@ * Converts a parser into one which will return the point in the stream where | ||
*/ | ||
export declare const withStart: <I, A>(p: Parser<I, A>) => Parser<I, [A, Stream<I>]>; | ||
export declare const withStart: <I, A>(p: Parser<I, A>) => Parser<I, [A, Stream<I>]> | ||
/** | ||
@@ -150,3 +150,3 @@ * The `maybe` parser combinator creates a parser which will run the provided | ||
*/ | ||
export declare const maybe: <A>(M: Monoid<A>) => <I>(p: Parser<I, A>) => Parser<I, A>; | ||
export declare const maybe: <A>(M: Monoid<A>) => <I>(p: Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -158,3 +158,3 @@ * Matches the end of the stream. | ||
*/ | ||
export declare const eof: <I>() => Parser<I, void>; | ||
export declare const eof: <I>() => Parser<I, void> | ||
/** | ||
@@ -172,3 +172,3 @@ * The `many` combinator takes a parser, and returns a new parser which will | ||
*/ | ||
export declare const many: <I, A>(p: Parser<I, A>) => Parser<I, A[]>; | ||
export declare const many: <I, A>(p: Parser<I, A>) => Parser<I, A[]> | ||
/** | ||
@@ -182,3 +182,3 @@ * The `many1` combinator is just like the `many` combinator, except it | ||
*/ | ||
export declare const many1: <I, A>(p: Parser<I, A>) => Parser<I, NEA.NonEmptyArray<A>>; | ||
export declare const many1: <I, A>(p: Parser<I, A>) => Parser<I, NEA.NonEmptyArray<A>> | ||
/** | ||
@@ -192,3 +192,3 @@ * Matches the provided parser `p` zero or more times, but requires the | ||
*/ | ||
export declare const sepBy: <I, A, B>(sep: Parser<I, A>, p: Parser<I, B>) => Parser<I, B[]>; | ||
export declare const sepBy: <I, A, B>(sep: Parser<I, A>, p: Parser<I, B>) => Parser<I, B[]> | ||
/** | ||
@@ -202,3 +202,3 @@ * Matches the provided parser `p` one or more times, but requires the | ||
*/ | ||
export declare const sepBy1: <I, A, B>(sep: Parser<I, A>, p: Parser<I, B>) => Parser<I, NEA.NonEmptyArray<B>>; | ||
export declare const sepBy1: <I, A, B>(sep: Parser<I, A>, p: Parser<I, B>) => Parser<I, NEA.NonEmptyArray<B>> | ||
/** | ||
@@ -211,3 +211,3 @@ * Like `sepBy1`, but cut on the separator, so that matching a `sep` not | ||
*/ | ||
export declare const sepByCut: <I, A, B>(sep: Parser<I, A>, p: Parser<I, B>) => Parser<I, NEA.NonEmptyArray<B>>; | ||
export declare const sepByCut: <I, A, B>(sep: Parser<I, A>, p: Parser<I, B>) => Parser<I, NEA.NonEmptyArray<B>> | ||
/** | ||
@@ -221,3 +221,3 @@ * Matches the provided parser `p` that occurs between the provided `left` and `right` parsers. | ||
*/ | ||
export declare const between: <I, A>(left: Parser<I, A>, right: Parser<I, A>) => <B>(p: Parser<I, B>) => Parser<I, B>; | ||
export declare const between: <I, A>(left: Parser<I, A>, right: Parser<I, A>) => <B>(p: Parser<I, B>) => Parser<I, B> | ||
/** | ||
@@ -229,3 +229,3 @@ * Matches the provided parser `p` that is surrounded by the `bound` parser. Shortcut for `between(bound, bound)`. | ||
*/ | ||
export declare const surroundedBy: <I, A>(bound: Parser<I, A>) => <B>(p: Parser<I, B>) => Parser<I, B>; | ||
export declare const surroundedBy: <I, A>(bound: Parser<I, A>) => <B>(p: Parser<I, B>) => Parser<I, B> | ||
/** | ||
@@ -251,3 +251,3 @@ * Takes a `Parser` and tries to match it without consuming any input. | ||
*/ | ||
export declare const lookAhead: <I, A>(p: Parser<I, A>) => Parser<I, A>; | ||
export declare const lookAhead: <I, A>(p: Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -269,3 +269,3 @@ * Takes a `Predicate` and continues parsing until the given `Predicate` is satisfied. | ||
*/ | ||
export declare const takeUntil: <I>(predicate: Predicate<I>) => Parser<I, Array<I>>; | ||
export declare const takeUntil: <I>(predicate: Predicate<I>) => Parser<I, Array<I>> | ||
/** | ||
@@ -275,3 +275,3 @@ * @category Functor | ||
*/ | ||
export declare const map: <A, B>(f: (a: A) => B) => <I>(fa: Parser<I, A>) => Parser<I, B>; | ||
export declare const map: <A, B>(f: (a: A) => B) => <I>(fa: Parser<I, A>) => Parser<I, B> | ||
/** | ||
@@ -281,3 +281,3 @@ * @category Apply | ||
*/ | ||
export declare const ap: <I, A>(fa: Parser<I, A>) => <B>(fab: Parser<I, (a: A) => B>) => Parser<I, B>; | ||
export declare const ap: <I, A>(fa: Parser<I, A>) => <B>(fab: Parser<I, (a: A) => B>) => Parser<I, B> | ||
/** | ||
@@ -287,3 +287,3 @@ * @category Apply | ||
*/ | ||
export declare const apFirst: <I, B>(fb: Parser<I, B>) => <A>(fa: Parser<I, A>) => Parser<I, A>; | ||
export declare const apFirst: <I, B>(fb: Parser<I, B>) => <A>(fa: Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -293,3 +293,3 @@ * @category Apply | ||
*/ | ||
export declare const apSecond: <I, B>(fb: Parser<I, B>) => <A>(fa: Parser<I, A>) => Parser<I, B>; | ||
export declare const apSecond: <I, B>(fb: Parser<I, B>) => <A>(fa: Parser<I, A>) => Parser<I, B> | ||
/** | ||
@@ -299,3 +299,3 @@ * @category Applicative | ||
*/ | ||
export declare const of: <I, A>(a: A) => Parser<I, A>; | ||
export declare const of: <I, A>(a: A) => Parser<I, A> | ||
/** | ||
@@ -305,3 +305,3 @@ * @category Monad | ||
*/ | ||
export declare const chain: <I, A, B>(f: (a: A) => Parser<I, B>) => (ma: Parser<I, A>) => Parser<I, B>; | ||
export declare const chain: <I, A, B>(f: (a: A) => Parser<I, B>) => (ma: Parser<I, A>) => Parser<I, B> | ||
/** | ||
@@ -311,3 +311,3 @@ * @category Monad | ||
*/ | ||
export declare const chainFirst: <I, A, B>(f: (a: A) => Parser<I, B>) => (ma: Parser<I, A>) => Parser<I, A>; | ||
export declare const chainFirst: <I, A, B>(f: (a: A) => Parser<I, B>) => (ma: Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -317,3 +317,3 @@ * @category Alt | ||
*/ | ||
export declare const alt: <I, A>(that: Lazy<Parser<I, A>>) => (fa: Parser<I, A>) => Parser<I, A>; | ||
export declare const alt: <I, A>(that: Lazy<Parser<I, A>>) => (fa: Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -323,3 +323,3 @@ * @category Monad | ||
*/ | ||
export declare const flatten: <I, A>(mma: Parser<I, Parser<I, A>>) => Parser<I, A>; | ||
export declare const flatten: <I, A>(mma: Parser<I, Parser<I, A>>) => Parser<I, A> | ||
/** | ||
@@ -329,3 +329,3 @@ * @category Alternative | ||
*/ | ||
export declare const zero: <I, A>() => Parser<I, A>; | ||
export declare const zero: <I, A>() => Parser<I, A> | ||
/** | ||
@@ -335,3 +335,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "Parser"; | ||
export declare const URI = 'Parser' | ||
/** | ||
@@ -341,7 +341,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/es6/HKT' { | ||
interface URItoKind2<E, A> { | ||
Parser: Parser<E, A>; | ||
} | ||
interface URItoKind2<E, A> { | ||
Parser: Parser<E, A> | ||
} | ||
} | ||
@@ -352,3 +352,3 @@ /** | ||
*/ | ||
export declare const getSemigroup: <I, A>(S: Semigroup<A>) => Semigroup<Parser<I, A>>; | ||
export declare const getSemigroup: <I, A>(S: Semigroup<A>) => Semigroup<Parser<I, A>> | ||
/** | ||
@@ -358,3 +358,3 @@ * @category instances | ||
*/ | ||
export declare const getMonoid: <I, A>(M: Monoid<A>) => Monoid<Parser<I, A>>; | ||
export declare const getMonoid: <I, A>(M: Monoid<A>) => Monoid<Parser<I, A>> | ||
/** | ||
@@ -364,3 +364,3 @@ * @category instances | ||
*/ | ||
export declare const Functor: Functor2<URI>; | ||
export declare const Functor: Functor2<URI> | ||
/** | ||
@@ -370,3 +370,3 @@ * @category instances | ||
*/ | ||
export declare const Applicative: Applicative2<URI>; | ||
export declare const Applicative: Applicative2<URI> | ||
/** | ||
@@ -376,3 +376,3 @@ * @category instances | ||
*/ | ||
export declare const Monad: Monad2<URI>; | ||
export declare const Monad: Monad2<URI> | ||
/** | ||
@@ -382,3 +382,3 @@ * @category instances | ||
*/ | ||
export declare const Alt: Alt2<URI>; | ||
export declare const Alt: Alt2<URI> | ||
/** | ||
@@ -388,3 +388,3 @@ * @category instances | ||
*/ | ||
export declare const Alternative: Alternative2<URI>; | ||
export declare const Alternative: Alternative2<URI> | ||
/** | ||
@@ -394,10 +394,13 @@ * @category instances | ||
*/ | ||
export declare const parser: Monad2<URI> & Alternative2<URI>; | ||
export declare const parser: Monad2<URI> & Alternative2<URI> | ||
/** | ||
* @since 0.6.8 | ||
*/ | ||
export declare const bindTo: <N extends string>(name: N) => <I, A>(fa: Parser<I, A>) => Parser<I, { [K in N]: A; }>; | ||
export declare const bindTo: <N extends string>(name: N) => <I, A>(fa: Parser<I, A>) => Parser<I, { [K in N]: A }> | ||
/** | ||
* @since 0.6.8 | ||
*/ | ||
export declare const bind: <N extends string, I, A, B>(name: Exclude<N, keyof A>, f: (a: A) => Parser<I, B>) => (fa: Parser<I, A>) => Parser<I, { [K in N | keyof A]: K extends keyof A ? A[K] : B; }>; | ||
export declare const bind: <N extends string, I, A, B>( | ||
name: Exclude<N, keyof A>, | ||
f: (a: A) => Parser<I, B> | ||
) => (fa: Parser<I, A>) => Parser<I, { [K in N | keyof A]: K extends keyof A ? A[K] : B }> |
@@ -1,3 +0,3 @@ | ||
import { Either } from 'fp-ts/es6/Either'; | ||
import { Stream } from './Stream'; | ||
import { Either } from 'fp-ts/es6/Either' | ||
import { Stream } from './Stream' | ||
/** | ||
@@ -8,5 +8,5 @@ * @category model | ||
export interface ParseError<I> { | ||
input: Stream<I>; | ||
expected: Array<string>; | ||
fatal: boolean; | ||
input: Stream<I> | ||
expected: Array<string> | ||
fatal: boolean | ||
} | ||
@@ -18,5 +18,5 @@ /** | ||
export interface ParseSuccess<I, A> { | ||
value: A; | ||
next: Stream<I>; | ||
start: Stream<I>; | ||
value: A | ||
next: Stream<I> | ||
start: Stream<I> | ||
} | ||
@@ -27,3 +27,3 @@ /** | ||
*/ | ||
export declare type ParseResult<I, A> = Either<ParseError<I>, ParseSuccess<I, A>>; | ||
export declare type ParseResult<I, A> = Either<ParseError<I>, ParseSuccess<I, A>> | ||
/** | ||
@@ -33,3 +33,3 @@ * @category constructors | ||
*/ | ||
export declare const success: <I, A>(value: A, next: Stream<I>, start: Stream<I>) => ParseResult<I, A>; | ||
export declare const success: <I, A>(value: A, next: Stream<I>, start: Stream<I>) => ParseResult<I, A> | ||
/** | ||
@@ -39,3 +39,7 @@ * @category constructors | ||
*/ | ||
export declare const error: <I, A = never>(input: Stream<I>, expected?: Array<string>, fatal?: boolean) => ParseResult<I, A>; | ||
export declare const error: <I, A = never>( | ||
input: Stream<I>, | ||
expected?: Array<string>, | ||
fatal?: boolean | ||
) => ParseResult<I, A> | ||
/** | ||
@@ -45,3 +49,3 @@ * @category combinators | ||
*/ | ||
export declare const withExpected: <I>(err: ParseError<I>, expected: Array<string>) => ParseError<I>; | ||
export declare const withExpected: <I>(err: ParseError<I>, expected: Array<string>) => ParseError<I> | ||
/** | ||
@@ -51,3 +55,3 @@ * @category combinators | ||
*/ | ||
export declare const escalate: <I>(err: ParseError<I>) => ParseError<I>; | ||
export declare const escalate: <I>(err: ParseError<I>) => ParseError<I> | ||
/** | ||
@@ -57,2 +61,2 @@ * @category combinators | ||
*/ | ||
export declare const extend: <I>(err1: ParseError<I>, err2: ParseError<I>) => ParseError<I>; | ||
export declare const extend: <I>(err1: ParseError<I>, err2: ParseError<I>) => ParseError<I> |
@@ -1,3 +0,3 @@ | ||
import { Eq } from 'fp-ts/es6/Eq'; | ||
import { Option } from 'fp-ts/es6/Option'; | ||
import { Eq } from 'fp-ts/es6/Eq' | ||
import { Option } from 'fp-ts/es6/Option' | ||
/** | ||
@@ -8,4 +8,4 @@ * @category model | ||
export interface Stream<A> { | ||
readonly buffer: Array<A>; | ||
readonly cursor: number; | ||
readonly buffer: Array<A> | ||
readonly cursor: number | ||
} | ||
@@ -16,3 +16,3 @@ /** | ||
*/ | ||
export declare const stream: <A>(buffer: Array<A>, cursor?: number) => Stream<A>; | ||
export declare const stream: <A>(buffer: Array<A>, cursor?: number) => Stream<A> | ||
/** | ||
@@ -22,3 +22,3 @@ * @category destructors | ||
*/ | ||
export declare const get: <A>(s: Stream<A>) => Option<A>; | ||
export declare const get: <A>(s: Stream<A>) => Option<A> | ||
/** | ||
@@ -28,3 +28,3 @@ * @category destructors | ||
*/ | ||
export declare const atEnd: <A>(s: Stream<A>) => boolean; | ||
export declare const atEnd: <A>(s: Stream<A>) => boolean | ||
/** | ||
@@ -34,6 +34,8 @@ * @category destructors | ||
*/ | ||
export declare const getAndNext: <A>(s: Stream<A>) => Option<{ | ||
value: A; | ||
next: Stream<A>; | ||
}>; | ||
export declare const getAndNext: <A>( | ||
s: Stream<A> | ||
) => Option<{ | ||
value: A | ||
next: Stream<A> | ||
}> | ||
/** | ||
@@ -43,2 +45,2 @@ * @category instances | ||
*/ | ||
export declare const getEq: <A>(E: Eq<A>) => Eq<Stream<A>>; | ||
export declare const getEq: <A>(E: Eq<A>) => Eq<Stream<A>> |
/** | ||
* @since 0.6.0 | ||
*/ | ||
import { Foldable, Foldable1 } from 'fp-ts/es6/Foldable'; | ||
import { Functor, Functor1 } from 'fp-ts/es6/Functor'; | ||
import { HKT, Kind, URIS } from 'fp-ts/es6/HKT'; | ||
import * as C from './char'; | ||
import * as P from './Parser'; | ||
import { Foldable, Foldable1 } from 'fp-ts/es6/Foldable' | ||
import { Functor, Functor1 } from 'fp-ts/es6/Functor' | ||
import { HKT, Kind, URIS } from 'fp-ts/es6/HKT' | ||
import * as C from './char' | ||
import * as P from './Parser' | ||
/** | ||
@@ -15,3 +15,3 @@ * Matches the exact string provided. | ||
*/ | ||
export declare const string: (s: string) => P.Parser<C.Char, string>; | ||
export declare const string: (s: string) => P.Parser<C.Char, string> | ||
/** | ||
@@ -23,4 +23,6 @@ * Matches one of a list of strings. | ||
*/ | ||
export declare function oneOf<F extends URIS>(F: Functor1<F> & Foldable1<F>): (ss: Kind<F, string>) => P.Parser<C.Char, string>; | ||
export declare function oneOf<F>(F: Functor<F> & Foldable<F>): (ss: HKT<F, string>) => P.Parser<C.Char, string>; | ||
export declare function oneOf<F extends URIS>( | ||
F: Functor1<F> & Foldable1<F> | ||
): (ss: Kind<F, string>) => P.Parser<C.Char, string> | ||
export declare function oneOf<F>(F: Functor<F> & Foldable<F>): (ss: HKT<F, string>) => P.Parser<C.Char, string> | ||
/** | ||
@@ -30,3 +32,3 @@ * @category destructors | ||
*/ | ||
export declare const fold: <I>(as: Array<P.Parser<I, string>>) => P.Parser<I, string>; | ||
export declare const fold: <I>(as: Array<P.Parser<I, string>>) => P.Parser<I, string> | ||
/** | ||
@@ -36,3 +38,3 @@ * @category combinators | ||
*/ | ||
export declare const maybe: <I>(p: P.Parser<I, string>) => P.Parser<I, string>; | ||
export declare const maybe: <I>(p: P.Parser<I, string>) => P.Parser<I, string> | ||
/** | ||
@@ -45,3 +47,3 @@ * Matches the given parser zero or more times, returning a string of the | ||
*/ | ||
export declare const many: (parser: P.Parser<C.Char, string>) => P.Parser<C.Char, string>; | ||
export declare const many: (parser: P.Parser<C.Char, string>) => P.Parser<C.Char, string> | ||
/** | ||
@@ -54,3 +56,3 @@ * Matches the given parser one or more times, returning a string of the | ||
*/ | ||
export declare const many1: (parser: P.Parser<C.Char, string>) => P.Parser<C.Char, string>; | ||
export declare const many1: (parser: P.Parser<C.Char, string>) => P.Parser<C.Char, string> | ||
/** | ||
@@ -62,3 +64,3 @@ * Matches zero or more whitespace characters. | ||
*/ | ||
export declare const spaces: P.Parser<C.Char, string>; | ||
export declare const spaces: P.Parser<C.Char, string> | ||
/** | ||
@@ -70,3 +72,3 @@ * Matches one or more whitespace characters. | ||
*/ | ||
export declare const spaces1: P.Parser<C.Char, string>; | ||
export declare const spaces1: P.Parser<C.Char, string> | ||
/** | ||
@@ -78,3 +80,3 @@ * Matches zero or more non-whitespace characters. | ||
*/ | ||
export declare const notSpaces: P.Parser<C.Char, string>; | ||
export declare const notSpaces: P.Parser<C.Char, string> | ||
/** | ||
@@ -86,3 +88,3 @@ * Matches one or more non-whitespace characters. | ||
*/ | ||
export declare const notSpaces1: P.Parser<C.Char, string>; | ||
export declare const notSpaces1: P.Parser<C.Char, string> | ||
/** | ||
@@ -92,3 +94,3 @@ * @category combinators | ||
*/ | ||
export declare const int: P.Parser<C.Char, number>; | ||
export declare const int: P.Parser<C.Char, number> | ||
/** | ||
@@ -98,3 +100,3 @@ * @category combinators | ||
*/ | ||
export declare const float: P.Parser<C.Char, number>; | ||
export declare const float: P.Parser<C.Char, number> | ||
/** | ||
@@ -108,2 +110,2 @@ * Parses a double quoted string, with support for escaping double quotes | ||
*/ | ||
export declare const doubleQuotedString: P.Parser<string, String>; | ||
export declare const doubleQuotedString: P.Parser<string, String> |
@@ -1,2 +0,2 @@ | ||
import * as P from './Parser'; | ||
import * as P from './Parser' | ||
/** | ||
@@ -6,3 +6,3 @@ * @category model | ||
*/ | ||
export declare type Char = string; | ||
export declare type Char = string | ||
/** | ||
@@ -15,3 +15,3 @@ * The `char` parser constructor returns a parser which matches only the | ||
*/ | ||
export declare const char: (c: Char) => P.Parser<Char, Char>; | ||
export declare const char: (c: Char) => P.Parser<Char, Char> | ||
/** | ||
@@ -24,3 +24,3 @@ * The `notChar` parser constructor makes a parser which will match any | ||
*/ | ||
export declare const notChar: (c: Char) => P.Parser<Char, Char>; | ||
export declare const notChar: (c: Char) => P.Parser<Char, Char> | ||
/** | ||
@@ -32,3 +32,3 @@ * Matches any one character from the provided string. | ||
*/ | ||
export declare const oneOf: (s: string) => P.Parser<Char, Char>; | ||
export declare const oneOf: (s: string) => P.Parser<Char, Char> | ||
/** | ||
@@ -40,3 +40,3 @@ * Matches a single character which isn't a character from the provided string. | ||
*/ | ||
export declare const notOneOf: (s: string) => P.Parser<Char, Char>; | ||
export declare const notOneOf: (s: string) => P.Parser<Char, Char> | ||
/** | ||
@@ -49,3 +49,3 @@ * Takes a `Parser<Char, string>` and matches it zero or more times, returning | ||
*/ | ||
export declare const many: (parser: P.Parser<Char, Char>) => P.Parser<Char, string>; | ||
export declare const many: (parser: P.Parser<Char, Char>) => P.Parser<Char, string> | ||
/** | ||
@@ -58,3 +58,3 @@ * Takes a `Parser<Char, string>` and matches it one or more times, returning | ||
*/ | ||
export declare const many1: (parser: P.Parser<Char, Char>) => P.Parser<Char, string>; | ||
export declare const many1: (parser: P.Parser<Char, Char>) => P.Parser<Char, string> | ||
/** | ||
@@ -66,3 +66,3 @@ * Matches a single digit. | ||
*/ | ||
export declare const digit: P.Parser<Char, Char>; | ||
export declare const digit: P.Parser<Char, Char> | ||
/** | ||
@@ -74,3 +74,3 @@ * Matches a single whitespace character. | ||
*/ | ||
export declare const space: P.Parser<Char, Char>; | ||
export declare const space: P.Parser<Char, Char> | ||
/** | ||
@@ -82,3 +82,3 @@ * Matches a single letter, digit or underscore character. | ||
*/ | ||
export declare const alphanum: P.Parser<Char, Char>; | ||
export declare const alphanum: P.Parser<Char, Char> | ||
/** | ||
@@ -89,3 +89,3 @@ * Matches a single ASCII letter. | ||
*/ | ||
export declare const letter: P.Parser<string, string>; | ||
export declare const letter: P.Parser<string, string> | ||
/** | ||
@@ -97,3 +97,3 @@ * Matches a single upper case ASCII letter. | ||
*/ | ||
export declare const upper: P.Parser<Char, Char>; | ||
export declare const upper: P.Parser<Char, Char> | ||
/** | ||
@@ -105,3 +105,3 @@ * Matches a single lower case ASCII letter. | ||
*/ | ||
export declare const lower: P.Parser<Char, Char>; | ||
export declare const lower: P.Parser<Char, Char> | ||
/** | ||
@@ -113,3 +113,3 @@ * Matches a single character which isn't a digit. | ||
*/ | ||
export declare const notDigit: P.Parser<Char, Char>; | ||
export declare const notDigit: P.Parser<Char, Char> | ||
/** | ||
@@ -121,3 +121,3 @@ * Matches a single character which isn't whitespace. | ||
*/ | ||
export declare const notSpace: P.Parser<Char, Char>; | ||
export declare const notSpace: P.Parser<Char, Char> | ||
/** | ||
@@ -129,3 +129,3 @@ * Matches a single character which isn't a letter, digit or underscore. | ||
*/ | ||
export declare const notAlphanum: P.Parser<Char, Char>; | ||
export declare const notAlphanum: P.Parser<Char, Char> | ||
/** | ||
@@ -137,3 +137,3 @@ * Matches a single character which isn't an ASCII letter. | ||
*/ | ||
export declare const notLetter: P.Parser<Char, Char>; | ||
export declare const notLetter: P.Parser<Char, Char> | ||
/** | ||
@@ -145,3 +145,3 @@ * Matches a single character which isn't an upper case ASCII letter. | ||
*/ | ||
export declare const notUpper: P.Parser<Char, Char>; | ||
export declare const notUpper: P.Parser<Char, Char> | ||
/** | ||
@@ -153,2 +153,2 @@ * Matches a single character which isn't a lower case ASCII letter. | ||
*/ | ||
export declare const notLower: P.Parser<Char, Char>; | ||
export declare const notLower: P.Parser<Char, Char> |
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -9,3 +16,3 @@ /** | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
var P = require("./Parser"); | ||
var P = __importStar(require("./Parser")); | ||
var maybe = P.maybe(Monoid_1.monoidString); | ||
@@ -12,0 +19,0 @@ // ------------------------------------------------------------------------------------- |
/** | ||
* @since 0.6.0 | ||
*/ | ||
import { Either } from 'fp-ts/lib/Either'; | ||
import { Char } from './char'; | ||
import { Parser } from './Parser'; | ||
import { Either } from 'fp-ts/lib/Either' | ||
import { Char } from './char' | ||
import { Parser } from './Parser' | ||
/** | ||
@@ -12,2 +12,2 @@ * Returns a pretty printed error message using `@babel/code-frame` | ||
*/ | ||
export declare const run: <A>(p: Parser<Char, A>, source: string) => Either<string, A>; | ||
export declare const run: <A>(p: Parser<Char, A>, source: string) => Either<string, A> |
/** | ||
* @since 0.6.0 | ||
*/ | ||
import * as char from './char'; | ||
import * as parser from './Parser'; | ||
import * as parseResult from './ParseResult'; | ||
import * as stream from './Stream'; | ||
import * as string from './string'; | ||
export { | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
char, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
parser, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
parseResult, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
stream, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
string }; | ||
import * as char from './char' | ||
import * as parser from './Parser' | ||
import * as parseResult from './ParseResult' | ||
import * as stream from './Stream' | ||
import * as string from './string' | ||
export { | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
char, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
parser, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
parseResult, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
stream, | ||
/** | ||
* @since 0.6.0 | ||
*/ | ||
string | ||
} |
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -6,11 +13,11 @@ /** | ||
*/ | ||
var char = require("./char"); | ||
var char = __importStar(require("./char")); | ||
exports.char = char; | ||
var parser = require("./Parser"); | ||
var parser = __importStar(require("./Parser")); | ||
exports.parser = parser; | ||
var parseResult = require("./ParseResult"); | ||
var parseResult = __importStar(require("./ParseResult")); | ||
exports.parseResult = parseResult; | ||
var stream = require("./Stream"); | ||
var stream = __importStar(require("./Stream")); | ||
exports.stream = stream; | ||
var string = require("./string"); | ||
var string = __importStar(require("./string")); | ||
exports.string = string; |
/** | ||
* @since 0.6.0 | ||
*/ | ||
import { Alt2 } from 'fp-ts/lib/Alt'; | ||
import { Alternative2 } from 'fp-ts/lib/Alternative'; | ||
import { Applicative2 } from 'fp-ts/lib/Applicative'; | ||
import { Functor2 } from 'fp-ts/lib/Functor'; | ||
import { Monad2 } from 'fp-ts/lib/Monad'; | ||
import { Monoid } from 'fp-ts/lib/Monoid'; | ||
import * as NEA from 'fp-ts/lib/NonEmptyArray'; | ||
import { Semigroup } from 'fp-ts/lib/Semigroup'; | ||
import { Predicate, Lazy } from 'fp-ts/lib/function'; | ||
import { ParseResult } from './ParseResult'; | ||
import { Stream } from './Stream'; | ||
import { Alt2 } from 'fp-ts/lib/Alt' | ||
import { Alternative2 } from 'fp-ts/lib/Alternative' | ||
import { Applicative2 } from 'fp-ts/lib/Applicative' | ||
import { Functor2 } from 'fp-ts/lib/Functor' | ||
import { Monad2 } from 'fp-ts/lib/Monad' | ||
import { Monoid } from 'fp-ts/lib/Monoid' | ||
import * as NEA from 'fp-ts/lib/NonEmptyArray' | ||
import { Semigroup } from 'fp-ts/lib/Semigroup' | ||
import { Predicate, Lazy } from 'fp-ts/lib/function' | ||
import { ParseResult } from './ParseResult' | ||
import { Stream } from './Stream' | ||
/** | ||
@@ -20,3 +20,3 @@ * @category model | ||
export interface Parser<I, A> { | ||
(i: Stream<I>): ParseResult<I, A>; | ||
(i: Stream<I>): ParseResult<I, A> | ||
} | ||
@@ -32,3 +32,3 @@ /** | ||
*/ | ||
export declare const succeed: <I, A>(a: A) => Parser<I, A>; | ||
export declare const succeed: <I, A>(a: A) => Parser<I, A> | ||
/** | ||
@@ -40,3 +40,3 @@ * The `fail` parser will just fail immediately without consuming any input | ||
*/ | ||
export declare const fail: <I, A = never>() => Parser<I, A>; | ||
export declare const fail: <I, A = never>() => Parser<I, A> | ||
/** | ||
@@ -49,3 +49,3 @@ * The `failAt` parser will fail immediately without consuming any input, | ||
*/ | ||
export declare const failAt: <I, A = never>(i: Stream<I>) => Parser<I, A>; | ||
export declare const failAt: <I, A = never>(i: Stream<I>) => Parser<I, A> | ||
/** | ||
@@ -60,3 +60,3 @@ * The `sat` parser constructor takes a predicate function, and will consume | ||
*/ | ||
export declare const sat: <I>(predicate: Predicate<I>) => Parser<I, I>; | ||
export declare const sat: <I>(predicate: Predicate<I>) => Parser<I, I> | ||
/** | ||
@@ -70,3 +70,3 @@ * A parser combinator which returns the provided parser unchanged, except | ||
*/ | ||
export declare const expected: <I, A>(p: Parser<I, A>, message: string) => Parser<I, A>; | ||
export declare const expected: <I, A>(p: Parser<I, A>, message: string) => Parser<I, A> | ||
/** | ||
@@ -79,3 +79,3 @@ * The `item` parser consumes a single value, regardless of what it is, | ||
*/ | ||
export declare const item: <I>() => Parser<I, I>; | ||
export declare const item: <I>() => Parser<I, I> | ||
/** | ||
@@ -89,3 +89,3 @@ * The `cut` parser combinator takes a parser and produces a new parser for | ||
*/ | ||
export declare const cut: <I, A>(p: Parser<I, A>) => Parser<I, A>; | ||
export declare const cut: <I, A>(p: Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -99,3 +99,3 @@ * Takes two parsers `p1` and `p2`, returning a parser which will match | ||
*/ | ||
export declare const cutWith: <I, A, B>(p1: Parser<I, A>, p2: Parser<I, B>) => Parser<I, B>; | ||
export declare const cutWith: <I, A, B>(p1: Parser<I, A>, p2: Parser<I, B>) => Parser<I, B> | ||
/** | ||
@@ -113,3 +113,3 @@ * The `seq` combinator takes a parser, and a function which will receive | ||
*/ | ||
export declare const seq: <I, A, B>(fa: Parser<I, A>, f: (a: A) => Parser<I, B>) => Parser<I, B>; | ||
export declare const seq: <I, A, B>(fa: Parser<I, A>, f: (a: A) => Parser<I, B>) => Parser<I, B> | ||
/** | ||
@@ -128,3 +128,3 @@ * The `either` combinator takes two parsers, runs the first on the input | ||
*/ | ||
export declare const either: <I, A>(p: Parser<I, A>, f: () => Parser<I, A>) => Parser<I, A>; | ||
export declare const either: <I, A>(p: Parser<I, A>, f: () => Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -140,3 +140,3 @@ * Converts a parser into one which will return the point in the stream where | ||
*/ | ||
export declare const withStart: <I, A>(p: Parser<I, A>) => Parser<I, [A, Stream<I>]>; | ||
export declare const withStart: <I, A>(p: Parser<I, A>) => Parser<I, [A, Stream<I>]> | ||
/** | ||
@@ -150,3 +150,3 @@ * The `maybe` parser combinator creates a parser which will run the provided | ||
*/ | ||
export declare const maybe: <A>(M: Monoid<A>) => <I>(p: Parser<I, A>) => Parser<I, A>; | ||
export declare const maybe: <A>(M: Monoid<A>) => <I>(p: Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -158,3 +158,3 @@ * Matches the end of the stream. | ||
*/ | ||
export declare const eof: <I>() => Parser<I, void>; | ||
export declare const eof: <I>() => Parser<I, void> | ||
/** | ||
@@ -172,3 +172,3 @@ * The `many` combinator takes a parser, and returns a new parser which will | ||
*/ | ||
export declare const many: <I, A>(p: Parser<I, A>) => Parser<I, A[]>; | ||
export declare const many: <I, A>(p: Parser<I, A>) => Parser<I, A[]> | ||
/** | ||
@@ -182,3 +182,3 @@ * The `many1` combinator is just like the `many` combinator, except it | ||
*/ | ||
export declare const many1: <I, A>(p: Parser<I, A>) => Parser<I, NEA.NonEmptyArray<A>>; | ||
export declare const many1: <I, A>(p: Parser<I, A>) => Parser<I, NEA.NonEmptyArray<A>> | ||
/** | ||
@@ -192,3 +192,3 @@ * Matches the provided parser `p` zero or more times, but requires the | ||
*/ | ||
export declare const sepBy: <I, A, B>(sep: Parser<I, A>, p: Parser<I, B>) => Parser<I, B[]>; | ||
export declare const sepBy: <I, A, B>(sep: Parser<I, A>, p: Parser<I, B>) => Parser<I, B[]> | ||
/** | ||
@@ -202,3 +202,3 @@ * Matches the provided parser `p` one or more times, but requires the | ||
*/ | ||
export declare const sepBy1: <I, A, B>(sep: Parser<I, A>, p: Parser<I, B>) => Parser<I, NEA.NonEmptyArray<B>>; | ||
export declare const sepBy1: <I, A, B>(sep: Parser<I, A>, p: Parser<I, B>) => Parser<I, NEA.NonEmptyArray<B>> | ||
/** | ||
@@ -211,3 +211,3 @@ * Like `sepBy1`, but cut on the separator, so that matching a `sep` not | ||
*/ | ||
export declare const sepByCut: <I, A, B>(sep: Parser<I, A>, p: Parser<I, B>) => Parser<I, NEA.NonEmptyArray<B>>; | ||
export declare const sepByCut: <I, A, B>(sep: Parser<I, A>, p: Parser<I, B>) => Parser<I, NEA.NonEmptyArray<B>> | ||
/** | ||
@@ -221,3 +221,3 @@ * Matches the provided parser `p` that occurs between the provided `left` and `right` parsers. | ||
*/ | ||
export declare const between: <I, A>(left: Parser<I, A>, right: Parser<I, A>) => <B>(p: Parser<I, B>) => Parser<I, B>; | ||
export declare const between: <I, A>(left: Parser<I, A>, right: Parser<I, A>) => <B>(p: Parser<I, B>) => Parser<I, B> | ||
/** | ||
@@ -229,3 +229,3 @@ * Matches the provided parser `p` that is surrounded by the `bound` parser. Shortcut for `between(bound, bound)`. | ||
*/ | ||
export declare const surroundedBy: <I, A>(bound: Parser<I, A>) => <B>(p: Parser<I, B>) => Parser<I, B>; | ||
export declare const surroundedBy: <I, A>(bound: Parser<I, A>) => <B>(p: Parser<I, B>) => Parser<I, B> | ||
/** | ||
@@ -251,3 +251,3 @@ * Takes a `Parser` and tries to match it without consuming any input. | ||
*/ | ||
export declare const lookAhead: <I, A>(p: Parser<I, A>) => Parser<I, A>; | ||
export declare const lookAhead: <I, A>(p: Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -269,3 +269,3 @@ * Takes a `Predicate` and continues parsing until the given `Predicate` is satisfied. | ||
*/ | ||
export declare const takeUntil: <I>(predicate: Predicate<I>) => Parser<I, Array<I>>; | ||
export declare const takeUntil: <I>(predicate: Predicate<I>) => Parser<I, Array<I>> | ||
/** | ||
@@ -275,3 +275,3 @@ * @category Functor | ||
*/ | ||
export declare const map: <A, B>(f: (a: A) => B) => <I>(fa: Parser<I, A>) => Parser<I, B>; | ||
export declare const map: <A, B>(f: (a: A) => B) => <I>(fa: Parser<I, A>) => Parser<I, B> | ||
/** | ||
@@ -281,3 +281,3 @@ * @category Apply | ||
*/ | ||
export declare const ap: <I, A>(fa: Parser<I, A>) => <B>(fab: Parser<I, (a: A) => B>) => Parser<I, B>; | ||
export declare const ap: <I, A>(fa: Parser<I, A>) => <B>(fab: Parser<I, (a: A) => B>) => Parser<I, B> | ||
/** | ||
@@ -287,3 +287,3 @@ * @category Apply | ||
*/ | ||
export declare const apFirst: <I, B>(fb: Parser<I, B>) => <A>(fa: Parser<I, A>) => Parser<I, A>; | ||
export declare const apFirst: <I, B>(fb: Parser<I, B>) => <A>(fa: Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -293,3 +293,3 @@ * @category Apply | ||
*/ | ||
export declare const apSecond: <I, B>(fb: Parser<I, B>) => <A>(fa: Parser<I, A>) => Parser<I, B>; | ||
export declare const apSecond: <I, B>(fb: Parser<I, B>) => <A>(fa: Parser<I, A>) => Parser<I, B> | ||
/** | ||
@@ -299,3 +299,3 @@ * @category Applicative | ||
*/ | ||
export declare const of: <I, A>(a: A) => Parser<I, A>; | ||
export declare const of: <I, A>(a: A) => Parser<I, A> | ||
/** | ||
@@ -305,3 +305,3 @@ * @category Monad | ||
*/ | ||
export declare const chain: <I, A, B>(f: (a: A) => Parser<I, B>) => (ma: Parser<I, A>) => Parser<I, B>; | ||
export declare const chain: <I, A, B>(f: (a: A) => Parser<I, B>) => (ma: Parser<I, A>) => Parser<I, B> | ||
/** | ||
@@ -311,3 +311,3 @@ * @category Monad | ||
*/ | ||
export declare const chainFirst: <I, A, B>(f: (a: A) => Parser<I, B>) => (ma: Parser<I, A>) => Parser<I, A>; | ||
export declare const chainFirst: <I, A, B>(f: (a: A) => Parser<I, B>) => (ma: Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -317,3 +317,3 @@ * @category Alt | ||
*/ | ||
export declare const alt: <I, A>(that: Lazy<Parser<I, A>>) => (fa: Parser<I, A>) => Parser<I, A>; | ||
export declare const alt: <I, A>(that: Lazy<Parser<I, A>>) => (fa: Parser<I, A>) => Parser<I, A> | ||
/** | ||
@@ -323,3 +323,3 @@ * @category Monad | ||
*/ | ||
export declare const flatten: <I, A>(mma: Parser<I, Parser<I, A>>) => Parser<I, A>; | ||
export declare const flatten: <I, A>(mma: Parser<I, Parser<I, A>>) => Parser<I, A> | ||
/** | ||
@@ -329,3 +329,3 @@ * @category Alternative | ||
*/ | ||
export declare const zero: <I, A>() => Parser<I, A>; | ||
export declare const zero: <I, A>() => Parser<I, A> | ||
/** | ||
@@ -335,3 +335,3 @@ * @category instances | ||
*/ | ||
export declare const URI = "Parser"; | ||
export declare const URI = 'Parser' | ||
/** | ||
@@ -341,7 +341,7 @@ * @category instances | ||
*/ | ||
export declare type URI = typeof URI; | ||
export declare type URI = typeof URI | ||
declare module 'fp-ts/lib/HKT' { | ||
interface URItoKind2<E, A> { | ||
Parser: Parser<E, A>; | ||
} | ||
interface URItoKind2<E, A> { | ||
Parser: Parser<E, A> | ||
} | ||
} | ||
@@ -352,3 +352,3 @@ /** | ||
*/ | ||
export declare const getSemigroup: <I, A>(S: Semigroup<A>) => Semigroup<Parser<I, A>>; | ||
export declare const getSemigroup: <I, A>(S: Semigroup<A>) => Semigroup<Parser<I, A>> | ||
/** | ||
@@ -358,3 +358,3 @@ * @category instances | ||
*/ | ||
export declare const getMonoid: <I, A>(M: Monoid<A>) => Monoid<Parser<I, A>>; | ||
export declare const getMonoid: <I, A>(M: Monoid<A>) => Monoid<Parser<I, A>> | ||
/** | ||
@@ -364,3 +364,3 @@ * @category instances | ||
*/ | ||
export declare const Functor: Functor2<URI>; | ||
export declare const Functor: Functor2<URI> | ||
/** | ||
@@ -370,3 +370,3 @@ * @category instances | ||
*/ | ||
export declare const Applicative: Applicative2<URI>; | ||
export declare const Applicative: Applicative2<URI> | ||
/** | ||
@@ -376,3 +376,3 @@ * @category instances | ||
*/ | ||
export declare const Monad: Monad2<URI>; | ||
export declare const Monad: Monad2<URI> | ||
/** | ||
@@ -382,3 +382,3 @@ * @category instances | ||
*/ | ||
export declare const Alt: Alt2<URI>; | ||
export declare const Alt: Alt2<URI> | ||
/** | ||
@@ -388,3 +388,3 @@ * @category instances | ||
*/ | ||
export declare const Alternative: Alternative2<URI>; | ||
export declare const Alternative: Alternative2<URI> | ||
/** | ||
@@ -394,10 +394,13 @@ * @category instances | ||
*/ | ||
export declare const parser: Monad2<URI> & Alternative2<URI>; | ||
export declare const parser: Monad2<URI> & Alternative2<URI> | ||
/** | ||
* @since 0.6.8 | ||
*/ | ||
export declare const bindTo: <N extends string>(name: N) => <I, A>(fa: Parser<I, A>) => Parser<I, { [K in N]: A; }>; | ||
export declare const bindTo: <N extends string>(name: N) => <I, A>(fa: Parser<I, A>) => Parser<I, { [K in N]: A }> | ||
/** | ||
* @since 0.6.8 | ||
*/ | ||
export declare const bind: <N extends string, I, A, B>(name: Exclude<N, keyof A>, f: (a: A) => Parser<I, B>) => (fa: Parser<I, A>) => Parser<I, { [K in N | keyof A]: K extends keyof A ? A[K] : B; }>; | ||
export declare const bind: <N extends string, I, A, B>( | ||
name: Exclude<N, keyof A>, | ||
f: (a: A) => Parser<I, B> | ||
) => (fa: Parser<I, A>) => Parser<I, { [K in N | keyof A]: K extends keyof A ? A[K] : B }> |
@@ -13,7 +13,14 @@ "use strict"; | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var A = require("fp-ts/lib/Array"); | ||
var E = require("fp-ts/lib/Either"); | ||
var NEA = require("fp-ts/lib/NonEmptyArray"); | ||
var O = require("fp-ts/lib/Option"); | ||
var A = __importStar(require("fp-ts/lib/Array")); | ||
var E = __importStar(require("fp-ts/lib/Either")); | ||
var NEA = __importStar(require("fp-ts/lib/NonEmptyArray")); | ||
var O = __importStar(require("fp-ts/lib/Option")); | ||
var function_1 = require("fp-ts/lib/function"); | ||
@@ -20,0 +27,0 @@ var pipeable_1 = require("fp-ts/lib/pipeable"); |
@@ -1,3 +0,3 @@ | ||
import { Either } from 'fp-ts/lib/Either'; | ||
import { Stream } from './Stream'; | ||
import { Either } from 'fp-ts/lib/Either' | ||
import { Stream } from './Stream' | ||
/** | ||
@@ -8,5 +8,5 @@ * @category model | ||
export interface ParseError<I> { | ||
input: Stream<I>; | ||
expected: Array<string>; | ||
fatal: boolean; | ||
input: Stream<I> | ||
expected: Array<string> | ||
fatal: boolean | ||
} | ||
@@ -18,5 +18,5 @@ /** | ||
export interface ParseSuccess<I, A> { | ||
value: A; | ||
next: Stream<I>; | ||
start: Stream<I>; | ||
value: A | ||
next: Stream<I> | ||
start: Stream<I> | ||
} | ||
@@ -27,3 +27,3 @@ /** | ||
*/ | ||
export declare type ParseResult<I, A> = Either<ParseError<I>, ParseSuccess<I, A>>; | ||
export declare type ParseResult<I, A> = Either<ParseError<I>, ParseSuccess<I, A>> | ||
/** | ||
@@ -33,3 +33,3 @@ * @category constructors | ||
*/ | ||
export declare const success: <I, A>(value: A, next: Stream<I>, start: Stream<I>) => ParseResult<I, A>; | ||
export declare const success: <I, A>(value: A, next: Stream<I>, start: Stream<I>) => ParseResult<I, A> | ||
/** | ||
@@ -39,3 +39,7 @@ * @category constructors | ||
*/ | ||
export declare const error: <I, A = never>(input: Stream<I>, expected?: Array<string>, fatal?: boolean) => ParseResult<I, A>; | ||
export declare const error: <I, A = never>( | ||
input: Stream<I>, | ||
expected?: Array<string>, | ||
fatal?: boolean | ||
) => ParseResult<I, A> | ||
/** | ||
@@ -45,3 +49,3 @@ * @category combinators | ||
*/ | ||
export declare const withExpected: <I>(err: ParseError<I>, expected: Array<string>) => ParseError<I>; | ||
export declare const withExpected: <I>(err: ParseError<I>, expected: Array<string>) => ParseError<I> | ||
/** | ||
@@ -51,3 +55,3 @@ * @category combinators | ||
*/ | ||
export declare const escalate: <I>(err: ParseError<I>) => ParseError<I>; | ||
export declare const escalate: <I>(err: ParseError<I>) => ParseError<I> | ||
/** | ||
@@ -57,2 +61,2 @@ * @category combinators | ||
*/ | ||
export declare const extend: <I>(err1: ParseError<I>, err2: ParseError<I>) => ParseError<I>; | ||
export declare const extend: <I>(err1: ParseError<I>, err2: ParseError<I>) => ParseError<I> |
@@ -1,3 +0,3 @@ | ||
import { Eq } from 'fp-ts/lib/Eq'; | ||
import { Option } from 'fp-ts/lib/Option'; | ||
import { Eq } from 'fp-ts/lib/Eq' | ||
import { Option } from 'fp-ts/lib/Option' | ||
/** | ||
@@ -8,4 +8,4 @@ * @category model | ||
export interface Stream<A> { | ||
readonly buffer: Array<A>; | ||
readonly cursor: number; | ||
readonly buffer: Array<A> | ||
readonly cursor: number | ||
} | ||
@@ -16,3 +16,3 @@ /** | ||
*/ | ||
export declare const stream: <A>(buffer: Array<A>, cursor?: number) => Stream<A>; | ||
export declare const stream: <A>(buffer: Array<A>, cursor?: number) => Stream<A> | ||
/** | ||
@@ -22,3 +22,3 @@ * @category destructors | ||
*/ | ||
export declare const get: <A>(s: Stream<A>) => Option<A>; | ||
export declare const get: <A>(s: Stream<A>) => Option<A> | ||
/** | ||
@@ -28,3 +28,3 @@ * @category destructors | ||
*/ | ||
export declare const atEnd: <A>(s: Stream<A>) => boolean; | ||
export declare const atEnd: <A>(s: Stream<A>) => boolean | ||
/** | ||
@@ -34,6 +34,8 @@ * @category destructors | ||
*/ | ||
export declare const getAndNext: <A>(s: Stream<A>) => Option<{ | ||
value: A; | ||
next: Stream<A>; | ||
}>; | ||
export declare const getAndNext: <A>( | ||
s: Stream<A> | ||
) => Option<{ | ||
value: A | ||
next: Stream<A> | ||
}> | ||
/** | ||
@@ -43,2 +45,2 @@ * @category instances | ||
*/ | ||
export declare const getEq: <A>(E: Eq<A>) => Eq<Stream<A>>; | ||
export declare const getEq: <A>(E: Eq<A>) => Eq<Stream<A>> |
/** | ||
* @since 0.6.0 | ||
*/ | ||
import { Foldable, Foldable1 } from 'fp-ts/lib/Foldable'; | ||
import { Functor, Functor1 } from 'fp-ts/lib/Functor'; | ||
import { HKT, Kind, URIS } from 'fp-ts/lib/HKT'; | ||
import * as C from './char'; | ||
import * as P from './Parser'; | ||
import { Foldable, Foldable1 } from 'fp-ts/lib/Foldable' | ||
import { Functor, Functor1 } from 'fp-ts/lib/Functor' | ||
import { HKT, Kind, URIS } from 'fp-ts/lib/HKT' | ||
import * as C from './char' | ||
import * as P from './Parser' | ||
/** | ||
@@ -15,3 +15,3 @@ * Matches the exact string provided. | ||
*/ | ||
export declare const string: (s: string) => P.Parser<C.Char, string>; | ||
export declare const string: (s: string) => P.Parser<C.Char, string> | ||
/** | ||
@@ -23,4 +23,6 @@ * Matches one of a list of strings. | ||
*/ | ||
export declare function oneOf<F extends URIS>(F: Functor1<F> & Foldable1<F>): (ss: Kind<F, string>) => P.Parser<C.Char, string>; | ||
export declare function oneOf<F>(F: Functor<F> & Foldable<F>): (ss: HKT<F, string>) => P.Parser<C.Char, string>; | ||
export declare function oneOf<F extends URIS>( | ||
F: Functor1<F> & Foldable1<F> | ||
): (ss: Kind<F, string>) => P.Parser<C.Char, string> | ||
export declare function oneOf<F>(F: Functor<F> & Foldable<F>): (ss: HKT<F, string>) => P.Parser<C.Char, string> | ||
/** | ||
@@ -30,3 +32,3 @@ * @category destructors | ||
*/ | ||
export declare const fold: <I>(as: Array<P.Parser<I, string>>) => P.Parser<I, string>; | ||
export declare const fold: <I>(as: Array<P.Parser<I, string>>) => P.Parser<I, string> | ||
/** | ||
@@ -36,3 +38,3 @@ * @category combinators | ||
*/ | ||
export declare const maybe: <I>(p: P.Parser<I, string>) => P.Parser<I, string>; | ||
export declare const maybe: <I>(p: P.Parser<I, string>) => P.Parser<I, string> | ||
/** | ||
@@ -45,3 +47,3 @@ * Matches the given parser zero or more times, returning a string of the | ||
*/ | ||
export declare const many: (parser: P.Parser<C.Char, string>) => P.Parser<C.Char, string>; | ||
export declare const many: (parser: P.Parser<C.Char, string>) => P.Parser<C.Char, string> | ||
/** | ||
@@ -54,3 +56,3 @@ * Matches the given parser one or more times, returning a string of the | ||
*/ | ||
export declare const many1: (parser: P.Parser<C.Char, string>) => P.Parser<C.Char, string>; | ||
export declare const many1: (parser: P.Parser<C.Char, string>) => P.Parser<C.Char, string> | ||
/** | ||
@@ -62,3 +64,3 @@ * Matches zero or more whitespace characters. | ||
*/ | ||
export declare const spaces: P.Parser<C.Char, string>; | ||
export declare const spaces: P.Parser<C.Char, string> | ||
/** | ||
@@ -70,3 +72,3 @@ * Matches one or more whitespace characters. | ||
*/ | ||
export declare const spaces1: P.Parser<C.Char, string>; | ||
export declare const spaces1: P.Parser<C.Char, string> | ||
/** | ||
@@ -78,3 +80,3 @@ * Matches zero or more non-whitespace characters. | ||
*/ | ||
export declare const notSpaces: P.Parser<C.Char, string>; | ||
export declare const notSpaces: P.Parser<C.Char, string> | ||
/** | ||
@@ -86,3 +88,3 @@ * Matches one or more non-whitespace characters. | ||
*/ | ||
export declare const notSpaces1: P.Parser<C.Char, string>; | ||
export declare const notSpaces1: P.Parser<C.Char, string> | ||
/** | ||
@@ -92,3 +94,3 @@ * @category combinators | ||
*/ | ||
export declare const int: P.Parser<C.Char, number>; | ||
export declare const int: P.Parser<C.Char, number> | ||
/** | ||
@@ -98,3 +100,3 @@ * @category combinators | ||
*/ | ||
export declare const float: P.Parser<C.Char, number>; | ||
export declare const float: P.Parser<C.Char, number> | ||
/** | ||
@@ -108,2 +110,2 @@ * Parses a double quoted string, with support for escaping double quotes | ||
*/ | ||
export declare const doubleQuotedString: P.Parser<string, String>; | ||
export declare const doubleQuotedString: P.Parser<string, String> |
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var M = require("fp-ts/lib/Monoid"); | ||
var O = require("fp-ts/lib/Option"); | ||
var M = __importStar(require("fp-ts/lib/Monoid")); | ||
var O = __importStar(require("fp-ts/lib/Option")); | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
var C = require("./char"); | ||
var P = require("./Parser"); | ||
var C = __importStar(require("./char")); | ||
var P = __importStar(require("./Parser")); | ||
// ------------------------------------------------------------------------------------- | ||
@@ -9,0 +16,0 @@ // constructors |
{ | ||
"name": "parser-ts", | ||
"version": "0.6.8", | ||
"version": "0.6.9", | ||
"description": "String parser combinators for TypeScript", | ||
"files": [ | ||
"lib", | ||
"es6" | ||
], | ||
"main": "lib/index.js", | ||
@@ -13,16 +9,2 @@ "module": "es6/index.js", | ||
"sideEffects": false, | ||
"scripts": { | ||
"lint": "tslint -p .", | ||
"mocha": "mocha -r ts-node/register test/*.ts", | ||
"prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --list-different \"{src,test,examples}/**/*.ts\"", | ||
"fix-prettier": "prettier --no-semi --single-quote --print-width 120 --parser typescript --write \"{src,test,examples}/**/*.ts\"", | ||
"test": "npm run lint && npm run prettier && npm run jest && npm run docs", | ||
"clean": "rm -rf ./lib ./es6", | ||
"prebuild": "npm run clean", | ||
"build": "tsc -p ./tsconfig.build.json && tsc -p ./tsconfig.build-es6.json", | ||
"postbuild": "import-path-rewrite", | ||
"prepublish": "npm run build", | ||
"jest": "jest --ci --coverage", | ||
"docs": "docs-ts" | ||
}, | ||
"repository": { | ||
@@ -41,18 +23,2 @@ "type": "git", | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^23.3.13", | ||
"@types/node": "7.0.4", | ||
"docs-ts": "^0.5.1", | ||
"dtslint": "^0.4.2", | ||
"fp-ts": "^2.0.0", | ||
"import-path-rewrite": "github:gcanti/import-path-rewrite", | ||
"jest": "^24.8.0", | ||
"mocha": "^5.2.0", | ||
"prettier": "^1.19.1", | ||
"ts-jest": "^24.0.2", | ||
"ts-node": "^8.0.1", | ||
"tslint": "^5.12.1", | ||
"tslint-config-standard": "^8.0.1", | ||
"typescript": "^3.5.2" | ||
}, | ||
"tags": [ | ||
@@ -73,2 +39,2 @@ "typescript", | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106215
0
38
3431