メインコンテンツまでスキップ

Modules

Type Aliases

Failure

Ƭ Failure: Object

Failure result type

Type declaration

NameType
indexnumber
successfalse

Defined in

index.ts:30


LazyContext

Ƭ LazyContext<U>: () => Parser<U>

Type parameters

Name
U

Type declaration

▸ (): Parser<U>

Returns

Parser<U>

Defined in

index.ts:283


LazyParserOpts

Ƭ LazyParserOpts<U>: Object

Type parameters

Name
U

Type declaration

NameType
children?undefined
handler?undefined
lazyLazyContext<U>
name?string

Defined in

index.ts:258


ParserContext

Ƭ ParserContext<U>: Object

Type parameters

Name
U

Type declaration

NameType
childrenParser<any>[]
handlerParserHandler<U>

Defined in

index.ts:275


ParserHandler

Ƭ ParserHandler<U>: (input: string, index: number, children: Parser<any>[], state: any) => Result<U>

Type parameters

Name
U

Type declaration

▸ (input, index, children, state): Result<U>

Type of parser handler

Parameters
NameType
inputstring
indexnumber
childrenParser<any>[]
stateany
Returns

Result<U>

Defined in

index.ts:270


Result

Ƭ Result<U>: Success<U> | Failure

Parser result

Type parameters

Name
U

Defined in

index.ts:52


ResultType

Ƭ ResultType<U>: U extends Parser<infer R> ? R : never

Get result type of Parser.

Type parameters

Name
U

Defined in

index.ts:291


ResultTypes

Ƭ ResultTypes<U>: U extends [infer Head, ...(infer Tail)] ? [ResultType<Head>, ...ResultTypes<Tail>] : []

Get result types of Parsers.

Type parameters

Name
U

Defined in

index.ts:298


StrictParserOpts

Ƭ StrictParserOpts<U>: Object

Type parameters

Name
U

Type declaration

NameType
children?Parser<any>[]
handlerParserHandler<U>
lazy?undefined
name?string

Defined in

index.ts:248


Success

Ƭ Success<U>: Object

Success result type

Type parameters

Name
U

Type declaration

NameType
indexnumber
successtrue
valueU

Defined in

index.ts:6

Variables

char

Const char: Parser<string>

any char

Defined in

index.ts:553


cr

Const cr: Parser<"\r">

Defined in

index.ts:515


crlf

Const crlf: Parser<"\r\n">

Defined in

index.ts:517


eof

Const eof: Parser<null>

Match the end of the input string.

Defined in

index.ts:542


lf

Const lf: Parser<"\n">

Defined in

index.ts:516


lineBegin

Const lineBegin: Parser<null>

Match lineBegin

Defined in

index.ts:566


lineEnd

Const lineEnd: Parser<null>

Match lineEnd

Defined in

index.ts:584


newline

Const newline: Parser<"\r" | "\n" | "\r\n">

newline

Defined in

index.ts:524


sof

Const sof: Parser<null>

Match the begin of the input string.

Defined in

index.ts:531

Functions

alt

alt<U>(parsers): Parser<ResultTypes<U>[number]>

alt

Type parameters

NameType
Uextends Parser<unknown>[]

Parameters

NameType
parsers[...U[]]

Returns

Parser<ResultTypes<U>[number]>

Defined in

index.ts:431


failure

failure(index): Failure

Make a failure result.

Parameters

NameType
indexnumber

Returns

Failure

Defined in

index.ts:40


language

language<U>(syntaxes): U

Create a language

Type parameters

Name
U

Parameters

NameType
syntaxes{ [K in string | number | symbol]: Function }

Returns

U

Defined in

index.ts:595


lazy

lazy<U>(fn, name?): Parser<U>

Create a lazy parser.

Type parameters

Name
U

Parameters

NameType
fn() => Parser<U>
name?string

Returns

Parser<U>

Defined in

index.ts:459


match

match<U>(parser): Parser<U>

match

Type parameters

Name
U

Parameters

NameType
parserParser<U>

Returns

Parser<U>

Defined in

index.ts:479


notMatch

notMatch(parser): Parser<null>

notMatch

Parameters

NameType
parserParser<unknown>

Returns

Parser<null>

Defined in

index.ts:493


parser

parser<U>(handler, children?, name?): Parser<U>

Create a custom parser.

Type parameters

Name
U

Parameters

NameType
handlerParserHandler<U>
children?Parser<any>[]
name?string

Returns

Parser<U>

Defined in

index.ts:449


seq

seq<U>(parsers): Parser<ResultTypes<[...U]>>

Create a new parser that sequentially applies an array of parser.

Type parameters

NameType
Uextends Parser<any>[]

Parameters

NameType
parsers[...U[]]

Returns

Parser<ResultTypes<[...U]>>

Defined in

index.ts:393

seq<U, V>(parsers, select): U[V]

Create a new parser that sequentially applies an array of parser.

Type parameters

NameType
Uextends Parser<any>[]
Vextends number

Parameters

NameTypeDescription
parsers[...U[]]-
selectVThe index of the data returned in the result.

Returns

U[V]

Defined in

index.ts:400


str

str<U>(value): Parser<U>

Create a new parser that matches the given string.

Type parameters

NameType
Uextends string

Parameters

NameType
valueU

Returns

Parser<U>

Defined in

index.ts:353

str(pattern): Parser<string>

Create a new parser that matches the given regular expression.

Parameters

NameType
patternRegExp

Returns

Parser<string>

Defined in

index.ts:359


succeeded

succeeded<U>(value): Parser<U>

Create a new parser that already succeeds.

Type parameters

Name
U

Parameters

NameType
valueU

Returns

Parser<U>

Defined in

index.ts:468


success

success<U>(index, value): Success<U>

Make a success result.

Type parameters

Name
U

Parameters

NameType
indexnumber
valueU

Returns

Success<U>

Defined in

index.ts:17


where

where<U>(condition, parser): Parser<U>

where

Type parameters

Name
U

Parameters

NameType
condition(state: any) => boolean
parserParser<U>

Returns

Parser<U>

Defined in

index.ts:507