Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Apr 7, 2022
1 parent 5650244 commit 4f9bcd3
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/yaml-cst-parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ export function parseAllDocsToCST(ctx: Context): {
// prettyErrors: false,
})
const cstNodes: CST.Token[] = []
const nodes = Array.from(
composer.compose(
(function* () {
for (const cst of parser.parse(ctx.code)) {
cstNodes.push(cst)
yield cst
}
})(),
),
)
for (const doc of nodes) {
const nodes: Document.Parsed[] = []

for (const doc of composer.compose(
(function* () {
for (const cst of parser.parse(ctx.code)) {
cstNodes.push(cst)
yield cst
}
})(),
)) {
for (const error of doc.errors) {
throw ctx.throwError(error.message, error.pos[0])
}
// ignore warns
// for (const error of doc.warnings) {
// throw ctx.throwError(error.message, error.pos[0])
// }
nodes.push(doc)
}

return { cstNodes, nodes }
Expand Down

0 comments on commit 4f9bcd3

Please sign in to comment.