mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Fix heuristic for Unix Assembly with .ms extension (#3550)
This commit is contained in:
committed by
John Gardner
parent
fa6ae1116f
commit
e80b92e407
@@ -298,7 +298,7 @@ module Linguist
|
|||||||
if /^[.'][a-z][a-z](\s|$)/i.match(data)
|
if /^[.'][a-z][a-z](\s|$)/i.match(data)
|
||||||
Language["Groff"]
|
Language["Groff"]
|
||||||
elsif /(?<!\S)\.(include|globa?l)\s/.match(data) || /(?<!\/\*)(\A|\n)\s*\.[A-Za-z]/.match(data.gsub(/"([^\\"]|\\.)*"|'([^\\']|\\.)*'|\\\s*(?:--.*)?\n/, ""))
|
elsif /(?<!\S)\.(include|globa?l)\s/.match(data) || /(?<!\/\*)(\A|\n)\s*\.[A-Za-z]/.match(data.gsub(/"([^\\"]|\\.)*"|'([^\\']|\\.)*'|\\\s*(?:--.*)?\n/, ""))
|
||||||
Language["GAS"]
|
Language["Unix Assembly"]
|
||||||
else
|
else
|
||||||
Language["MAXScript"]
|
Language["MAXScript"]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -178,6 +178,13 @@ class TestHeuristcs < Minitest::Test
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_ms_by_heuristics
|
||||||
|
assert_heuristics({
|
||||||
|
"Unix Assembly" => all_fixtures("Unix Assembly", "*.ms"),
|
||||||
|
"MAXScript" => all_fixtures("MAXScript", "*.ms")
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
# Candidate languages = ["C++", "Objective-C"]
|
# Candidate languages = ["C++", "Objective-C"]
|
||||||
def test_obj_c_by_heuristics
|
def test_obj_c_by_heuristics
|
||||||
# Only calling out '.h' filenames as these are the ones causing issues
|
# Only calling out '.h' filenames as these are the ones causing issues
|
||||||
|
|||||||
Reference in New Issue
Block a user