MCPcopy
hub / github.com/braziljs/eloquente-javascript / parseStr

Function parseStr

src/pseudo_json.mjs:72–84  ·  view source on GitHub ↗
(stream)

Source from the content-addressed store, hash-verified

70}
71
72function parseStr(stream) {
73 let start = stream.pos
74 stream.pos++
75 for (let escaped = false;;) {
76 let next = stream.next
77 stream.pos++
78 if (next == 34 && !escaped) break
79 else if (isNaN(next)) stream.err("Unterminated string")
80 escaped = next == 92
81 }
82 stream.space()
83 return JSON.parse(stream.str.slice(start, stream.pos))
84}
85
86function parseWord(stream, prop) {
87 let start = stream.pos

Callers 1

parseValueFunction · 0.85

Calls 4

errMethod · 0.80
spaceMethod · 0.80
parseMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected