mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 20:38:47 +00:00
Heuristic for .lsp and .lisp (Common Lisp, NewLisp)
This commit is contained in:
@@ -165,5 +165,13 @@ module Linguist
|
|||||||
Language["text"]
|
Language["text"]
|
||||||
end
|
end
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -126,6 +126,13 @@ class TestHeuristcs < Test::Unit::TestCase
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_lsp_by_heuristics
|
||||||
|
assert_heuristics({
|
||||||
|
"Common Lisp" => all_fixtures("Common Lisp"),
|
||||||
|
"NewLisp" => all_fixtures("NewLisp")
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
def assert_heuristics(hash)
|
def assert_heuristics(hash)
|
||||||
candidates = hash.keys.map { |l| Language[l] }
|
candidates = hash.keys.map { |l| Language[l] }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user