Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
veqq
8mo ago
0 comments
Save
Share
Of course. You can do it in a single pass/just parse the token stream. There are various implementations like:
https://zserge.com/jsmn/
0 comments
2 comments · 1 top-level
top
newest
oldest
andrepd
8mo ago
· 1 in thread
It requires manual allocation of an array of tokens. So it needs a backing "stack vector" of sorts.
And what about escapes?
int_19h
8mo ago
For escapes you can mutate the raw buffer with data in place, since a single escape always expands to fewer characters than the escape itself.
j
/
k
navigate · click thread line to collapse