mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Disambiguate .r extension between Rebol and R
This commit is contained in:
@@ -28,6 +28,9 @@ module Linguist
|
|||||||
if languages.all? { |l| ["Common Lisp", "OpenCL"].include?(l) }
|
if languages.all? { |l| ["Common Lisp", "OpenCL"].include?(l) }
|
||||||
disambiguate_cl(data, languages)
|
disambiguate_cl(data, languages)
|
||||||
end
|
end
|
||||||
|
if languages.all? { |l| ["Rebol", "R"].include?(l) }
|
||||||
|
disambiguate_r(data, languages)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -73,6 +76,13 @@ module Linguist
|
|||||||
matches
|
matches
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.disambiguate_r(data, languages)
|
||||||
|
matches = []
|
||||||
|
matches << Language["Rebol"] if /\bRebol\b/i.match(data)
|
||||||
|
matches << Language["R"] if data.include?("<-")
|
||||||
|
matches
|
||||||
|
end
|
||||||
|
|
||||||
def self.active?
|
def self.active?
|
||||||
!!ACTIVE
|
!!ACTIVE
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user