More regex goodness to improve the detection of C++ vs C

This commit is contained in:
DX-MON
2014-04-02 19:48:44 +01:00
parent cb10c53dee
commit 5c071a2e07

View File

@@ -39,8 +39,9 @@ module Linguist
matches = []
if (/@(interface|class|protocol|synchronised|selector|implementation)/.match(data))
matches << Language["Objective-C"]
elsif (/^\s*#\s*include <(cstdint|string|vector|map|list|array|bitset|queue|stack|forward_list|unordered_map|unordered_set)>/.match(data) or
/template\s*</.match(data) or /[^@]class/.match(data))
end
if (/^\s*#\s*include <(cstdint|string|vector|map|list|array|bitset|queue|stack|forward_list|unordered_map|unordered_set)>/.match(data) or
/^\s*template\s*</.match(data) or /[^@]class\s+\w+/.match(data) or /^[^@](private|public|protected):$/.match(data))
matches << Language["C++"]
end
matches