lib/linguist/heuristics.rb in github-linguist-4.2.3 vs lib/linguist/heuristics.rb in github-linguist-4.2.5

- old
+ new

@@ -59,10 +59,18 @@ # Internal: Perform the heuristic def call(data) @heuristic.call(data) end + disambiguate "BitBake", "BlitzBasic" do |data| + if /^\s*; /.match(data) || data.include?("End Function") + Language["BlitzBasic"] + elsif /^\s*(# |include|require)\b/.match(data) + Language["BitBake"] + end + 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)) @@ -127,11 +135,11 @@ end disambiguate "FORTRAN", "Forth" do |data| if /^: /.match(data) Language["Forth"] - elsif /^([c*][^a-z]| subroutine\s)/i.match(data) + elsif /^([c*][^a-z]| (subroutine|program)\s|!)/i.match(data) Language["FORTRAN"] end end disambiguate "F#", "Forth", "GLSL" do |data| @@ -154,7 +162,24 @@ else Language["LiveScript"] end end + disambiguate "TypeScript", "XML" do |data| + if data.include?("<TS ") + Language["XML"] + else + Language["TypeScript"] + end + 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) + Language["Frege"] + else + Language["Text"] + end + end end end