Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

96
Views
llparse peek() characters with multiple code points

I'm trying to modify llhttp, an HTTP client based on llparse, to support NTRIP (an HTTP-based protocol). To do so, I need to peek '\u{D3}' (match but not consume) and perform a test, otherwise start a span.

The problem is peek() only works with a single character and '\u{D3}' counts as 2 ('\u{C3}\u{93}'). How would I peek multiple characters or re-prepend the first character?

Here is what I had:

n('header_field_start') // Match node
  .match('\r', n('headers_almost_done'))
  .peek('\n', n('headers_almost_done'))
  .peek(
    '\u{D3}', // 2 characters
    this.testLenientFlags(
      LENIENT_FLAGS.NTRIP, 
      {
        1: this.invokePausable('on_chunk_complete', ERROR.CB_CHUNK_COMPLETE, 'message_done') // If NTRIP is set
      },
      p.error(ERROR.INVALID_VERSION, 'Invalid major version') // Otherwise
    )
  )
  .otherwise(span.headerField.start(n('header_field')));

// Defined earlier...
private testLenientFlags(flag: LENIENT_FLAGS, map: { [key: number]: Node }, next?: string | Node): Node {
  const p = this.llparse;
  const res = p.invoke(p.code.test('lenient_flags', flag), map);
  if (next !== undefined) {
    res.otherwise(this.node(next));
  }
  return res;
}
almost 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!