we (web engine): Experimental web browser project to understand the limits of Claude

js: lex `/` after control-flow header `)` as regex literal (isu issue 361) master

The lexer's regex-vs-division heuristic treated any `/` following a `)` as division, but `)` closing an `if`/`for`/`while`/`with` header is followed by statement/expression-start position, where `/` begins a RegularExpressionLiteral. This rejected valid Next.js chunks like `for(let t of x)/didomi/gi.test(t)`. Track per-`(` whether it opens a control-flow header (guarding against property-name keywords such as `obj.for(...)`), and on the matching `)` mark it as not ending an expression so the following `/` lexes as a regex. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>


+133 -1
3 changed files