lib/linguist/heuristics.rb in github-linguist-4.2.6 vs lib/linguist/heuristics.rb in github-linguist-4.2.7

- old
+ new

@@ -67,10 +67,18 @@ elsif /^\s*(# |include|require)\b/.match(data) Language["BitBake"] end end + disambiguate "C#", "Smalltalk" do |data| + if /![\w\s]+methodsFor: /.match(data) + Language["Smalltalk"] + elsif /^\s*namespace\s*[\w\.]+\s*{/.match(data) || /^\s*\/\//.match(data) + Language["C#"] + end + end + disambiguate "Objective-C", "C++", "C" do |data| if (/^[ \t]*@(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) || /^[ \t]*try/.match(data) || /^[ \t]*catch\s*\(/.match(data) || /^[ \t]*(class|(using[ \t]+)?namespace)\s+\w+/.match(data) || /^[ \t]*(private|public|protected):$/.match(data) || /std::\w+/.match(data)) @@ -173,10 +181,10 @@ end disambiguate "Frege", "Forth", "Text" do |data| if /^(: |also |new-device|previous )/.match(data) Language["Forth"] - elsif /\s*(import|module|package|data|type) /.match(data) + elsif /^\s*(import|module|package|data|type) /.match(data) Language["Frege"] else Language["Text"] end end