module Rouge module Lexers class Javascript < RegexLexer desc "JavaScript, the browser scripting language" tag 'javascript' aliases 'js' filenames '*.js' mimetypes 'application/javascript', 'application/x-javascript', 'text/javascript', 'text/x-javascript' def self.analyze_text(text) return 1 if text.shebang?('node') return 1 if text.shebang?('jsc') # TODO: rhino, spidermonkey, etc end state :comments_and_whitespace do rule /\s+/, 'Text' rule /