Class: CodeRay::Scanners::JavaScript

Inherits:
Scanner show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/coderay-1.1.3/lib/coderay/scanners/java_script.rb

Overview

Scanner for JavaScript.

Aliases: ecmascript, ecma_script, javascript

Constant Summary collapse

KEYWORDS =

The actual JavaScript keywords.

%w[
  break case catch continue default delete do else
  finally for function if in instanceof new
  return switch throw try typeof var void while with
]
PREDEFINED_CONSTANTS =

:nodoc:

%w[
  false null true undefined NaN Infinity
]
MAGIC_VARIABLES =

:nodoc:

%w[ this arguments ]
KEYWORDS_EXPECTING_VALUE =

:nodoc: arguments was introduced in JavaScript 1.4

WordList.new.add %w[
  case delete in instanceof new return throw typeof with
]
RESERVED_WORDS =

Reserved for future use.

%w[
  abstract boolean byte char class debugger double enum export extends
  final float goto implements import int interface long native package
  private protected public short static super synchronized throws transient
  volatile
]
IDENT_KIND =

:nodoc:

WordList.new(:ident).
add(RESERVED_WORDS, :reserved).
add(PREDEFINED_CONSTANTS, :predefined_constant).
add(MAGIC_VARIABLES, :local_variable).
add(KEYWORDS, :keyword)
ESCAPE =

:nodoc:

/ [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
UNICODE_ESCAPE =

:nodoc:

/ u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
REGEXP_ESCAPE =

:nodoc:

/ [bBdDsSwW] /x
STRING_CONTENT_PATTERN =
{
  "'" => /[^\\']+/,
  '"' => /[^\\"]+/,
  '/' => /[^\\\/]+/,
}
KEY_CHECK_PATTERN =

:nodoc:

{
  "'" => / (?> [^\\']* (?: \\. [^\\']* )* ) ' \s* : /mx,
  '"' => / (?> [^\\"]* (?: \\. [^\\"]* )* ) " \s* : /mx,
}

Constants inherited from Scanner

Scanner::DEFAULT_OPTIONS, Scanner::KINDS_NOT_LOC, Scanner::ScanError

Instance Attribute Summary

Attributes inherited from Scanner

#state

Attributes included from Plugin

#plugin_id

Method Summary

Methods inherited from Scanner

#binary_string, #column, #each, encoding, file_extension, #file_extension, #initialize, #lang, lang, #line, normalize, #reset, #string=, #tokenize, #tokens

Methods included from Plugin

#aliases, #plugin_host, #register_for, #title

Methods included from Enumerable

#as_json, #compact_blank, #exclude?, #excluding, #in_order_of, #including, #index_by, #index_with, #many?, #maximum, #minimum, #pick, #pluck, #sole, #sum

Constructor Details

This class inherits a constructor from CodeRay::Scanners::Scanner