1
0
Fork 0
mirror of https://github.com/dawidd6/action-ansible-playbook.git synced 2024-11-27 02:27:11 +00:00
action-ansible-playbook/node_modules/yaml/dist/compose/composer.d.ts

63 lines
2.6 KiB
TypeScript
Raw Normal View History

2022-10-21 14:44:44 +00:00
import { Directives } from '../doc/directives.js';
import { Document } from '../doc/Document.js';
import { ErrorCode, YAMLParseError, YAMLWarning } from '../errors.js';
2024-01-17 09:08:10 +00:00
import type { ParsedNode, Range } from '../nodes/Node.js';
2022-10-21 14:44:44 +00:00
import type { DocumentOptions, ParseOptions, SchemaOptions } from '../options.js';
import type { Token } from '../parse/cst.js';
2024-01-17 09:08:10 +00:00
type ErrorSource = number | [number, number] | Range | {
2022-10-21 14:44:44 +00:00
offset: number;
source?: string;
};
2024-01-17 09:08:10 +00:00
export type ComposeErrorHandler = (source: ErrorSource, code: ErrorCode, message: string, warning?: boolean) => void;
2022-10-21 14:44:44 +00:00
/**
* Compose a stream of CST nodes into a stream of YAML Documents.
*
* ```ts
* import { Composer, Parser } from 'yaml'
*
* const src: string = ...
* const tokens = new Parser().parse(src)
* const docs = new Composer().compose(tokens)
* ```
*/
2024-01-17 09:08:10 +00:00
export declare class Composer<Contents extends ParsedNode = ParsedNode, Strict extends boolean = true> {
2022-10-21 14:44:44 +00:00
private directives;
private doc;
private options;
private atDirectives;
private prelude;
private errors;
private warnings;
constructor(options?: ParseOptions & DocumentOptions & SchemaOptions);
private onError;
private decorate;
/**
* Current stream status information.
*
* Mostly useful at the end of input for an empty stream.
*/
streamInfo(): {
comment: string;
directives: Directives;
errors: YAMLParseError[];
warnings: YAMLWarning[];
};
/**
* Compose tokens into documents.
*
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
*/
2024-01-17 09:08:10 +00:00
compose(tokens: Iterable<Token>, forceDoc?: boolean, endOffset?: number): Generator<Document.Parsed<Contents, Strict>, void, unknown>;
2022-10-21 14:44:44 +00:00
/** Advance the composer by one CST token. */
2024-01-17 09:08:10 +00:00
next(token: Token): Generator<Document.Parsed<Contents, Strict>, void, unknown>;
2022-10-21 14:44:44 +00:00
/**
* Call at end of input to yield any remaining document.
*
* @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.
* @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.
*/
2024-01-17 09:08:10 +00:00
end(forceDoc?: boolean, endOffset?: number): Generator<Document.Parsed<Contents, Strict>, void, unknown>;
2022-10-21 14:44:44 +00:00
}
export {};