@the_dissidents/libemmm 0.0.2 → 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 +32 -12
- package/dist/index.d.mts +272 -166
- package/dist/index.d.ts +272 -166
- package/dist/index.js +2068 -902
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2061 -901
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -11,8 +11,9 @@ declare class NameManager<T extends {
|
|
|
11
11
|
}> {
|
|
12
12
|
private array;
|
|
13
13
|
private data;
|
|
14
|
-
constructor(from?: ReadonlyNameManager<T> | readonly T[]);
|
|
15
|
-
toArray():
|
|
14
|
+
constructor(from?: ReadonlyNameManager<T> | readonly T[] | ReadonlySet<T>);
|
|
15
|
+
toArray(): T[];
|
|
16
|
+
toSet(): Set<T>;
|
|
16
17
|
get(name: string): T | undefined;
|
|
17
18
|
has(name: string): boolean;
|
|
18
19
|
remove(name: string): void;
|
|
@@ -23,33 +24,65 @@ type ReadonlyNameManager<T extends {
|
|
|
23
24
|
name: string;
|
|
24
25
|
}> = Omit<NameManager<T>, 'add' | 'remove'>;
|
|
25
26
|
|
|
26
|
-
interface
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
interface ParseContextStoreDefinitions {
|
|
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;
|
|
34
67
|
}
|
|
68
|
+
|
|
35
69
|
declare enum MessageSeverity {
|
|
36
70
|
Info = 0,
|
|
37
71
|
Warning = 1,
|
|
38
72
|
Error = 2
|
|
39
73
|
}
|
|
40
|
-
type FixSuggestion = {
|
|
41
|
-
info: string;
|
|
42
|
-
apply(src: string, cursor: number): [out_src: string, new_cursor: number];
|
|
43
|
-
};
|
|
44
74
|
type Message = {
|
|
45
75
|
readonly severity: MessageSeverity;
|
|
46
|
-
readonly
|
|
47
|
-
readonly length: number;
|
|
76
|
+
readonly location: LocationRange;
|
|
48
77
|
readonly info: string;
|
|
49
78
|
readonly code: number;
|
|
50
|
-
readonly fixes: readonly FixSuggestion[];
|
|
51
79
|
};
|
|
52
|
-
type
|
|
80
|
+
type SourceDescriptor = {
|
|
81
|
+
name: string;
|
|
82
|
+
};
|
|
83
|
+
type LocationRange = {
|
|
84
|
+
original?: LocationRange;
|
|
85
|
+
source: SourceDescriptor;
|
|
53
86
|
start: number;
|
|
54
87
|
end: number;
|
|
55
88
|
actualEnd?: number;
|
|
@@ -65,81 +98,94 @@ declare enum NodeType {
|
|
|
65
98
|
BlockModifier = 7,
|
|
66
99
|
Interpolation = 8
|
|
67
100
|
}
|
|
68
|
-
type ParagraphNode =
|
|
101
|
+
type ParagraphNode = {
|
|
102
|
+
location: LocationRange;
|
|
69
103
|
type: NodeType.Paragraph;
|
|
70
104
|
content: InlineEntity[];
|
|
71
105
|
};
|
|
72
|
-
type PreNode =
|
|
106
|
+
type PreNode = {
|
|
107
|
+
location: LocationRange;
|
|
73
108
|
type: NodeType.Preformatted;
|
|
74
|
-
content:
|
|
109
|
+
content: {
|
|
110
|
+
start: number;
|
|
111
|
+
end: number;
|
|
75
112
|
text: string;
|
|
76
113
|
};
|
|
77
114
|
};
|
|
78
|
-
type TextNode =
|
|
115
|
+
type TextNode = {
|
|
116
|
+
location: LocationRange;
|
|
79
117
|
type: NodeType.Text;
|
|
80
118
|
content: string;
|
|
81
119
|
};
|
|
82
|
-
type EscapedNode =
|
|
120
|
+
type EscapedNode = {
|
|
121
|
+
location: LocationRange;
|
|
83
122
|
type: NodeType.Escaped;
|
|
84
123
|
content: string;
|
|
85
124
|
};
|
|
86
|
-
type SystemModifierNode<TState> =
|
|
125
|
+
type SystemModifierNode<TState> = {
|
|
126
|
+
location: LocationRange;
|
|
87
127
|
type: NodeType.SystemModifier;
|
|
88
128
|
mod: SystemModifierDefinition<TState>;
|
|
89
129
|
state?: TState;
|
|
90
|
-
head:
|
|
130
|
+
head: LocationRange;
|
|
91
131
|
arguments: ModifierArgument[];
|
|
92
132
|
content: BlockEntity[];
|
|
93
133
|
expansion?: never[];
|
|
94
134
|
};
|
|
95
|
-
type BlockModifierNode<TState> =
|
|
135
|
+
type BlockModifierNode<TState> = {
|
|
136
|
+
location: LocationRange;
|
|
96
137
|
type: NodeType.BlockModifier;
|
|
97
138
|
mod: BlockModifierDefinition<TState>;
|
|
98
139
|
state?: TState;
|
|
99
|
-
head:
|
|
140
|
+
head: LocationRange;
|
|
100
141
|
arguments: ModifierArgument[];
|
|
101
142
|
content: BlockEntity[];
|
|
102
143
|
expansion?: BlockEntity[];
|
|
103
144
|
};
|
|
104
|
-
type InlineModifierNode<TState> =
|
|
145
|
+
type InlineModifierNode<TState> = {
|
|
146
|
+
location: LocationRange;
|
|
105
147
|
type: NodeType.InlineModifier;
|
|
106
148
|
mod: InlineModifierDefinition<TState>;
|
|
107
149
|
state?: TState;
|
|
108
|
-
head:
|
|
150
|
+
head: LocationRange;
|
|
109
151
|
arguments: ModifierArgument[];
|
|
110
152
|
content: InlineEntity[];
|
|
111
153
|
expansion?: InlineEntity[];
|
|
112
154
|
};
|
|
113
|
-
type RootNode =
|
|
155
|
+
type RootNode = {
|
|
114
156
|
type: NodeType.Root;
|
|
115
157
|
content: BlockEntity[];
|
|
158
|
+
source: SourceDescriptor;
|
|
116
159
|
};
|
|
117
160
|
type ModifierNode<T = any> = BlockModifierNode<T> | InlineModifierNode<T> | SystemModifierNode<T>;
|
|
118
161
|
type BlockEntity = ParagraphNode | PreNode | BlockModifierNode<any> | SystemModifierNode<any>;
|
|
119
162
|
type InlineEntity = TextNode | EscapedNode | InlineModifierNode<any> | SystemModifierNode<any>;
|
|
120
163
|
type DocumentNode = BlockEntity | InlineEntity | RootNode;
|
|
121
|
-
type InterpolationNode =
|
|
164
|
+
type InterpolationNode = {
|
|
165
|
+
location: LocationRange;
|
|
122
166
|
type: NodeType.Interpolation;
|
|
123
167
|
definition: ArgumentInterpolatorDefinition;
|
|
124
168
|
argument: ModifierArgument;
|
|
125
169
|
expansion?: string;
|
|
126
170
|
};
|
|
127
|
-
type ModifierArgument =
|
|
171
|
+
type ModifierArgument = {
|
|
172
|
+
location: LocationRange;
|
|
128
173
|
content: ArgumentEntity[];
|
|
129
174
|
expansion?: string;
|
|
130
175
|
};
|
|
131
176
|
type ArgumentEntity = TextNode | EscapedNode | InterpolationNode;
|
|
132
|
-
declare enum
|
|
177
|
+
declare enum ModifierSlotType {
|
|
133
178
|
Normal = 0,
|
|
134
179
|
/** Content is preformatted: no escaping, no inner tags */
|
|
135
180
|
Preformatted = 1,
|
|
136
181
|
/** No content slot */
|
|
137
|
-
|
|
182
|
+
None = 2
|
|
138
183
|
}
|
|
139
184
|
declare class ModifierBase<TNode, TEntity> {
|
|
140
185
|
readonly name: string;
|
|
141
|
-
readonly
|
|
142
|
-
constructor(name: string,
|
|
186
|
+
readonly slotType: ModifierSlotType;
|
|
187
|
+
constructor(name: string, slotType?: ModifierSlotType, args?: Partial<ModifierBase<TNode, TEntity>>);
|
|
188
|
+
roleHint?: string;
|
|
143
189
|
delayContentExpansion: boolean;
|
|
144
190
|
alwaysTryExpand: boolean;
|
|
145
191
|
beforeParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
@@ -162,225 +208,238 @@ declare class ArgumentInterpolatorDefinition {
|
|
|
162
208
|
alwaysTryExpand: boolean;
|
|
163
209
|
expand?: (content: string, cxt: ParseContext, immediate: boolean) => string | undefined;
|
|
164
210
|
}
|
|
165
|
-
type
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
type InlineInstantiationData = {
|
|
171
|
-
mod: InlineModifierDefinition<any>;
|
|
172
|
-
slotContent: InlineEntity[];
|
|
173
|
-
args: Map<string, string>;
|
|
211
|
+
type Shorthand<TMod> = {
|
|
212
|
+
name: string;
|
|
213
|
+
parts: readonly string[];
|
|
214
|
+
postfix: string | undefined;
|
|
215
|
+
mod: TMod;
|
|
174
216
|
};
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
type ParseContextStoreKey = keyof ParseContextStoreDefinitions;
|
|
178
|
-
type ParseContextStoreEntry<S extends ParseContextStoreKey> = ParseContextStoreDefinitions[S];
|
|
179
|
-
declare class ParseContext {
|
|
180
|
-
config: Configuration;
|
|
181
|
-
variables: Map<string, string>;
|
|
182
|
-
private data;
|
|
183
|
-
constructor(config: Configuration, variables?: Map<string, string>);
|
|
184
|
-
init<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
|
|
185
|
-
set<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
|
|
186
|
-
get<S extends ParseContextStoreKey>(key: S): ParseContextStoreEntry<S>;
|
|
187
|
-
}
|
|
188
|
-
declare class Document {
|
|
189
|
-
root: RootNode;
|
|
190
|
-
context: ParseContext;
|
|
191
|
-
messages: Message[];
|
|
192
|
-
constructor(root: RootNode, context: ParseContext, messages: Message[]);
|
|
193
|
-
debugPrint(source: string): string;
|
|
194
|
-
}
|
|
195
|
-
interface ReadonlyConfiguration {
|
|
196
|
-
initializers: readonly ((cxt: ParseContext) => void)[];
|
|
197
|
-
blockModifiers: ReadonlyNameManager<BlockModifierDefinition<any>>;
|
|
198
|
-
inlineModifiers: ReadonlyNameManager<InlineModifierDefinition<any>>;
|
|
199
|
-
systemModifiers: ReadonlyNameManager<SystemModifierDefinition<any>>;
|
|
200
|
-
argumentInterpolators: ReadonlyNameManager<ArgumentInterpolatorDefinition>;
|
|
201
|
-
reparseDepthLimit: number;
|
|
202
|
-
}
|
|
203
|
-
declare class Configuration {
|
|
204
|
-
initializers: ((cxt: ParseContext) => void)[];
|
|
205
|
-
blockModifiers: NameManager<BlockModifierDefinition<any>>;
|
|
206
|
-
inlineModifiers: NameManager<InlineModifierDefinition<any>>;
|
|
207
|
-
systemModifiers: NameManager<SystemModifierDefinition<any>>;
|
|
208
|
-
argumentInterpolators: NameManager<ArgumentInterpolatorDefinition>;
|
|
209
|
-
reparseDepthLimit: number;
|
|
210
|
-
constructor(from?: ReadonlyConfiguration);
|
|
211
|
-
}
|
|
217
|
+
type BlockShorthand<TState> = Shorthand<BlockModifierDefinition<TState>>;
|
|
218
|
+
type InlineShorthand<TState> = Shorthand<InlineModifierDefinition<TState>>;
|
|
212
219
|
|
|
213
220
|
declare class SimpleScanner implements Scanner {
|
|
214
221
|
private src;
|
|
222
|
+
readonly source: SourceDescriptor;
|
|
215
223
|
private pos;
|
|
216
|
-
constructor(src: string);
|
|
224
|
+
constructor(src: string, source?: SourceDescriptor);
|
|
217
225
|
position(): number;
|
|
218
226
|
isEOF(): boolean;
|
|
219
227
|
peek(str: string): boolean;
|
|
220
228
|
acceptChar(): string;
|
|
221
229
|
accept(str: string): boolean;
|
|
222
230
|
acceptWhitespaceChar(): string | null;
|
|
223
|
-
|
|
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;
|
|
224
240
|
}
|
|
225
241
|
|
|
226
|
-
declare function parse(scanner: Scanner,
|
|
242
|
+
declare function parse(scanner: Scanner, cxt: ParseContext): Document;
|
|
227
243
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
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>;
|
|
237
289
|
}
|
|
290
|
+
|
|
238
291
|
declare class AddThingMessage implements Message {
|
|
239
292
|
readonly code: number;
|
|
240
293
|
readonly severity: MessageSeverity;
|
|
241
|
-
readonly
|
|
242
|
-
readonly length: number;
|
|
294
|
+
readonly location: LocationRange;
|
|
243
295
|
readonly info: string;
|
|
244
|
-
|
|
245
|
-
private what;
|
|
246
|
-
constructor(code: number, severity: MessageSeverity, position: number, length: number, info: string, fixstr: string, what: string);
|
|
247
|
-
get fixes(): readonly FixSuggestion[];
|
|
296
|
+
constructor(code: number, severity: MessageSeverity, location: LocationRange, info: string);
|
|
248
297
|
}
|
|
249
298
|
declare class RemoveThingMessage implements Message {
|
|
250
299
|
readonly code: number;
|
|
251
300
|
readonly severity: MessageSeverity;
|
|
252
|
-
readonly
|
|
253
|
-
readonly length: number;
|
|
301
|
+
readonly location: LocationRange;
|
|
254
302
|
readonly info: string;
|
|
255
|
-
|
|
256
|
-
constructor(code: number, severity: MessageSeverity, position: number, length: number, info: string, fixstr: string);
|
|
257
|
-
get fixes(): readonly FixSuggestion[];
|
|
303
|
+
constructor(code: number, severity: MessageSeverity, location: LocationRange, info: string);
|
|
258
304
|
}
|
|
259
305
|
declare class ExpectedMessage implements Message {
|
|
260
|
-
readonly
|
|
306
|
+
readonly location: LocationRange;
|
|
261
307
|
private what;
|
|
262
|
-
constructor(
|
|
308
|
+
constructor(location: LocationRange, what: string);
|
|
263
309
|
readonly code = 1;
|
|
264
310
|
readonly severity = MessageSeverity.Error;
|
|
265
|
-
get length(): number;
|
|
266
311
|
get info(): string;
|
|
267
|
-
get fixes(): readonly FixSuggestion[];
|
|
268
312
|
}
|
|
269
313
|
declare class UnknownModifierMessage implements Message {
|
|
270
|
-
readonly
|
|
271
|
-
readonly length: number;
|
|
314
|
+
readonly location: LocationRange;
|
|
272
315
|
private what;
|
|
273
|
-
constructor(
|
|
316
|
+
constructor(location: LocationRange, what: string);
|
|
274
317
|
readonly code = 2;
|
|
275
318
|
readonly severity = MessageSeverity.Error;
|
|
276
319
|
get info(): string;
|
|
277
|
-
get fixes(): readonly FixSuggestion[];
|
|
278
320
|
}
|
|
279
321
|
declare class UnclosedInlineModifierMessage implements Message {
|
|
280
|
-
readonly
|
|
322
|
+
readonly location: LocationRange;
|
|
281
323
|
private what;
|
|
282
|
-
constructor(
|
|
324
|
+
constructor(location: LocationRange, what: string);
|
|
283
325
|
readonly code = 3;
|
|
284
326
|
readonly severity = MessageSeverity.Error;
|
|
285
|
-
readonly length = 0;
|
|
286
|
-
readonly fixes: readonly FixSuggestion[];
|
|
287
327
|
get info(): string;
|
|
288
328
|
}
|
|
289
329
|
declare class ArgumentCountMismatchMessage implements Message {
|
|
290
|
-
readonly
|
|
291
|
-
|
|
292
|
-
constructor(position: number, length: number, min?: number, max?: number);
|
|
330
|
+
readonly location: LocationRange;
|
|
331
|
+
constructor(location: LocationRange, min?: number, max?: number);
|
|
293
332
|
private msg;
|
|
294
333
|
readonly code = 4;
|
|
295
334
|
readonly severity = MessageSeverity.Error;
|
|
296
|
-
readonly fixes: readonly FixSuggestion[];
|
|
297
335
|
get info(): string;
|
|
298
336
|
}
|
|
299
337
|
declare class CannotExpandArgumentMessage implements Message {
|
|
300
|
-
readonly
|
|
301
|
-
readonly length: number;
|
|
338
|
+
readonly location: LocationRange;
|
|
302
339
|
private what?;
|
|
303
|
-
constructor(
|
|
340
|
+
constructor(location: LocationRange, what?: string | undefined);
|
|
304
341
|
readonly code = 5;
|
|
305
342
|
readonly severity = MessageSeverity.Error;
|
|
306
|
-
readonly fixes: readonly FixSuggestion[];
|
|
307
343
|
get info(): string;
|
|
308
344
|
}
|
|
309
345
|
declare class InvalidArgumentMessage implements Message {
|
|
310
|
-
readonly
|
|
311
|
-
readonly length: number;
|
|
346
|
+
readonly location: LocationRange;
|
|
312
347
|
private what?;
|
|
313
|
-
constructor(
|
|
348
|
+
constructor(location: LocationRange, what?: string | undefined);
|
|
314
349
|
readonly code = 6;
|
|
315
350
|
readonly severity = MessageSeverity.Error;
|
|
316
|
-
readonly fixes: readonly FixSuggestion[];
|
|
317
351
|
get info(): string;
|
|
318
352
|
}
|
|
319
|
-
declare class
|
|
320
|
-
readonly
|
|
321
|
-
|
|
322
|
-
constructor(
|
|
353
|
+
declare class EntityNotAllowedMessage implements Message {
|
|
354
|
+
readonly location: LocationRange;
|
|
355
|
+
private what?;
|
|
356
|
+
constructor(location: LocationRange, what?: string | undefined);
|
|
323
357
|
readonly code = 7;
|
|
324
358
|
readonly severity = MessageSeverity.Error;
|
|
325
|
-
readonly fixes: readonly FixSuggestion[];
|
|
326
359
|
get info(): string;
|
|
327
360
|
}
|
|
328
361
|
declare class ReachedRecursionLimitMessage implements Message {
|
|
329
|
-
readonly
|
|
330
|
-
readonly length: number;
|
|
362
|
+
readonly location: LocationRange;
|
|
331
363
|
private limit;
|
|
332
364
|
private what;
|
|
333
|
-
constructor(
|
|
365
|
+
constructor(location: LocationRange, limit: number, what: string);
|
|
334
366
|
readonly code = 8;
|
|
335
367
|
readonly severity = MessageSeverity.Error;
|
|
336
|
-
readonly fixes: readonly FixSuggestion[];
|
|
337
368
|
get info(): string;
|
|
338
369
|
}
|
|
339
370
|
declare class SlotUsedOutsideDefinitionMessage implements Message {
|
|
340
|
-
readonly
|
|
341
|
-
|
|
342
|
-
constructor(position: number, length: number);
|
|
371
|
+
readonly location: LocationRange;
|
|
372
|
+
constructor(location: LocationRange);
|
|
343
373
|
readonly code = 9;
|
|
344
374
|
readonly severity = MessageSeverity.Error;
|
|
345
|
-
readonly fixes: readonly FixSuggestion[];
|
|
346
375
|
get info(): string;
|
|
347
376
|
}
|
|
348
|
-
declare class
|
|
349
|
-
readonly
|
|
350
|
-
|
|
351
|
-
constructor(position: number, length: number);
|
|
377
|
+
declare class NoNestedModuleMessage implements Message {
|
|
378
|
+
readonly location: LocationRange;
|
|
379
|
+
constructor(location: LocationRange);
|
|
352
380
|
readonly code = 10;
|
|
353
381
|
readonly severity = MessageSeverity.Error;
|
|
354
|
-
|
|
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;
|
|
355
410
|
get info(): string;
|
|
356
411
|
}
|
|
357
412
|
declare class UnnecessaryNewlineMessage extends RemoveThingMessage {
|
|
358
|
-
constructor(
|
|
413
|
+
constructor(location: LocationRange);
|
|
359
414
|
}
|
|
360
415
|
declare class NewBlockShouldBeOnNewlineMessage extends AddThingMessage {
|
|
361
|
-
constructor(
|
|
416
|
+
constructor(location: LocationRange);
|
|
362
417
|
}
|
|
363
418
|
declare class ContentShouldBeOnNewlineMessage extends AddThingMessage {
|
|
364
|
-
constructor(
|
|
419
|
+
constructor(location: LocationRange);
|
|
365
420
|
}
|
|
366
421
|
declare class NameAlreadyDefinedMessage implements Message {
|
|
367
|
-
readonly
|
|
368
|
-
readonly length: number;
|
|
422
|
+
readonly location: LocationRange;
|
|
369
423
|
private what;
|
|
370
|
-
constructor(
|
|
424
|
+
constructor(location: LocationRange, what: string);
|
|
371
425
|
readonly code = 4;
|
|
372
426
|
readonly severity = MessageSeverity.Warning;
|
|
373
|
-
readonly fixes: readonly FixSuggestion[];
|
|
374
427
|
get info(): string;
|
|
375
428
|
}
|
|
376
429
|
declare class UndefinedVariableMessage implements Message {
|
|
377
|
-
readonly
|
|
378
|
-
readonly length: number;
|
|
430
|
+
readonly location: LocationRange;
|
|
379
431
|
private what;
|
|
380
|
-
constructor(
|
|
432
|
+
constructor(location: LocationRange, what: string);
|
|
381
433
|
readonly code = 5;
|
|
382
434
|
readonly severity = MessageSeverity.Warning;
|
|
383
|
-
|
|
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;
|
|
384
443
|
get info(): string;
|
|
385
444
|
}
|
|
386
445
|
|
|
@@ -388,24 +447,32 @@ type messages_ArgumentCountMismatchMessage = ArgumentCountMismatchMessage;
|
|
|
388
447
|
declare const messages_ArgumentCountMismatchMessage: typeof ArgumentCountMismatchMessage;
|
|
389
448
|
type messages_CannotExpandArgumentMessage = CannotExpandArgumentMessage;
|
|
390
449
|
declare const messages_CannotExpandArgumentMessage: typeof CannotExpandArgumentMessage;
|
|
391
|
-
type
|
|
392
|
-
declare const
|
|
450
|
+
type messages_CannotUseModuleInSelfMessage = CannotUseModuleInSelfMessage;
|
|
451
|
+
declare const messages_CannotUseModuleInSelfMessage: typeof CannotUseModuleInSelfMessage;
|
|
393
452
|
type messages_ContentShouldBeOnNewlineMessage = ContentShouldBeOnNewlineMessage;
|
|
394
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;
|
|
395
458
|
type messages_ExpectedMessage = ExpectedMessage;
|
|
396
459
|
declare const messages_ExpectedMessage: typeof ExpectedMessage;
|
|
397
|
-
type messages_InlineDefinitonInvalidEntityMessage = InlineDefinitonInvalidEntityMessage;
|
|
398
|
-
declare const messages_InlineDefinitonInvalidEntityMessage: typeof InlineDefinitonInvalidEntityMessage;
|
|
399
460
|
type messages_InvalidArgumentMessage = InvalidArgumentMessage;
|
|
400
461
|
declare const messages_InvalidArgumentMessage: typeof InvalidArgumentMessage;
|
|
462
|
+
type messages_MultipleBlocksNotPermittedMessage = MultipleBlocksNotPermittedMessage;
|
|
463
|
+
declare const messages_MultipleBlocksNotPermittedMessage: typeof MultipleBlocksNotPermittedMessage;
|
|
401
464
|
type messages_NameAlreadyDefinedMessage = NameAlreadyDefinedMessage;
|
|
402
465
|
declare const messages_NameAlreadyDefinedMessage: typeof NameAlreadyDefinedMessage;
|
|
403
466
|
type messages_NewBlockShouldBeOnNewlineMessage = NewBlockShouldBeOnNewlineMessage;
|
|
404
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;
|
|
405
474
|
type messages_ReachedRecursionLimitMessage = ReachedRecursionLimitMessage;
|
|
406
475
|
declare const messages_ReachedRecursionLimitMessage: typeof ReachedRecursionLimitMessage;
|
|
407
|
-
type messages_ReferredMessage = ReferredMessage;
|
|
408
|
-
declare const messages_ReferredMessage: typeof ReferredMessage;
|
|
409
476
|
type messages_SlotUsedOutsideDefinitionMessage = SlotUsedOutsideDefinitionMessage;
|
|
410
477
|
declare const messages_SlotUsedOutsideDefinitionMessage: typeof SlotUsedOutsideDefinitionMessage;
|
|
411
478
|
type messages_UnclosedInlineModifierMessage = UnclosedInlineModifierMessage;
|
|
@@ -417,11 +484,50 @@ declare const messages_UnknownModifierMessage: typeof UnknownModifierMessage;
|
|
|
417
484
|
type messages_UnnecessaryNewlineMessage = UnnecessaryNewlineMessage;
|
|
418
485
|
declare const messages_UnnecessaryNewlineMessage: typeof UnnecessaryNewlineMessage;
|
|
419
486
|
declare namespace messages {
|
|
420
|
-
export { messages_ArgumentCountMismatchMessage as ArgumentCountMismatchMessage, messages_CannotExpandArgumentMessage as CannotExpandArgumentMessage,
|
|
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 };
|
|
421
488
|
}
|
|
422
489
|
|
|
423
490
|
declare const BuiltinConfiguration: ReadonlyConfiguration;
|
|
424
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;
|
|
530
|
+
|
|
425
531
|
declare function setDebugLevel(level: DebugLevel): void;
|
|
426
532
|
|
|
427
|
-
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 };
|