@the_dissidents/libemmm 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +285 -4
- package/dist/index.d.mts +283 -152
- package/dist/index.d.ts +283 -152
- package/dist/index.js +2110 -860
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2103 -859
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -11,43 +11,81 @@ declare class NameManager<T extends {
|
|
|
11
11
|
}> {
|
|
12
12
|
private array;
|
|
13
13
|
private data;
|
|
14
|
-
constructor(from
|
|
14
|
+
constructor(from?: ReadonlyNameManager<T> | readonly T[] | ReadonlySet<T>);
|
|
15
|
+
toArray(): T[];
|
|
16
|
+
toSet(): Set<T>;
|
|
15
17
|
get(name: string): T | undefined;
|
|
16
18
|
has(name: string): boolean;
|
|
17
19
|
remove(name: string): void;
|
|
18
20
|
add(...elems: T[]): void;
|
|
19
21
|
find(predicate: (x: T) => boolean): T | undefined;
|
|
20
22
|
}
|
|
23
|
+
type ReadonlyNameManager<T extends {
|
|
24
|
+
name: string;
|
|
25
|
+
}> = Omit<NameManager<T>, 'add' | 'remove'>;
|
|
21
26
|
|
|
22
|
-
interface
|
|
23
|
-
position(): number;
|
|
24
|
-
isEOF(): boolean;
|
|
25
|
-
peek(str: string): boolean;
|
|
26
|
-
accept(str: string): boolean;
|
|
27
|
-
acceptChar(): string;
|
|
28
|
-
acceptWhitespaceChar(): string | null;
|
|
29
|
-
acceptUntil(str: string): string | null;
|
|
27
|
+
interface ParseContextStoreDefinitions {
|
|
30
28
|
}
|
|
29
|
+
type ParseContextStoreKey = keyof ParseContextStoreDefinitions;
|
|
30
|
+
type ParseContextStoreEntry<S extends ParseContextStoreKey> = ParseContextStoreDefinitions[S];
|
|
31
|
+
declare class ParseContext {
|
|
32
|
+
config: Configuration;
|
|
33
|
+
variables: Map<string, string>;
|
|
34
|
+
private data;
|
|
35
|
+
constructor(config: Configuration, variables?: Map<string, string>);
|
|
36
|
+
init<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
|
|
37
|
+
set<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
|
|
38
|
+
get<S extends ParseContextStoreKey>(key: S): ParseContextStoreEntry<S>;
|
|
39
|
+
}
|
|
40
|
+
declare class Document {
|
|
41
|
+
readonly root: RootNode;
|
|
42
|
+
readonly context: ParseContext;
|
|
43
|
+
readonly messages: readonly Message[];
|
|
44
|
+
constructor(root: RootNode, context: ParseContext, messages: readonly Message[]);
|
|
45
|
+
toStripped(): Document;
|
|
46
|
+
}
|
|
47
|
+
interface ReadonlyConfiguration {
|
|
48
|
+
readonly initializers: readonly ((cxt: ParseContext) => void)[];
|
|
49
|
+
readonly blockModifiers: ReadonlyNameManager<BlockModifierDefinition<any>>;
|
|
50
|
+
readonly inlineModifiers: ReadonlyNameManager<InlineModifierDefinition<any>>;
|
|
51
|
+
readonly systemModifiers: ReadonlyNameManager<SystemModifierDefinition<any>>;
|
|
52
|
+
readonly argumentInterpolators: ReadonlyNameManager<ArgumentInterpolatorDefinition>;
|
|
53
|
+
readonly blockShorthands: ReadonlyNameManager<BlockShorthand<any>>;
|
|
54
|
+
readonly inlineShorthands: ReadonlyNameManager<InlineShorthand<any>>;
|
|
55
|
+
readonly reparseDepthLimit: number;
|
|
56
|
+
}
|
|
57
|
+
declare class Configuration implements ReadonlyConfiguration {
|
|
58
|
+
initializers: ((cxt: ParseContext) => void)[];
|
|
59
|
+
blockModifiers: NameManager<BlockModifierDefinition<any>>;
|
|
60
|
+
inlineModifiers: NameManager<InlineModifierDefinition<any>>;
|
|
61
|
+
systemModifiers: NameManager<SystemModifierDefinition<any>>;
|
|
62
|
+
argumentInterpolators: NameManager<ArgumentInterpolatorDefinition>;
|
|
63
|
+
blockShorthands: NameManager<BlockShorthand<any>>;
|
|
64
|
+
inlineShorthands: NameManager<InlineShorthand<any>>;
|
|
65
|
+
reparseDepthLimit: number;
|
|
66
|
+
static from(from: ReadonlyConfiguration): Configuration;
|
|
67
|
+
}
|
|
68
|
+
|
|
31
69
|
declare enum MessageSeverity {
|
|
32
70
|
Info = 0,
|
|
33
71
|
Warning = 1,
|
|
34
72
|
Error = 2
|
|
35
73
|
}
|
|
36
|
-
type FixSuggestion = {
|
|
37
|
-
info: string;
|
|
38
|
-
apply(src: string, cursor: number): [out_src: string, new_cursor: number];
|
|
39
|
-
};
|
|
40
74
|
type Message = {
|
|
41
75
|
readonly severity: MessageSeverity;
|
|
42
|
-
readonly
|
|
43
|
-
readonly length: number;
|
|
76
|
+
readonly location: LocationRange;
|
|
44
77
|
readonly info: string;
|
|
45
78
|
readonly code: number;
|
|
46
|
-
readonly fixes: readonly FixSuggestion[];
|
|
47
79
|
};
|
|
48
|
-
type
|
|
80
|
+
type SourceDescriptor = {
|
|
81
|
+
name: string;
|
|
82
|
+
};
|
|
83
|
+
type LocationRange = {
|
|
84
|
+
original?: LocationRange;
|
|
85
|
+
source: SourceDescriptor;
|
|
49
86
|
start: number;
|
|
50
87
|
end: number;
|
|
88
|
+
actualEnd?: number;
|
|
51
89
|
};
|
|
52
90
|
declare enum NodeType {
|
|
53
91
|
Root = 0,
|
|
@@ -60,81 +98,94 @@ declare enum NodeType {
|
|
|
60
98
|
BlockModifier = 7,
|
|
61
99
|
Interpolation = 8
|
|
62
100
|
}
|
|
63
|
-
type ParagraphNode =
|
|
101
|
+
type ParagraphNode = {
|
|
102
|
+
location: LocationRange;
|
|
64
103
|
type: NodeType.Paragraph;
|
|
65
104
|
content: InlineEntity[];
|
|
66
105
|
};
|
|
67
|
-
type PreNode =
|
|
106
|
+
type PreNode = {
|
|
107
|
+
location: LocationRange;
|
|
68
108
|
type: NodeType.Preformatted;
|
|
69
|
-
content:
|
|
109
|
+
content: {
|
|
110
|
+
start: number;
|
|
111
|
+
end: number;
|
|
70
112
|
text: string;
|
|
71
113
|
};
|
|
72
114
|
};
|
|
73
|
-
type TextNode =
|
|
115
|
+
type TextNode = {
|
|
116
|
+
location: LocationRange;
|
|
74
117
|
type: NodeType.Text;
|
|
75
118
|
content: string;
|
|
76
119
|
};
|
|
77
|
-
type EscapedNode =
|
|
120
|
+
type EscapedNode = {
|
|
121
|
+
location: LocationRange;
|
|
78
122
|
type: NodeType.Escaped;
|
|
79
123
|
content: string;
|
|
80
124
|
};
|
|
81
|
-
type SystemModifierNode<TState> =
|
|
125
|
+
type SystemModifierNode<TState> = {
|
|
126
|
+
location: LocationRange;
|
|
82
127
|
type: NodeType.SystemModifier;
|
|
83
128
|
mod: SystemModifierDefinition<TState>;
|
|
84
129
|
state?: TState;
|
|
85
|
-
head:
|
|
130
|
+
head: LocationRange;
|
|
86
131
|
arguments: ModifierArgument[];
|
|
87
132
|
content: BlockEntity[];
|
|
88
133
|
expansion?: never[];
|
|
89
134
|
};
|
|
90
|
-
type BlockModifierNode<TState> =
|
|
135
|
+
type BlockModifierNode<TState> = {
|
|
136
|
+
location: LocationRange;
|
|
91
137
|
type: NodeType.BlockModifier;
|
|
92
138
|
mod: BlockModifierDefinition<TState>;
|
|
93
139
|
state?: TState;
|
|
94
|
-
head:
|
|
140
|
+
head: LocationRange;
|
|
95
141
|
arguments: ModifierArgument[];
|
|
96
142
|
content: BlockEntity[];
|
|
97
143
|
expansion?: BlockEntity[];
|
|
98
144
|
};
|
|
99
|
-
type InlineModifierNode<TState> =
|
|
145
|
+
type InlineModifierNode<TState> = {
|
|
146
|
+
location: LocationRange;
|
|
100
147
|
type: NodeType.InlineModifier;
|
|
101
148
|
mod: InlineModifierDefinition<TState>;
|
|
102
149
|
state?: TState;
|
|
103
|
-
head:
|
|
150
|
+
head: LocationRange;
|
|
104
151
|
arguments: ModifierArgument[];
|
|
105
152
|
content: InlineEntity[];
|
|
106
153
|
expansion?: InlineEntity[];
|
|
107
154
|
};
|
|
108
|
-
type RootNode =
|
|
155
|
+
type RootNode = {
|
|
109
156
|
type: NodeType.Root;
|
|
110
157
|
content: BlockEntity[];
|
|
158
|
+
source: SourceDescriptor;
|
|
111
159
|
};
|
|
112
160
|
type ModifierNode<T = any> = BlockModifierNode<T> | InlineModifierNode<T> | SystemModifierNode<T>;
|
|
113
161
|
type BlockEntity = ParagraphNode | PreNode | BlockModifierNode<any> | SystemModifierNode<any>;
|
|
114
162
|
type InlineEntity = TextNode | EscapedNode | InlineModifierNode<any> | SystemModifierNode<any>;
|
|
115
163
|
type DocumentNode = BlockEntity | InlineEntity | RootNode;
|
|
116
|
-
type InterpolationNode =
|
|
164
|
+
type InterpolationNode = {
|
|
165
|
+
location: LocationRange;
|
|
117
166
|
type: NodeType.Interpolation;
|
|
118
167
|
definition: ArgumentInterpolatorDefinition;
|
|
119
168
|
argument: ModifierArgument;
|
|
120
169
|
expansion?: string;
|
|
121
170
|
};
|
|
122
|
-
type ModifierArgument =
|
|
171
|
+
type ModifierArgument = {
|
|
172
|
+
location: LocationRange;
|
|
123
173
|
content: ArgumentEntity[];
|
|
124
174
|
expansion?: string;
|
|
125
175
|
};
|
|
126
176
|
type ArgumentEntity = TextNode | EscapedNode | InterpolationNode;
|
|
127
|
-
declare enum
|
|
177
|
+
declare enum ModifierSlotType {
|
|
128
178
|
Normal = 0,
|
|
129
179
|
/** Content is preformatted: no escaping, no inner tags */
|
|
130
180
|
Preformatted = 1,
|
|
131
181
|
/** No content slot */
|
|
132
|
-
|
|
182
|
+
None = 2
|
|
133
183
|
}
|
|
134
184
|
declare class ModifierBase<TNode, TEntity> {
|
|
135
185
|
readonly name: string;
|
|
136
|
-
readonly
|
|
137
|
-
constructor(name: string,
|
|
186
|
+
readonly slotType: ModifierSlotType;
|
|
187
|
+
constructor(name: string, slotType?: ModifierSlotType, args?: Partial<ModifierBase<TNode, TEntity>>);
|
|
188
|
+
roleHint?: string;
|
|
138
189
|
delayContentExpansion: boolean;
|
|
139
190
|
alwaysTryExpand: boolean;
|
|
140
191
|
beforeParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
@@ -157,207 +208,238 @@ declare class ArgumentInterpolatorDefinition {
|
|
|
157
208
|
alwaysTryExpand: boolean;
|
|
158
209
|
expand?: (content: string, cxt: ParseContext, immediate: boolean) => string | undefined;
|
|
159
210
|
}
|
|
160
|
-
type
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
type InlineInstantiationData = {
|
|
166
|
-
mod: InlineModifierDefinition<any>;
|
|
167
|
-
slotContent: InlineEntity[];
|
|
168
|
-
args: Map<string, string>;
|
|
211
|
+
type Shorthand<TMod> = {
|
|
212
|
+
name: string;
|
|
213
|
+
parts: readonly string[];
|
|
214
|
+
postfix: string | undefined;
|
|
215
|
+
mod: TMod;
|
|
169
216
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
type ParseContextStoreKey = keyof ParseContextStoreDefinitions;
|
|
173
|
-
type ParseContextStoreEntry<S extends ParseContextStoreKey> = ParseContextStoreDefinitions[S];
|
|
174
|
-
declare class ParseContext {
|
|
175
|
-
config: Configuration;
|
|
176
|
-
variables: Map<string, string>;
|
|
177
|
-
private data;
|
|
178
|
-
constructor(config: Configuration, variables?: Map<string, string>);
|
|
179
|
-
init<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
|
|
180
|
-
set<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
|
|
181
|
-
get<S extends ParseContextStoreKey>(key: S): ParseContextStoreEntry<S>;
|
|
182
|
-
}
|
|
183
|
-
declare class Document {
|
|
184
|
-
root: RootNode;
|
|
185
|
-
context: ParseContext;
|
|
186
|
-
messages: Message[];
|
|
187
|
-
constructor(root: RootNode, context: ParseContext, messages: Message[]);
|
|
188
|
-
debugPrint(source: string): string;
|
|
189
|
-
}
|
|
190
|
-
declare class Configuration {
|
|
191
|
-
initializers: ((cxt: ParseContext) => void)[];
|
|
192
|
-
blockModifiers: NameManager<BlockModifierDefinition<any>>;
|
|
193
|
-
inlineModifiers: NameManager<InlineModifierDefinition<any>>;
|
|
194
|
-
systemModifiers: NameManager<SystemModifierDefinition<any>>;
|
|
195
|
-
argumentInterpolators: NameManager<ArgumentInterpolatorDefinition>;
|
|
196
|
-
reparseDepthLimit: number;
|
|
197
|
-
constructor(from?: Configuration);
|
|
198
|
-
}
|
|
217
|
+
type BlockShorthand<TState> = Shorthand<BlockModifierDefinition<TState>>;
|
|
218
|
+
type InlineShorthand<TState> = Shorthand<InlineModifierDefinition<TState>>;
|
|
199
219
|
|
|
200
220
|
declare class SimpleScanner implements Scanner {
|
|
201
221
|
private src;
|
|
222
|
+
readonly source: SourceDescriptor;
|
|
202
223
|
private pos;
|
|
203
|
-
constructor(src: string);
|
|
224
|
+
constructor(src: string, source?: SourceDescriptor);
|
|
204
225
|
position(): number;
|
|
205
226
|
isEOF(): boolean;
|
|
206
227
|
peek(str: string): boolean;
|
|
207
228
|
acceptChar(): string;
|
|
208
229
|
accept(str: string): boolean;
|
|
209
230
|
acceptWhitespaceChar(): string | null;
|
|
210
|
-
|
|
231
|
+
}
|
|
232
|
+
interface Scanner {
|
|
233
|
+
readonly source: SourceDescriptor;
|
|
234
|
+
position(): number;
|
|
235
|
+
isEOF(): boolean;
|
|
236
|
+
peek(str: string): boolean;
|
|
237
|
+
accept(str: string): boolean;
|
|
238
|
+
acceptChar(): string;
|
|
239
|
+
acceptWhitespaceChar(): string | null;
|
|
211
240
|
}
|
|
212
241
|
|
|
213
|
-
declare function parse(scanner: Scanner,
|
|
242
|
+
declare function parse(scanner: Scanner, cxt: ParseContext): Document;
|
|
214
243
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
244
|
+
type RendererType<TState, TReturn, TOptions = undefined> = {
|
|
245
|
+
state: TState;
|
|
246
|
+
return: TReturn;
|
|
247
|
+
options: TOptions;
|
|
248
|
+
};
|
|
249
|
+
type AnyRendererType = RendererType<any, any, any>;
|
|
250
|
+
type getState<Type> = Type extends RendererType<infer T, any, any> ? T : never;
|
|
251
|
+
type getReturn<Type> = Type extends RendererType<any, infer T, any> ? T : never;
|
|
252
|
+
type getOptions<Type> = Type extends RendererType<any, any, infer T> ? T : never;
|
|
253
|
+
type NodeRenderer<Type extends AnyRendererType, TNode> = (node: TNode, cxt: RenderContext<Type>) => getReturn<Type>;
|
|
254
|
+
type NodeRendererDefinition<Type extends AnyRendererType, TNode, TDef> = [def: TDef, renderer: NodeRenderer<Type, TNode>];
|
|
255
|
+
declare class RenderContext<Type extends AnyRendererType> {
|
|
256
|
+
readonly config: RenderConfiguration<Type>;
|
|
257
|
+
readonly parseContext: ParseContext;
|
|
258
|
+
state: getState<Type>;
|
|
259
|
+
renderEntity(node: BlockEntity | InlineEntity): getReturn<Type> | undefined;
|
|
260
|
+
constructor(config: RenderConfiguration<Type>, parseContext: ParseContext, state: getState<Type>);
|
|
261
|
+
}
|
|
262
|
+
interface ReadonlyRenderConfiguration<Type extends AnyRendererType> {
|
|
263
|
+
readonly options: getOptions<Type>;
|
|
264
|
+
readonly paragraphRenderer?: NodeRenderer<Type, ParagraphNode>;
|
|
265
|
+
readonly textRenderer?: NodeRenderer<Type, TextNode | PreNode | EscapedNode>;
|
|
266
|
+
readonly undefinedBlockRenderer?: NodeRenderer<Type, BlockModifierNode<any>>;
|
|
267
|
+
readonly undefinedInlineRenderer?: NodeRenderer<Type, InlineModifierNode<any>>;
|
|
268
|
+
readonly blockRenderers: ReadonlyMap<BlockModifierDefinition<any>, NodeRenderer<Type, BlockModifierNode<any>>>;
|
|
269
|
+
readonly inlineRenderers: ReadonlyMap<InlineModifierDefinition<any>, NodeRenderer<Type, InlineModifierNode<any>>>;
|
|
270
|
+
readonly postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>;
|
|
271
|
+
render(doc: Document, state: getState<Type>): getReturn<Type>;
|
|
272
|
+
}
|
|
273
|
+
type BlockRendererDefiniton<Type extends AnyRendererType, ModState = any> = NodeRendererDefinition<Type, BlockModifierNode<ModState>, BlockModifierDefinition<ModState>>;
|
|
274
|
+
type InlineRendererDefiniton<Type extends AnyRendererType, ModState = any> = NodeRendererDefinition<Type, InlineModifierNode<ModState>, InlineModifierDefinition<ModState>>;
|
|
275
|
+
declare class RenderConfiguration<Type extends AnyRendererType> implements ReadonlyRenderConfiguration<Type> {
|
|
276
|
+
options: getOptions<Type>;
|
|
277
|
+
postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>;
|
|
278
|
+
paragraphRenderer?: NodeRenderer<Type, ParagraphNode>;
|
|
279
|
+
textRenderer?: NodeRenderer<Type, TextNode | PreNode | EscapedNode>;
|
|
280
|
+
undefinedBlockRenderer?: NodeRenderer<Type, BlockModifierNode<any>>;
|
|
281
|
+
undefinedInlineRenderer?: NodeRenderer<Type, InlineModifierNode<any>>;
|
|
282
|
+
blockRenderers: Map<BlockModifierDefinition<any>, NodeRenderer<Type, BlockModifierNode<any>>>;
|
|
283
|
+
inlineRenderers: Map<InlineModifierDefinition<any>, NodeRenderer<Type, InlineModifierNode<any>>>;
|
|
284
|
+
constructor(options: getOptions<Type>, postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>);
|
|
285
|
+
render(doc: Document, state: getState<Type>): getReturn<Type>;
|
|
286
|
+
addBlockRenderer(...rs: BlockRendererDefiniton<Type>[]): void;
|
|
287
|
+
addInlineRenderer(...rs: InlineRendererDefiniton<Type>[]): void;
|
|
288
|
+
static from<Type extends AnyRendererType>(from: ReadonlyRenderConfiguration<Type>): RenderConfiguration<Type>;
|
|
224
289
|
}
|
|
290
|
+
|
|
225
291
|
declare class AddThingMessage implements Message {
|
|
226
292
|
readonly code: number;
|
|
227
293
|
readonly severity: MessageSeverity;
|
|
228
|
-
readonly
|
|
229
|
-
readonly length: number;
|
|
294
|
+
readonly location: LocationRange;
|
|
230
295
|
readonly info: string;
|
|
231
|
-
|
|
232
|
-
private what;
|
|
233
|
-
constructor(code: number, severity: MessageSeverity, position: number, length: number, info: string, fixstr: string, what: string);
|
|
234
|
-
get fixes(): readonly FixSuggestion[];
|
|
296
|
+
constructor(code: number, severity: MessageSeverity, location: LocationRange, info: string);
|
|
235
297
|
}
|
|
236
298
|
declare class RemoveThingMessage implements Message {
|
|
237
299
|
readonly code: number;
|
|
238
300
|
readonly severity: MessageSeverity;
|
|
239
|
-
readonly
|
|
240
|
-
readonly length: number;
|
|
301
|
+
readonly location: LocationRange;
|
|
241
302
|
readonly info: string;
|
|
242
|
-
|
|
243
|
-
constructor(code: number, severity: MessageSeverity, position: number, length: number, info: string, fixstr: string);
|
|
244
|
-
get fixes(): readonly FixSuggestion[];
|
|
303
|
+
constructor(code: number, severity: MessageSeverity, location: LocationRange, info: string);
|
|
245
304
|
}
|
|
246
305
|
declare class ExpectedMessage implements Message {
|
|
247
|
-
readonly
|
|
306
|
+
readonly location: LocationRange;
|
|
248
307
|
private what;
|
|
249
|
-
constructor(
|
|
308
|
+
constructor(location: LocationRange, what: string);
|
|
250
309
|
readonly code = 1;
|
|
251
310
|
readonly severity = MessageSeverity.Error;
|
|
252
|
-
get length(): number;
|
|
253
311
|
get info(): string;
|
|
254
|
-
get fixes(): readonly FixSuggestion[];
|
|
255
312
|
}
|
|
256
313
|
declare class UnknownModifierMessage implements Message {
|
|
257
|
-
readonly
|
|
258
|
-
|
|
259
|
-
constructor(
|
|
314
|
+
readonly location: LocationRange;
|
|
315
|
+
private what;
|
|
316
|
+
constructor(location: LocationRange, what: string);
|
|
260
317
|
readonly code = 2;
|
|
261
318
|
readonly severity = MessageSeverity.Error;
|
|
262
|
-
|
|
263
|
-
get fixes(): readonly FixSuggestion[];
|
|
319
|
+
get info(): string;
|
|
264
320
|
}
|
|
265
321
|
declare class UnclosedInlineModifierMessage implements Message {
|
|
266
|
-
readonly
|
|
322
|
+
readonly location: LocationRange;
|
|
267
323
|
private what;
|
|
268
|
-
constructor(
|
|
324
|
+
constructor(location: LocationRange, what: string);
|
|
269
325
|
readonly code = 3;
|
|
270
326
|
readonly severity = MessageSeverity.Error;
|
|
271
|
-
readonly length = 0;
|
|
272
|
-
readonly fixes: readonly FixSuggestion[];
|
|
273
327
|
get info(): string;
|
|
274
328
|
}
|
|
275
329
|
declare class ArgumentCountMismatchMessage implements Message {
|
|
276
|
-
readonly
|
|
277
|
-
|
|
278
|
-
constructor(position: number, length: number, min?: number, max?: number);
|
|
330
|
+
readonly location: LocationRange;
|
|
331
|
+
constructor(location: LocationRange, min?: number, max?: number);
|
|
279
332
|
private msg;
|
|
280
333
|
readonly code = 4;
|
|
281
334
|
readonly severity = MessageSeverity.Error;
|
|
282
|
-
readonly fixes: readonly FixSuggestion[];
|
|
283
335
|
get info(): string;
|
|
284
336
|
}
|
|
285
337
|
declare class CannotExpandArgumentMessage implements Message {
|
|
286
|
-
readonly
|
|
287
|
-
readonly length: number;
|
|
338
|
+
readonly location: LocationRange;
|
|
288
339
|
private what?;
|
|
289
|
-
constructor(
|
|
340
|
+
constructor(location: LocationRange, what?: string | undefined);
|
|
290
341
|
readonly code = 5;
|
|
291
342
|
readonly severity = MessageSeverity.Error;
|
|
292
|
-
readonly fixes: readonly FixSuggestion[];
|
|
293
343
|
get info(): string;
|
|
294
344
|
}
|
|
295
345
|
declare class InvalidArgumentMessage implements Message {
|
|
296
|
-
readonly
|
|
297
|
-
readonly length: number;
|
|
346
|
+
readonly location: LocationRange;
|
|
298
347
|
private what?;
|
|
299
|
-
constructor(
|
|
348
|
+
constructor(location: LocationRange, what?: string | undefined);
|
|
300
349
|
readonly code = 6;
|
|
301
350
|
readonly severity = MessageSeverity.Error;
|
|
302
|
-
readonly fixes: readonly FixSuggestion[];
|
|
303
351
|
get info(): string;
|
|
304
352
|
}
|
|
305
|
-
declare class
|
|
306
|
-
readonly
|
|
307
|
-
|
|
308
|
-
constructor(
|
|
353
|
+
declare class EntityNotAllowedMessage implements Message {
|
|
354
|
+
readonly location: LocationRange;
|
|
355
|
+
private what?;
|
|
356
|
+
constructor(location: LocationRange, what?: string | undefined);
|
|
309
357
|
readonly code = 7;
|
|
310
358
|
readonly severity = MessageSeverity.Error;
|
|
311
|
-
readonly fixes: readonly FixSuggestion[];
|
|
312
359
|
get info(): string;
|
|
313
360
|
}
|
|
314
361
|
declare class ReachedRecursionLimitMessage implements Message {
|
|
315
|
-
readonly
|
|
316
|
-
readonly length: number;
|
|
362
|
+
readonly location: LocationRange;
|
|
317
363
|
private limit;
|
|
318
364
|
private what;
|
|
319
|
-
constructor(
|
|
365
|
+
constructor(location: LocationRange, limit: number, what: string);
|
|
320
366
|
readonly code = 8;
|
|
321
367
|
readonly severity = MessageSeverity.Error;
|
|
322
|
-
readonly fixes: readonly FixSuggestion[];
|
|
323
368
|
get info(): string;
|
|
324
369
|
}
|
|
325
370
|
declare class SlotUsedOutsideDefinitionMessage implements Message {
|
|
326
|
-
readonly
|
|
327
|
-
|
|
328
|
-
constructor(position: number, length: number);
|
|
371
|
+
readonly location: LocationRange;
|
|
372
|
+
constructor(location: LocationRange);
|
|
329
373
|
readonly code = 9;
|
|
330
374
|
readonly severity = MessageSeverity.Error;
|
|
331
|
-
|
|
375
|
+
get info(): string;
|
|
376
|
+
}
|
|
377
|
+
declare class NoNestedModuleMessage implements Message {
|
|
378
|
+
readonly location: LocationRange;
|
|
379
|
+
constructor(location: LocationRange);
|
|
380
|
+
readonly code = 10;
|
|
381
|
+
readonly severity = MessageSeverity.Error;
|
|
382
|
+
get info(): string;
|
|
383
|
+
}
|
|
384
|
+
declare class CannotUseModuleInSelfMessage implements Message {
|
|
385
|
+
readonly location: LocationRange;
|
|
386
|
+
constructor(location: LocationRange);
|
|
387
|
+
readonly code = 11;
|
|
388
|
+
readonly severity = MessageSeverity.Error;
|
|
389
|
+
get info(): string;
|
|
390
|
+
}
|
|
391
|
+
declare class EitherNormalOrPreMessage implements Message {
|
|
392
|
+
readonly location: LocationRange;
|
|
393
|
+
constructor(location: LocationRange);
|
|
394
|
+
readonly code = 12;
|
|
395
|
+
readonly severity = MessageSeverity.Error;
|
|
396
|
+
get info(): string;
|
|
397
|
+
}
|
|
398
|
+
declare class MultipleBlocksNotPermittedMessage implements Message {
|
|
399
|
+
readonly location: LocationRange;
|
|
400
|
+
constructor(location: LocationRange);
|
|
401
|
+
readonly code = 13;
|
|
402
|
+
readonly severity = MessageSeverity.Error;
|
|
403
|
+
get info(): string;
|
|
404
|
+
}
|
|
405
|
+
declare class OnlySimpleParagraphsPermittedMessage implements Message {
|
|
406
|
+
readonly location: LocationRange;
|
|
407
|
+
constructor(location: LocationRange);
|
|
408
|
+
readonly code = 14;
|
|
409
|
+
readonly severity = MessageSeverity.Error;
|
|
332
410
|
get info(): string;
|
|
333
411
|
}
|
|
334
412
|
declare class UnnecessaryNewlineMessage extends RemoveThingMessage {
|
|
335
|
-
constructor(
|
|
413
|
+
constructor(location: LocationRange);
|
|
336
414
|
}
|
|
337
415
|
declare class NewBlockShouldBeOnNewlineMessage extends AddThingMessage {
|
|
338
|
-
constructor(
|
|
416
|
+
constructor(location: LocationRange);
|
|
339
417
|
}
|
|
340
418
|
declare class ContentShouldBeOnNewlineMessage extends AddThingMessage {
|
|
341
|
-
constructor(
|
|
419
|
+
constructor(location: LocationRange);
|
|
342
420
|
}
|
|
343
421
|
declare class NameAlreadyDefinedMessage implements Message {
|
|
344
|
-
readonly
|
|
345
|
-
readonly length: number;
|
|
422
|
+
readonly location: LocationRange;
|
|
346
423
|
private what;
|
|
347
|
-
constructor(
|
|
424
|
+
constructor(location: LocationRange, what: string);
|
|
348
425
|
readonly code = 4;
|
|
349
426
|
readonly severity = MessageSeverity.Warning;
|
|
350
|
-
readonly fixes: readonly FixSuggestion[];
|
|
351
427
|
get info(): string;
|
|
352
428
|
}
|
|
353
429
|
declare class UndefinedVariableMessage implements Message {
|
|
354
|
-
readonly
|
|
355
|
-
readonly length: number;
|
|
430
|
+
readonly location: LocationRange;
|
|
356
431
|
private what;
|
|
357
|
-
constructor(
|
|
432
|
+
constructor(location: LocationRange, what: string);
|
|
358
433
|
readonly code = 5;
|
|
359
434
|
readonly severity = MessageSeverity.Warning;
|
|
360
|
-
|
|
435
|
+
get info(): string;
|
|
436
|
+
}
|
|
437
|
+
declare class OverwriteDefinitionsMessage implements Message {
|
|
438
|
+
readonly location: LocationRange;
|
|
439
|
+
private what;
|
|
440
|
+
constructor(location: LocationRange, what: string);
|
|
441
|
+
readonly code = 6;
|
|
442
|
+
readonly severity = MessageSeverity.Warning;
|
|
361
443
|
get info(): string;
|
|
362
444
|
}
|
|
363
445
|
|
|
@@ -365,22 +447,32 @@ type messages_ArgumentCountMismatchMessage = ArgumentCountMismatchMessage;
|
|
|
365
447
|
declare const messages_ArgumentCountMismatchMessage: typeof ArgumentCountMismatchMessage;
|
|
366
448
|
type messages_CannotExpandArgumentMessage = CannotExpandArgumentMessage;
|
|
367
449
|
declare const messages_CannotExpandArgumentMessage: typeof CannotExpandArgumentMessage;
|
|
450
|
+
type messages_CannotUseModuleInSelfMessage = CannotUseModuleInSelfMessage;
|
|
451
|
+
declare const messages_CannotUseModuleInSelfMessage: typeof CannotUseModuleInSelfMessage;
|
|
368
452
|
type messages_ContentShouldBeOnNewlineMessage = ContentShouldBeOnNewlineMessage;
|
|
369
453
|
declare const messages_ContentShouldBeOnNewlineMessage: typeof ContentShouldBeOnNewlineMessage;
|
|
454
|
+
type messages_EitherNormalOrPreMessage = EitherNormalOrPreMessage;
|
|
455
|
+
declare const messages_EitherNormalOrPreMessage: typeof EitherNormalOrPreMessage;
|
|
456
|
+
type messages_EntityNotAllowedMessage = EntityNotAllowedMessage;
|
|
457
|
+
declare const messages_EntityNotAllowedMessage: typeof EntityNotAllowedMessage;
|
|
370
458
|
type messages_ExpectedMessage = ExpectedMessage;
|
|
371
459
|
declare const messages_ExpectedMessage: typeof ExpectedMessage;
|
|
372
|
-
type messages_InlineDefinitonInvalidEntityMessage = InlineDefinitonInvalidEntityMessage;
|
|
373
|
-
declare const messages_InlineDefinitonInvalidEntityMessage: typeof InlineDefinitonInvalidEntityMessage;
|
|
374
460
|
type messages_InvalidArgumentMessage = InvalidArgumentMessage;
|
|
375
461
|
declare const messages_InvalidArgumentMessage: typeof InvalidArgumentMessage;
|
|
462
|
+
type messages_MultipleBlocksNotPermittedMessage = MultipleBlocksNotPermittedMessage;
|
|
463
|
+
declare const messages_MultipleBlocksNotPermittedMessage: typeof MultipleBlocksNotPermittedMessage;
|
|
376
464
|
type messages_NameAlreadyDefinedMessage = NameAlreadyDefinedMessage;
|
|
377
465
|
declare const messages_NameAlreadyDefinedMessage: typeof NameAlreadyDefinedMessage;
|
|
378
466
|
type messages_NewBlockShouldBeOnNewlineMessage = NewBlockShouldBeOnNewlineMessage;
|
|
379
467
|
declare const messages_NewBlockShouldBeOnNewlineMessage: typeof NewBlockShouldBeOnNewlineMessage;
|
|
468
|
+
type messages_NoNestedModuleMessage = NoNestedModuleMessage;
|
|
469
|
+
declare const messages_NoNestedModuleMessage: typeof NoNestedModuleMessage;
|
|
470
|
+
type messages_OnlySimpleParagraphsPermittedMessage = OnlySimpleParagraphsPermittedMessage;
|
|
471
|
+
declare const messages_OnlySimpleParagraphsPermittedMessage: typeof OnlySimpleParagraphsPermittedMessage;
|
|
472
|
+
type messages_OverwriteDefinitionsMessage = OverwriteDefinitionsMessage;
|
|
473
|
+
declare const messages_OverwriteDefinitionsMessage: typeof OverwriteDefinitionsMessage;
|
|
380
474
|
type messages_ReachedRecursionLimitMessage = ReachedRecursionLimitMessage;
|
|
381
475
|
declare const messages_ReachedRecursionLimitMessage: typeof ReachedRecursionLimitMessage;
|
|
382
|
-
type messages_ReferredMessage = ReferredMessage;
|
|
383
|
-
declare const messages_ReferredMessage: typeof ReferredMessage;
|
|
384
476
|
type messages_SlotUsedOutsideDefinitionMessage = SlotUsedOutsideDefinitionMessage;
|
|
385
477
|
declare const messages_SlotUsedOutsideDefinitionMessage: typeof SlotUsedOutsideDefinitionMessage;
|
|
386
478
|
type messages_UnclosedInlineModifierMessage = UnclosedInlineModifierMessage;
|
|
@@ -392,11 +484,50 @@ declare const messages_UnknownModifierMessage: typeof UnknownModifierMessage;
|
|
|
392
484
|
type messages_UnnecessaryNewlineMessage = UnnecessaryNewlineMessage;
|
|
393
485
|
declare const messages_UnnecessaryNewlineMessage: typeof UnnecessaryNewlineMessage;
|
|
394
486
|
declare namespace messages {
|
|
395
|
-
export { messages_ArgumentCountMismatchMessage as ArgumentCountMismatchMessage, messages_CannotExpandArgumentMessage as CannotExpandArgumentMessage, messages_ContentShouldBeOnNewlineMessage as ContentShouldBeOnNewlineMessage,
|
|
487
|
+
export { messages_ArgumentCountMismatchMessage as ArgumentCountMismatchMessage, messages_CannotExpandArgumentMessage as CannotExpandArgumentMessage, messages_CannotUseModuleInSelfMessage as CannotUseModuleInSelfMessage, messages_ContentShouldBeOnNewlineMessage as ContentShouldBeOnNewlineMessage, messages_EitherNormalOrPreMessage as EitherNormalOrPreMessage, messages_EntityNotAllowedMessage as EntityNotAllowedMessage, messages_ExpectedMessage as ExpectedMessage, messages_InvalidArgumentMessage as InvalidArgumentMessage, messages_MultipleBlocksNotPermittedMessage as MultipleBlocksNotPermittedMessage, messages_NameAlreadyDefinedMessage as NameAlreadyDefinedMessage, messages_NewBlockShouldBeOnNewlineMessage as NewBlockShouldBeOnNewlineMessage, messages_NoNestedModuleMessage as NoNestedModuleMessage, messages_OnlySimpleParagraphsPermittedMessage as OnlySimpleParagraphsPermittedMessage, messages_OverwriteDefinitionsMessage as OverwriteDefinitionsMessage, messages_ReachedRecursionLimitMessage as ReachedRecursionLimitMessage, messages_SlotUsedOutsideDefinitionMessage as SlotUsedOutsideDefinitionMessage, messages_UnclosedInlineModifierMessage as UnclosedInlineModifierMessage, messages_UndefinedVariableMessage as UndefinedVariableMessage, messages_UnknownModifierMessage as UnknownModifierMessage, messages_UnnecessaryNewlineMessage as UnnecessaryNewlineMessage };
|
|
396
488
|
}
|
|
397
489
|
|
|
398
|
-
declare const BuiltinConfiguration:
|
|
490
|
+
declare const BuiltinConfiguration: ReadonlyConfiguration;
|
|
491
|
+
|
|
492
|
+
declare const DefaultConfiguration: ReadonlyConfiguration;
|
|
493
|
+
|
|
494
|
+
type HTMLRendererOptions = {
|
|
495
|
+
headPlugins: HTMLComponentPlugin[];
|
|
496
|
+
headerPlugins: HTMLComponentPlugin[];
|
|
497
|
+
footerPlugins: HTMLComponentPlugin[];
|
|
498
|
+
transformAsset: (url: URL) => string | undefined;
|
|
499
|
+
};
|
|
500
|
+
type HTMLRenderType = {
|
|
501
|
+
state: HTMLRenderState;
|
|
502
|
+
options: HTMLRendererOptions;
|
|
503
|
+
return: string;
|
|
504
|
+
};
|
|
505
|
+
type HTMLRenderPlugin = (elem: BlockEntity | InlineEntity, cxt: RenderContext<HTMLRenderType>) => string | undefined;
|
|
506
|
+
type HTMLComponentPlugin = (cxt: RenderContext<HTMLRenderType>) => string | undefined;
|
|
507
|
+
type HTMLPostprocessPlugin = (cxt: RenderContext<HTMLRenderType>, output: string) => string;
|
|
508
|
+
declare class HTMLRenderState {
|
|
509
|
+
title: string;
|
|
510
|
+
stylesheet: string;
|
|
511
|
+
cssVariables: Map<string, string>;
|
|
512
|
+
escape(content: string): string;
|
|
513
|
+
invalidBlock(node: BlockEntity, msg: string): string;
|
|
514
|
+
invalidInline(node: InlineEntity, msg: string): string;
|
|
515
|
+
render(elems: (BlockEntity | InlineEntity)[], cxt: RenderContext<HTMLRenderType>): string;
|
|
516
|
+
}
|
|
517
|
+
declare const HTMLRenderConfiguration: ReadonlyRenderConfiguration<HTMLRenderType>;
|
|
518
|
+
|
|
519
|
+
declare const debugPrint: {
|
|
520
|
+
blockModifier: (x: BlockModifierDefinition<any>) => string;
|
|
521
|
+
inlineModifier: (x: InlineModifierDefinition<any>) => string;
|
|
522
|
+
inlineShorthand: (x: InlineShorthand<any>) => string;
|
|
523
|
+
blockShorthand: (x: BlockShorthand<any>) => string;
|
|
524
|
+
argument: (arg: ModifierArgument) => string;
|
|
525
|
+
node: (...nodes: (BlockEntity | InlineEntity)[]) => string;
|
|
526
|
+
message: (m: Message, source?: string, descriptor?: SourceDescriptor) => string;
|
|
527
|
+
document: typeof debugDumpDocument;
|
|
528
|
+
};
|
|
529
|
+
declare function debugDumpDocument(doc: Document, source: string): string;
|
|
399
530
|
|
|
400
531
|
declare function setDebugLevel(level: DebugLevel): void;
|
|
401
532
|
|
|
402
|
-
export { type ArgumentEntity, ArgumentInterpolatorDefinition, type BlockEntity, type
|
|
533
|
+
export { type ArgumentEntity, ArgumentInterpolatorDefinition, type BlockEntity, BlockModifierDefinition, type BlockModifierNode, type BlockRendererDefiniton, type BlockShorthand, BuiltinConfiguration, Configuration, DebugLevel, DefaultConfiguration, Document, type DocumentNode, type EscapedNode, type HTMLComponentPlugin, type HTMLPostprocessPlugin, HTMLRenderConfiguration, type HTMLRenderPlugin, HTMLRenderState, type HTMLRenderType, type HTMLRendererOptions, type InlineEntity, InlineModifierDefinition, type InlineModifierNode, type InlineRendererDefiniton, type InlineShorthand, type InterpolationNode, type LocationRange, type Message, MessageSeverity, type ModifierArgument, type ModifierNode, ModifierSlotType, type NodeRenderer, type NodeRendererDefinition, NodeType, type ParagraphNode, ParseContext, type ParseContextStoreDefinitions, type ParseContextStoreKey, type PreNode, type ReadonlyConfiguration, type ReadonlyRenderConfiguration, RenderConfiguration, RenderContext, type RendererType, type RootNode, type Scanner, SimpleScanner, type SourceDescriptor, SystemModifierDefinition, type SystemModifierNode, type TextNode, debugPrint, messages, parse, setDebugLevel };
|