You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.7 KiB
77 lines
1.7 KiB
3 years ago
|
import { CST } from './parse-cst'
|
||
|
import { Pair, Scalar, Schema } from './types'
|
||
|
|
||
|
export function findPair(items: any[], key: Scalar | any): Pair | undefined
|
||
|
|
||
|
export function stringifyNumber(item: Scalar): string
|
||
|
export function stringifyString(
|
||
|
item: Scalar,
|
||
|
ctx: Schema.StringifyContext,
|
||
|
onComment?: () => void,
|
||
|
onChompKeep?: () => void
|
||
|
): string
|
||
|
|
||
|
export function toJS(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'
|
||
|
}
|