lib/rouge/lexers/perl.rb in rouge-3.2.0 vs lib/rouge/lexers/perl.rb in rouge-3.2.1

- old
+ new

@@ -75,24 +75,28 @@ end rule /(?:eq|lt|gt|le|ge|ne|not|and|or|cmp)\b/, Operator::Word # common delimiters - rule %r(s/(\\\\|\\/|[^/])*/(\\\\|\\/|[^/])*/[egimosx]*), re_tok - rule %r(s!(\\\\|\\!|[^!])*!(\\\\|\\!|[^!])*![egimosx]*), re_tok - rule %r(s\\(\\\\|[^\\])*\\(\\\\|[^\\])*\\[egimosx]*), re_tok - rule %r(s@(\\\\|\\@|[^@])*@(\\\\|\\@|[^@])*@[egimosx]*), re_tok - rule %r(s%(\\\\|\\%|[^%])*%(\\\\|\\%|[^%])*%[egimosx]*), re_tok + rule %r(s/(\\\\|\\/|[^/])*/(\\\\|\\/|[^/])*/[msixpodualngc]*), re_tok + rule %r(s!(\\\\|\\!|[^!])*!(\\\\|\\!|[^!])*![msixpodualngc]*), re_tok + rule %r(s\\(\\\\|[^\\])*\\(\\\\|[^\\])*\\[msixpodualngc]*), re_tok + rule %r(s@(\\\\|\\@|[^@])*@(\\\\|\\@|[^@])*@[msixpodualngc]*), re_tok + rule %r(s%(\\\\|\\%|[^%])*%(\\\\|\\%|[^%])*%[msixpodualngc]*), re_tok # balanced delimiters rule %r(s{(\\\\|\\}|[^}])*}\s*), re_tok, :balanced_regex rule %r(s<(\\\\|\\>|[^>])*>\s*), re_tok, :balanced_regex rule %r(s\[(\\\\|\\\]|[^\]])*\]\s*), re_tok, :balanced_regex rule %r[s\((\\\\|\\\)|[^\)])*\)\s*], re_tok, :balanced_regex - rule %r(m?/(\\\\|\\/|[^/\n])*/[gcimosx]*), re_tok + rule %r(m?/(\\\\|\\/|[^/\n])*/[msixpodualngc]*), re_tok rule %r(m(?=[/!\\{<\[\(@%\$])), re_tok, :balanced_regex - rule %r(((?<==~)|(?<=\())\s*/(\\\\|\\/|[^/])*/[gcimosx]*), + + # Perl allows any non-whitespace character to delimit + # a regex when `m` is used. + rule %r(m(\S).*\1[msixpodualngc]*), re_tok + rule %r(((?<==~)|(?<=\())\s*/(\\\\|\\/|[^/])*/[msixpodualngc]*), re_tok, :balanced_regex rule /\s+/, Text rule /(?:#{builtins.join('|')})\b/, Name::Builtin rule /((__(DATA|DIE|WARN)__)|(STD(IN|OUT|ERR)))\b/,