aboutsummaryrefslogtreecommitdiff
path: root/node_modules/yaml/dist/parse/parser.d.ts
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-06-04 08:51:01 +0200
committerMinteck <contact@minteck.org>2022-06-04 08:51:01 +0200
commit383285ecd5292bf9a825e05904955b937de84cc9 (patch)
tree0a53b6f02c1604b078044567c03dc1b6c944c8c2 /node_modules/yaml/dist/parse/parser.d.ts
downloadequestriadb-383285ecd5292bf9a825e05904955b937de84cc9.tar.gz
equestriadb-383285ecd5292bf9a825e05904955b937de84cc9.tar.bz2
equestriadb-383285ecd5292bf9a825e05904955b937de84cc9.zip
Initial commit
Diffstat (limited to 'node_modules/yaml/dist/parse/parser.d.ts')
-rw-r--r--node_modules/yaml/dist/parse/parser.d.ts84
1 files changed, 84 insertions, 0 deletions
diff --git a/node_modules/yaml/dist/parse/parser.d.ts b/node_modules/yaml/dist/parse/parser.d.ts
new file mode 100644
index 0000000..8f3159f
--- /dev/null
+++ b/node_modules/yaml/dist/parse/parser.d.ts
@@ -0,0 +1,84 @@
+import { Token } from './cst.js';
+/**
+ * A YAML concrete syntax tree (CST) parser
+ *
+ * ```ts
+ * const src: string = ...
+ * for (const token of new Parser().parse(src)) {
+ * // token: Token
+ * }
+ * ```
+ *
+ * To use the parser with a user-provided lexer:
+ *
+ * ```ts
+ * function* parse(source: string, lexer: Lexer) {
+ * const parser = new Parser()
+ * for (const lexeme of lexer.lex(source))
+ * yield* parser.next(lexeme)
+ * yield* parser.end()
+ * }
+ *
+ * const src: string = ...
+ * const lexer = new Lexer()
+ * for (const token of parse(src, lexer)) {
+ * // token: Token
+ * }
+ * ```
+ */
+export declare class Parser {
+ private onNewLine?;
+ /** If true, space and sequence indicators count as indentation */
+ private atNewLine;
+ /** If true, next token is a scalar value */
+ private atScalar;
+ /** Current indentation level */
+ private indent;
+ /** Current offset since the start of parsing */
+ offset: number;
+ /** On the same line with a block map key */
+ private onKeyLine;
+ /** Top indicates the node that's currently being built */
+ stack: Token[];
+ /** The source of the current token, set in parse() */
+ private source;
+ /** The type of the current token, set in parse() */
+ private type;
+ /**
+ * @param onNewLine - If defined, called separately with the start position of
+ * each new line (in `parse()`, including the start of input).
+ */
+ constructor(onNewLine?: (offset: number) => void);
+ /**
+ * Parse `source` as a YAML stream.
+ * If `incomplete`, a part of the last line may be left as a buffer for the next call.
+ *
+ * Errors are not thrown, but yielded as `{ type: 'error', message }` tokens.
+ *
+ * @returns A generator of tokens representing each directive, document, and other structure.
+ */
+ parse(source: string, incomplete?: boolean): Generator<Token, void, unknown>;
+ /**
+ * Advance the parser by the `source` of one lexical token.
+ */
+ next(source: string): Generator<Token, void, unknown>;
+ private lexer;
+ /** Call at end of input to push out any remaining constructions */
+ end(): Generator<Token, void, unknown>;
+ private get sourceToken();
+ private step;
+ private peek;
+ private pop;
+ private stream;
+ private document;
+ private scalar;
+ private blockScalar;
+ private blockMap;
+ private blockSequence;
+ private flowCollection;
+ private flowScalar;
+ private startBlockValue;
+ private atIndentedComment;
+ private documentEnd;
+ private lineEnd;
+}