mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Found out that nothing was ever getting returned from the heuristic function "find_by_heuristics", and that headers matching C, Obj-C and C++ were never getting checked heuristically
This commit is contained in:
@@ -12,23 +12,25 @@ module Linguist
|
|||||||
#
|
#
|
||||||
# Returns an array of Languages or []
|
# Returns an array of Languages or []
|
||||||
def self.find_by_heuristics(data, languages)
|
def self.find_by_heuristics(data, languages)
|
||||||
|
matches = []
|
||||||
if active?
|
if active?
|
||||||
if languages.all? { |l| ["Objective-C", "C++"].include?(l) }
|
if languages.all? { |l| ["Objective-C", "C++", "C"].include?(l) }
|
||||||
disambiguate_c(data, languages)
|
matches = disambiguate_c(data, languages)
|
||||||
end
|
end
|
||||||
if languages.all? { |l| ["Perl", "Prolog"].include?(l) }
|
if languages.all? { |l| ["Perl", "Prolog"].include?(l) }
|
||||||
disambiguate_pl(data, languages)
|
matches = disambiguate_pl(data, languages)
|
||||||
end
|
end
|
||||||
if languages.all? { |l| ["ECL", "Prolog"].include?(l) }
|
if languages.all? { |l| ["ECL", "Prolog"].include?(l) }
|
||||||
disambiguate_ecl(data, languages)
|
matches = disambiguate_ecl(data, languages)
|
||||||
end
|
end
|
||||||
if languages.all? { |l| ["TypeScript", "XML"].include?(l) }
|
if languages.all? { |l| ["TypeScript", "XML"].include?(l) }
|
||||||
disambiguate_ts(data, languages)
|
matches = disambiguate_ts(data, languages)
|
||||||
end
|
end
|
||||||
if languages.all? { |l| ["Common Lisp", "OpenCL"].include?(l) }
|
if languages.all? { |l| ["Common Lisp", "OpenCL"].include?(l) }
|
||||||
disambiguate_cl(data, languages)
|
matches = disambiguate_cl(data, languages)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
matches
|
||||||
end
|
end
|
||||||
|
|
||||||
# .h extensions are ambigious between C, C++, and Objective-C.
|
# .h extensions are ambigious between C, C++, and Objective-C.
|
||||||
|
|||||||
Reference in New Issue
Block a user