mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Merge pull request #1627 from github/1036-local
Disambiguate C, C++, Objective-C
This commit is contained in:
@@ -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"]
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user