From 88f196e4d4db5d49d0a928d23093d8fe05abe597 Mon Sep 17 00:00:00 2001 From: ellemenno Date: Mon, 17 Nov 2014 01:55:59 -0500 Subject: [PATCH] add a heuristic to disambiguate LiveScript from LoomScript Keying off of `package {`, since LoomScript code must be enclosed in a package definition, whereas that would be invalid LiveScript --- lib/linguist/heuristics.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/linguist/heuristics.rb b/lib/linguist/heuristics.rb index c203b1ba..c85fe964 100644 --- a/lib/linguist/heuristics.rb +++ b/lib/linguist/heuristics.rb @@ -144,6 +144,15 @@ module Linguist disambiguate "Gosu", "JavaScript" do |data| Language["Gosu"] if /^uses java\./.match(data) - end + end + + disambiguate "LoomScript", "LiveScript" do |data| + if /^\s*package[\w\W]*{/.match(data) + Language["LoomScript"] + else + Language["LiveScript"] + end + end + end end