-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.ts
45 lines (37 loc) · 867 Bytes
/
interface.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
export type TokenType = 'unit' | 'ws' | 'number' | 'op' | 'keyword';
export type Unit = 's' | 'm' | 'h' | 'd' | 'w' | 'M' | 'y';
export interface Token {
type: TokenType;
raw: string;
start: number;
end: number;
}
export interface Node {
type: string;
}
interface Location {
start: number;
end: number;
}
export interface InputExpression extends Node {
type: 'Expression';
body: Array<InputOffset | InputPeriod>;
}
export interface Expression extends Node, Location {
type: 'Expression';
body: Array<Offset | Period>;
}
export interface InputOffset extends Node {
type: 'Offset';
op: '+' | '-';
number: number;
unit: Unit;
}
export type Offset = InputOffset & Location;
export interface InputPeriod extends Node {
type: 'Period';
op: '/' | '\\';
number: number;
unit: Unit;
}
export type Period = InputPeriod & Location;