mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
More regex goodness to improve the detection of C++ vs C
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user