util.d.ts
2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { Document } from './index'
import { CST } from './parse-cst'
import { AST, Pair, Scalar, Schema } from './types'
export function findPair(items: any[], key: Scalar | any): Pair | undefined
export function parseMap(doc: Document, cst: CST.Map): AST.BlockMap
export function parseMap(doc: Document, cst: CST.FlowMap): AST.FlowMap
export function parseSeq(doc: Document, cst: CST.Seq): AST.BlockSeq
export function parseSeq(doc: Document, cst: CST.FlowSeq): AST.FlowSeq
export function stringifyNumber(item: Scalar): string
export function stringifyString(
item: Scalar,
ctx: Schema.StringifyContext,
onComment?: () => void,
onChompKeep?: () => void
): string
export function toJSON(
value: any,
arg?: any,
ctx?: Schema.CreateNodeContext
): any
export enum Type {
ALIAS = 'ALIAS',
BLANK_LINE = 'BLANK_LINE',
BLOCK_FOLDED = 'BLOCK_FOLDED',
BLOCK_LITERAL = 'BLOCK_LITERAL',
COMMENT = 'COMMENT',
DIRECTIVE = 'DIRECTIVE',
DOCUMENT = 'DOCUMENT',
FLOW_MAP = 'FLOW_MAP',
FLOW_SEQ = 'FLOW_SEQ',
MAP = 'MAP',
MAP_KEY = 'MAP_KEY',
MAP_VALUE = 'MAP_VALUE',
PLAIN = 'PLAIN',
QUOTE_DOUBLE = 'QUOTE_DOUBLE',
QUOTE_SINGLE = 'QUOTE_SINGLE',
SEQ = 'SEQ',
SEQ_ITEM = 'SEQ_ITEM'
}
interface LinePos {
line: number
col: number
}
export class YAMLError extends Error {
name:
| 'YAMLReferenceError'
| 'YAMLSemanticError'
| 'YAMLSyntaxError'
| 'YAMLWarning'
message: string
source?: CST.Node
nodeType?: Type
range?: CST.Range
linePos?: { start: LinePos; end: LinePos }
/**
* Drops `source` and adds `nodeType`, `range` and `linePos`, as well as
* adding details to `message`. Run automatically for document errors if
* the `prettyErrors` option is set.
*/
makePretty(): void
}
export class YAMLReferenceError extends YAMLError {
name: 'YAMLReferenceError'
}
export class YAMLSemanticError extends YAMLError {
name: 'YAMLSemanticError'
}
export class YAMLSyntaxError extends YAMLError {
name: 'YAMLSyntaxError'
}
export class YAMLWarning extends YAMLError {
name: 'YAMLWarning'
}