Skip to content
10 changes: 4 additions & 6 deletions lib/coderay/scanners/java_script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ class JavaScript < Scanner
add(KEYWORDS, :keyword) # :nodoc:

ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc:
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc:
REGEXP_ESCAPE = / [bBdDsSwW] /x # :nodoc:
STRING_CONTENT_PATTERN = {
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc:
REGEXP_ESCAPE = / [bBdDsSwW] /x # :nodoc:
STRING_CONTENT_PATTERN = {
Comment thread
korny marked this conversation as resolved.
Comment thread
korny marked this conversation as resolved.
Comment thread
korny marked this conversation as resolved.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Operator = should be surrounded by a single space. (https://rubystyle.guide#spaces-operators)

"'" => /[^\\']+/,
'"' => /[^\\"]+/,
'/' => /[^\\\/]+/,
'/' => %r{ (?: [^\\/\[]+ | \[ ([^\]\\]+ | \\.)* \]? )+ }mx,
} # :nodoc:
KEY_CHECK_PATTERN = {
"'" => / (?> [^\\']* (?: \\. [^\\']* )* ) ' \s* : /mx,
Expand Down Expand Up @@ -219,8 +219,6 @@ def scan_tokens encoder, options
encoder
end

protected

def reset_instance
super
@xml_scanner.reset if defined? @xml_scanner
Expand Down