mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Guess if .r is R or REBOL
.r is the default extension used widely for both, R and REBOL. This patch attempts to guess if .r is a REBOL file by looking for the following very common REBOL code fragments: - `REBOL` - `: func [` - `make object! [` - `context [` If any of those is found in a .r file, it is identified as a REBOL file. Otherwise the language for a .r file is R. Signed-off-by: Andreas Bolka <a@bolka.at>
This commit is contained in:
@@ -224,6 +224,10 @@ class TestBlob < Test::Unit::TestCase
|
||||
assert_equal Language['Ruby'], blob("wrong_shebang.rb").language
|
||||
assert_nil blob("octocat.png").language
|
||||
|
||||
# .r disambiguation
|
||||
assert_equal Language['R'], blob("hello-r.R").language
|
||||
assert_equal Language['Rebol'], blob("hello-rebol.r").language
|
||||
|
||||
# ML
|
||||
assert_equal Language['OCaml'], blob("Foo.ml").language
|
||||
assert_equal Language['Standard ML'], blob("Foo.sig").language
|
||||
|
||||
Reference in New Issue
Block a user