In the specific corner case where a regex contains a flag but is not followed by any symbols, the ast.RegExpLiteral.Literal value would drop (part of) that flag.
This happens because the p.next() call during the parsing of the flag wouldn't actually advance the p.chrOffset, and thus endOffset would be erroneously adjusted.
The fix is just to use the current p.chrOffset and then call p.next() afterwards.
In the specific corner case where a regex contains a flag but is not followed by any symbols, the
ast.RegExpLiteral.Literal
value would drop (part of) that flag.This happens because the
p.next()
call during the parsing of the flag wouldn't actually advance thep.chrOffset
, and thusendOffset
would be erroneously adjusted.The fix is just to use the current
p.chrOffset
and then callp.next()
afterwards.