@the_dissidents/libemmm 0.0.2 → 0.0.4
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 +37 -14
- package/dist/index.d.mts +293 -166
- package/dist/index.d.ts +293 -166
- package/dist/index.js +2193 -903
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2186 -902
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
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,86 +98,109 @@ 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;
|
|
189
|
+
/**
|
|
190
|
+
* If true, any modifier encountered in the content of it will *not* be expanded, *unless* that modifier is `alwaysTryExpand`.
|
|
191
|
+
*/
|
|
143
192
|
delayContentExpansion: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* If true, such a modifier will always be expanded whenever it is encountered, *even if* contained in a modifier with `delayContentExpansion`.
|
|
195
|
+
*/
|
|
144
196
|
alwaysTryExpand: boolean;
|
|
197
|
+
/** Called before the modifier's content is parsed. */
|
|
145
198
|
beforeParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
199
|
+
/** Called after the modifier's content is parsed. */
|
|
146
200
|
afterParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
201
|
+
/** Called before reparsing of the expansion. */
|
|
147
202
|
beforeProcessExpansion?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
203
|
+
/** Called before reparsing of the expansion. */
|
|
148
204
|
afterProcessExpansion?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
149
205
|
prepareExpand?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
150
206
|
expand?: (node: TNode, cxt: ParseContext, immediate: boolean) => TEntity[] | undefined;
|
|
@@ -162,225 +218,247 @@ declare class ArgumentInterpolatorDefinition {
|
|
|
162
218
|
alwaysTryExpand: boolean;
|
|
163
219
|
expand?: (content: string, cxt: ParseContext, immediate: boolean) => string | undefined;
|
|
164
220
|
}
|
|
165
|
-
type
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
type InlineInstantiationData = {
|
|
171
|
-
mod: InlineModifierDefinition<any>;
|
|
172
|
-
slotContent: InlineEntity[];
|
|
173
|
-
args: Map<string, string>;
|
|
221
|
+
type Shorthand<TMod> = {
|
|
222
|
+
name: string;
|
|
223
|
+
parts: readonly string[];
|
|
224
|
+
postfix: string | undefined;
|
|
225
|
+
mod: TMod;
|
|
174
226
|
};
|
|
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
|
-
}
|
|
227
|
+
type BlockShorthand<TState> = Shorthand<BlockModifierDefinition<TState>>;
|
|
228
|
+
type InlineShorthand<TState> = Shorthand<InlineModifierDefinition<TState>>;
|
|
212
229
|
|
|
213
230
|
declare class SimpleScanner implements Scanner {
|
|
214
231
|
private src;
|
|
232
|
+
readonly source: SourceDescriptor;
|
|
215
233
|
private pos;
|
|
216
|
-
constructor(src: string);
|
|
234
|
+
constructor(src: string, source?: SourceDescriptor);
|
|
217
235
|
position(): number;
|
|
218
236
|
isEOF(): boolean;
|
|
219
237
|
peek(str: string): boolean;
|
|
220
238
|
acceptChar(): string;
|
|
221
239
|
accept(str: string): boolean;
|
|
222
240
|
acceptWhitespaceChar(): string | null;
|
|
223
|
-
|
|
241
|
+
}
|
|
242
|
+
interface Scanner {
|
|
243
|
+
readonly source: SourceDescriptor;
|
|
244
|
+
position(): number;
|
|
245
|
+
isEOF(): boolean;
|
|
246
|
+
peek(str: string): boolean;
|
|
247
|
+
accept(str: string): boolean;
|
|
248
|
+
acceptChar(): string;
|
|
249
|
+
acceptWhitespaceChar(): string | null;
|
|
224
250
|
}
|
|
225
251
|
|
|
226
|
-
declare function parse(scanner: Scanner,
|
|
252
|
+
declare function parse(scanner: Scanner, cxt: ParseContext): Document;
|
|
227
253
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
254
|
+
type RendererType<TState, TReturn, TOptions = undefined> = {
|
|
255
|
+
state: TState;
|
|
256
|
+
return: TReturn;
|
|
257
|
+
options: TOptions;
|
|
258
|
+
};
|
|
259
|
+
type AnyRendererType = RendererType<any, any, any>;
|
|
260
|
+
type getState<Type> = Type extends RendererType<infer T, any, any> ? T : never;
|
|
261
|
+
type getReturn<Type> = Type extends RendererType<any, infer T, any> ? T : never;
|
|
262
|
+
type getOptions<Type> = Type extends RendererType<any, any, infer T> ? T : never;
|
|
263
|
+
type NodeRenderer<Type extends AnyRendererType, TNode> = (node: TNode, cxt: RenderContext<Type>) => getReturn<Type>;
|
|
264
|
+
type NodeRendererDefinition<Type extends AnyRendererType, TNode, TDef> = [def: TDef, renderer: NodeRenderer<Type, TNode>];
|
|
265
|
+
declare class RenderContext<Type extends AnyRendererType> {
|
|
266
|
+
readonly config: RenderConfiguration<Type>;
|
|
267
|
+
readonly parseContext: ParseContext;
|
|
268
|
+
state: getState<Type>;
|
|
269
|
+
renderEntity(node: BlockEntity | InlineEntity): getReturn<Type> | undefined;
|
|
270
|
+
constructor(config: RenderConfiguration<Type>, parseContext: ParseContext, state: getState<Type>);
|
|
271
|
+
}
|
|
272
|
+
interface ReadonlyRenderConfiguration<Type extends AnyRendererType> {
|
|
273
|
+
readonly options: getOptions<Type>;
|
|
274
|
+
readonly paragraphRenderer?: NodeRenderer<Type, ParagraphNode>;
|
|
275
|
+
readonly textRenderer?: NodeRenderer<Type, TextNode | PreNode | EscapedNode>;
|
|
276
|
+
readonly undefinedBlockRenderer?: NodeRenderer<Type, BlockModifierNode<any>>;
|
|
277
|
+
readonly undefinedInlineRenderer?: NodeRenderer<Type, InlineModifierNode<any>>;
|
|
278
|
+
readonly blockRenderers: ReadonlyMap<BlockModifierDefinition<any>, NodeRenderer<Type, BlockModifierNode<any>>>;
|
|
279
|
+
readonly inlineRenderers: ReadonlyMap<InlineModifierDefinition<any>, NodeRenderer<Type, InlineModifierNode<any>>>;
|
|
280
|
+
readonly postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>;
|
|
281
|
+
render(doc: Document, state: getState<Type>): getReturn<Type>;
|
|
282
|
+
}
|
|
283
|
+
type BlockRendererDefiniton<Type extends AnyRendererType, ModState = any> = NodeRendererDefinition<Type, BlockModifierNode<ModState>, BlockModifierDefinition<ModState>>;
|
|
284
|
+
type InlineRendererDefiniton<Type extends AnyRendererType, ModState = any> = NodeRendererDefinition<Type, InlineModifierNode<ModState>, InlineModifierDefinition<ModState>>;
|
|
285
|
+
declare class RenderConfiguration<Type extends AnyRendererType> implements ReadonlyRenderConfiguration<Type> {
|
|
286
|
+
options: getOptions<Type>;
|
|
287
|
+
postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>;
|
|
288
|
+
paragraphRenderer?: NodeRenderer<Type, ParagraphNode>;
|
|
289
|
+
textRenderer?: NodeRenderer<Type, TextNode | PreNode | EscapedNode>;
|
|
290
|
+
undefinedBlockRenderer?: NodeRenderer<Type, BlockModifierNode<any>>;
|
|
291
|
+
undefinedInlineRenderer?: NodeRenderer<Type, InlineModifierNode<any>>;
|
|
292
|
+
blockRenderers: Map<BlockModifierDefinition<any>, NodeRenderer<Type, BlockModifierNode<any>>>;
|
|
293
|
+
inlineRenderers: Map<InlineModifierDefinition<any>, NodeRenderer<Type, InlineModifierNode<any>>>;
|
|
294
|
+
constructor(options: getOptions<Type>, postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getReturn<Type>);
|
|
295
|
+
render(doc: Document, state: getState<Type>): getReturn<Type>;
|
|
296
|
+
addBlockRenderer(...rs: BlockRendererDefiniton<Type>[]): void;
|
|
297
|
+
addInlineRenderer(...rs: InlineRendererDefiniton<Type>[]): void;
|
|
298
|
+
static from<Type extends AnyRendererType>(from: ReadonlyRenderConfiguration<Type>): RenderConfiguration<Type>;
|
|
237
299
|
}
|
|
300
|
+
|
|
238
301
|
declare class AddThingMessage implements Message {
|
|
239
302
|
readonly code: number;
|
|
240
303
|
readonly severity: MessageSeverity;
|
|
241
|
-
readonly
|
|
242
|
-
readonly length: number;
|
|
304
|
+
readonly location: LocationRange;
|
|
243
305
|
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[];
|
|
306
|
+
constructor(code: number, severity: MessageSeverity, location: LocationRange, info: string);
|
|
248
307
|
}
|
|
249
308
|
declare class RemoveThingMessage implements Message {
|
|
250
309
|
readonly code: number;
|
|
251
310
|
readonly severity: MessageSeverity;
|
|
252
|
-
readonly
|
|
253
|
-
readonly length: number;
|
|
311
|
+
readonly location: LocationRange;
|
|
254
312
|
readonly info: string;
|
|
255
|
-
|
|
256
|
-
constructor(code: number, severity: MessageSeverity, position: number, length: number, info: string, fixstr: string);
|
|
257
|
-
get fixes(): readonly FixSuggestion[];
|
|
313
|
+
constructor(code: number, severity: MessageSeverity, location: LocationRange, info: string);
|
|
258
314
|
}
|
|
259
315
|
declare class ExpectedMessage implements Message {
|
|
260
|
-
readonly
|
|
316
|
+
readonly location: LocationRange;
|
|
261
317
|
private what;
|
|
262
|
-
constructor(
|
|
318
|
+
constructor(location: LocationRange, what: string);
|
|
263
319
|
readonly code = 1;
|
|
264
320
|
readonly severity = MessageSeverity.Error;
|
|
265
|
-
get length(): number;
|
|
266
321
|
get info(): string;
|
|
267
|
-
get fixes(): readonly FixSuggestion[];
|
|
268
322
|
}
|
|
269
323
|
declare class UnknownModifierMessage implements Message {
|
|
270
|
-
readonly
|
|
271
|
-
readonly length: number;
|
|
324
|
+
readonly location: LocationRange;
|
|
272
325
|
private what;
|
|
273
|
-
constructor(
|
|
326
|
+
constructor(location: LocationRange, what: string);
|
|
274
327
|
readonly code = 2;
|
|
275
328
|
readonly severity = MessageSeverity.Error;
|
|
276
329
|
get info(): string;
|
|
277
|
-
get fixes(): readonly FixSuggestion[];
|
|
278
330
|
}
|
|
279
331
|
declare class UnclosedInlineModifierMessage implements Message {
|
|
280
|
-
readonly
|
|
332
|
+
readonly location: LocationRange;
|
|
281
333
|
private what;
|
|
282
|
-
constructor(
|
|
334
|
+
constructor(location: LocationRange, what: string);
|
|
283
335
|
readonly code = 3;
|
|
284
336
|
readonly severity = MessageSeverity.Error;
|
|
285
|
-
readonly length = 0;
|
|
286
|
-
readonly fixes: readonly FixSuggestion[];
|
|
287
337
|
get info(): string;
|
|
288
338
|
}
|
|
289
339
|
declare class ArgumentCountMismatchMessage implements Message {
|
|
290
|
-
readonly
|
|
291
|
-
|
|
292
|
-
constructor(position: number, length: number, min?: number, max?: number);
|
|
340
|
+
readonly location: LocationRange;
|
|
341
|
+
constructor(location: LocationRange, min?: number, max?: number);
|
|
293
342
|
private msg;
|
|
294
343
|
readonly code = 4;
|
|
295
344
|
readonly severity = MessageSeverity.Error;
|
|
296
|
-
readonly fixes: readonly FixSuggestion[];
|
|
297
345
|
get info(): string;
|
|
298
346
|
}
|
|
299
347
|
declare class CannotExpandArgumentMessage implements Message {
|
|
300
|
-
readonly
|
|
301
|
-
readonly length: number;
|
|
348
|
+
readonly location: LocationRange;
|
|
302
349
|
private what?;
|
|
303
|
-
constructor(
|
|
350
|
+
constructor(location: LocationRange, what?: string | undefined);
|
|
304
351
|
readonly code = 5;
|
|
305
352
|
readonly severity = MessageSeverity.Error;
|
|
306
|
-
readonly fixes: readonly FixSuggestion[];
|
|
307
353
|
get info(): string;
|
|
308
354
|
}
|
|
309
355
|
declare class InvalidArgumentMessage implements Message {
|
|
310
|
-
readonly
|
|
311
|
-
readonly length: number;
|
|
356
|
+
readonly location: LocationRange;
|
|
312
357
|
private what?;
|
|
313
|
-
constructor(
|
|
358
|
+
constructor(location: LocationRange, what?: string | undefined);
|
|
314
359
|
readonly code = 6;
|
|
315
360
|
readonly severity = MessageSeverity.Error;
|
|
316
|
-
readonly fixes: readonly FixSuggestion[];
|
|
317
361
|
get info(): string;
|
|
318
362
|
}
|
|
319
|
-
declare class
|
|
320
|
-
readonly
|
|
321
|
-
|
|
322
|
-
constructor(
|
|
363
|
+
declare class EntityNotAllowedMessage implements Message {
|
|
364
|
+
readonly location: LocationRange;
|
|
365
|
+
private what?;
|
|
366
|
+
constructor(location: LocationRange, what?: string | undefined);
|
|
323
367
|
readonly code = 7;
|
|
324
368
|
readonly severity = MessageSeverity.Error;
|
|
325
|
-
readonly fixes: readonly FixSuggestion[];
|
|
326
369
|
get info(): string;
|
|
327
370
|
}
|
|
328
371
|
declare class ReachedRecursionLimitMessage implements Message {
|
|
329
|
-
readonly
|
|
330
|
-
readonly length: number;
|
|
372
|
+
readonly location: LocationRange;
|
|
331
373
|
private limit;
|
|
332
374
|
private what;
|
|
333
|
-
constructor(
|
|
375
|
+
constructor(location: LocationRange, limit: number, what: string);
|
|
334
376
|
readonly code = 8;
|
|
335
377
|
readonly severity = MessageSeverity.Error;
|
|
336
|
-
readonly fixes: readonly FixSuggestion[];
|
|
337
378
|
get info(): string;
|
|
338
379
|
}
|
|
339
380
|
declare class SlotUsedOutsideDefinitionMessage implements Message {
|
|
340
|
-
readonly
|
|
341
|
-
|
|
342
|
-
constructor(position: number, length: number);
|
|
381
|
+
readonly location: LocationRange;
|
|
382
|
+
constructor(location: LocationRange);
|
|
343
383
|
readonly code = 9;
|
|
344
384
|
readonly severity = MessageSeverity.Error;
|
|
345
|
-
readonly fixes: readonly FixSuggestion[];
|
|
346
385
|
get info(): string;
|
|
347
386
|
}
|
|
348
|
-
declare class
|
|
349
|
-
readonly
|
|
350
|
-
|
|
351
|
-
constructor(position: number, length: number);
|
|
387
|
+
declare class NoNestedModuleMessage implements Message {
|
|
388
|
+
readonly location: LocationRange;
|
|
389
|
+
constructor(location: LocationRange);
|
|
352
390
|
readonly code = 10;
|
|
353
391
|
readonly severity = MessageSeverity.Error;
|
|
354
|
-
|
|
392
|
+
get info(): string;
|
|
393
|
+
}
|
|
394
|
+
declare class CannotUseModuleInSelfMessage implements Message {
|
|
395
|
+
readonly location: LocationRange;
|
|
396
|
+
constructor(location: LocationRange);
|
|
397
|
+
readonly code = 11;
|
|
398
|
+
readonly severity = MessageSeverity.Error;
|
|
399
|
+
get info(): string;
|
|
400
|
+
}
|
|
401
|
+
declare class EitherNormalOrPreMessage implements Message {
|
|
402
|
+
readonly location: LocationRange;
|
|
403
|
+
constructor(location: LocationRange);
|
|
404
|
+
readonly code = 12;
|
|
405
|
+
readonly severity = MessageSeverity.Error;
|
|
406
|
+
get info(): string;
|
|
407
|
+
}
|
|
408
|
+
declare class MultipleBlocksNotPermittedMessage implements Message {
|
|
409
|
+
readonly location: LocationRange;
|
|
410
|
+
constructor(location: LocationRange);
|
|
411
|
+
readonly code = 13;
|
|
412
|
+
readonly severity = MessageSeverity.Error;
|
|
413
|
+
get info(): string;
|
|
414
|
+
}
|
|
415
|
+
declare class OnlySimpleParagraphsPermittedMessage implements Message {
|
|
416
|
+
readonly location: LocationRange;
|
|
417
|
+
constructor(location: LocationRange);
|
|
418
|
+
readonly code = 14;
|
|
419
|
+
readonly severity = MessageSeverity.Error;
|
|
355
420
|
get info(): string;
|
|
356
421
|
}
|
|
357
422
|
declare class UnnecessaryNewlineMessage extends RemoveThingMessage {
|
|
358
|
-
constructor(
|
|
423
|
+
constructor(location: LocationRange);
|
|
359
424
|
}
|
|
360
425
|
declare class NewBlockShouldBeOnNewlineMessage extends AddThingMessage {
|
|
361
|
-
constructor(
|
|
426
|
+
constructor(location: LocationRange);
|
|
362
427
|
}
|
|
363
428
|
declare class ContentShouldBeOnNewlineMessage extends AddThingMessage {
|
|
364
|
-
constructor(
|
|
429
|
+
constructor(location: LocationRange);
|
|
365
430
|
}
|
|
366
431
|
declare class NameAlreadyDefinedMessage implements Message {
|
|
367
|
-
readonly
|
|
368
|
-
readonly length: number;
|
|
432
|
+
readonly location: LocationRange;
|
|
369
433
|
private what;
|
|
370
|
-
constructor(
|
|
434
|
+
constructor(location: LocationRange, what: string);
|
|
371
435
|
readonly code = 4;
|
|
372
436
|
readonly severity = MessageSeverity.Warning;
|
|
373
|
-
readonly fixes: readonly FixSuggestion[];
|
|
374
437
|
get info(): string;
|
|
375
438
|
}
|
|
376
439
|
declare class UndefinedVariableMessage implements Message {
|
|
377
|
-
readonly
|
|
378
|
-
readonly length: number;
|
|
440
|
+
readonly location: LocationRange;
|
|
379
441
|
private what;
|
|
380
|
-
constructor(
|
|
442
|
+
constructor(location: LocationRange, what: string);
|
|
381
443
|
readonly code = 5;
|
|
382
444
|
readonly severity = MessageSeverity.Warning;
|
|
383
|
-
|
|
445
|
+
get info(): string;
|
|
446
|
+
}
|
|
447
|
+
declare class OverwriteDefinitionsMessage implements Message {
|
|
448
|
+
readonly location: LocationRange;
|
|
449
|
+
private what;
|
|
450
|
+
constructor(location: LocationRange, what: string);
|
|
451
|
+
readonly code = 6;
|
|
452
|
+
readonly severity = MessageSeverity.Warning;
|
|
453
|
+
get info(): string;
|
|
454
|
+
}
|
|
455
|
+
declare class OverwriteSpecialVariableMessage implements Message {
|
|
456
|
+
readonly location: LocationRange;
|
|
457
|
+
private varname;
|
|
458
|
+
private previous;
|
|
459
|
+
constructor(location: LocationRange, varname: string, previous: string);
|
|
460
|
+
readonly code = 6;
|
|
461
|
+
readonly severity = MessageSeverity.Warning;
|
|
384
462
|
get info(): string;
|
|
385
463
|
}
|
|
386
464
|
|
|
@@ -388,24 +466,34 @@ type messages_ArgumentCountMismatchMessage = ArgumentCountMismatchMessage;
|
|
|
388
466
|
declare const messages_ArgumentCountMismatchMessage: typeof ArgumentCountMismatchMessage;
|
|
389
467
|
type messages_CannotExpandArgumentMessage = CannotExpandArgumentMessage;
|
|
390
468
|
declare const messages_CannotExpandArgumentMessage: typeof CannotExpandArgumentMessage;
|
|
391
|
-
type
|
|
392
|
-
declare const
|
|
469
|
+
type messages_CannotUseModuleInSelfMessage = CannotUseModuleInSelfMessage;
|
|
470
|
+
declare const messages_CannotUseModuleInSelfMessage: typeof CannotUseModuleInSelfMessage;
|
|
393
471
|
type messages_ContentShouldBeOnNewlineMessage = ContentShouldBeOnNewlineMessage;
|
|
394
472
|
declare const messages_ContentShouldBeOnNewlineMessage: typeof ContentShouldBeOnNewlineMessage;
|
|
473
|
+
type messages_EitherNormalOrPreMessage = EitherNormalOrPreMessage;
|
|
474
|
+
declare const messages_EitherNormalOrPreMessage: typeof EitherNormalOrPreMessage;
|
|
475
|
+
type messages_EntityNotAllowedMessage = EntityNotAllowedMessage;
|
|
476
|
+
declare const messages_EntityNotAllowedMessage: typeof EntityNotAllowedMessage;
|
|
395
477
|
type messages_ExpectedMessage = ExpectedMessage;
|
|
396
478
|
declare const messages_ExpectedMessage: typeof ExpectedMessage;
|
|
397
|
-
type messages_InlineDefinitonInvalidEntityMessage = InlineDefinitonInvalidEntityMessage;
|
|
398
|
-
declare const messages_InlineDefinitonInvalidEntityMessage: typeof InlineDefinitonInvalidEntityMessage;
|
|
399
479
|
type messages_InvalidArgumentMessage = InvalidArgumentMessage;
|
|
400
480
|
declare const messages_InvalidArgumentMessage: typeof InvalidArgumentMessage;
|
|
481
|
+
type messages_MultipleBlocksNotPermittedMessage = MultipleBlocksNotPermittedMessage;
|
|
482
|
+
declare const messages_MultipleBlocksNotPermittedMessage: typeof MultipleBlocksNotPermittedMessage;
|
|
401
483
|
type messages_NameAlreadyDefinedMessage = NameAlreadyDefinedMessage;
|
|
402
484
|
declare const messages_NameAlreadyDefinedMessage: typeof NameAlreadyDefinedMessage;
|
|
403
485
|
type messages_NewBlockShouldBeOnNewlineMessage = NewBlockShouldBeOnNewlineMessage;
|
|
404
486
|
declare const messages_NewBlockShouldBeOnNewlineMessage: typeof NewBlockShouldBeOnNewlineMessage;
|
|
487
|
+
type messages_NoNestedModuleMessage = NoNestedModuleMessage;
|
|
488
|
+
declare const messages_NoNestedModuleMessage: typeof NoNestedModuleMessage;
|
|
489
|
+
type messages_OnlySimpleParagraphsPermittedMessage = OnlySimpleParagraphsPermittedMessage;
|
|
490
|
+
declare const messages_OnlySimpleParagraphsPermittedMessage: typeof OnlySimpleParagraphsPermittedMessage;
|
|
491
|
+
type messages_OverwriteDefinitionsMessage = OverwriteDefinitionsMessage;
|
|
492
|
+
declare const messages_OverwriteDefinitionsMessage: typeof OverwriteDefinitionsMessage;
|
|
493
|
+
type messages_OverwriteSpecialVariableMessage = OverwriteSpecialVariableMessage;
|
|
494
|
+
declare const messages_OverwriteSpecialVariableMessage: typeof OverwriteSpecialVariableMessage;
|
|
405
495
|
type messages_ReachedRecursionLimitMessage = ReachedRecursionLimitMessage;
|
|
406
496
|
declare const messages_ReachedRecursionLimitMessage: typeof ReachedRecursionLimitMessage;
|
|
407
|
-
type messages_ReferredMessage = ReferredMessage;
|
|
408
|
-
declare const messages_ReferredMessage: typeof ReferredMessage;
|
|
409
497
|
type messages_SlotUsedOutsideDefinitionMessage = SlotUsedOutsideDefinitionMessage;
|
|
410
498
|
declare const messages_SlotUsedOutsideDefinitionMessage: typeof SlotUsedOutsideDefinitionMessage;
|
|
411
499
|
type messages_UnclosedInlineModifierMessage = UnclosedInlineModifierMessage;
|
|
@@ -417,11 +505,50 @@ declare const messages_UnknownModifierMessage: typeof UnknownModifierMessage;
|
|
|
417
505
|
type messages_UnnecessaryNewlineMessage = UnnecessaryNewlineMessage;
|
|
418
506
|
declare const messages_UnnecessaryNewlineMessage: typeof UnnecessaryNewlineMessage;
|
|
419
507
|
declare namespace messages {
|
|
420
|
-
export { messages_ArgumentCountMismatchMessage as ArgumentCountMismatchMessage, messages_CannotExpandArgumentMessage as CannotExpandArgumentMessage,
|
|
508
|
+
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_OverwriteSpecialVariableMessage as OverwriteSpecialVariableMessage, 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
509
|
}
|
|
422
510
|
|
|
423
511
|
declare const BuiltinConfiguration: ReadonlyConfiguration;
|
|
424
512
|
|
|
513
|
+
declare const DefaultConfiguration: ReadonlyConfiguration;
|
|
514
|
+
|
|
515
|
+
type HTMLRendererOptions = {
|
|
516
|
+
headPlugins: HTMLComponentPlugin[];
|
|
517
|
+
headerPlugins: HTMLComponentPlugin[];
|
|
518
|
+
footerPlugins: HTMLComponentPlugin[];
|
|
519
|
+
transformAsset: (id: string) => string | undefined;
|
|
520
|
+
};
|
|
521
|
+
type HTMLRenderType = {
|
|
522
|
+
state: HTMLRenderState;
|
|
523
|
+
options: HTMLRendererOptions;
|
|
524
|
+
return: string;
|
|
525
|
+
};
|
|
526
|
+
type HTMLRenderPlugin = (elem: BlockEntity | InlineEntity, cxt: RenderContext<HTMLRenderType>) => string | undefined;
|
|
527
|
+
type HTMLComponentPlugin = (cxt: RenderContext<HTMLRenderType>) => string | undefined;
|
|
528
|
+
type HTMLPostprocessPlugin = (cxt: RenderContext<HTMLRenderType>, output: string) => string;
|
|
529
|
+
declare class HTMLRenderState {
|
|
530
|
+
title: string;
|
|
531
|
+
stylesheet: string;
|
|
532
|
+
cssVariables: Map<string, string>;
|
|
533
|
+
escape(content: string): string;
|
|
534
|
+
invalidBlock(node: BlockEntity, msg: string): string;
|
|
535
|
+
invalidInline(node: InlineEntity, msg: string): string;
|
|
536
|
+
render(elems: (BlockEntity | InlineEntity)[], cxt: RenderContext<HTMLRenderType>): string;
|
|
537
|
+
}
|
|
538
|
+
declare const HTMLRenderConfiguration: ReadonlyRenderConfiguration<HTMLRenderType>;
|
|
539
|
+
|
|
540
|
+
declare const debugPrint: {
|
|
541
|
+
blockModifier: (x: BlockModifierDefinition<any>) => string;
|
|
542
|
+
inlineModifier: (x: InlineModifierDefinition<any>) => string;
|
|
543
|
+
inlineShorthand: (x: InlineShorthand<any>) => string;
|
|
544
|
+
blockShorthand: (x: BlockShorthand<any>) => string;
|
|
545
|
+
argument: (arg: ModifierArgument) => string;
|
|
546
|
+
node: (...nodes: (BlockEntity | InlineEntity)[]) => string;
|
|
547
|
+
message: (m: Message, source?: string, descriptor?: SourceDescriptor) => string;
|
|
548
|
+
document: typeof debugDumpDocument;
|
|
549
|
+
};
|
|
550
|
+
declare function debugDumpDocument(doc: Document, source: string): string;
|
|
551
|
+
|
|
425
552
|
declare function setDebugLevel(level: DebugLevel): void;
|
|
426
553
|
|
|
427
|
-
export { type ArgumentEntity, ArgumentInterpolatorDefinition, type BlockEntity, type
|
|
554
|
+
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 };
|