class Rouge::Lexers::Javascript
be unhappy, and kittens will cry.
for a new language. It will not get merged, you will
Please do not copy this lexer and open a pull request
IMPORTANT NOTICE:
def self.analyze_text(text)
def self.analyze_text(text) return 1 if text.shebang?('node') return 1 if text.shebang?('jsc') # TODO: rhino, spidermonkey, etc end
def self.builtins
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
def self.constants
def self.constants @constants ||= Set.new %w(true false null NaN Infinity undefined) end
def self.declarations
def self.declarations @declarations ||= Set.new %w( var let const with function class extends constructor get set ) end
def self.id_regex
def self.id_regex /[$a-z_][a-z0-9_]*/io end
def self.keywords
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
def self.reserved
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