import { Parser } from "https://deno.land/x/windmill@v1.64.0/node_modules/yaml/dist/parse/parser.d.ts";
A YAML concrete syntax tree (CST) parser
const src: string = ...
for (const token of new Parser().parse(src)) {
// token: Token
}
To use the parser with a user-provided lexer:
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
}
Properties
stack: Token[]
Top indicates the node that's currently being built
Methods
Advance the parser by the source
of one lexical token.