lib/rouge/lexers/java.rb in rouge-2.0.1 vs lib/rouge/lexers/java.rb in rouge-2.0.2
- old
+ new
@@ -54,15 +54,23 @@
rule /"(\\\\|\\"|[^"])*"/, Str
rule /'(?:\\.|[^\\]|\\u[0-9a-f]{4})'/, Str::Char
rule /(\.)(#{id})/ do
groups Operator, Name::Attribute
end
+
rule /#{id}:/, Name::Label
rule /\$?#{id}/, Name
rule /[~^*!%&\[\](){}<>\|+=:;,.\/?-]/, Operator
- rule /[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?/, Num::Float
- rule /0x[0-9a-f]+/, Num::Hex
- rule /[0-9]+L?/, Num::Integer
+
+ digit = /[0-9]_+[0-9]|[0-9]/
+ bin_digit = /[01]_+[01]|[01]/
+ oct_digit = /[0-7]_+[0-7]|[0-7]/
+ hex_digit = /[0-9a-f]_+[0-9a-f]|[0-9a-f]/i
+ rule /#{digit}+\.#{digit}+([eE]#{digit}+)?[fd]?/, Num::Float
+ rule /0b#{bin_digit}+/i, Num::Bin
+ rule /0x#{hex_digit}+/i, Num::Hex
+ rule /0#{oct_digit}+/, Num::Oct
+ rule /#{digit}+L?/, Num::Integer
rule /\n/, Text
end
state :class do
rule /\s+/m, Text