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

81
Views
Nearley Postprocessing is removing valid whitespaces

New to Nearley grammar, not sure what is going wrong here. Here is my grammar to get whatever is placed inside an opening and closing parenthesis.

@builtin "whitespace.ne"

with_in_brackets ->
    "(" _ args _ ")" {% d => ({
      type: 'inside_brackets',
      argumentstring: d[2]
    })%}
    
args -> .:* {% d => d[0].join("") %}
  • Test Input - (hello, " ", world)
  • Expected Result - {type: "inside_brackets", argumentstring: "hello, " ", world"}
  • Actual Result - {type: "inside_brackets", argumentstring: "hello, " ", world"}

Notice - the actual result is compacting 4 whitespaces to 1 whitespace. Not sure why this is happening.

Any thoughts? FYI - I am using Nearley Playground to test my grammer on Safari v15 browser.

about 4 years ago · Juan Pablo Isaza
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!