jviereck / regjsparser

Parsing the JavaScript's RegExp in JavaScript.
http://www.julianviereck.de/regjsparser/
BSD 2-Clause "Simplified" License
79 stars 20 forks source link

bug: optional forward lookahead #130

Closed domdomegg closed 1 year ago

domdomegg commented 1 year ago

In JavaScript, the following regex is valid:

/(?=a)?/

However, it is rejected by regjsparser (SyntaxError: Expected atom at position 5).

I think an optional forward lookahead is a little pointless, but it seems to be used. For example, this appears in the wild in ua-parser-js: https://github.com/faisalman/ua-parser-js/blob/3c3c03ceeba9920437533dcf1d72276acac091a3/src/ua-parser.js#L464

jviereck commented 1 year ago

Thank you for reporting this issue. I will take a look over the weekend.

jviereck commented 1 year ago

Created CR #131.

jviereck commented 1 year ago

Fixed and release 0.10.0 published to npm.