lib/rouge/lexers/cpp.rb in rouge-1.10.1 vs lib/rouge/lexers/cpp.rb in rouge-1.11.0

- old
+ new

@@ -22,21 +22,30 @@ @keywords ||= super + Set.new(%w( asm catch const_cast delete dynamic_cast explicit export friend mutable namespace new operator private protected public reinterpret_cast restrict static_cast template this throw throws typeid typename using virtual + + alignas alignof constexpr decltype noexcept static_assert + thread_local try )) end + def self.keywords_type + @keywords_type ||= super + Set.new(%w( + bool + )) + end + def self.reserved @reserved ||= super + Set.new(%w( __virtual_inheritance __uuidof __super __single_inheritance __multiple_inheritance __interface __event )) end - id = /[a-zA-Z_][a-zA-Z0-9]*/ + id = /[a-zA-Z_][a-zA-Z0-9_]*/ prepend :root do # Offload C++ extensions, http://offload.codeplay.com/ rule /(?:__offload|__blockingoffload|__outer)\b/, Keyword::Pseudo end @@ -50,9 +59,11 @@ rule %r((#{dq}[.]#{dq}?|[.]#{dq})(e[+-]?#{dq}[lu]*)?)i, Num::Float rule %r(#{dq}e[+-]?#{dq}[lu]*)i, Num::Float rule /0x\h('?\h)*[lu]*/i, Num::Hex rule /0[0-7]('?[0-7])*[lu]*/i, Num::Oct rule /#{dq}[lu]*/i, Num::Integer + rule /\bnullptr\b/, Name::Builtin + rule /(?:u8|u|U|L)?R"([a-zA-Z0-9_{}\[\]#<>%:;.?*\+\-\/\^&|~!=,"']{,16})\(.*?\)\1"/m, Str end state :classname do rule id, Name::Class, :pop!