summaryrefslogtreecommitdiff
path: root/src/types.ts
blob: 7863981aef121a386be2779f2ac6a6afe4bce8d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { constructors, Union } from "./utils"

type ExprT = {
  Start: any,
  End: any,
  Optional: { expr: Expr },
  OneOrMore: { expr: Expr },
  ZeroOrMore: { expr: Expr },
  NextItem: any,
  AnyItem: any,
  Or: any,
  AnyString: any,
  AnyNumber: any,
  AnyBool: any,
  Truthy: any,
  Falsey: any,
  Group: { exprs: Expr[] },
}

export type Expr = Union<ExprT>

export const Expr = constructors<ExprT>()