lib/rouge/lexers/perl.rb in rouge-3.20.0 vs lib/rouge/lexers/perl.rb in rouge-3.21.0

- old
+ new

@@ -63,11 +63,11 @@ rule %r(%(\\[\\%]|[^%])*%[egimosx]*), re_tok, :pop! rule %r(\$(\\[\\\$]|[^\$])*\$[egimosx]*), re_tok, :pop! end state :root do - rule %r/#.*?$/, Comment::Single + rule %r/#.*/, Comment::Single rule %r/^=[a-zA-Z0-9]+\s+.*?\n=cut/m, Comment::Multiline rule %r/(?:#{keywords.join('|')})\b/, Keyword rule %r/(format)(\s+)([a-zA-Z0-9_]+)(\s*)(=)(\s*\n)/ do groups Keyword, Text, Name, Text, Punctuation, Text @@ -97,10 +97,13 @@ rule %r(((?<==~)|(?<=\())\s*/(\\\\|\\/|[^/])*/[msixpodualngc]*), re_tok, :balanced_regex rule %r/\s+/, Text + + rule(/(?=[a-z_]\w*(\s*#.*\n)*\s*=>)/i) { push :fat_comma } + rule %r/(?:#{builtins.join('|')})\b/, Name::Builtin rule %r/((__(DIE|WARN)__)|(DATA|STD(IN|OUT|ERR)))\b/, Name::Builtin::Pseudo rule %r/<<([\'"]?)([a-zA-Z_][a-zA-Z0-9_]*)\1;?\n.*?\n\2\n/m, Str @@ -140,10 +143,17 @@ state :format do rule %r/\.\n/, Str::Interpol, :pop! rule %r/.*?\n/, Str::Interpol end + state :fat_comma do + rule %r/#.*/, Comment::Single + rule %r/\w+/, Str + rule %r/\s+/, Text + rule %r/=>/, Operator, :pop! + end + state :name_common do rule %r/\w+::/, Name::Namespace rule %r/[\w:]+/, Name::Variable, :pop! end @@ -176,19 +186,27 @@ rule %r/.*?{/, Punctuation, :pop! rule %r/;/, Punctuation, :pop! end state :sq do - rule %r/\\[']/, Str::Escape + rule %r/\\[\\']/, Str::Escape rule %r/[^\\']+/, Str::Single rule %r/'/, Punctuation, :pop! + rule %r/\\/, Str::Single end state :dq do mixin :string_intp - rule %r/\\[\\tnr"]/, Str::Escape + rule %r/\\[\\tnrabefluLUE"$@]/, Str::Escape + rule %r/\\0\d{2}/, Str::Escape + rule %r/\\o\{\d+\}/, Str::Escape + rule %r/\\x\h{2}/, Str::Escape + rule %r/\\x\{\h+\}/, Str::Escape + rule %r/\\c./, Str::Escape + rule %r/\\N\{[^\}]+\}/, Str::Escape rule %r/[^\\"]+?/, Str::Double rule %r/"/, Punctuation, :pop! + rule %r/\\/, Str::Escape end state :bq do mixin :string_intp rule %r/\\[\\tnr`]/, Str::Escape