MCPcopy Create free account
hub / github.com/Effect-TS/effect / parseQuotedValue

Method parseQuotedValue

packages/effect/src/encoding/Yaml.ts:1334–1362  ·  view source on GitHub ↗
(value: string, parentIndent: number)

Source from the content-addressed store, hash-verified

1332 }
1333
1334 private parseQuotedValue(value: string, parentIndent: number): unknown {
1335 const quote = value[0]
1336 let output = quote
1337 let line = value.slice(1)
1338 while (true) {
1339 const end = closingQuote(line, quote, 0)
1340 if (end !== -1) {
1341 const rest = line.slice(end + 1)
1342 if (!isSeparationOnly(rest) && !/^[ \t]+#/.test(rest)) {
1343 throw new SyntaxError("Unexpected content after quoted YAML scalar")
1344 }
1345 return parseScalar(output + line.slice(0, end + 1))
1346 }
1347 if (quote === "\"" && endsWithEscape(line)) {
1348 output += line.slice(0, -1)
1349 } else {
1350 const blankLines = this.skipBlankLines()
1351 this.rejectTabIndentedBlankLines(blankLines, parentIndent)
1352 output += trimFoldedEnd(line, quote) + foldLineBreak(blankLines)
1353 }
1354 const next = this.lineAt(this.index++)
1355 if (next === undefined) throw new SyntaxError("Unterminated quoted YAML scalar")
1356 this.rejectTabIndent(next)
1357 if (!isSeparationOnly(next.raw) && next.indent <= parentIndent) {
1358 this.fail(next, "Invalid quoted scalar indentation")
1359 }
1360 line = trimWhiteStart(next.raw)
1361 }
1362 }
1363
1364 private parseBlockScalar(indicator: string, parentIndent: number): string {
1365 const style = indicator[0]

Callers 1

parseValueMethod · 0.95

Calls 13

skipBlankLinesMethod · 0.95
lineAtMethod · 0.95
rejectTabIndentMethod · 0.95
failMethod · 0.95
closingQuoteFunction · 0.85
isSeparationOnlyFunction · 0.85
parseScalarFunction · 0.85
endsWithEscapeFunction · 0.85
trimFoldedEndFunction · 0.85
foldLineBreakFunction · 0.85
trimWhiteStartFunction · 0.85

Tested by

no test coverage detected