Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "presets/numbers"

Index

Variables

Const DOT

DOT: LitParser<string> = lit(".")

Const EXP

EXP: Fn<ParseContext<string>, boolean> = maybe(seq([maybe(oneOf("eE")), SIGN, DIGITS]))

Const FLOAT

FLOAT: Fn<ParseContext<string>, boolean> = xform(_REAL, xfFloat)

Like REAL but transforms result w/ xfFloat to JS number.

Const FRACT0

FRACT0: Fn<ParseContext<string>, boolean> = maybe(seq([DOT, zeroOrMore(DIGIT)]))

Const FRACT1

FRACT1: Fn<ParseContext<string>, boolean> = seq([DOT, DIGITS])

Const INT

INT: Fn<ParseContext<string>, boolean> = xform(seq([SIGN, DIGITS], "int"), xfInt())

Matches optionally signed DIGITS and result transformed w/ xfInt to JS number.

Const REAL

REAL: Fn<ParseContext<string>, boolean> = join(_REAL)

Matches IEEE754 floating point number.

Const SIGN

SIGN: Fn<ParseContext<string>, boolean> = maybe(oneOf("-+"))

Matches single + or - char.

Const UINT

UINT: Fn<ParseContext<string>, boolean> = xform(DIGITS, comp(xfID("uint"), xfInt()))

Matches same as DIGITS but result transformed w/ xfInt to JS number.

Const _REAL

_REAL: Fn<ParseContext<string>, boolean> = seq([SIGN, alt([FRACT1, seq([DIGITS, FRACT0])]), EXP], "real")

Generated using TypeDoc