1 | export { createScalarToken, resolveAsScalar, setScalarValue } from './cst-scalar';
|
2 | export { stringify } from './cst-stringify';
|
3 | export type { Visitor, VisitPath } from './cst-visit';
|
4 | export { visit } from './cst-visit';
|
5 | export interface SourceToken {
|
6 | type: 'byte-order-mark' | 'doc-mode' | 'doc-start' | 'space' | 'comment' | 'newline' | 'directive-line' | 'anchor' | 'tag' | 'seq-item-ind' | 'explicit-key-ind' | 'map-value-ind' | 'flow-map-start' | 'flow-map-end' | 'flow-seq-start' | 'flow-seq-end' | 'flow-error-end' | 'comma' | 'block-scalar-header';
|
7 | offset: number;
|
8 | indent: number;
|
9 | source: string;
|
10 | }
|
11 | export interface ErrorToken {
|
12 | type: 'error';
|
13 | offset: number;
|
14 | source: string;
|
15 | message: string;
|
16 | }
|
17 | export interface Directive {
|
18 | type: 'directive';
|
19 | offset: number;
|
20 | source: string;
|
21 | }
|
22 | export interface Document {
|
23 | type: 'document';
|
24 | offset: number;
|
25 | start: SourceToken[];
|
26 | value?: Token;
|
27 | end?: SourceToken[];
|
28 | }
|
29 | export interface DocumentEnd {
|
30 | type: 'doc-end';
|
31 | offset: number;
|
32 | source: string;
|
33 | end?: SourceToken[];
|
34 | }
|
35 | export interface FlowScalar {
|
36 | type: 'alias' | 'scalar' | 'single-quoted-scalar' | 'double-quoted-scalar';
|
37 | offset: number;
|
38 | indent: number;
|
39 | source: string;
|
40 | end?: SourceToken[];
|
41 | }
|
42 | export interface BlockScalar {
|
43 | type: 'block-scalar';
|
44 | offset: number;
|
45 | indent: number;
|
46 | props: Token[];
|
47 | source: string;
|
48 | }
|
49 | export interface BlockMap {
|
50 | type: 'block-map';
|
51 | offset: number;
|
52 | indent: number;
|
53 | items: Array<{
|
54 | start: SourceToken[];
|
55 | explicitKey?: true;
|
56 | key?: never;
|
57 | sep?: never;
|
58 | value?: never;
|
59 | } | {
|
60 | start: SourceToken[];
|
61 | explicitKey?: true;
|
62 | key: Token | null;
|
63 | sep: SourceToken[];
|
64 | value?: Token;
|
65 | }>;
|
66 | }
|
67 | export interface BlockSequence {
|
68 | type: 'block-seq';
|
69 | offset: number;
|
70 | indent: number;
|
71 | items: Array<{
|
72 | start: SourceToken[];
|
73 | key?: never;
|
74 | sep?: never;
|
75 | value?: Token;
|
76 | }>;
|
77 | }
|
78 | export type CollectionItem = {
|
79 | start: SourceToken[];
|
80 | key?: Token | null;
|
81 | sep?: SourceToken[];
|
82 | value?: Token;
|
83 | };
|
84 | export interface FlowCollection {
|
85 | type: 'flow-collection';
|
86 | offset: number;
|
87 | indent: number;
|
88 | start: SourceToken;
|
89 | items: CollectionItem[];
|
90 | end: SourceToken[];
|
91 | }
|
92 | export type Token = SourceToken | ErrorToken | Directive | Document | DocumentEnd | FlowScalar | BlockScalar | BlockMap | BlockSequence | FlowCollection;
|
93 | export type TokenType = SourceToken['type'] | DocumentEnd['type'] | FlowScalar['type'];
|
94 |
|
95 | export declare const BOM = "\uFEFF";
|
96 |
|
97 | export declare const DOCUMENT = "\u0002";
|
98 |
|
99 | export declare const FLOW_END = "\u0018";
|
100 |
|
101 | export declare const SCALAR = "\u001F";
|
102 |
|
103 | export declare const isCollection: (token: Token | null | undefined) => token is BlockMap | BlockSequence | FlowCollection;
|
104 |
|
105 | export declare const isScalar: (token: Token | null | undefined) => token is FlowScalar | BlockScalar;
|
106 |
|
107 | export declare function prettyToken(token: string): string;
|
108 |
|
109 | export declare function tokenType(source: string): TokenType | null;
|