mirror of
https://github.com/KevinMidboe/linguist.git
synced 2026-01-17 14:55:41 +00:00
Merge branch 'master' into inc
This commit is contained in:
@@ -65,9 +65,11 @@ module Linguist
|
||||
generated_net_docfile? ||
|
||||
generated_postscript? ||
|
||||
compiled_cython_file? ||
|
||||
generated_protocol_buffer_go? ||
|
||||
generated_go? ||
|
||||
generated_protocol_buffer? ||
|
||||
generated_apache_thrift? ||
|
||||
generated_jni_header? ||
|
||||
generated_unity3d_meta? ||
|
||||
vcr_cassette?
|
||||
end
|
||||
|
||||
@@ -179,11 +181,11 @@ module Linguist
|
||||
def generated_net_designer_file?
|
||||
name.downcase =~ /\.designer\.cs$/
|
||||
end
|
||||
|
||||
|
||||
# Internal: Is this a codegen file for Specflow feature file?
|
||||
#
|
||||
# Visual Studio's SpecFlow extension generates *.feature.cs files
|
||||
# from *.feature files, they are not meant to be consumed by humans.
|
||||
# from *.feature files, they are not meant to be consumed by humans.
|
||||
# Let's hide them.
|
||||
#
|
||||
# Returns true or false
|
||||
@@ -231,11 +233,11 @@ module Linguist
|
||||
creator.include?("ImageMagick")
|
||||
end
|
||||
|
||||
def generated_protocol_buffer_go?
|
||||
def generated_go?
|
||||
return false unless extname == '.go'
|
||||
return false unless lines.count > 1
|
||||
|
||||
return lines[0].include?("Code generated by protoc-gen-go")
|
||||
return lines[0].include?("Code generated by")
|
||||
end
|
||||
|
||||
# Internal: Is the blob a C++, Java or Python source file generated by the
|
||||
@@ -249,6 +251,16 @@ module Linguist
|
||||
return lines[0].include?("Generated by the protocol buffer compiler. DO NOT EDIT!")
|
||||
end
|
||||
|
||||
# Internal: Is the blob generated by Apache Thrift compiler?
|
||||
#
|
||||
# Returns true or false
|
||||
def generated_apache_thrift?
|
||||
return false unless ['.rb', '.py', '.go', '.js', '.m', '.java', '.h', '.cc', '.cpp'].include?(extname)
|
||||
return false unless lines.count > 1
|
||||
|
||||
return lines[0].include?("Autogenerated by Thrift Compiler") || lines[1].include?("Autogenerated by Thrift Compiler")
|
||||
end
|
||||
|
||||
# Internal: Is the blob a C/C++ header generated by the Java JNI tool javah?
|
||||
#
|
||||
# Returns true of false.
|
||||
@@ -311,5 +323,18 @@ module Linguist
|
||||
return false unless lines.count > 1
|
||||
return lines[0].include?("Generated by Cython")
|
||||
end
|
||||
|
||||
# Internal: Is this a metadata file from Unity3D?
|
||||
#
|
||||
# Unity3D Meta files start with:
|
||||
# fileFormatVersion: X
|
||||
# guid: XXXXXXXXXXXXXXX
|
||||
#
|
||||
# Return true or false
|
||||
def generated_unity3d_meta?
|
||||
return false unless extname == '.meta'
|
||||
return false unless lines.count > 1
|
||||
return lines[0].include?("fileFormatVersion: ")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -283,11 +283,39 @@ module Linguist
|
||||
end
|
||||
|
||||
disambiguate "Rust", "RenderScript" do |data|
|
||||
if data.include?("^(use |fn |mod |pub |macro_rules|impl|#!?\[)")
|
||||
if /^(use |fn |mod |pub |macro_rules|impl|#!?\[)/.match(data)
|
||||
Language["Rust"]
|
||||
elsif /#include|#pragma\s+(rs|version)|__attribute__/.match(data)
|
||||
Language["RenderScript"]
|
||||
end
|
||||
end
|
||||
|
||||
disambiguate "Common Lisp", "Lex", "Groff", "PicoLisp" do |data|
|
||||
if /\(def(un|macro)\s/.match(data)
|
||||
Language["Common Lisp"]
|
||||
elsif /^(%[%{}]xs|<.*>)/.match(data)
|
||||
Language["Lex"]
|
||||
elsif /^\.[a-z][a-z](\s|$)/i.match(data)
|
||||
Language["Groff"]
|
||||
elsif /^\((de|class|rel|code|data|must)\s/.match(data)
|
||||
Language["PicoLisp"]
|
||||
end
|
||||
end
|
||||
|
||||
disambiguate "Groff", "Nemerle" do |data|
|
||||
if /^[.']/.match(data)
|
||||
Language["Groff"]
|
||||
elsif /^(module|namespace|using)\s/.match(data)
|
||||
Language["Nemerle"]
|
||||
end
|
||||
end
|
||||
|
||||
disambiguate "GAS", "Groff" do |data|
|
||||
if /^[.'][a-z][a-z](\s|$)/i.match(data)
|
||||
Language["Groff"]
|
||||
elsif /((^|\s)move?[. ])|\.(include|globa?l)\s/.match(data)
|
||||
Language["GAS"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -160,6 +160,7 @@ ApacheConf:
|
||||
- apache
|
||||
extensions:
|
||||
- .apacheconf
|
||||
- .vhost
|
||||
tm_scope: source.apache-config
|
||||
ace_mode: apache_conf
|
||||
|
||||
@@ -296,9 +297,10 @@ Befunge:
|
||||
|
||||
Bison:
|
||||
type: programming
|
||||
group: Yacc
|
||||
tm_scope: source.bison
|
||||
extensions:
|
||||
- .y
|
||||
- .bison
|
||||
ace_mode: text
|
||||
|
||||
BitBake:
|
||||
@@ -602,6 +604,7 @@ Common Lisp:
|
||||
- .lisp
|
||||
- .asd
|
||||
- .cl
|
||||
- .l
|
||||
- .lsp
|
||||
- .ny
|
||||
- .podsl
|
||||
@@ -1040,6 +1043,7 @@ GAS:
|
||||
group: Assembly
|
||||
extensions:
|
||||
- .s
|
||||
- .ms
|
||||
tm_scope: source.asm.x86
|
||||
ace_mode: assembly_x86
|
||||
|
||||
@@ -1208,12 +1212,26 @@ Groff:
|
||||
extensions:
|
||||
- .man
|
||||
- '.1'
|
||||
- .1in
|
||||
- .1m
|
||||
- .1x
|
||||
- '.2'
|
||||
- '.3'
|
||||
- .3in
|
||||
- .3m
|
||||
- .3qt
|
||||
- .3x
|
||||
- '.4'
|
||||
- '.5'
|
||||
- '.6'
|
||||
- '.7'
|
||||
- '.8'
|
||||
- '.9'
|
||||
- .l
|
||||
- .ms
|
||||
- .n
|
||||
- .rno
|
||||
- .roff
|
||||
tm_scope: text.groff
|
||||
aliases:
|
||||
- nroff
|
||||
@@ -1344,7 +1362,7 @@ Haskell:
|
||||
Haxe:
|
||||
type: programming
|
||||
ace_mode: haxe
|
||||
color: "#f7941e"
|
||||
color: "#df7900"
|
||||
extensions:
|
||||
- .hx
|
||||
- .hxsl
|
||||
@@ -1366,7 +1384,7 @@ HyPhy:
|
||||
extensions:
|
||||
- .bf
|
||||
tm_scope: none
|
||||
|
||||
|
||||
IDL:
|
||||
type: programming
|
||||
color: "#a3522f"
|
||||
@@ -1471,6 +1489,7 @@ J:
|
||||
JFlex:
|
||||
type: programming
|
||||
color: "#DBCA00"
|
||||
group: Lex
|
||||
extensions:
|
||||
- .flex
|
||||
- .jflex
|
||||
@@ -1506,11 +1525,12 @@ JSONLD:
|
||||
tm_scope: source.js
|
||||
|
||||
JSONiq:
|
||||
color: "#40d47e"
|
||||
type: programming
|
||||
ace_mode: jsoniq
|
||||
extensions:
|
||||
- .jq
|
||||
tm_scope: source.xquery
|
||||
tm_scope: source.jq
|
||||
|
||||
Jade:
|
||||
group: HTML
|
||||
@@ -1621,7 +1641,7 @@ Kit:
|
||||
|
||||
Kotlin:
|
||||
type: programming
|
||||
color: "#EA4DFA"
|
||||
color: "#F18E33"
|
||||
extensions:
|
||||
- .kt
|
||||
- .ktm
|
||||
@@ -1688,7 +1708,7 @@ Latte:
|
||||
group: HTML
|
||||
extensions:
|
||||
- .latte
|
||||
tm_scope: source.smarty
|
||||
tm_scope: text.html.smarty
|
||||
ace_mode: smarty
|
||||
|
||||
Lean:
|
||||
@@ -1706,6 +1726,17 @@ Less:
|
||||
tm_scope: source.css.less
|
||||
ace_mode: less
|
||||
|
||||
Lex:
|
||||
type: programming
|
||||
color: "#DBCA00"
|
||||
aliases:
|
||||
- flex
|
||||
extensions:
|
||||
- .l
|
||||
- .lex
|
||||
tm_scope: none
|
||||
ace_mode: text
|
||||
|
||||
LilyPond:
|
||||
type: programming
|
||||
extensions:
|
||||
@@ -1868,6 +1899,7 @@ Makefile:
|
||||
- .mk
|
||||
filenames:
|
||||
- GNUmakefile
|
||||
- Kbuild
|
||||
- Makefile
|
||||
- makefile
|
||||
interpreters:
|
||||
@@ -2099,6 +2131,9 @@ Nginx:
|
||||
type: markup
|
||||
extensions:
|
||||
- .nginxconf
|
||||
- .vhost
|
||||
filenames:
|
||||
- nginx.conf
|
||||
tm_scope: source.nginx
|
||||
aliases:
|
||||
- nginx configuration file
|
||||
@@ -2425,6 +2460,7 @@ Perl:
|
||||
color: "#0298c3"
|
||||
extensions:
|
||||
- .pl
|
||||
- .al
|
||||
- .cgi
|
||||
- .fcgi
|
||||
- .perl
|
||||
@@ -2459,6 +2495,16 @@ Perl6:
|
||||
tm_scope: source.perl.6
|
||||
ace_mode: perl
|
||||
|
||||
PicoLisp:
|
||||
type: programming
|
||||
extensions:
|
||||
- .l
|
||||
interpreters:
|
||||
- picolisp
|
||||
- pil
|
||||
tm_scope: source.lisp
|
||||
ace_mode: lisp
|
||||
|
||||
PigLatin:
|
||||
type: programming
|
||||
color: "#fcd7de"
|
||||
@@ -2636,6 +2682,7 @@ QML:
|
||||
color: "#44a51c"
|
||||
extensions:
|
||||
- .qml
|
||||
- .qbs
|
||||
tm_scope: source.qml
|
||||
ace_mode: text
|
||||
|
||||
@@ -2726,7 +2773,7 @@ Racket:
|
||||
|
||||
Ragel in Ruby Host:
|
||||
type: programming
|
||||
color: "#e17600"
|
||||
color: "#9d5200"
|
||||
extensions:
|
||||
- .rl
|
||||
aliases:
|
||||
@@ -2833,11 +2880,15 @@ Ruby:
|
||||
- ruby
|
||||
- macruby
|
||||
- rake
|
||||
- jruby
|
||||
- rbx
|
||||
filenames:
|
||||
- .pryrc
|
||||
- Appraisals
|
||||
- Berksfile
|
||||
- Buildfile
|
||||
- Deliverfile
|
||||
- Fastfile
|
||||
- Gemfile
|
||||
- Gemfile.lock
|
||||
- Guardfile
|
||||
@@ -2845,6 +2896,7 @@ Ruby:
|
||||
- Mavenfile
|
||||
- Podfile
|
||||
- Puppetfile
|
||||
- Snapfile
|
||||
- Thorfile
|
||||
- Vagrantfile
|
||||
- buildfile
|
||||
@@ -3065,6 +3117,13 @@ Slim:
|
||||
- .slim
|
||||
ace_mode: text
|
||||
|
||||
Smali:
|
||||
type: programming
|
||||
extensions:
|
||||
- .smali
|
||||
ace_mode: text
|
||||
tm_scope: source.smali
|
||||
|
||||
Smalltalk:
|
||||
type: programming
|
||||
color: "#596706"
|
||||
@@ -3080,6 +3139,7 @@ Smarty:
|
||||
extensions:
|
||||
- .tpl
|
||||
ace_mode: smarty
|
||||
tm_scope: text.html.smarty
|
||||
|
||||
SourcePawn:
|
||||
type: programming
|
||||
@@ -3269,7 +3329,7 @@ Turtle:
|
||||
|
||||
Twig:
|
||||
type: markup
|
||||
group: PHP
|
||||
group: HTML
|
||||
extensions:
|
||||
- .twig
|
||||
tm_scope: text.html.twig
|
||||
@@ -3294,6 +3354,19 @@ Unified Parallel C:
|
||||
- .upc
|
||||
tm_scope: source.c
|
||||
|
||||
Unity3D Asset:
|
||||
type: data
|
||||
ace_mode: yaml
|
||||
color: "#ab69a1"
|
||||
extensions:
|
||||
- .anim
|
||||
- .asset
|
||||
- .mat
|
||||
- .meta
|
||||
- .prefab
|
||||
- .unity
|
||||
tm_scope: source.yaml
|
||||
|
||||
UnrealScript:
|
||||
type: programming
|
||||
color: "#a54c4d"
|
||||
@@ -3433,10 +3506,12 @@ XML:
|
||||
- .glade
|
||||
- .gml
|
||||
- .grxml
|
||||
- .iml
|
||||
- .ivy
|
||||
- .jelly
|
||||
- .kml
|
||||
- .launch
|
||||
- .mdpolicy
|
||||
- .mm
|
||||
- .mxml
|
||||
- .nproj
|
||||
@@ -3511,6 +3586,7 @@ XQuery:
|
||||
- .xqm
|
||||
- .xqy
|
||||
ace_mode: xquery
|
||||
tm_scope: source.xq
|
||||
|
||||
XS:
|
||||
type: programming
|
||||
@@ -3559,6 +3635,15 @@ YAML:
|
||||
- .yaml
|
||||
ace_mode: yaml
|
||||
|
||||
Yacc:
|
||||
type: programming
|
||||
extensions:
|
||||
- .y
|
||||
- .yacc
|
||||
- .yy
|
||||
tm_scope: source.bison
|
||||
ace_mode: text
|
||||
|
||||
Zephir:
|
||||
type: programming
|
||||
color: "#118f9e"
|
||||
|
||||
@@ -2,7 +2,7 @@ module Linguist
|
||||
module Strategy
|
||||
class Modeline
|
||||
EmacsModeline = /-\*-\s*(?:(?!mode)[\w-]+\s*:\s*(?:[\w+-]+)\s*;?\s*)*(?:mode\s*:)?\s*([\w+-]+)\s*(?:;\s*(?!mode)[\w-]+\s*:\s*[\w+-]+\s*)*;?\s*-\*-/i
|
||||
VimModeline = /\/\*\s*vim:\s*set\s*(?:ft|filetype)=(\w+):\s*\*\//i
|
||||
VimModeline = /vim:\s*set\s*(?:ft|filetype)=(\w+):/i
|
||||
|
||||
# Public: Detects language based on Vim and Emacs modelines
|
||||
#
|
||||
|
||||
@@ -163,6 +163,9 @@
|
||||
|
||||
## Obj-C ##
|
||||
|
||||
# Carthage
|
||||
- ^Carthage/
|
||||
|
||||
# Cocoapods
|
||||
- ^Pods/
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Linguist
|
||||
VERSION = "4.5.4"
|
||||
VERSION = "4.5.6"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user