Merge pull request #2170 from pchaigno/mod-extension

.mod extension
This commit is contained in:
Arfon Smith
2015-07-04 20:57:40 +01:00
15 changed files with 642 additions and 2 deletions

View File

@@ -69,8 +69,9 @@ module Linguist
generated_protocol_buffer? ||
generated_apache_thrift? ||
generated_jni_header? ||
generated_unity3d_meta? ||
vcr_cassette?
vcr_cassette? ||
generated_module? ||
generated_unity3d_meta?
end
# Internal: Is the blob an Xcode file?
@@ -324,6 +325,24 @@ module Linguist
return lines[0].include?("Generated by Cython")
end
# Internal: Is it a KiCAD or GFortran module file?
#
# KiCAD module files contain:
# PCBNEW-LibModule-V1 yyyy-mm-dd h:mm:ss XM
# on the first line.
#
# GFortran module files contain:
# GFORTRAN module version 'x' created from
# on the first line.
#
# Return true of false
def generated_module?
return false unless extname == '.mod'
return false unless lines.count > 1
return lines[0].include?("PCBNEW-LibModule-V") ||
lines[0].include?("GFORTRAN module version '")
end
# Internal: Is this a metadata file from Unity3D?
#
# Unity3D Meta files start with:

View File

@@ -274,6 +274,16 @@ module Linguist
end
end
disambiguate "XML", "Modula-2", "Linux Kernel Module", "AMPL" do |data|
if data.include?('<!ENTITY ')
Language["XML"]
elsif /MODULE\s\w+\s*;/i.match(data) || /^\s*END \w+;$/i.match(data)
Language["Modula-2"]
else
[Language["Linux Kernel Module"], Language["AMPL"]]
end
end
disambiguate "NL", "NewLisp" do |data|
if /^(b|g)[0-9]+ /.match(data)
Language["NL"]

View File

@@ -49,6 +49,7 @@ AMPL:
color: "#E6EFBB"
extensions:
- .ampl
- .mod
tm_scope: source.ampl
ace_mode: text
@@ -1767,6 +1768,13 @@ Linker Script:
tm_scope: none
ace_mode: text
Linux Kernel Module:
type: data
extensions:
- .mod
tm_scope: none
ace_mode: text
Liquid:
type: markup
extensions:
@@ -2033,6 +2041,13 @@ Modelica:
tm_scope: source.modelica
ace_mode: text
Modula-2:
type: programming
extensions:
- .mod
tm_scope: source.modula2
ace_mode: text
Module Management System:
type: programming
extensions:
@@ -3533,6 +3548,7 @@ XML:
- .launch
- .mdpolicy
- .mm
- .mod
- .mxml
- .nproj
- .nuspec