/
types.ts
121 lines (100 loc) · 2.21 KB
/
types.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import {
VersionedTextDocumentIdentifier,
Position,
Range,
} from "vscode-languageserver-types";
export interface Hyp<Pp> {
names: Pp[];
def?: Pp;
ty: Pp;
}
export interface Goal<Pp> {
ty: Pp;
hyps: Hyp<Pp>[];
}
export interface GoalConfig<Pp> {
goals: Goal<Pp>[];
stack: [Goal<Pp>[], Goal<Pp>[]][];
bullet?: Pp;
shelf: Goal<Pp>[];
given_up: Goal<Pp>[];
}
export interface Message<Pp> {
range?: Range;
level: number;
text: Pp;
}
export type Id = ["Id", string];
export interface Loc {
fname: any;
line_nb: number;
bol_pos: number;
line_nb_last: number;
bol_pos_last: number;
bp: number;
ep: number;
}
export interface Obl {
name: Id;
loc?: Loc;
status: [boolean, any];
solved: boolean;
}
export interface OblsView {
opaque: boolean;
remaining: number;
obligations: Obl[];
}
export type ProgramInfo = [Id, OblsView][];
export interface GoalAnswer<Pp> {
textDocument: VersionedTextDocumentIdentifier;
position: Position;
goals?: GoalConfig<Pp>;
program?: ProgramInfo;
messages: Pp[] | Message<Pp>[];
error?: Pp;
}
export interface GoalRequest {
textDocument: VersionedTextDocumentIdentifier;
position: Position;
}
export type Pp =
| ["Pp_empty"]
| ["Pp_string", string]
| ["Pp_glue", Pp[]]
| ["Pp_box", any, Pp]
| ["Pp_tag", any, Pp]
| ["Pp_print_break", number, number]
| ["Pp_force_newline"]
| ["Pp_comment", string[]];
export type PpString = Pp | string;
export interface FlecheDocumentParams {
textDocument: VersionedTextDocumentIdentifier;
}
// Status of the document, Yes if fully checked, range contains the last seen lexical token
interface CompletionStatus {
status: ["Yes" | "Stopped" | "Failed"];
range: Range;
}
// Implementation-specific span information, for now the serialized Ast if present.
type SpanInfo = any;
interface RangedSpan {
range: Range;
span?: SpanInfo;
}
export interface FlecheDocument {
spans: RangedSpan[];
completed: CompletionStatus;
}
export interface FlecheSaveParams {
textDocument: VersionedTextDocumentIdentifier;
}
export interface SentencePerfParams {
loc: Loc;
time: number;
mem: number;
}
export interface DocumentPerfParams {
summary: string;
timings: SentencePerfParams[];
}