lib/rouge/lexers/javascript.rb in rouge-0.0.14 vs lib/rouge/lexers/javascript.rb in rouge-0.1.0.rc1
- old
+ new
@@ -29,11 +29,11 @@
| [^/\\\n] # regular characters
| \[ (\\. | [^\]\\\n])* \] # character classes
)+
/ # closing slash
(?:[gim]+\b|\B) # flags
- )x, 'Literal.String.Regex'
+ )x, 'Literal.String.Regex', :pop!
# if it's not matched by the above r.e., it's not
# a valid expression, so we use :bad_regex to eat until the
# end of the line.
rule %r(/), 'Literal.String.Regex', :bad_regex
@@ -68,10 +68,10 @@
window
).join('|')
state :root do
rule /\A\s*#!.*?\n/m, 'Comment.Preproc'
- rule %r(^(?=\s|/|<!--)), 'Text', :slash_starts_regex
+ rule %r((?<=\n)(?=\s|/|<!--)), 'Text', :slash_starts_regex
mixin :comments_and_whitespace
rule %r(\+\+ | -- | ~ | && | \|\| | \\(?=\n) | << | >>>? | ===
| !== | \? | : )x,
'Operator', :slash_starts_regex
rule %r([-<>+*%&|\^/!=]=?), 'Operator', :slash_starts_regex