@the_dissidents/libemmm 0.0.8 → 0.0.9
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 +204 -62
- package/dist/chunk-Bp6m_JJh.js +13 -0
- package/dist/index.cjs +3311 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +727 -0
- package/dist/index.d.ts +598 -506
- package/dist/index.js +3078 -3246
- package/dist/index.js.map +1 -1
- package/package.json +25 -17
- package/dist/index.d.mts +0 -634
- package/dist/index.mjs +0 -3366
- package/dist/index.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,316 +1,388 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { t as __export } from "./chunk-Bp6m_JJh.js";
|
|
2
|
+
import * as minimal_jsx_runtime_jsx_runtime0 from "minimal-jsx-runtime/jsx-runtime";
|
|
2
3
|
|
|
4
|
+
//#region src/debug.d.ts
|
|
3
5
|
declare enum DebugLevel {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
6
|
+
Trace = 0,
|
|
7
|
+
Info = 1,
|
|
8
|
+
Warning = 2,
|
|
9
|
+
Error = 3,
|
|
10
|
+
None = 4,
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/source.d.ts
|
|
11
14
|
type SourceDescriptor = {
|
|
12
|
-
|
|
15
|
+
readonly name: string;
|
|
13
16
|
};
|
|
14
17
|
interface Source extends SourceDescriptor {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
readonly nLines: number;
|
|
19
|
+
/**
|
|
20
|
+
* Return the row- and column-index corresponding to a given location. The indices are zero-based.
|
|
21
|
+
*/
|
|
22
|
+
getRowCol(loc: number): [row: number, col: number];
|
|
23
|
+
/**
|
|
24
|
+
* Returns the position of the start of row `n` (zero-based). If `n` is zero, returns zero. If the source contains less than `n` rows, returns `Infinity`.
|
|
25
|
+
*/
|
|
26
|
+
getRowStart(n: number): number;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the content of the row `n` (zero-based). If the source contains less than `n` rows, returns `undefined`.
|
|
29
|
+
*/
|
|
30
|
+
getRow(n: number): string | undefined;
|
|
28
31
|
}
|
|
29
32
|
declare class StringSource implements Source {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
private readonly src;
|
|
34
|
+
readonly name: string;
|
|
35
|
+
readonly nLines: number;
|
|
36
|
+
private readonly lineMap;
|
|
37
|
+
constructor(d: SourceDescriptor, src: string);
|
|
38
|
+
getRowCol(pos: number): [row: number, col: number];
|
|
39
|
+
getRowStart(n: number): number;
|
|
40
|
+
getRow(n: number): string | undefined;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/module.d.ts
|
|
44
|
+
type ModuleDefinition = {
|
|
45
|
+
usedModules: Set<string>;
|
|
46
|
+
blocks: Set<BlockModifierDefinition<unknown>>;
|
|
47
|
+
inlines: Set<InlineModifierDefinition<unknown>>;
|
|
48
|
+
inlineShorthands: Set<InlineShorthand<unknown>>;
|
|
49
|
+
blockShorthands: Set<BlockShorthand<unknown>>;
|
|
50
|
+
};
|
|
51
|
+
declare namespace ModuleDefinition {
|
|
52
|
+
function from(cxt: ParseContext): ModuleDefinition;
|
|
53
|
+
function apply(defs: ModuleDefinition, cxt: ParseContext): void;
|
|
54
|
+
function diff(cnew: ModuleDefinition, cold: ModuleDefinition): ModuleDefinition;
|
|
55
|
+
function combine(cnew: ModuleDefinition, cold: ModuleDefinition): [ModuleDefinition, string];
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/scanner.d.ts
|
|
59
|
+
type Inspector = {
|
|
60
|
+
position: number;
|
|
61
|
+
callback: (cxt: ParseContext, pos: number) => void;
|
|
62
|
+
};
|
|
63
|
+
declare class SimpleScanner implements Scanner {
|
|
64
|
+
#private;
|
|
65
|
+
private src;
|
|
66
|
+
readonly source: Source;
|
|
67
|
+
constructor(src: string, sourceDesc?: SourceDescriptor, inspectors?: Inspector[]);
|
|
68
|
+
position(): number;
|
|
69
|
+
isEOF(): boolean;
|
|
70
|
+
inspectors(): Inspector[];
|
|
71
|
+
peek(str: string): boolean;
|
|
72
|
+
acceptChar(): string;
|
|
73
|
+
accept(str: string): boolean;
|
|
74
|
+
acceptWhitespaceChar(): string | null;
|
|
38
75
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
76
|
+
interface Scanner {
|
|
77
|
+
readonly source: Source;
|
|
78
|
+
position(): number;
|
|
79
|
+
isEOF(): boolean;
|
|
80
|
+
/** Sources can have inspectors in them, which are positions that trigger a callback when encounterede. This function returns the inspectors that lie between the current position and where this function was previously called (or the beginning for the first call). */
|
|
81
|
+
inspectors(): Inspector[];
|
|
82
|
+
/** return true if sees str immediately */
|
|
83
|
+
peek(str: string): boolean;
|
|
84
|
+
/** if sees str immediately, consumes it and returns true */
|
|
85
|
+
accept(str: string): boolean;
|
|
86
|
+
/** consumes a character and returns it; throws at EOF */
|
|
87
|
+
acceptChar(): string;
|
|
88
|
+
/** newlines are NOT whitespaces */
|
|
89
|
+
acceptWhitespaceChar(): string | null;
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/util.d.ts
|
|
93
|
+
declare class NameManager<T$1 extends {
|
|
94
|
+
name: string;
|
|
42
95
|
}> {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
type ReadonlyNameManager<T extends {
|
|
55
|
-
|
|
56
|
-
}> = Omit<NameManager<T>, 'add' | 'remove'>;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
96
|
+
private array;
|
|
97
|
+
private data;
|
|
98
|
+
constructor(from?: ReadonlyNameManager<T$1> | readonly T$1[] | ReadonlySet<T$1>);
|
|
99
|
+
toArray(): T$1[];
|
|
100
|
+
toSet(): Set<T$1>;
|
|
101
|
+
get(name: string): T$1 | undefined;
|
|
102
|
+
has(name: string): boolean;
|
|
103
|
+
remove(name: string): void;
|
|
104
|
+
add(...elems: T$1[]): void;
|
|
105
|
+
find(predicate: (x: T$1) => boolean): T$1 | undefined;
|
|
106
|
+
}
|
|
107
|
+
type ReadonlyNameManager<T$1 extends {
|
|
108
|
+
name: string;
|
|
109
|
+
}> = Omit<NameManager<T$1>, 'add' | 'remove'>;
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/parser-config.d.ts
|
|
112
|
+
interface ParseContextStoreDefinitions {}
|
|
60
113
|
type ParseContextStoreKey = keyof ParseContextStoreDefinitions;
|
|
61
114
|
type ParseContextStoreEntry<S extends ParseContextStoreKey> = ParseContextStoreDefinitions[S];
|
|
62
115
|
declare class ParseContext {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
116
|
+
readonly config: Configuration;
|
|
117
|
+
variables: Map<string, string>;
|
|
118
|
+
private data;
|
|
119
|
+
usedModules: Set<string>;
|
|
120
|
+
constructor(config: Configuration, variables?: Map<string, string>);
|
|
121
|
+
init<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
|
|
122
|
+
set<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
|
|
123
|
+
get<S extends ParseContextStoreKey>(key: S): ParseContextStoreEntry<S>;
|
|
124
|
+
parse(scanner: Scanner): Document$1;
|
|
70
125
|
}
|
|
71
126
|
declare class Document$1 {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
127
|
+
readonly root: RootNode;
|
|
128
|
+
readonly context: ParseContext;
|
|
129
|
+
readonly messages: readonly Message[];
|
|
130
|
+
constructor(root: RootNode, context: ParseContext, messages: readonly Message[]);
|
|
131
|
+
toStripped(): Document$1;
|
|
132
|
+
/**
|
|
133
|
+
* Performs a depth-first walk of the node tree.
|
|
134
|
+
*/
|
|
135
|
+
walk(callback: (node: BlockEntity | InlineEntity | ArgumentEntity) => 'skip' | 'break' | 'continue'): void;
|
|
136
|
+
/**
|
|
137
|
+
* Gets all nodes that covers the given position, from outermost to innermost (essentially a path).
|
|
138
|
+
*/
|
|
139
|
+
resolvePosition(pos: number): (BlockEntity | InlineEntity | ArgumentEntity)[];
|
|
85
140
|
}
|
|
141
|
+
type Shorthand<TMod> = {
|
|
142
|
+
name: string;
|
|
143
|
+
parts: readonly string[];
|
|
144
|
+
postfix: string | undefined;
|
|
145
|
+
mod: TMod;
|
|
146
|
+
};
|
|
147
|
+
type BlockShorthand<TState> = Shorthand<BlockModifierDefinition<TState>>;
|
|
148
|
+
type InlineShorthand<TState> = Shorthand<InlineModifierDefinition<TState>>;
|
|
149
|
+
type KernelConfiguration = {
|
|
150
|
+
collapseWhitespaces: boolean;
|
|
151
|
+
reparseDepthLimit: number;
|
|
152
|
+
};
|
|
86
153
|
interface ReadonlyConfiguration {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
154
|
+
readonly initializers: readonly ((cxt: ParseContext) => void)[];
|
|
155
|
+
readonly blockModifiers: ReadonlyNameManager<BlockModifierDefinition<any>>;
|
|
156
|
+
readonly inlineModifiers: ReadonlyNameManager<InlineModifierDefinition<any>>;
|
|
157
|
+
readonly systemModifiers: ReadonlyNameManager<SystemModifierDefinition<any>>;
|
|
158
|
+
readonly argumentInterpolators: ReadonlyNameManager<ArgumentInterpolatorDefinition>;
|
|
159
|
+
readonly blockShorthands: ReadonlyNameManager<BlockShorthand<any>>;
|
|
160
|
+
readonly inlineShorthands: ReadonlyNameManager<InlineShorthand<any>>;
|
|
161
|
+
readonly kernel: KernelConfiguration;
|
|
95
162
|
}
|
|
96
163
|
declare class Configuration implements ReadonlyConfiguration {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
164
|
+
initializers: ((cxt: ParseContext) => void)[];
|
|
165
|
+
modules: Map<string, ModuleDefinition>;
|
|
166
|
+
blockModifiers: NameManager<BlockModifierDefinition<any>>;
|
|
167
|
+
inlineModifiers: NameManager<InlineModifierDefinition<any>>;
|
|
168
|
+
systemModifiers: NameManager<SystemModifierDefinition<any>>;
|
|
169
|
+
argumentInterpolators: NameManager<ArgumentInterpolatorDefinition>;
|
|
170
|
+
blockShorthands: NameManager<BlockShorthand<any>>;
|
|
171
|
+
inlineShorthands: NameManager<InlineShorthand<any>>;
|
|
172
|
+
kernel: KernelConfiguration;
|
|
173
|
+
static from(from: ReadonlyConfiguration): Configuration;
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/modifier.d.ts
|
|
177
|
+
declare enum ModifierSlotType {
|
|
178
|
+
Normal = 0,
|
|
179
|
+
/** Content is preformatted: no escaping, no inner tags */
|
|
180
|
+
Preformatted = 1,
|
|
181
|
+
/** No content slot */
|
|
182
|
+
None = 2,
|
|
106
183
|
}
|
|
107
|
-
|
|
184
|
+
type ModifierMetadata = {};
|
|
185
|
+
declare class ModifierBase<TNode, TEntity> {
|
|
186
|
+
readonly name: string;
|
|
187
|
+
readonly slotType: ModifierSlotType;
|
|
188
|
+
constructor(name: string, slotType?: ModifierSlotType, args?: Partial<ModifierBase<TNode, TEntity>>);
|
|
189
|
+
metadata: ModifierMetadata;
|
|
190
|
+
/**
|
|
191
|
+
* Common values: heading, emphasis, keyword, highlight, commentary, comment, link, quote, pre
|
|
192
|
+
*/
|
|
193
|
+
roleHint?: string;
|
|
194
|
+
/**
|
|
195
|
+
* If true, any modifier encountered inside it will *not* be expanded *during parse-content*,
|
|
196
|
+
* *unless* that modifier is `alwaysTryExpand`. In the vast majority of cases, you shouldn't
|
|
197
|
+
* be using this.
|
|
198
|
+
*/
|
|
199
|
+
delayContentExpansion: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* If true, such a modifier will always be expanded whenever it is encountered, *even if*
|
|
202
|
+
* it is contained in a modifier with `delayContentExpansion`. In the vast majority of cases,
|
|
203
|
+
* you shouldn't be using this.
|
|
204
|
+
*/
|
|
205
|
+
alwaysTryExpand: boolean;
|
|
206
|
+
/** Called before the modifier's content is parsed.
|
|
207
|
+
* @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.
|
|
208
|
+
*/
|
|
209
|
+
beforeParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
210
|
+
/** Called after the modifier's content is parsed.
|
|
211
|
+
* @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.
|
|
212
|
+
*/
|
|
213
|
+
afterParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
214
|
+
/** Called before reparsing of the expansion.
|
|
215
|
+
* @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.*/
|
|
216
|
+
beforeProcessExpansion?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
217
|
+
/** Called before reparsing of the expansion.
|
|
218
|
+
* @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.*/
|
|
219
|
+
afterProcessExpansion?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
220
|
+
/**
|
|
221
|
+
* @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.
|
|
222
|
+
*/
|
|
223
|
+
prepareExpand?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
224
|
+
/**
|
|
225
|
+
* @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.
|
|
226
|
+
*/
|
|
227
|
+
expand?: (node: TNode, cxt: ParseContext, immediate: boolean) => TEntity[] | undefined;
|
|
228
|
+
}
|
|
229
|
+
declare class BlockModifierDefinition<TState> extends ModifierBase<BlockModifierNode<TState>, BlockEntity> {}
|
|
230
|
+
declare class InlineModifierDefinition<TState> extends ModifierBase<InlineModifierNode<TState>, InlineEntity> {}
|
|
231
|
+
declare class SystemModifierDefinition<TState> extends ModifierBase<SystemModifierNode<TState>, never> {}
|
|
232
|
+
declare class ArgumentInterpolatorDefinition {
|
|
233
|
+
readonly name: string;
|
|
234
|
+
readonly postfix: string;
|
|
235
|
+
constructor(name: string, postfix: string, args?: Partial<ArgumentInterpolatorDefinition>);
|
|
236
|
+
alwaysTryExpand: boolean;
|
|
237
|
+
expand?: (content: string, cxt: ParseContext, immediate: boolean) => string | undefined;
|
|
238
|
+
}
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/interface.d.ts
|
|
108
241
|
declare enum MessageSeverity {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
242
|
+
Info = 0,
|
|
243
|
+
Warning = 1,
|
|
244
|
+
Error = 2,
|
|
112
245
|
}
|
|
113
246
|
type Message = {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
247
|
+
readonly severity: MessageSeverity;
|
|
248
|
+
readonly location: LocationRange;
|
|
249
|
+
readonly info: string;
|
|
250
|
+
readonly code: number;
|
|
118
251
|
};
|
|
119
252
|
type LocationRange = {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
253
|
+
original?: LocationRange;
|
|
254
|
+
source: Source;
|
|
255
|
+
start: number;
|
|
256
|
+
end: number;
|
|
257
|
+
actualEnd?: number;
|
|
125
258
|
};
|
|
126
259
|
declare enum NodeType {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
260
|
+
Root = 0,
|
|
261
|
+
Group = 1,
|
|
262
|
+
Paragraph = 2,
|
|
263
|
+
Preformatted = 3,
|
|
264
|
+
Text = 4,
|
|
265
|
+
Escaped = 5,
|
|
266
|
+
SystemModifier = 6,
|
|
267
|
+
InlineModifier = 7,
|
|
268
|
+
BlockModifier = 8,
|
|
269
|
+
Interpolation = 9,
|
|
136
270
|
}
|
|
271
|
+
type RootNode = {
|
|
272
|
+
type: NodeType.Root;
|
|
273
|
+
content: BlockEntity[];
|
|
274
|
+
source: Source;
|
|
275
|
+
};
|
|
276
|
+
type GroupNode = {
|
|
277
|
+
location: LocationRange;
|
|
278
|
+
type: NodeType.Group;
|
|
279
|
+
content: BlockEntity[];
|
|
280
|
+
};
|
|
137
281
|
type ParagraphNode = {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
282
|
+
location: LocationRange;
|
|
283
|
+
type: NodeType.Paragraph;
|
|
284
|
+
content: InlineEntity[];
|
|
141
285
|
};
|
|
142
286
|
type PreNode = {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
287
|
+
location: LocationRange;
|
|
288
|
+
type: NodeType.Preformatted;
|
|
289
|
+
content: {
|
|
290
|
+
start: number;
|
|
291
|
+
end: number;
|
|
292
|
+
text: string;
|
|
293
|
+
};
|
|
150
294
|
};
|
|
151
295
|
type TextNode = {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
296
|
+
location: LocationRange;
|
|
297
|
+
type: NodeType.Text;
|
|
298
|
+
content: string;
|
|
155
299
|
};
|
|
156
300
|
type EscapedNode = {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
301
|
+
location: LocationRange;
|
|
302
|
+
type: NodeType.Escaped;
|
|
303
|
+
content: string;
|
|
160
304
|
};
|
|
161
|
-
type
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
state?: TState;
|
|
166
|
-
head: LocationRange;
|
|
167
|
-
arguments: ModifierArgument[];
|
|
168
|
-
content: BlockEntity[];
|
|
169
|
-
expansion?: never[];
|
|
305
|
+
type ModifierArguments = {
|
|
306
|
+
positional: ModifierArgument[];
|
|
307
|
+
named: Map<string, ModifierArgument>;
|
|
308
|
+
location: LocationRange;
|
|
170
309
|
};
|
|
171
|
-
type
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
head: LocationRange;
|
|
177
|
-
arguments: ModifierArgument[];
|
|
178
|
-
content: BlockEntity[];
|
|
179
|
-
expansion?: BlockEntity[];
|
|
310
|
+
type ModifierNodeBase<TState> = {
|
|
311
|
+
location: LocationRange;
|
|
312
|
+
state?: TState;
|
|
313
|
+
head: LocationRange;
|
|
314
|
+
arguments: ModifierArguments;
|
|
180
315
|
};
|
|
181
|
-
type
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
head: LocationRange;
|
|
187
|
-
arguments: ModifierArgument[];
|
|
188
|
-
content: InlineEntity[];
|
|
189
|
-
expansion?: InlineEntity[];
|
|
316
|
+
type SystemModifierNode<TState> = ModifierNodeBase<TState> & {
|
|
317
|
+
type: NodeType.SystemModifier;
|
|
318
|
+
mod: SystemModifierDefinition<TState>;
|
|
319
|
+
content: BlockEntity[];
|
|
320
|
+
expansion?: never[];
|
|
190
321
|
};
|
|
191
|
-
type
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
322
|
+
type BlockModifierNode<TState> = ModifierNodeBase<TState> & {
|
|
323
|
+
type: NodeType.BlockModifier;
|
|
324
|
+
mod: BlockModifierDefinition<TState>;
|
|
325
|
+
content: BlockEntity[];
|
|
326
|
+
expansion?: BlockEntity[];
|
|
327
|
+
};
|
|
328
|
+
type InlineModifierNode<TState> = ModifierNodeBase<TState> & {
|
|
329
|
+
type: NodeType.InlineModifier;
|
|
330
|
+
mod: InlineModifierDefinition<TState>;
|
|
331
|
+
content: InlineEntity[];
|
|
332
|
+
expansion?: InlineEntity[];
|
|
195
333
|
};
|
|
196
|
-
type ModifierNode<T = any> = BlockModifierNode<T> | InlineModifierNode<T> | SystemModifierNode<T>;
|
|
197
|
-
type BlockEntity = ParagraphNode | PreNode | BlockModifierNode<any> | SystemModifierNode<any>;
|
|
334
|
+
type ModifierNode<T$1 = any> = BlockModifierNode<T$1> | InlineModifierNode<T$1> | SystemModifierNode<T$1>;
|
|
335
|
+
type BlockEntity = GroupNode | ParagraphNode | PreNode | BlockModifierNode<any> | SystemModifierNode<any>;
|
|
198
336
|
type InlineEntity = TextNode | EscapedNode | InlineModifierNode<any> | SystemModifierNode<any>;
|
|
199
337
|
type DocumentNode = BlockEntity | InlineEntity | RootNode;
|
|
200
338
|
type InterpolationNode = {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
339
|
+
location: LocationRange;
|
|
340
|
+
type: NodeType.Interpolation;
|
|
341
|
+
definition: ArgumentInterpolatorDefinition;
|
|
342
|
+
argument: ModifierArgument;
|
|
343
|
+
expansion?: string;
|
|
206
344
|
};
|
|
207
345
|
type ModifierArgument = {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
346
|
+
location: LocationRange;
|
|
347
|
+
content: ArgumentEntity[];
|
|
348
|
+
expansion?: string;
|
|
211
349
|
};
|
|
212
350
|
type ArgumentEntity = TextNode | EscapedNode | InterpolationNode;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
beforeParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
244
|
-
/** Called after the modifier's content is parsed.
|
|
245
|
-
* @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.
|
|
246
|
-
*/
|
|
247
|
-
afterParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
248
|
-
/** Called before reparsing of the expansion.
|
|
249
|
-
* @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.*/
|
|
250
|
-
beforeProcessExpansion?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
251
|
-
/** Called before reparsing of the expansion.
|
|
252
|
-
* @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.*/
|
|
253
|
-
afterProcessExpansion?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
254
|
-
/**
|
|
255
|
-
* @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.
|
|
256
|
-
*/
|
|
257
|
-
prepareExpand?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
|
|
258
|
-
/**
|
|
259
|
-
* @param immediate False when the node is inside a `delayContentExpansion` modifier, but it is `alwaysTryExpand`; otherwise true.
|
|
260
|
-
*/
|
|
261
|
-
expand?: (node: TNode, cxt: ParseContext, immediate: boolean) => TEntity[] | undefined;
|
|
262
|
-
}
|
|
263
|
-
declare class BlockModifierDefinition<TState> extends ModifierBase<BlockModifierNode<TState>, BlockEntity> {
|
|
264
|
-
}
|
|
265
|
-
declare class InlineModifierDefinition<TState> extends ModifierBase<InlineModifierNode<TState>, InlineEntity> {
|
|
266
|
-
}
|
|
267
|
-
declare class SystemModifierDefinition<TState> extends ModifierBase<SystemModifierNode<TState>, never> {
|
|
268
|
-
}
|
|
269
|
-
declare class ArgumentInterpolatorDefinition {
|
|
270
|
-
readonly name: string;
|
|
271
|
-
readonly postfix: string;
|
|
272
|
-
constructor(name: string, postfix: string, args?: Partial<ArgumentInterpolatorDefinition>);
|
|
273
|
-
alwaysTryExpand: boolean;
|
|
274
|
-
expand?: (content: string, cxt: ParseContext, immediate: boolean) => string | undefined;
|
|
275
|
-
}
|
|
276
|
-
type Shorthand<TMod> = {
|
|
277
|
-
name: string;
|
|
278
|
-
parts: readonly string[];
|
|
279
|
-
postfix: string | undefined;
|
|
280
|
-
mod: TMod;
|
|
281
|
-
};
|
|
282
|
-
type BlockShorthand<TState> = Shorthand<BlockModifierDefinition<TState>>;
|
|
283
|
-
type InlineShorthand<TState> = Shorthand<InlineModifierDefinition<TState>>;
|
|
284
|
-
|
|
285
|
-
declare class SimpleScanner implements Scanner {
|
|
286
|
-
private src;
|
|
287
|
-
readonly source: Source;
|
|
288
|
-
private pos;
|
|
289
|
-
constructor(src: string, sourceDesc?: SourceDescriptor);
|
|
290
|
-
position(): number;
|
|
291
|
-
isEOF(): boolean;
|
|
292
|
-
peek(str: string): boolean;
|
|
293
|
-
acceptChar(): string;
|
|
294
|
-
accept(str: string): boolean;
|
|
295
|
-
acceptWhitespaceChar(): string | null;
|
|
296
|
-
}
|
|
297
|
-
interface Scanner {
|
|
298
|
-
readonly source: Source;
|
|
299
|
-
position(): number;
|
|
300
|
-
isEOF(): boolean;
|
|
301
|
-
peek(str: string): boolean;
|
|
302
|
-
accept(str: string): boolean;
|
|
303
|
-
acceptChar(): string;
|
|
304
|
-
acceptWhitespaceChar(): string | null;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
declare function parse(scanner: Scanner, cxt: ParseContext): Document$1;
|
|
308
|
-
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region src/parser.d.ts
|
|
353
|
+
declare class Parser {
|
|
354
|
+
#private;
|
|
355
|
+
private scanner;
|
|
356
|
+
private cxt;
|
|
357
|
+
private emit;
|
|
358
|
+
private delayDepth;
|
|
359
|
+
constructor(scanner: Scanner, cxt: ParseContext);
|
|
360
|
+
parse(): Document$1;
|
|
361
|
+
private WHITESPACES;
|
|
362
|
+
private WHITESPACES_OR_NEWLINES;
|
|
363
|
+
private SHOULD_BE_A_NEWLINE;
|
|
364
|
+
private WARN_IF_MORE_NEWLINES_THAN;
|
|
365
|
+
private DOCUMENT;
|
|
366
|
+
private BLOCK_ENTITY;
|
|
367
|
+
private MODIFIER;
|
|
368
|
+
private PRE_PARAGRAPH;
|
|
369
|
+
private MAYBE_GROUPED_PARAGRAPH;
|
|
370
|
+
private PARAGRAPH;
|
|
371
|
+
private SHORTHAND;
|
|
372
|
+
private MODIFIER_BODY;
|
|
373
|
+
private INLINE_ENTITY;
|
|
374
|
+
private PREFORMATTED_INLINE_ENTITY;
|
|
375
|
+
private ARGUMENT_CONTENT;
|
|
376
|
+
private POSSIBLY_NAMED_ARGUMENT;
|
|
377
|
+
private ARGUMENTS;
|
|
378
|
+
}
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/renderer.d.ts
|
|
309
381
|
type RendererType<TState, TReturn, TDocument, TOptions = undefined> = {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
382
|
+
state: TState;
|
|
383
|
+
return: TReturn;
|
|
384
|
+
document: TDocument;
|
|
385
|
+
options: TOptions;
|
|
314
386
|
};
|
|
315
387
|
type AnyRendererType = RendererType<any, any, any, any>;
|
|
316
388
|
type getState<Type> = Type extends RendererType<infer T, any, any, any> ? T : never;
|
|
@@ -318,317 +390,337 @@ type getReturn<Type> = Type extends RendererType<any, infer T, any, any> ? T : n
|
|
|
318
390
|
type getDocument<Type> = Type extends RendererType<any, any, infer T, any> ? T : never;
|
|
319
391
|
type getOptions<Type> = Type extends RendererType<any, any, any, infer T> ? T : never;
|
|
320
392
|
type NodeRenderer<Type extends AnyRendererType, TNode> = (node: TNode, cxt: RenderContext<Type>) => getReturn<Type>;
|
|
321
|
-
type NodeRendererDefinition<Type extends AnyRendererType, TNode, TDef> = [
|
|
322
|
-
def: TDef,
|
|
323
|
-
renderer: NodeRenderer<Type, TNode>
|
|
324
|
-
];
|
|
393
|
+
type NodeRendererDefinition<Type extends AnyRendererType, TNode, TDef> = [def: TDef, renderer: NodeRenderer<Type, TNode>];
|
|
325
394
|
declare class RenderContext<Type extends AnyRendererType> {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
395
|
+
readonly config: RenderConfiguration<Type>;
|
|
396
|
+
readonly parsedDocument: Document$1;
|
|
397
|
+
state: getState<Type>;
|
|
398
|
+
renderEntity(node: BlockEntity | InlineEntity): getReturn<Type>[];
|
|
399
|
+
constructor(config: RenderConfiguration<Type>, parsedDocument: Document$1, state: getState<Type>);
|
|
331
400
|
}
|
|
332
401
|
interface ReadonlyRenderConfiguration<Type extends AnyRendererType> {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
402
|
+
readonly options: getOptions<Type>;
|
|
403
|
+
readonly paragraphRenderer?: NodeRenderer<Type, ParagraphNode>;
|
|
404
|
+
readonly textRenderer?: NodeRenderer<Type, TextNode | PreNode | EscapedNode>;
|
|
405
|
+
readonly undefinedBlockRenderer?: NodeRenderer<Type, BlockModifierNode<any>>;
|
|
406
|
+
readonly undefinedInlineRenderer?: NodeRenderer<Type, InlineModifierNode<any>>;
|
|
407
|
+
readonly blockRenderers: ReadonlyMap<BlockModifierDefinition<any>, NodeRenderer<Type, BlockModifierNode<any>>>;
|
|
408
|
+
readonly inlineRenderers: ReadonlyMap<InlineModifierDefinition<any>, NodeRenderer<Type, InlineModifierNode<any>>>;
|
|
409
|
+
readonly postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getDocument<Type>;
|
|
410
|
+
render(doc: Document$1, state: getState<Type>): getDocument<Type>;
|
|
342
411
|
}
|
|
343
412
|
type BlockRendererDefiniton<Type extends AnyRendererType, ModState = any> = NodeRendererDefinition<Type, BlockModifierNode<ModState>, BlockModifierDefinition<ModState>>;
|
|
344
413
|
type InlineRendererDefiniton<Type extends AnyRendererType, ModState = any> = NodeRendererDefinition<Type, InlineModifierNode<ModState>, InlineModifierDefinition<ModState>>;
|
|
345
414
|
declare class RenderConfiguration<Type extends AnyRendererType> implements ReadonlyRenderConfiguration<Type> {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
415
|
+
options: getOptions<Type>;
|
|
416
|
+
postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getDocument<Type>;
|
|
417
|
+
paragraphRenderer?: NodeRenderer<Type, ParagraphNode>;
|
|
418
|
+
textRenderer?: NodeRenderer<Type, TextNode | PreNode | EscapedNode>;
|
|
419
|
+
undefinedBlockRenderer?: NodeRenderer<Type, BlockModifierNode<any>>;
|
|
420
|
+
undefinedInlineRenderer?: NodeRenderer<Type, InlineModifierNode<any>>;
|
|
421
|
+
blockRenderers: Map<BlockModifierDefinition<any>, NodeRenderer<Type, BlockModifierNode<any>>>;
|
|
422
|
+
inlineRenderers: Map<InlineModifierDefinition<any>, NodeRenderer<Type, InlineModifierNode<any>>>;
|
|
423
|
+
constructor(options: getOptions<Type>, postprocessor: (results: getReturn<Type>[], cxt: RenderContext<Type>) => getDocument<Type>);
|
|
424
|
+
render(doc: Document$1, state: getState<Type>): getDocument<Type>;
|
|
425
|
+
addBlockRenderer(...rs: BlockRendererDefiniton<Type>[]): void;
|
|
426
|
+
addInlineRenderer(...rs: InlineRendererDefiniton<Type>[]): void;
|
|
427
|
+
static from<Type extends AnyRendererType>(from: ReadonlyRenderConfiguration<Type>): RenderConfiguration<Type>;
|
|
428
|
+
}
|
|
429
|
+
declare namespace messages_d_exports {
|
|
430
|
+
export { ArgumentCountMismatchMessage, CannotExpandArgumentMessage, CannotUseModuleInSelfMessage, ContentExpectedMessage, DuplicateNamedArgumentMessage, EitherNormalOrPreMessage, EntityNotAllowedMessage, ExpectedMessage, InternalErrorMessage, InvalidArgumentMessage, MultipleBlocksNotPermittedMessage, NameAlreadyDefinedMessage, NewBlockShouldBeOnNewlineMessage, NoNestedModuleMessage, OnlySimpleParagraphsPermittedMessage, OverwriteDefinitionsMessage, OverwriteSpecialVariableMessage, ReachedRecursionLimitMessage, ShouldBeOnNewlineMessage, SlotUsedOutsideDefinitionMessage, UnclosedInlineModifierMessage, UndefinedVariableMessage, UnknownModifierMessage, UnnecessaryNewlineMessage };
|
|
359
431
|
}
|
|
360
|
-
|
|
361
432
|
declare class AddThingMessage implements Message {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
433
|
+
readonly code: number;
|
|
434
|
+
readonly severity: MessageSeverity;
|
|
435
|
+
readonly location: LocationRange;
|
|
436
|
+
readonly info: string;
|
|
437
|
+
constructor(code: number, severity: MessageSeverity, location: LocationRange, info: string);
|
|
367
438
|
}
|
|
368
439
|
declare class RemoveThingMessage implements Message {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
440
|
+
readonly code: number;
|
|
441
|
+
readonly severity: MessageSeverity;
|
|
442
|
+
readonly location: LocationRange;
|
|
443
|
+
readonly info: string;
|
|
444
|
+
constructor(code: number, severity: MessageSeverity, location: LocationRange, info: string);
|
|
374
445
|
}
|
|
375
446
|
declare class ExpectedMessage implements Message {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
447
|
+
readonly location: LocationRange;
|
|
448
|
+
private what;
|
|
449
|
+
constructor(location: LocationRange, what: string);
|
|
450
|
+
readonly code = 1;
|
|
451
|
+
readonly severity = MessageSeverity.Error;
|
|
452
|
+
get info(): string;
|
|
382
453
|
}
|
|
383
454
|
declare class UnknownModifierMessage implements Message {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
455
|
+
readonly location: LocationRange;
|
|
456
|
+
private what;
|
|
457
|
+
constructor(location: LocationRange, what: string);
|
|
458
|
+
readonly code = 2;
|
|
459
|
+
readonly severity = MessageSeverity.Error;
|
|
460
|
+
get info(): string;
|
|
390
461
|
}
|
|
391
462
|
declare class UnclosedInlineModifierMessage implements Message {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
463
|
+
readonly location: LocationRange;
|
|
464
|
+
private what;
|
|
465
|
+
constructor(location: LocationRange, what: string);
|
|
466
|
+
readonly code = 3;
|
|
467
|
+
readonly severity = MessageSeverity.Error;
|
|
468
|
+
get info(): string;
|
|
398
469
|
}
|
|
399
470
|
declare class ArgumentCountMismatchMessage implements Message {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
471
|
+
readonly location: LocationRange;
|
|
472
|
+
constructor(location: LocationRange, min?: number, max?: number);
|
|
473
|
+
private msg;
|
|
474
|
+
readonly code = 4;
|
|
475
|
+
readonly severity = MessageSeverity.Error;
|
|
476
|
+
get info(): string;
|
|
406
477
|
}
|
|
407
478
|
declare class CannotExpandArgumentMessage implements Message {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
479
|
+
readonly location: LocationRange;
|
|
480
|
+
private what?;
|
|
481
|
+
constructor(location: LocationRange, what?: string | undefined);
|
|
482
|
+
readonly code = 5;
|
|
483
|
+
readonly severity = MessageSeverity.Error;
|
|
484
|
+
get info(): string;
|
|
414
485
|
}
|
|
415
486
|
declare class InvalidArgumentMessage implements Message {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
487
|
+
readonly location: LocationRange;
|
|
488
|
+
private what?;
|
|
489
|
+
constructor(location: LocationRange, what?: string | undefined);
|
|
490
|
+
readonly code = 6;
|
|
491
|
+
readonly severity = MessageSeverity.Error;
|
|
492
|
+
get info(): string;
|
|
422
493
|
}
|
|
423
494
|
declare class EntityNotAllowedMessage implements Message {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
495
|
+
readonly location: LocationRange;
|
|
496
|
+
private what?;
|
|
497
|
+
constructor(location: LocationRange, what?: string | undefined);
|
|
498
|
+
readonly code = 7;
|
|
499
|
+
readonly severity = MessageSeverity.Error;
|
|
500
|
+
get info(): string;
|
|
430
501
|
}
|
|
431
502
|
declare class ReachedRecursionLimitMessage implements Message {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
503
|
+
readonly location: LocationRange;
|
|
504
|
+
private limit;
|
|
505
|
+
private what;
|
|
506
|
+
constructor(location: LocationRange, limit: number, what: string);
|
|
507
|
+
readonly code = 8;
|
|
508
|
+
readonly severity = MessageSeverity.Error;
|
|
509
|
+
get info(): string;
|
|
439
510
|
}
|
|
440
511
|
declare class SlotUsedOutsideDefinitionMessage implements Message {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
512
|
+
readonly location: LocationRange;
|
|
513
|
+
constructor(location: LocationRange);
|
|
514
|
+
readonly code = 9;
|
|
515
|
+
readonly severity = MessageSeverity.Error;
|
|
516
|
+
get info(): string;
|
|
446
517
|
}
|
|
447
518
|
declare class NoNestedModuleMessage implements Message {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
519
|
+
readonly location: LocationRange;
|
|
520
|
+
constructor(location: LocationRange);
|
|
521
|
+
readonly code = 10;
|
|
522
|
+
readonly severity = MessageSeverity.Error;
|
|
523
|
+
get info(): string;
|
|
453
524
|
}
|
|
454
525
|
declare class CannotUseModuleInSelfMessage implements Message {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
526
|
+
readonly location: LocationRange;
|
|
527
|
+
constructor(location: LocationRange);
|
|
528
|
+
readonly code = 11;
|
|
529
|
+
readonly severity = MessageSeverity.Error;
|
|
530
|
+
get info(): string;
|
|
460
531
|
}
|
|
461
532
|
declare class EitherNormalOrPreMessage implements Message {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
533
|
+
readonly location: LocationRange;
|
|
534
|
+
constructor(location: LocationRange);
|
|
535
|
+
readonly code = 12;
|
|
536
|
+
readonly severity = MessageSeverity.Error;
|
|
537
|
+
get info(): string;
|
|
467
538
|
}
|
|
468
539
|
declare class MultipleBlocksNotPermittedMessage implements Message {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
540
|
+
readonly location: LocationRange;
|
|
541
|
+
constructor(location: LocationRange);
|
|
542
|
+
readonly code = 13;
|
|
543
|
+
readonly severity = MessageSeverity.Error;
|
|
544
|
+
get info(): string;
|
|
474
545
|
}
|
|
475
546
|
declare class OnlySimpleParagraphsPermittedMessage implements Message {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
547
|
+
readonly location: LocationRange;
|
|
548
|
+
constructor(location: LocationRange);
|
|
549
|
+
readonly code = 14;
|
|
550
|
+
readonly severity = MessageSeverity.Error;
|
|
551
|
+
get info(): string;
|
|
552
|
+
}
|
|
553
|
+
declare class ContentExpectedMessage implements Message {
|
|
554
|
+
readonly location: LocationRange;
|
|
555
|
+
constructor(location: LocationRange);
|
|
556
|
+
readonly code = 15;
|
|
557
|
+
readonly severity = MessageSeverity.Error;
|
|
558
|
+
get info(): string;
|
|
559
|
+
}
|
|
560
|
+
declare class InternalErrorMessage implements Message {
|
|
561
|
+
readonly location: LocationRange;
|
|
562
|
+
readonly error: any;
|
|
563
|
+
constructor(location: LocationRange, error: any);
|
|
564
|
+
readonly code = 16;
|
|
565
|
+
readonly severity = MessageSeverity.Error;
|
|
566
|
+
get info(): string;
|
|
567
|
+
}
|
|
568
|
+
declare class DuplicateNamedArgumentMessage implements Message {
|
|
569
|
+
readonly location: LocationRange;
|
|
570
|
+
readonly name: string;
|
|
571
|
+
constructor(location: LocationRange, name: string);
|
|
572
|
+
readonly code = 17;
|
|
573
|
+
readonly severity = MessageSeverity.Error;
|
|
574
|
+
get info(): string;
|
|
481
575
|
}
|
|
482
576
|
declare class UnnecessaryNewlineMessage extends RemoveThingMessage {
|
|
483
|
-
|
|
577
|
+
constructor(location: LocationRange);
|
|
484
578
|
}
|
|
485
579
|
declare class NewBlockShouldBeOnNewlineMessage extends AddThingMessage {
|
|
486
|
-
|
|
580
|
+
constructor(location: LocationRange);
|
|
487
581
|
}
|
|
488
582
|
declare class ShouldBeOnNewlineMessage extends AddThingMessage {
|
|
489
|
-
|
|
583
|
+
constructor(location: LocationRange);
|
|
490
584
|
}
|
|
491
585
|
declare class NameAlreadyDefinedMessage implements Message {
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
586
|
+
readonly location: LocationRange;
|
|
587
|
+
private what;
|
|
588
|
+
constructor(location: LocationRange, what: string);
|
|
589
|
+
readonly code = 4;
|
|
590
|
+
readonly severity = MessageSeverity.Warning;
|
|
591
|
+
get info(): string;
|
|
498
592
|
}
|
|
499
593
|
declare class UndefinedVariableMessage implements Message {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
594
|
+
readonly location: LocationRange;
|
|
595
|
+
private what;
|
|
596
|
+
constructor(location: LocationRange, what: string);
|
|
597
|
+
readonly code = 5;
|
|
598
|
+
readonly severity = MessageSeverity.Warning;
|
|
599
|
+
get info(): string;
|
|
506
600
|
}
|
|
507
601
|
declare class OverwriteDefinitionsMessage implements Message {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
602
|
+
readonly location: LocationRange;
|
|
603
|
+
private what;
|
|
604
|
+
constructor(location: LocationRange, what: string);
|
|
605
|
+
readonly code = 6;
|
|
606
|
+
readonly severity = MessageSeverity.Warning;
|
|
607
|
+
get info(): string;
|
|
514
608
|
}
|
|
515
609
|
declare class OverwriteSpecialVariableMessage implements Message {
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
type
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
declare
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
type messages_OverwriteSpecialVariableMessage = OverwriteSpecialVariableMessage;
|
|
552
|
-
declare const messages_OverwriteSpecialVariableMessage: typeof OverwriteSpecialVariableMessage;
|
|
553
|
-
type messages_ReachedRecursionLimitMessage = ReachedRecursionLimitMessage;
|
|
554
|
-
declare const messages_ReachedRecursionLimitMessage: typeof ReachedRecursionLimitMessage;
|
|
555
|
-
type messages_ShouldBeOnNewlineMessage = ShouldBeOnNewlineMessage;
|
|
556
|
-
declare const messages_ShouldBeOnNewlineMessage: typeof ShouldBeOnNewlineMessage;
|
|
557
|
-
type messages_SlotUsedOutsideDefinitionMessage = SlotUsedOutsideDefinitionMessage;
|
|
558
|
-
declare const messages_SlotUsedOutsideDefinitionMessage: typeof SlotUsedOutsideDefinitionMessage;
|
|
559
|
-
type messages_UnclosedInlineModifierMessage = UnclosedInlineModifierMessage;
|
|
560
|
-
declare const messages_UnclosedInlineModifierMessage: typeof UnclosedInlineModifierMessage;
|
|
561
|
-
type messages_UndefinedVariableMessage = UndefinedVariableMessage;
|
|
562
|
-
declare const messages_UndefinedVariableMessage: typeof UndefinedVariableMessage;
|
|
563
|
-
type messages_UnknownModifierMessage = UnknownModifierMessage;
|
|
564
|
-
declare const messages_UnknownModifierMessage: typeof UnknownModifierMessage;
|
|
565
|
-
type messages_UnnecessaryNewlineMessage = UnnecessaryNewlineMessage;
|
|
566
|
-
declare const messages_UnnecessaryNewlineMessage: typeof UnnecessaryNewlineMessage;
|
|
567
|
-
declare namespace messages {
|
|
568
|
-
export { messages_ArgumentCountMismatchMessage as ArgumentCountMismatchMessage, messages_CannotExpandArgumentMessage as CannotExpandArgumentMessage, messages_CannotUseModuleInSelfMessage as CannotUseModuleInSelfMessage, 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_ShouldBeOnNewlineMessage as ShouldBeOnNewlineMessage, messages_SlotUsedOutsideDefinitionMessage as SlotUsedOutsideDefinitionMessage, messages_UnclosedInlineModifierMessage as UnclosedInlineModifierMessage, messages_UndefinedVariableMessage as UndefinedVariableMessage, messages_UnknownModifierMessage as UnknownModifierMessage, messages_UnnecessaryNewlineMessage as UnnecessaryNewlineMessage };
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
declare function checkArgumentLength(node: ModifierNode, min?: number, max?: number | undefined): Message[] | null;
|
|
572
|
-
declare function checkArguments(node: ModifierNode, min?: number, max?: number | undefined): Message[] | null;
|
|
610
|
+
readonly location: LocationRange;
|
|
611
|
+
private varname;
|
|
612
|
+
private previous;
|
|
613
|
+
constructor(location: LocationRange, varname: string, previous: string);
|
|
614
|
+
readonly code = 6;
|
|
615
|
+
readonly severity = MessageSeverity.Warning;
|
|
616
|
+
get info(): string;
|
|
617
|
+
}
|
|
618
|
+
declare namespace modifier_helper_d_exports {
|
|
619
|
+
export { bindArgs, createParagraphWrapper, createPlaintextWrapper, onlyPermitPlaintextParagraph, onlyPermitSimpleParagraphs, onlyPermitSingleBlock };
|
|
620
|
+
}
|
|
621
|
+
type BindResult<P extends string[], Opt extends string[], N extends Record<string, string>> = {
|
|
622
|
+
msgs: Message[];
|
|
623
|
+
args: undefined;
|
|
624
|
+
nodes: undefined;
|
|
625
|
+
rest: undefined;
|
|
626
|
+
restNodes: undefined;
|
|
627
|
+
} | {
|
|
628
|
+
msgs: null;
|
|
629
|
+
args: { [key in P[number]]: string } & { [key in Opt[number]]?: string | undefined } & { [key in keyof N]: string };
|
|
630
|
+
nodes: { [key in P[number]]: ModifierArgument } & { [key in Opt[number]]: ModifierArgument | undefined } & { [key in keyof N]: ModifierArgument | undefined };
|
|
631
|
+
rest: string[];
|
|
632
|
+
restNodes: ModifierArgument[];
|
|
633
|
+
};
|
|
634
|
+
declare function bindArgs<P extends string[], Opt extends string[] = [], N extends Record<string, string> = {}>(node: ModifierNode, p: readonly [...P], opts?: {
|
|
635
|
+
named?: N;
|
|
636
|
+
optional?: readonly [...Opt];
|
|
637
|
+
rest?: boolean;
|
|
638
|
+
restNamed?: boolean;
|
|
639
|
+
trim?: boolean;
|
|
640
|
+
}): BindResult<P, Opt, N>;
|
|
641
|
+
/**
|
|
642
|
+
* Helper function to ensure that a modifier only accepts plaintext paragraphs as content.
|
|
643
|
+
* @returns The content as a string if OK, otherwise an array of error messages.
|
|
644
|
+
*/
|
|
573
645
|
declare function onlyPermitPlaintextParagraph(node: BlockModifierNode<any> | SystemModifierNode<any>): Message[] | string;
|
|
646
|
+
/**
|
|
647
|
+
* Helper function to ensure that a modifier does not accept any block modifiers inside its content.
|
|
648
|
+
* @returns `null` if OK, otherwise an array of error messages.
|
|
649
|
+
*/
|
|
574
650
|
declare function onlyPermitSimpleParagraphs(node: BlockModifierNode<any> | SystemModifierNode<any>): Message[] | null;
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
declare
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
declare
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
651
|
+
/**
|
|
652
|
+
* Helper function to ensure that a modifier only accepts one block as its content.
|
|
653
|
+
* @returns `null` if OK, otherwise an array of error messages.
|
|
654
|
+
*/
|
|
655
|
+
declare function onlyPermitSingleBlock(node: BlockModifierNode<any> | SystemModifierNode<any>, opt?: {
|
|
656
|
+
optional?: boolean;
|
|
657
|
+
}): Message[] | null;
|
|
658
|
+
declare function createPlaintextWrapper(name: string, get: (cxt: ParseContext) => string | undefined, set: (cxt: ParseContext, value: string) => string, slotType?: ModifierSlotType): SystemModifierDefinition<void>;
|
|
659
|
+
declare function createParagraphWrapper(name: string, get: (cxt: ParseContext) => ParagraphNode | undefined, set: (cxt: ParseContext, value: ParagraphNode) => void, slotType?: ModifierSlotType): SystemModifierDefinition<void>;
|
|
660
|
+
//#endregion
|
|
661
|
+
//#region src/node-util.d.ts
|
|
662
|
+
type CloneNodeOptions = {
|
|
663
|
+
newLocation?: LocationRange;
|
|
664
|
+
withState?: boolean;
|
|
665
|
+
};
|
|
666
|
+
declare function cloneNode<T$1 extends DocumentNode>(node: T$1, options?: CloneNodeOptions): T$1;
|
|
667
|
+
declare function cloneNodes<T$1 extends readonly DocumentNode[]>(nodes: T$1, options?: CloneNodeOptions): T$1;
|
|
668
|
+
/** Warning: modifies the original nodes */
|
|
669
|
+
declare function stripNode(...nodes: DocumentNode[]): DocumentNode[];
|
|
670
|
+
//#endregion
|
|
671
|
+
//#region src/builtin/builtin.d.ts
|
|
586
672
|
declare const BuiltinConfiguration: ReadonlyConfiguration;
|
|
587
|
-
|
|
673
|
+
//#endregion
|
|
674
|
+
//#region src/default/default.d.ts
|
|
588
675
|
declare const DefaultConfiguration: ReadonlyConfiguration;
|
|
589
|
-
|
|
676
|
+
//#endregion
|
|
677
|
+
//#region src/default/html-renderer.d.ts
|
|
590
678
|
type HTMLRendererOptions = {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
679
|
+
document: Document;
|
|
680
|
+
headPlugins: HTMLComponentPlugin[];
|
|
681
|
+
headerPlugins: HTMLComponentPlugin[];
|
|
682
|
+
footerPlugins: HTMLComponentPlugin[];
|
|
683
|
+
postprocessPlugins: HTMLPostprocessPlugin[];
|
|
684
|
+
transformAsset: (id: string) => string | undefined;
|
|
596
685
|
};
|
|
597
686
|
type HTMLRenderType = {
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
687
|
+
state: HTMLRenderState;
|
|
688
|
+
options: HTMLRendererOptions;
|
|
689
|
+
document: Document;
|
|
690
|
+
return: Node | Node[];
|
|
602
691
|
};
|
|
603
692
|
type HTMLRenderPlugin = (elem: BlockEntity | InlineEntity, cxt: RenderContext<HTMLRenderType>) => string | undefined;
|
|
604
693
|
type HTMLComponentPlugin = (cxt: RenderContext<HTMLRenderType>) => Node | Node[] | undefined;
|
|
605
694
|
type HTMLPostprocessPlugin = (cxt: RenderContext<HTMLRenderType>, output: Document) => void;
|
|
606
695
|
declare class HTMLRenderState {
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
696
|
+
title: string;
|
|
697
|
+
stylesheet: string;
|
|
698
|
+
cssVariables: Map<string, string>;
|
|
699
|
+
invalidBlock(node: BlockEntity, msg: string): minimal_jsx_runtime_jsx_runtime0.JSX.Element;
|
|
700
|
+
invalidInline(node: InlineEntity, msg: string): minimal_jsx_runtime_jsx_runtime0.JSX.Element;
|
|
701
|
+
render(elems: (BlockEntity | InlineEntity)[], cxt: RenderContext<HTMLRenderType>): DocumentFragment;
|
|
613
702
|
}
|
|
614
703
|
declare const HTMLRenderConfiguration: ReadonlyRenderConfiguration<HTMLRenderType>;
|
|
615
|
-
|
|
704
|
+
//#endregion
|
|
705
|
+
//#region src/debug-print.d.ts
|
|
616
706
|
declare const debugPrint: {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
707
|
+
blockModifier: (x: BlockModifierDefinition<any>) => string;
|
|
708
|
+
inlineModifier: (x: InlineModifierDefinition<any>) => string;
|
|
709
|
+
inlineShorthand: (x: InlineShorthand<any>) => string;
|
|
710
|
+
blockShorthand: (x: BlockShorthand<any>) => string;
|
|
711
|
+
argument: (arg: ModifierArgument) => string;
|
|
712
|
+
node: (...nodes: (BlockEntity | InlineEntity)[]) => string;
|
|
713
|
+
message: typeof debugPrintMsg;
|
|
714
|
+
range: typeof debugPrintRange;
|
|
715
|
+
document: typeof debugDumpDocument;
|
|
626
716
|
};
|
|
627
717
|
declare function debugPrintRange(loc: LocationRange, context?: number): string;
|
|
628
718
|
declare function debugPrintMsg(m: Message): string;
|
|
629
719
|
declare function debugDumpDocument(doc: Document$1): string;
|
|
630
|
-
|
|
720
|
+
//#endregion
|
|
721
|
+
//#region src/index.d.ts
|
|
631
722
|
declare const emmmVersion = "0.0.6";
|
|
632
723
|
declare function setDebugLevel(level: DebugLevel): void;
|
|
633
|
-
|
|
634
|
-
export {
|
|
724
|
+
//#endregion
|
|
725
|
+
export { ArgumentEntity, ArgumentInterpolatorDefinition, BlockEntity, BlockModifierDefinition, BlockModifierNode, BlockRendererDefiniton, BlockShorthand, BuiltinConfiguration, CloneNodeOptions, Configuration, DebugLevel, DefaultConfiguration, Document$1 as Document, DocumentNode, EscapedNode, GroupNode, HTMLComponentPlugin, HTMLPostprocessPlugin, HTMLRenderConfiguration, HTMLRenderPlugin, HTMLRenderState, HTMLRenderType, HTMLRendererOptions, InlineEntity, InlineModifierDefinition, InlineModifierNode, InlineRendererDefiniton, InlineShorthand, Inspector, InterpolationNode, KernelConfiguration, LocationRange, Message, MessageSeverity, ModifierArgument, ModifierArguments, ModifierMetadata, ModifierNode, ModifierSlotType, NodeRenderer, NodeRendererDefinition, NodeType, ParagraphNode, ParseContext, ParseContextStoreDefinitions, ParseContextStoreKey, Parser, PreNode, ReadonlyConfiguration, ReadonlyRenderConfiguration, RenderConfiguration, RenderContext, RendererType, RootNode, Scanner, SimpleScanner, Source, SourceDescriptor, StringSource, SystemModifierDefinition, SystemModifierNode, TextNode, cloneNode, cloneNodes, debugPrint, emmmVersion, modifier_helper_d_exports as helper, messages_d_exports as messages, setDebugLevel, stripNode };
|
|
726
|
+
//# sourceMappingURL=index.d.ts.map
|