@the_dissidents/libemmm 0.0.0

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 ADDED
@@ -0,0 +1,6 @@
1
+ # emmm
2
+ [![Node.js CI](https://github.com/the-dissidents/emmm/actions/workflows/node.js.yml/badge.svg)](https://github.com/the-dissidents/emmm/actions/workflows/node.js.yml)
3
+
4
+ > *Legible, simple, consistent and extensible*
5
+
6
+ A better markup language for typesetting articles.
@@ -0,0 +1,349 @@
1
+ declare class NameManager<T extends {
2
+ name: string;
3
+ }> {
4
+ private array;
5
+ private data;
6
+ constructor(from: NameManager<T> | undefined);
7
+ get(name: string): T | undefined;
8
+ has(name: string): boolean;
9
+ remove(name: string): void;
10
+ add(...elems: T[]): void;
11
+ find(predicate: (x: T) => boolean): T | undefined;
12
+ }
13
+
14
+ interface Scanner {
15
+ position(): number;
16
+ isEOF(): boolean;
17
+ peek(str: string): boolean;
18
+ accept(str: string): boolean;
19
+ acceptChar(): string;
20
+ acceptWhitespaceChar(): string | null;
21
+ acceptUntil(str: string): string | null;
22
+ }
23
+ declare enum MessageSeverity {
24
+ Info = 0,
25
+ Warning = 1,
26
+ Error = 2
27
+ }
28
+ type FixSuggestion = {
29
+ info: string;
30
+ apply(src: string, cursor: number): [out_src: string, new_cursor: number];
31
+ };
32
+ type Message = {
33
+ readonly severity: MessageSeverity;
34
+ readonly position: number;
35
+ readonly length: number;
36
+ readonly info: string;
37
+ readonly code: number;
38
+ readonly fixes: readonly FixSuggestion[];
39
+ };
40
+ type PositionRange = {
41
+ start: number;
42
+ end: number;
43
+ };
44
+ declare enum NodeType {
45
+ Root = 0,
46
+ Paragraph = 1,
47
+ Preformatted = 2,
48
+ Text = 3,
49
+ Escaped = 4,
50
+ SystemModifier = 5,
51
+ InlineModifier = 6,
52
+ BlockModifier = 7,
53
+ Interpolation = 8
54
+ }
55
+ type ParagraphNode = PositionRange & {
56
+ type: NodeType.Paragraph;
57
+ content: InlineEntity[];
58
+ };
59
+ type PreNode = PositionRange & {
60
+ type: NodeType.Preformatted;
61
+ content: PositionRange & {
62
+ text: string;
63
+ };
64
+ };
65
+ type TextNode = PositionRange & {
66
+ type: NodeType.Text;
67
+ content: string;
68
+ };
69
+ type EscapedNode = PositionRange & {
70
+ type: NodeType.Escaped;
71
+ content: string;
72
+ };
73
+ type SystemModifierNode<TState> = PositionRange & {
74
+ type: NodeType.SystemModifier;
75
+ mod: SystemModifierDefinition<TState>;
76
+ state?: TState;
77
+ head: PositionRange;
78
+ arguments: ModifierArgument[];
79
+ content: BlockEntity[];
80
+ expansion?: never[];
81
+ };
82
+ type BlockModifierNode<TState> = PositionRange & {
83
+ type: NodeType.BlockModifier;
84
+ mod: BlockModifierDefinition<TState>;
85
+ state?: TState;
86
+ head: PositionRange;
87
+ arguments: ModifierArgument[];
88
+ content: BlockEntity[];
89
+ expansion?: BlockEntity[];
90
+ };
91
+ type InlineModifierNode<TState> = PositionRange & {
92
+ type: NodeType.InlineModifier;
93
+ mod: InlineModifierDefinition<TState>;
94
+ state?: TState;
95
+ head: PositionRange;
96
+ arguments: ModifierArgument[];
97
+ content: InlineEntity[];
98
+ expansion?: InlineEntity[];
99
+ };
100
+ type RootNode = PositionRange & {
101
+ type: NodeType.Root;
102
+ content: BlockEntity[];
103
+ };
104
+ type ModifierNode = BlockModifierNode<any> | InlineModifierNode<any> | SystemModifierNode<any>;
105
+ type BlockEntity = ParagraphNode | PreNode | BlockModifierNode<any> | SystemModifierNode<any>;
106
+ type InlineEntity = TextNode | EscapedNode | InlineModifierNode<any> | SystemModifierNode<any>;
107
+ type DocumentNode = BlockEntity | InlineEntity | RootNode;
108
+ type InterpolationNode = PositionRange & {
109
+ type: NodeType.Interpolation;
110
+ definition: ArgumentInterpolatorDefinition;
111
+ arg: ModifierArgument;
112
+ };
113
+ type ModifierArgument = PositionRange & {
114
+ content: ArgumentEntity[];
115
+ };
116
+ type ArgumentEntity = TextNode | EscapedNode | InterpolationNode;
117
+ declare enum ModifierFlags {
118
+ Normal = 0,
119
+ /** Content is preformatted: no escaping, no inner tags */
120
+ Preformatted = 1,
121
+ /** No content slot */
122
+ Marker = 2
123
+ }
124
+ declare class ModifierBase<TNode, TEntity> {
125
+ readonly name: string;
126
+ readonly flags: ModifierFlags;
127
+ constructor(name: string, flags?: ModifierFlags, args?: Partial<ModifierBase<TNode, TEntity>>);
128
+ delayContentExpansion: boolean;
129
+ alwaysTryExpand: boolean;
130
+ beforeParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
131
+ afterParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
132
+ beforeProcessExpansion?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
133
+ afterProcessExpansion?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
134
+ prepareExpand?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
135
+ expand?: (node: TNode, cxt: ParseContext, immediate: boolean) => TEntity[] | undefined;
136
+ }
137
+ declare class BlockModifierDefinition<TState> extends ModifierBase<BlockModifierNode<TState>, BlockEntity> {
138
+ }
139
+ declare class InlineModifierDefinition<TState> extends ModifierBase<InlineModifierNode<TState>, InlineEntity> {
140
+ }
141
+ declare class SystemModifierDefinition<TState> extends ModifierBase<SystemModifierNode<TState>, never> {
142
+ }
143
+ declare class ArgumentInterpolatorDefinition {
144
+ readonly name: string;
145
+ readonly postfix: string;
146
+ expand: (content: string, cxt: ParseContext) => string;
147
+ constructor(name: string, postfix: string, expand: (content: string, cxt: ParseContext) => string);
148
+ }
149
+ type BlockInstantiationData = {
150
+ mod: BlockModifierDefinition<any>;
151
+ slotContent: BlockEntity[];
152
+ args: Map<string, string>;
153
+ };
154
+ type InlineInstantiationData = {
155
+ mod: InlineModifierDefinition<any>;
156
+ slotContent: InlineEntity[];
157
+ args: Map<string, string>;
158
+ };
159
+ interface ParseContextStoreDefinitions {
160
+ }
161
+ type ParseContextStoreKey = keyof ParseContextStoreDefinitions;
162
+ type ParseContextStoreEntry<S extends ParseContextStoreKey> = ParseContextStoreDefinitions[S];
163
+ declare class ParseContext {
164
+ #private;
165
+ config: Configuration;
166
+ variables: Map<string, string>;
167
+ private data;
168
+ constructor(config: Configuration, variables?: Map<string, string>);
169
+ init<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
170
+ set<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
171
+ get<S extends ParseContextStoreKey>(key: S): ParseContextStoreEntry<S>;
172
+ evaluateArgument(arg: ModifierArgument): string;
173
+ }
174
+ declare class Document {
175
+ root: RootNode;
176
+ context: ParseContext;
177
+ messages: Message[];
178
+ constructor(root: RootNode, context: ParseContext, messages: Message[]);
179
+ }
180
+ declare class Configuration {
181
+ initializers: ((cxt: ParseContext) => void)[];
182
+ blockModifiers: NameManager<BlockModifierDefinition<any>>;
183
+ inlineModifiers: NameManager<InlineModifierDefinition<any>>;
184
+ systemModifiers: NameManager<SystemModifierDefinition<any>>;
185
+ argumentInterpolators: NameManager<ArgumentInterpolatorDefinition>;
186
+ reparseDepthLimit: number;
187
+ constructor(from?: Configuration);
188
+ }
189
+
190
+ declare class SimpleScanner implements Scanner {
191
+ private src;
192
+ private pos;
193
+ constructor(src: string);
194
+ position(): number;
195
+ isEOF(): boolean;
196
+ peek(str: string): boolean;
197
+ acceptChar(): string;
198
+ accept(str: string): boolean;
199
+ acceptWhitespaceChar(): string | null;
200
+ acceptUntil(str: string): string | null;
201
+ }
202
+
203
+ declare function parse(scanner: Scanner, config: Configuration): Document;
204
+
205
+ declare class ReferredMessage implements Message {
206
+ readonly original: Message;
207
+ readonly position: number;
208
+ readonly length: number;
209
+ constructor(original: Message, position: number, length: number);
210
+ get severity(): MessageSeverity;
211
+ get info(): string;
212
+ get code(): number;
213
+ readonly fixes: readonly FixSuggestion[];
214
+ }
215
+ declare class AddThingMessage implements Message {
216
+ readonly code: number;
217
+ readonly severity: MessageSeverity;
218
+ readonly position: number;
219
+ readonly length: number;
220
+ readonly info: string;
221
+ private fixstr;
222
+ private what;
223
+ constructor(code: number, severity: MessageSeverity, position: number, length: number, info: string, fixstr: string, what: string);
224
+ get fixes(): readonly FixSuggestion[];
225
+ }
226
+ declare class RemoveThingMessage implements Message {
227
+ readonly code: number;
228
+ readonly severity: MessageSeverity;
229
+ readonly position: number;
230
+ readonly length: number;
231
+ readonly info: string;
232
+ private fixstr;
233
+ constructor(code: number, severity: MessageSeverity, position: number, length: number, info: string, fixstr: string);
234
+ get fixes(): readonly FixSuggestion[];
235
+ }
236
+ declare class ExpectedMessage implements Message {
237
+ readonly position: number;
238
+ private what;
239
+ constructor(position: number, what: string);
240
+ readonly code = 1;
241
+ readonly severity = MessageSeverity.Error;
242
+ get length(): number;
243
+ get info(): string;
244
+ get fixes(): readonly FixSuggestion[];
245
+ }
246
+ declare class UnknownModifierMessage implements Message {
247
+ readonly position: number;
248
+ readonly length: number;
249
+ constructor(position: number, length: number);
250
+ readonly code = 2;
251
+ readonly severity = MessageSeverity.Error;
252
+ readonly info = "unknown modifier; did you forget to escape it?";
253
+ get fixes(): readonly FixSuggestion[];
254
+ }
255
+ declare class UnclosedInlineModifierMessage implements Message {
256
+ readonly position: number;
257
+ private what;
258
+ constructor(position: number, what: string);
259
+ readonly code = 3;
260
+ readonly severity = MessageSeverity.Error;
261
+ readonly length = 0;
262
+ readonly fixes: readonly FixSuggestion[];
263
+ get info(): string;
264
+ }
265
+ declare class ArgumentsTooFewMessage implements Message {
266
+ readonly position: number;
267
+ readonly length: number;
268
+ private expected?;
269
+ constructor(position: number, length: number, expected?: number | undefined);
270
+ readonly code = 4;
271
+ readonly severity = MessageSeverity.Error;
272
+ readonly fixes: readonly FixSuggestion[];
273
+ get info(): string;
274
+ }
275
+ declare class ArgumentsTooManyMessage extends RemoveThingMessage {
276
+ constructor(pos: number, len: number, expected?: number);
277
+ }
278
+ declare class InvalidArgumentMessage implements Message {
279
+ readonly position: number;
280
+ readonly length: number;
281
+ private what?;
282
+ constructor(position: number, length: number, what?: string | undefined);
283
+ readonly code = 6;
284
+ readonly severity = MessageSeverity.Error;
285
+ readonly fixes: readonly FixSuggestion[];
286
+ get info(): string;
287
+ }
288
+ declare class InlineDefinitonInvalidEntityMessage implements Message {
289
+ readonly position: number;
290
+ readonly length: number;
291
+ constructor(position: number, length: number);
292
+ readonly code = 7;
293
+ readonly severity = MessageSeverity.Error;
294
+ readonly fixes: readonly FixSuggestion[];
295
+ get info(): string;
296
+ }
297
+ declare class ReachedRecursionLimitMessage implements Message {
298
+ readonly position: number;
299
+ readonly length: number;
300
+ private limit;
301
+ private what;
302
+ constructor(position: number, length: number, limit: number, what: string);
303
+ readonly code = 8;
304
+ readonly severity = MessageSeverity.Error;
305
+ readonly fixes: readonly FixSuggestion[];
306
+ get info(): string;
307
+ }
308
+ declare class SlotUsedOutsideDefinitionMessage implements Message {
309
+ readonly position: number;
310
+ readonly length: number;
311
+ constructor(position: number, length: number);
312
+ readonly code = 9;
313
+ readonly severity = MessageSeverity.Error;
314
+ readonly fixes: readonly FixSuggestion[];
315
+ get info(): string;
316
+ }
317
+ declare class UnnecessaryNewlineMessage extends RemoveThingMessage {
318
+ constructor(pos: number, len: number);
319
+ }
320
+ declare class NewBlockShouldBeOnNewlineMessage extends AddThingMessage {
321
+ constructor(pos: number);
322
+ }
323
+ declare class ContentShouldBeOnNewlineMessage extends AddThingMessage {
324
+ constructor(pos: number);
325
+ }
326
+ declare class NameAlreadyDefinedMessage implements Message {
327
+ readonly position: number;
328
+ readonly length: number;
329
+ private what;
330
+ constructor(position: number, length: number, what: string);
331
+ readonly code = 4;
332
+ readonly severity = MessageSeverity.Warning;
333
+ readonly fixes: readonly FixSuggestion[];
334
+ get info(): string;
335
+ }
336
+ declare class UndefinedVariableMessage implements Message {
337
+ readonly position: number;
338
+ readonly length: number;
339
+ private what;
340
+ constructor(position: number, length: number, what: string);
341
+ readonly code = 5;
342
+ readonly severity = MessageSeverity.Warning;
343
+ readonly fixes: readonly FixSuggestion[];
344
+ get info(): string;
345
+ }
346
+
347
+ declare const BuiltinConfiguration: Configuration;
348
+
349
+ export { type ArgumentEntity, ArgumentInterpolatorDefinition, ArgumentsTooFewMessage, ArgumentsTooManyMessage, type BlockEntity, type BlockInstantiationData, BlockModifierDefinition, type BlockModifierNode, BuiltinConfiguration, Configuration, ContentShouldBeOnNewlineMessage, Document, type DocumentNode, type EscapedNode, ExpectedMessage, type FixSuggestion, InlineDefinitonInvalidEntityMessage, type InlineEntity, type InlineInstantiationData, InlineModifierDefinition, type InlineModifierNode, type InterpolationNode, InvalidArgumentMessage, type Message, MessageSeverity, type ModifierArgument, ModifierFlags, type ModifierNode, NameAlreadyDefinedMessage, NewBlockShouldBeOnNewlineMessage, NodeType, type ParagraphNode, ParseContext, type ParseContextStoreDefinitions, type ParseContextStoreKey, type PositionRange, type PreNode, ReachedRecursionLimitMessage, ReferredMessage, type RootNode, type Scanner, SimpleScanner, SlotUsedOutsideDefinitionMessage, SystemModifierDefinition, type SystemModifierNode, type TextNode, UnclosedInlineModifierMessage, UndefinedVariableMessage, UnknownModifierMessage, UnnecessaryNewlineMessage, parse };
@@ -0,0 +1,349 @@
1
+ declare class NameManager<T extends {
2
+ name: string;
3
+ }> {
4
+ private array;
5
+ private data;
6
+ constructor(from: NameManager<T> | undefined);
7
+ get(name: string): T | undefined;
8
+ has(name: string): boolean;
9
+ remove(name: string): void;
10
+ add(...elems: T[]): void;
11
+ find(predicate: (x: T) => boolean): T | undefined;
12
+ }
13
+
14
+ interface Scanner {
15
+ position(): number;
16
+ isEOF(): boolean;
17
+ peek(str: string): boolean;
18
+ accept(str: string): boolean;
19
+ acceptChar(): string;
20
+ acceptWhitespaceChar(): string | null;
21
+ acceptUntil(str: string): string | null;
22
+ }
23
+ declare enum MessageSeverity {
24
+ Info = 0,
25
+ Warning = 1,
26
+ Error = 2
27
+ }
28
+ type FixSuggestion = {
29
+ info: string;
30
+ apply(src: string, cursor: number): [out_src: string, new_cursor: number];
31
+ };
32
+ type Message = {
33
+ readonly severity: MessageSeverity;
34
+ readonly position: number;
35
+ readonly length: number;
36
+ readonly info: string;
37
+ readonly code: number;
38
+ readonly fixes: readonly FixSuggestion[];
39
+ };
40
+ type PositionRange = {
41
+ start: number;
42
+ end: number;
43
+ };
44
+ declare enum NodeType {
45
+ Root = 0,
46
+ Paragraph = 1,
47
+ Preformatted = 2,
48
+ Text = 3,
49
+ Escaped = 4,
50
+ SystemModifier = 5,
51
+ InlineModifier = 6,
52
+ BlockModifier = 7,
53
+ Interpolation = 8
54
+ }
55
+ type ParagraphNode = PositionRange & {
56
+ type: NodeType.Paragraph;
57
+ content: InlineEntity[];
58
+ };
59
+ type PreNode = PositionRange & {
60
+ type: NodeType.Preformatted;
61
+ content: PositionRange & {
62
+ text: string;
63
+ };
64
+ };
65
+ type TextNode = PositionRange & {
66
+ type: NodeType.Text;
67
+ content: string;
68
+ };
69
+ type EscapedNode = PositionRange & {
70
+ type: NodeType.Escaped;
71
+ content: string;
72
+ };
73
+ type SystemModifierNode<TState> = PositionRange & {
74
+ type: NodeType.SystemModifier;
75
+ mod: SystemModifierDefinition<TState>;
76
+ state?: TState;
77
+ head: PositionRange;
78
+ arguments: ModifierArgument[];
79
+ content: BlockEntity[];
80
+ expansion?: never[];
81
+ };
82
+ type BlockModifierNode<TState> = PositionRange & {
83
+ type: NodeType.BlockModifier;
84
+ mod: BlockModifierDefinition<TState>;
85
+ state?: TState;
86
+ head: PositionRange;
87
+ arguments: ModifierArgument[];
88
+ content: BlockEntity[];
89
+ expansion?: BlockEntity[];
90
+ };
91
+ type InlineModifierNode<TState> = PositionRange & {
92
+ type: NodeType.InlineModifier;
93
+ mod: InlineModifierDefinition<TState>;
94
+ state?: TState;
95
+ head: PositionRange;
96
+ arguments: ModifierArgument[];
97
+ content: InlineEntity[];
98
+ expansion?: InlineEntity[];
99
+ };
100
+ type RootNode = PositionRange & {
101
+ type: NodeType.Root;
102
+ content: BlockEntity[];
103
+ };
104
+ type ModifierNode = BlockModifierNode<any> | InlineModifierNode<any> | SystemModifierNode<any>;
105
+ type BlockEntity = ParagraphNode | PreNode | BlockModifierNode<any> | SystemModifierNode<any>;
106
+ type InlineEntity = TextNode | EscapedNode | InlineModifierNode<any> | SystemModifierNode<any>;
107
+ type DocumentNode = BlockEntity | InlineEntity | RootNode;
108
+ type InterpolationNode = PositionRange & {
109
+ type: NodeType.Interpolation;
110
+ definition: ArgumentInterpolatorDefinition;
111
+ arg: ModifierArgument;
112
+ };
113
+ type ModifierArgument = PositionRange & {
114
+ content: ArgumentEntity[];
115
+ };
116
+ type ArgumentEntity = TextNode | EscapedNode | InterpolationNode;
117
+ declare enum ModifierFlags {
118
+ Normal = 0,
119
+ /** Content is preformatted: no escaping, no inner tags */
120
+ Preformatted = 1,
121
+ /** No content slot */
122
+ Marker = 2
123
+ }
124
+ declare class ModifierBase<TNode, TEntity> {
125
+ readonly name: string;
126
+ readonly flags: ModifierFlags;
127
+ constructor(name: string, flags?: ModifierFlags, args?: Partial<ModifierBase<TNode, TEntity>>);
128
+ delayContentExpansion: boolean;
129
+ alwaysTryExpand: boolean;
130
+ beforeParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
131
+ afterParseContent?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
132
+ beforeProcessExpansion?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
133
+ afterProcessExpansion?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
134
+ prepareExpand?: (node: TNode, cxt: ParseContext, immediate: boolean) => Message[];
135
+ expand?: (node: TNode, cxt: ParseContext, immediate: boolean) => TEntity[] | undefined;
136
+ }
137
+ declare class BlockModifierDefinition<TState> extends ModifierBase<BlockModifierNode<TState>, BlockEntity> {
138
+ }
139
+ declare class InlineModifierDefinition<TState> extends ModifierBase<InlineModifierNode<TState>, InlineEntity> {
140
+ }
141
+ declare class SystemModifierDefinition<TState> extends ModifierBase<SystemModifierNode<TState>, never> {
142
+ }
143
+ declare class ArgumentInterpolatorDefinition {
144
+ readonly name: string;
145
+ readonly postfix: string;
146
+ expand: (content: string, cxt: ParseContext) => string;
147
+ constructor(name: string, postfix: string, expand: (content: string, cxt: ParseContext) => string);
148
+ }
149
+ type BlockInstantiationData = {
150
+ mod: BlockModifierDefinition<any>;
151
+ slotContent: BlockEntity[];
152
+ args: Map<string, string>;
153
+ };
154
+ type InlineInstantiationData = {
155
+ mod: InlineModifierDefinition<any>;
156
+ slotContent: InlineEntity[];
157
+ args: Map<string, string>;
158
+ };
159
+ interface ParseContextStoreDefinitions {
160
+ }
161
+ type ParseContextStoreKey = keyof ParseContextStoreDefinitions;
162
+ type ParseContextStoreEntry<S extends ParseContextStoreKey> = ParseContextStoreDefinitions[S];
163
+ declare class ParseContext {
164
+ #private;
165
+ config: Configuration;
166
+ variables: Map<string, string>;
167
+ private data;
168
+ constructor(config: Configuration, variables?: Map<string, string>);
169
+ init<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
170
+ set<S extends ParseContextStoreKey>(key: S, obj: ParseContextStoreEntry<S>): void;
171
+ get<S extends ParseContextStoreKey>(key: S): ParseContextStoreEntry<S>;
172
+ evaluateArgument(arg: ModifierArgument): string;
173
+ }
174
+ declare class Document {
175
+ root: RootNode;
176
+ context: ParseContext;
177
+ messages: Message[];
178
+ constructor(root: RootNode, context: ParseContext, messages: Message[]);
179
+ }
180
+ declare class Configuration {
181
+ initializers: ((cxt: ParseContext) => void)[];
182
+ blockModifiers: NameManager<BlockModifierDefinition<any>>;
183
+ inlineModifiers: NameManager<InlineModifierDefinition<any>>;
184
+ systemModifiers: NameManager<SystemModifierDefinition<any>>;
185
+ argumentInterpolators: NameManager<ArgumentInterpolatorDefinition>;
186
+ reparseDepthLimit: number;
187
+ constructor(from?: Configuration);
188
+ }
189
+
190
+ declare class SimpleScanner implements Scanner {
191
+ private src;
192
+ private pos;
193
+ constructor(src: string);
194
+ position(): number;
195
+ isEOF(): boolean;
196
+ peek(str: string): boolean;
197
+ acceptChar(): string;
198
+ accept(str: string): boolean;
199
+ acceptWhitespaceChar(): string | null;
200
+ acceptUntil(str: string): string | null;
201
+ }
202
+
203
+ declare function parse(scanner: Scanner, config: Configuration): Document;
204
+
205
+ declare class ReferredMessage implements Message {
206
+ readonly original: Message;
207
+ readonly position: number;
208
+ readonly length: number;
209
+ constructor(original: Message, position: number, length: number);
210
+ get severity(): MessageSeverity;
211
+ get info(): string;
212
+ get code(): number;
213
+ readonly fixes: readonly FixSuggestion[];
214
+ }
215
+ declare class AddThingMessage implements Message {
216
+ readonly code: number;
217
+ readonly severity: MessageSeverity;
218
+ readonly position: number;
219
+ readonly length: number;
220
+ readonly info: string;
221
+ private fixstr;
222
+ private what;
223
+ constructor(code: number, severity: MessageSeverity, position: number, length: number, info: string, fixstr: string, what: string);
224
+ get fixes(): readonly FixSuggestion[];
225
+ }
226
+ declare class RemoveThingMessage implements Message {
227
+ readonly code: number;
228
+ readonly severity: MessageSeverity;
229
+ readonly position: number;
230
+ readonly length: number;
231
+ readonly info: string;
232
+ private fixstr;
233
+ constructor(code: number, severity: MessageSeverity, position: number, length: number, info: string, fixstr: string);
234
+ get fixes(): readonly FixSuggestion[];
235
+ }
236
+ declare class ExpectedMessage implements Message {
237
+ readonly position: number;
238
+ private what;
239
+ constructor(position: number, what: string);
240
+ readonly code = 1;
241
+ readonly severity = MessageSeverity.Error;
242
+ get length(): number;
243
+ get info(): string;
244
+ get fixes(): readonly FixSuggestion[];
245
+ }
246
+ declare class UnknownModifierMessage implements Message {
247
+ readonly position: number;
248
+ readonly length: number;
249
+ constructor(position: number, length: number);
250
+ readonly code = 2;
251
+ readonly severity = MessageSeverity.Error;
252
+ readonly info = "unknown modifier; did you forget to escape it?";
253
+ get fixes(): readonly FixSuggestion[];
254
+ }
255
+ declare class UnclosedInlineModifierMessage implements Message {
256
+ readonly position: number;
257
+ private what;
258
+ constructor(position: number, what: string);
259
+ readonly code = 3;
260
+ readonly severity = MessageSeverity.Error;
261
+ readonly length = 0;
262
+ readonly fixes: readonly FixSuggestion[];
263
+ get info(): string;
264
+ }
265
+ declare class ArgumentsTooFewMessage implements Message {
266
+ readonly position: number;
267
+ readonly length: number;
268
+ private expected?;
269
+ constructor(position: number, length: number, expected?: number | undefined);
270
+ readonly code = 4;
271
+ readonly severity = MessageSeverity.Error;
272
+ readonly fixes: readonly FixSuggestion[];
273
+ get info(): string;
274
+ }
275
+ declare class ArgumentsTooManyMessage extends RemoveThingMessage {
276
+ constructor(pos: number, len: number, expected?: number);
277
+ }
278
+ declare class InvalidArgumentMessage implements Message {
279
+ readonly position: number;
280
+ readonly length: number;
281
+ private what?;
282
+ constructor(position: number, length: number, what?: string | undefined);
283
+ readonly code = 6;
284
+ readonly severity = MessageSeverity.Error;
285
+ readonly fixes: readonly FixSuggestion[];
286
+ get info(): string;
287
+ }
288
+ declare class InlineDefinitonInvalidEntityMessage implements Message {
289
+ readonly position: number;
290
+ readonly length: number;
291
+ constructor(position: number, length: number);
292
+ readonly code = 7;
293
+ readonly severity = MessageSeverity.Error;
294
+ readonly fixes: readonly FixSuggestion[];
295
+ get info(): string;
296
+ }
297
+ declare class ReachedRecursionLimitMessage implements Message {
298
+ readonly position: number;
299
+ readonly length: number;
300
+ private limit;
301
+ private what;
302
+ constructor(position: number, length: number, limit: number, what: string);
303
+ readonly code = 8;
304
+ readonly severity = MessageSeverity.Error;
305
+ readonly fixes: readonly FixSuggestion[];
306
+ get info(): string;
307
+ }
308
+ declare class SlotUsedOutsideDefinitionMessage implements Message {
309
+ readonly position: number;
310
+ readonly length: number;
311
+ constructor(position: number, length: number);
312
+ readonly code = 9;
313
+ readonly severity = MessageSeverity.Error;
314
+ readonly fixes: readonly FixSuggestion[];
315
+ get info(): string;
316
+ }
317
+ declare class UnnecessaryNewlineMessage extends RemoveThingMessage {
318
+ constructor(pos: number, len: number);
319
+ }
320
+ declare class NewBlockShouldBeOnNewlineMessage extends AddThingMessage {
321
+ constructor(pos: number);
322
+ }
323
+ declare class ContentShouldBeOnNewlineMessage extends AddThingMessage {
324
+ constructor(pos: number);
325
+ }
326
+ declare class NameAlreadyDefinedMessage implements Message {
327
+ readonly position: number;
328
+ readonly length: number;
329
+ private what;
330
+ constructor(position: number, length: number, what: string);
331
+ readonly code = 4;
332
+ readonly severity = MessageSeverity.Warning;
333
+ readonly fixes: readonly FixSuggestion[];
334
+ get info(): string;
335
+ }
336
+ declare class UndefinedVariableMessage implements Message {
337
+ readonly position: number;
338
+ readonly length: number;
339
+ private what;
340
+ constructor(position: number, length: number, what: string);
341
+ readonly code = 5;
342
+ readonly severity = MessageSeverity.Warning;
343
+ readonly fixes: readonly FixSuggestion[];
344
+ get info(): string;
345
+ }
346
+
347
+ declare const BuiltinConfiguration: Configuration;
348
+
349
+ export { type ArgumentEntity, ArgumentInterpolatorDefinition, ArgumentsTooFewMessage, ArgumentsTooManyMessage, type BlockEntity, type BlockInstantiationData, BlockModifierDefinition, type BlockModifierNode, BuiltinConfiguration, Configuration, ContentShouldBeOnNewlineMessage, Document, type DocumentNode, type EscapedNode, ExpectedMessage, type FixSuggestion, InlineDefinitonInvalidEntityMessage, type InlineEntity, type InlineInstantiationData, InlineModifierDefinition, type InlineModifierNode, type InterpolationNode, InvalidArgumentMessage, type Message, MessageSeverity, type ModifierArgument, ModifierFlags, type ModifierNode, NameAlreadyDefinedMessage, NewBlockShouldBeOnNewlineMessage, NodeType, type ParagraphNode, ParseContext, type ParseContextStoreDefinitions, type ParseContextStoreKey, type PositionRange, type PreNode, ReachedRecursionLimitMessage, ReferredMessage, type RootNode, type Scanner, SimpleScanner, SlotUsedOutsideDefinitionMessage, SystemModifierDefinition, type SystemModifierNode, type TextNode, UnclosedInlineModifierMessage, UndefinedVariableMessage, UnknownModifierMessage, UnnecessaryNewlineMessage, parse };