Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by veqq

4 days ago

Of course. You can do it in a single pass/just parse the token stream. There are various implementations like: https://zserge.com/jsmn/

2 comments

veqq

Reply

andrepd  4 days ago

It requires manual allocation of an array of tokens. So it needs a backing "stack vector" of sorts.

And what about escapes?

  • int_19h  3 days 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.

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities