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 126 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 122 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 105 def self.declarations @declarations ||= Set.new %w( var let const with function class extends constructor get set ) end
id_regex()
click to toggle source
# File lib/rouge/lexers/javascript.rb, line 141 def self.id_regex /[$a-z_][a-z0-9_]*/io end
keywords()
click to toggle source
# File lib/rouge/lexers/javascript.rb, line 97 def self.keywords @keywords ||= Set.new %w( for in of while do break return continue switch case default if else throw try catch finally new delete typeof instanceof void this yield import export from as async super this ) end
reserved()
click to toggle source
# File lib/rouge/lexers/javascript.rb, line 112 def self.reserved @reserved ||= Set.new %w( abstract boolean byte char debugger double enum final float goto implements int interface long native package private protected public short static synchronized throws transient volatile eval arguments await ) end