mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Add F# and GLSL samples. Add Forth and GLSL extension .fs.
Add heuristic to disambiguate between F#, Forth, and GLSL.
This commit is contained in:
@@ -39,6 +39,9 @@ module Linguist
|
||||
if languages.all? { |l| ["FORTRAN", "Forth"].include?(l) }
|
||||
result = disambiguate_f(data)
|
||||
end
|
||||
if languages.all? { |l| ["F#", "Forth", "GLSL"].include?(l) }
|
||||
result = disambiguate_fs(data)
|
||||
end
|
||||
return result
|
||||
end
|
||||
end
|
||||
@@ -151,6 +154,18 @@ module Linguist
|
||||
matches
|
||||
end
|
||||
|
||||
def self.disambiguate_fs(data)
|
||||
matches = []
|
||||
if /^(: |new-device)/.match(data)
|
||||
matches << Language["Forth"]
|
||||
elsif /^(#light|import|let|module|namespace|open|type)/.match(data)
|
||||
matches << Language["F#"]
|
||||
elsif /^(#include|#pragma|precision|uniform|varying|void)/.match(data)
|
||||
matches << Language["GLSL"]
|
||||
end
|
||||
matches
|
||||
end
|
||||
|
||||
def self.active?
|
||||
!!ACTIVE
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user