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:
Lars Brinkhoff
2013-08-24 14:24:53 +02:00
parent 9f103abfb5
commit 2d940e72c2
6 changed files with 342 additions and 0 deletions

View File

@@ -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