Add 'text' language with samples, and heuristics for .fr.

This commit is contained in:
Lars Brinkhoff
2014-11-27 08:04:48 +01:00
parent 5fd56c75d5
commit de6b2f3307
6 changed files with 40 additions and 0 deletions

View File

@@ -156,5 +156,14 @@ module Linguist
end
end
disambiguate "Frege", "Forth", "text" do |data|
if /^(: |also |new-device|previous )/.match(data)
Language["Forth"]
elsif /\s*(import|module|package|data|type) /.match(data)
Language["Frege"]
else
Language["text"]
end
end
end
end

View File

@@ -3232,6 +3232,15 @@ reStructuredText:
- .rest
ace_mode: none
text:
type: prose
wrap: true
extensions:
- .txt
- .fr
tm_scope: none
ace_mode: none
wisp:
type: programming
ace_mode: clojure

View File

@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 2.8)
project(Foo)
set(CMAKE_SKIP_RPATH TRUE)
set(CMAKE_INSTALL_PREFIX "/usr/local")
add_subdirectory(bar)
add_executable(foo foo.c)
target_link_libraries(foo pthread)
install(TARGETS foo DESTINATION bin)

1
samples/text/messages.fr Normal file
View File

@@ -0,0 +1 @@
the green potato=la pomme de terre verte

1
samples/text/readme.txt Normal file
View File

@@ -0,0 +1 @@
Read me now!

View File

@@ -118,6 +118,14 @@ class TestHeuristcs < Test::Unit::TestCase
})
end
def test_fr_by_heuristics
assert_heuristics({
"Frege" => all_fixtures("Frege"),
"Forth" => all_fixtures("Forth"),
"text" => all_fixtures("text")
})
end
def assert_heuristics(hash)
candidates = hash.keys.map { |l| Language[l] }