lib/rouge/lexers/cpp.rb in rouge-3.7.0 vs lib/rouge/lexers/cpp.rb in rouge-3.8.0
- old
+ new
@@ -15,11 +15,11 @@
filenames '*.cpp', '*.hpp',
'*.c++', '*.h++',
'*.cc', '*.hh',
'*.cxx', '*.hxx',
'*.pde', '*.ino',
- '*.tpp'
+ '*.tpp', '*.h'
mimetypes 'text/x-c++hdr', 'text/x-c++src'
def self.keywords
@keywords ||= super + Set.new(%w(
asm auto catch const_cast delete dynamic_cast explicit export
@@ -56,13 +56,15 @@
# see www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf
dq = /\d('?\d)*/
prepend :statements do
rule %r/class\b/, Keyword, :classname
+ rule %r/\d+(\.\d+)?(?:h|(?:min)|s|(?:ms)|(?:us)|(?:ns))/, Num::Other
rule %r((#{dq}[.]#{dq}?|[.]#{dq})(e[+-]?#{dq}[lu]*)?)i, Num::Float
rule %r(#{dq}e[+-]?#{dq}[lu]*)i, Num::Float
rule %r/0x\h('?\h)*[lu]*/i, Num::Hex
+ rule %r/0b[01]+(?:_[01]+)*/, Num::Bin
rule %r/0[0-7]('?[0-7])*[lu]*/i, Num::Oct
rule %r/#{dq}[lu]*/i, Num::Integer
rule %r/\bnullptr\b/, Name::Builtin
rule %r/(?:u8|u|U|L)?R"([a-zA-Z0-9_{}\[\]#<>%:;.?*\+\-\/\^&|~!=,"']{,16})\(.*?\)\1"/m, Str
end
@@ -70,9 +72,10 @@
state :classname do
rule id, Name::Class, :pop!
# template specification
rule %r/\s*(?=>)/m, Text, :pop!
+ rule %r/[.]{3}/, Operator
mixin :whitespace
end
end
end
end