Add ".es" to recognised ECMAScript extensions

* Add ".es" to recognised JavaScript extensions
* Add heuristic to differentiate Erlang from ECMAScript
* Add test-case for .es heuristic
This commit is contained in:
John Gardner
2016-03-30 06:36:13 +11:00
committed by Arfon Smith
parent 7c8bc8561d
commit 24b368a30c
8 changed files with 194 additions and 1 deletions

View File

@@ -127,6 +127,14 @@ module Linguist
Language["ECL"]
end
end
disambiguate ".es" do |data|
if /^\s*(?:%%|main\s*\(.*?\)\s*->)/.match(data)
Language["Erlang"]
elsif /(?:\/\/|("|')use strict\1|export\s+default\s|\/\*.*?\*\/)/m.match(data)
Language["JavaScript"]
end
end
disambiguate ".for", ".f" do |data|
if /^: /.match(data)