lib/rouge/lexers/javascript.rb in rouge-1.11.0 vs lib/rouge/lexers/javascript.rb in rouge-1.11.1
- old
+ new
@@ -1,9 +1,15 @@
# -*- coding: utf-8 -*- #
module Rouge
module Lexers
+ # 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.
+ #
class Javascript < RegexLexer
title "JavaScript"
desc "JavaScript, the browser scripting language"
tag 'javascript'
@@ -31,11 +37,14 @@
rule %r(/) do
token Str::Regex
goto :regex
end
- rule /[{]/, Punctuation, :object
+ rule /[{]/ do
+ token Punctuation
+ goto :object
+ end
rule //, Text, :pop!
end
state :regex do
@@ -175,9 +184,15 @@
end
# object literals
state :object do
mixin :comments_and_whitespace
+
+ rule /[{]/ do
+ token Punctuation
+ push
+ end
+
rule /[}]/ do
token Punctuation
goto :statement
end