lib/rouge/lexers/perl.rb in rouge-3.24.0 vs lib/rouge/lexers/perl.rb in rouge-3.25.0
- old
+ new
@@ -108,13 +108,14 @@
rule %r/<<([\'"]?)([a-zA-Z_][a-zA-Z0-9_]*)\1;?\n.*?\n\2\n/m, Str
rule %r/(__(END|DATA)__)\b/, Comment::Preproc, :end_part
rule %r/\$\^[ADEFHILMOPSTWX]/, Name::Variable::Global
- rule %r/\$[\\"'\[\]&`+*.,;=%~?@$!<>(^\|\/-](?!\w)/, Name::Variable::Global
+ rule %r/\$[\\"'\[\]&`+*.,;=%~?@$!<>(^\|\/_-](?!\w)/, Name::Variable::Global
+ rule %r/[$@%&*][$@%&*#_]*(?=[a-z{\[;])/i, Name::Variable, :varname
+
rule %r/[-+\/*%=<>&^\|!\\~]=?/, Operator
- rule %r/[$@%#]+/, Name::Variable, :varname
rule %r/0_?[0-7]+(_[0-7]+)*/, Num::Oct
rule %r/0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*/, Num::Hex
rule %r/0b[01]+(_[01]+)*/, Num::Bin
rule %r/(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?/i,
@@ -157,11 +158,12 @@
rule %r/[\w:]+/, Name::Variable, :pop!
end
state :varname do
rule %r/\s+/, Text
- rule %r/\{/, Punctuation, :pop! # hash syntax
- rule %r/\)|,/, Punctuation, :pop! # arg specifier
+ rule %r/[{\[]/, Punctuation, :pop! # hash syntax
+ rule %r/[),]/, Punctuation, :pop! # arg specifier
+ rule %r/[;]/, Punctuation, :pop! # postfix
mixin :name_common
end
state :name do
mixin :name_common