Heuristic for .lsp and .lisp (Common Lisp, NewLisp)

This commit is contained in:
Paul Chaignon
2014-12-06 19:51:45 -05:00
parent bbd1646ae5
commit 0b02b68538
2 changed files with 15 additions and 0 deletions

View File

@@ -165,5 +165,13 @@ module Linguist
Language["text"]
end
end
disambiguate "Common Lisp", "NewLisp" do |data|
if /^\s*\((defun|defactor|in-package|defpackage) /.match(data)
Language["Common Lisp"]
elsif /^\s*\(define /.match(data)
Language["NewLisp"]
end
end
end
end

View File

@@ -126,6 +126,13 @@ class TestHeuristcs < Test::Unit::TestCase
})
end
def test_lsp_by_heuristics
assert_heuristics({
"Common Lisp" => all_fixtures("Common Lisp"),
"NewLisp" => all_fixtures("NewLisp")
})
end
def assert_heuristics(hash)
candidates = hash.keys.map { |l| Language[l] }