mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Added detection for the new M (aka MUMPS) language.
This commit is contained in:
@@ -457,6 +457,9 @@ module Linguist
|
|||||||
# * Leading function keyword
|
# * Leading function keyword
|
||||||
# * "%" comments
|
# * "%" comments
|
||||||
#
|
#
|
||||||
|
# M heuristics:
|
||||||
|
# * ";" comments
|
||||||
|
#
|
||||||
# Returns a Language.
|
# Returns a Language.
|
||||||
def guess_m_language
|
def guess_m_language
|
||||||
# Objective-C keywords
|
# Objective-C keywords
|
||||||
@@ -471,6 +474,10 @@ module Linguist
|
|||||||
elsif lines.grep(/^%/).any?
|
elsif lines.grep(/^%/).any?
|
||||||
Language['Matlab']
|
Language['Matlab']
|
||||||
|
|
||||||
|
# M comment
|
||||||
|
elsif lines.grep(/^[ \t]*;/).any?
|
||||||
|
Language['M']
|
||||||
|
|
||||||
# Fallback to Objective-C, don't want any Matlab false positives
|
# Fallback to Objective-C, don't want any Matlab false positives
|
||||||
else
|
else
|
||||||
Language['Objective-C']
|
Language['Objective-C']
|
||||||
|
|||||||
@@ -627,6 +627,14 @@ Lua:
|
|||||||
- .lua
|
- .lua
|
||||||
- .nse
|
- .nse
|
||||||
|
|
||||||
|
M:
|
||||||
|
type: programming
|
||||||
|
lexer: Text only
|
||||||
|
aliases:
|
||||||
|
- mumps
|
||||||
|
extensions:
|
||||||
|
- .m
|
||||||
|
|
||||||
Makefile:
|
Makefile:
|
||||||
extensions:
|
extensions:
|
||||||
- .mak
|
- .mak
|
||||||
|
|||||||
4
test/fixtures/m_simple.m
vendored
Normal file
4
test/fixtures/m_simple.m
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
fox
|
||||||
|
; The quick brown fox jumps over the lazy dog
|
||||||
|
write "The quick brown fox jumps over the lazy dog",!
|
||||||
|
quit
|
||||||
@@ -307,6 +307,7 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
assert_equal Language['Objective-C'], blob("hello.m").language
|
assert_equal Language['Objective-C'], blob("hello.m").language
|
||||||
assert_equal Language['Matlab'], blob("matlab_function.m").language
|
assert_equal Language['Matlab'], blob("matlab_function.m").language
|
||||||
assert_equal Language['Matlab'], blob("matlab_script.m").language
|
assert_equal Language['Matlab'], blob("matlab_script.m").language
|
||||||
|
assert_equal Language['M'], blob("m_simple.m").language
|
||||||
|
|
||||||
# .r disambiguation
|
# .r disambiguation
|
||||||
assert_equal Language['R'], blob("hello-r.R").language
|
assert_equal Language['R'], blob("hello-r.R").language
|
||||||
|
|||||||
Reference in New Issue
Block a user