Merge pull request #1627 from github/1036-local

Disambiguate C, C++, Objective-C
This commit is contained in:
Arfon Smith
2014-11-28 18:05:16 -06:00
15 changed files with 1606 additions and 3 deletions

View File

@@ -61,6 +61,15 @@ module Linguist
@heuristic.call(data)
end
disambiguate "Objective-C", "C++", "C" do |data|
if (/@(interface|class|protocol|property|end|synchronised|selector|implementation)\b/.match(data))
Language["Objective-C"]
elsif (/^\s*#\s*include <(cstdint|string|vector|map|list|array|bitset|queue|stack|forward_list|unordered_map|unordered_set|(i|o|io)stream)>/.match(data) ||
/^\s*template\s*</.match(data) || /^[^@]class\s+\w+/.match(data) || /^[^@](private|public|protected):$/.match(data) || /std::.+$/.match(data))
Language["C++"]
end
end
disambiguate "Perl", "Prolog" do |data|
if data.include?("use strict")
Language["Perl"]

View File

@@ -308,6 +308,8 @@ C:
color: "#555"
extensions:
- .c
- .C
- .H
- .cats
- .h
- .idc
@@ -335,9 +337,6 @@ C++:
- cpp
extensions:
- .cpp
- .C
- .CPP
- .H
- .c++
- .cc
- .cxx