1 | import type { Document } from './Document.js';
|
---|
2 | export declare class Directives {
|
---|
3 | static defaultYaml: Directives['yaml'];
|
---|
4 | static defaultTags: Directives['tags'];
|
---|
5 | yaml: {
|
---|
6 | version: '1.1' | '1.2' | 'next';
|
---|
7 | explicit?: boolean;
|
---|
8 | };
|
---|
9 | tags: Record<string, string>;
|
---|
10 | /**
|
---|
11 | * The directives-end/doc-start marker `---`. If `null`, a marker may still be
|
---|
12 | * included in the document's stringified representation.
|
---|
13 | */
|
---|
14 | docStart: true | null;
|
---|
15 | /** The doc-end marker `...`. */
|
---|
16 | docEnd: boolean;
|
---|
17 | /**
|
---|
18 | * Used when parsing YAML 1.1, where:
|
---|
19 | * > If the document specifies no directives, it is parsed using the same
|
---|
20 | * > settings as the previous document. If the document does specify any
|
---|
21 | * > directives, all directives of previous documents, if any, are ignored.
|
---|
22 | */
|
---|
23 | private atNextDocument?;
|
---|
24 | constructor(yaml?: Directives['yaml'], tags?: Directives['tags']);
|
---|
25 | clone(): Directives;
|
---|
26 | /**
|
---|
27 | * During parsing, get a Directives instance for the current document and
|
---|
28 | * update the stream state according to the current version's spec.
|
---|
29 | */
|
---|
30 | atDocument(): Directives;
|
---|
31 | /**
|
---|
32 | * @param onError - May be called even if the action was successful
|
---|
33 | * @returns `true` on success
|
---|
34 | */
|
---|
35 | add(line: string, onError: (offset: number, message: string, warning?: boolean) => void): boolean;
|
---|
36 | /**
|
---|
37 | * Resolves a tag, matching handles to those defined in %TAG directives.
|
---|
38 | *
|
---|
39 | * @returns Resolved tag, which may also be the non-specific tag `'!'` or a
|
---|
40 | * `'!local'` tag, or `null` if unresolvable.
|
---|
41 | */
|
---|
42 | tagName(source: string, onError: (message: string) => void): string | null;
|
---|
43 | /**
|
---|
44 | * Given a fully resolved tag, returns its printable string form,
|
---|
45 | * taking into account current tag prefixes and defaults.
|
---|
46 | */
|
---|
47 | tagString(tag: string): string;
|
---|
48 | toString(doc?: Document): string;
|
---|
49 | }
|
---|