mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Heuristic for .lsp and .lisp (Common Lisp, NewLisp)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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] }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user