-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpr.d.ts
62 lines (62 loc) · 1.39 KB
/
expr.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { Plugin, Rule, Context, Token } from 'jsonic';
type OpDef = {
src?: string | string[];
osrc?: string;
csrc?: string;
left?: number;
right?: number;
use?: any;
prefix?: boolean;
suffix?: boolean;
infix?: boolean;
ternary?: boolean;
paren?: boolean;
preval?: {
active?: boolean;
required?: boolean;
};
};
type ExprOptions = {
op?: {
[name: string]: OpDef;
};
evaluate?: typeof evaluation;
};
type Op = {
name: string;
src: string;
left: number;
right: number;
use: any;
prefix: boolean;
suffix: boolean;
infix: boolean;
ternary: boolean;
paren: boolean;
terms: number;
tkn: string;
tin: number;
osrc: string;
csrc: string;
otkn: string;
otin: number;
ctkn: string;
ctin: number;
preval: {
active: boolean;
required: boolean;
};
token: Token;
OP_MARK: typeof OP_MARK;
};
type Evaluate = (rule: Rule, ctx: Context, op: Op, ...terms: any) => any;
declare const OP_MARK: {};
declare let Expr: Plugin;
declare function prattify(expr: any, op?: Op): any[];
declare function evaluation(rule: Rule, ctx: Context, expr: any, evaluate: Evaluate): any;
declare const testing: {
prattify: typeof prattify;
opify: (x: any) => any;
};
export { Expr, evaluation, testing };
export type { ExprOptions, OpDef, Op, Evaluate };