mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-01-07 09:55:32 +00:00
Heuristic for .bb (BitBake, BlitzBasic)
This commit is contained in:
@@ -165,5 +165,13 @@ module Linguist
|
|||||||
Language["text"]
|
Language["text"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
disambiguate "BitBake", "BlitzBasic" do |data|
|
||||||
|
if /^\s*; /.match(data) || data.include?("End Function")
|
||||||
|
Language["BlitzBasic"]
|
||||||
|
elsif /^\s*(# |include|require)\b/.match(data)
|
||||||
|
Language["BitBake"]
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -126,6 +126,13 @@ class TestHeuristcs < Test::Unit::TestCase
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_bb_by_heuristics
|
||||||
|
assert_heuristics({
|
||||||
|
"BitBake" => all_fixtures("BitBake"),
|
||||||
|
"BlitzBasic" => all_fixtures("BlitzBasic")
|
||||||
|
})
|
||||||
|
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