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
builtins()
click to toggle source
# File lib/rouge/lexers/javascript.rb, line 124 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 window navigator self global Promise Set Map WeakSet WeakMap Symbol Proxy Reflect Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Uint16ClampedArray Int32Array Uint32Array Uint32ClampedArray Float32Array Float64Array DataView ArrayBuffer ) end
constants()
click to toggle source
# File lib/rouge/lexers/javascript.rb, line 120 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 106 def self.declarations @declarations ||= Set.new %w( var let const with function class extends constructor get set static ) end
detect?(text)
click to toggle source
# File lib/rouge/lexers/javascript.rb, line 21 def self.detect?(text) return 1 if text.shebang?('node') return 1 if text.shebang?('jsc') # TODO: rhino, spidermonkey, etc end
id_regex()
click to toggle source
# File lib/rouge/lexers/javascript.rb, line 139 def self.id_regex /[$a-z_][a-z0-9_]*/io end
keywords()
click to toggle source
# File lib/rouge/lexers/javascript.rb, line 98 def self.keywords @keywords ||= Set.new %w( as async await break case catch continue debugger default delete do else export finally from for if import in instanceof new of return super switch this throw try typeof void while yield ) end
reserved()
click to toggle source
# File lib/rouge/lexers/javascript.rb, line 113 def self.reserved @reserved ||= Set.new %w( enum implements interface package private protected public ) end