Improved the C++ heuristic for detecting based on included headers

This commit is contained in:
Rachel Mant
2014-04-02 12:55:29 +01:00
parent f39456ee47
commit fd585beb07

View File

@@ -38,7 +38,8 @@ module Linguist
def self.disambiguate_c(data, languages)
matches = []
matches << Language["Objective-C"] if data.include?("@interface")
matches << Language["C++"] if data.include?("#include <cstdint>")
if (/^\s*#\s*include <(cstdint|string|vector|map|list|array|bitset|queue|stack|forward_list|unordered_map|unordered_set)>$/.match(data))
matches << Language["C++"]
matches
end