class Rouge::Lexers::Javascript

IMPORTANT NOTICE:

Please do not copy this lexer and open a pull request for a new language. It will not get merged, you will be unhappy, and kittens will cry.

Public Class Methods

analyze_text(text) click to toggle source
# File lib/rouge/lexers/javascript.rb, line 20
def self.analyze_text(text)
  return 1 if text.shebang?('node')
  return 1 if text.shebang?('jsc')
  # TODO: rhino, spidermonkey, etc
end
builtins() click to toggle source
# File lib/rouge/lexers/javascript.rb, line 116
def self.builtins
  @builtins ||= %w(
    Array Boolean Date Error Function Math netscape
    Number Object Packages RegExp String sun decodeURI
    decodeURIComponent encodeURI encodeURIComponent
    Error eval isFinite isNaN parseFloat parseInt document this
    window
  )
end
constants() click to toggle source
# File lib/rouge/lexers/javascript.rb, line 112
def self.constants
  @constants ||= Set.new %w(true false null NaN Infinity undefined)
end
declarations() click to toggle source
# File lib/rouge/lexers/javascript.rb, line 99
def self.declarations
  @declarations ||= Set.new %w(var let with function)
end
keywords() click to toggle source
# File lib/rouge/lexers/javascript.rb, line 91
def self.keywords
  @keywords ||= Set.new %w(
    for in while do break return continue switch case default
    if else throw try catch finally new delete typeof instanceof
    void this yield
  )
end
reserved() click to toggle source
# File lib/rouge/lexers/javascript.rb, line 103
def self.reserved
  @reserved ||= Set.new %w(
    abstract boolean byte char class const 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
  )
end