class Parser::Lexer
def source_buffer=(source_buffer)
def source_buffer=(source_buffer) @source_buffer = source_buffer if @source_buffer source = @source_buffer.source # Force UTF8 unpacking even if JS works with UTF-16/UCS-2 # See: https://mathiasbynens.be/notes/javascript-encoding @source_pts = source.unpack('U*') else @source_pts = nil end # Since parser v3.2.1 Parser::Lexer has @strings if @strings @strings.source_buffer = @source_buffer @strings.source_pts = @source_pts end end