class Rouge::Lexers::Javascript
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 this window ) 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 with function) end
def self.keywords
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 ) end
def self.reserved
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