Merge branch 'master' into benchmarking

Conflicts:
	lib/linguist/heuristics.rb
	lib/linguist/languages.yml
This commit is contained in:
Arfon Smith
2014-09-10 17:06:48 -05:00
49 changed files with 10868 additions and 438 deletions

View File

@@ -235,7 +235,7 @@ module Linguist
#
# Returns true or false.
def composer_lock?
!!name.match(/composer.lock/)
!!name.match(/composer\.lock/)
end
# Internal: Is the blob a generated by Zephir

View File

@@ -12,28 +12,15 @@ module Linguist
#
# Returns an array of Languages or []
def self.find_by_heuristics(data, languages)
determined = nil
if active?
if languages.all? { |l| ["Objective-C", "C++", "C"].include?(l) }
determined = disambiguate_c(data, languages)
end
if languages.all? { |l| ["Perl", "Prolog"].include?(l) }
determined = disambiguate_pl(data, languages)
result = disambiguate_pl(data, languages)
end
if languages.all? { |l| ["ECL", "Prolog"].include?(l) }
determined = disambiguate_ecl(data, languages)
end
if languages.all? { |l| ["TypeScript", "XML"].include?(l) }
determined = disambiguate_ts(data, languages)
end
if languages.all? { |l| ["Common Lisp", "OpenCL"].include?(l) }
determined = disambiguate_cl(data, languages)
end
if languages.all? { |l| ["Rebol", "R"].include?(l) }
determined = disambiguate_r(data, languages)
result = disambiguate_ecl(data, languages)
end
return result
end
determined
end
# .h extensions are ambigious between C, C++, and Objective-C.
@@ -42,7 +29,7 @@ module Linguist
# Returns an array of Languages or []
def self.disambiguate_c(data, languages)
matches = []
matches << Language["Objective-C"] if data.include?("i")
matches << Language["Objective-C"] if data.include?("@interface")
matches << Language["C++"] if data.include?("#include <cstdint>")
matches
end

View File

@@ -136,7 +136,7 @@ module Linguist
elsif (determined = Heuristics.find_by_heuristics(data, possible_language_names)) && !determined.empty?
determined.first
# Lastly, fall back to the probablistic classifier.
elsif classified = Classifier.classify(Samples::DATA, data, possible_language_names ).first
elsif classified = Classifier.classify(Samples::DATA, data, possible_language_names).first
# Return the actual Language object based of the string language name (i.e., first element of `#classify`)
Language[classified[0]]
end
@@ -532,6 +532,7 @@ module Linguist
if extnames = extensions[name]
extnames.each do |extname|
if !options['extensions'].include?(extname)
warn "#{name} has a sample with extension (#{extname}) that isn't explicitly defined in languages.yml" unless extname == '.script!'
options['extensions'] << extname
end
end

View File

@@ -28,6 +28,16 @@ ABAP:
extensions:
- .abap
AGS Script:
type: programming
lexer: C++
color: "#B9D9FF"
aliases:
- ags
extensions:
- .asc
- .ash
ANTLR:
type: programming
color: "#9DC3FF"
@@ -35,6 +45,12 @@ ANTLR:
extensions:
- .g4
APL:
type: programming
color: "#8a0707"
extensions:
- .apl
ASP:
type: programming
color: "#6a40fd"
@@ -260,6 +276,7 @@ C:
extensions:
- .c
- .cats
- .h
- .w
C#:
@@ -282,7 +299,21 @@ C++:
aliases:
- cpp
extensions:
- .a
- .cpp
- .C
- .c++
- .cc
- .cxx
- .H
- .h
- .h++
- .hh
- .hpp
- .hxx
- .inl
- .tcc
- .tpp
- .ipp
C-ObjDump:
type: data
@@ -308,7 +339,7 @@ CLIPS:
CMake:
extensions:
- .cmake
- .cmake.in
- .in
filenames:
- CMakeLists.txt
@@ -333,6 +364,14 @@ Ceylon:
extensions:
- .ceylon
Chapel:
type: programming
color: "#8dc63f"
aliases:
- chpl
extensions:
- .chpl
ChucK:
lexer: Java
extensions:
@@ -341,9 +380,8 @@ ChucK:
Cirru:
type: programming
color: "#aaaaff"
# ace_mode: cirru
# lexer: Cirru
lexer: Text only
ace_mode: cirru
lexer: Cirru
extensions:
- .cirru
@@ -367,7 +405,7 @@ Clojure:
- .cljscm
- .cljx
- .hic
- .cljs.hl
- .hl
filenames:
- riemann.config
@@ -390,14 +428,27 @@ CoffeeScript:
ColdFusion:
type: programming
group: ColdFusion
lexer: Coldfusion HTML
ace_mode: coldfusion
color: "#ed2cd6"
search_term: cfm
aliases:
- cfm
- cfml
extensions:
- .cfm
ColdFusion CFC:
type: programming
group: ColdFusion
lexer: Coldfusion CFC
ace_mode: coldfusion
color: "#ed2cd6"
search_term: cfc
aliases:
- cfc
extensions:
- .cfc
Common Lisp:
@@ -431,6 +482,7 @@ Coq:
type: programming
extensions:
- .coq
- .v
Cpp-ObjDump:
type: data
@@ -466,6 +518,12 @@ Cuda:
- .cu
- .cuh
Cycript:
type: programming
lexer: JavaScript
extensions:
- .cy
Cython:
type: programming
group: Python
@@ -520,6 +578,7 @@ Dart:
Diff:
extensions:
- .diff
- .patch
Dogescript:
type: programming
@@ -568,7 +627,7 @@ Eagle:
Eiffel:
type: programming
lexer: Text only
lexer: Eiffel
color: "#946d57"
extensions:
- .e
@@ -588,7 +647,7 @@ Elm:
Emacs Lisp:
type: programming
lexer: Scheme
lexer: Common Lisp
color: "#c065db"
aliases:
- elisp
@@ -599,11 +658,20 @@ Emacs Lisp:
- .el
- .emacs
EmberScript:
type: programming
color: "#f64e3e"
lexer: CoffeeScript
extensions:
- .em
- .emberscript
Erlang:
type: programming
color: "#0faf8d"
extensions:
- .erl
- .escript
- .hrl
F#:
@@ -679,6 +747,7 @@ Forth:
extensions:
- .fth
- .4th
- .forth
Frege:
type: programming
@@ -787,6 +856,9 @@ Gosu:
color: "#82937f"
extensions:
- .gs
- .gst
- .gsx
- .vark
Grace:
type: programming
@@ -822,6 +894,7 @@ Groovy:
color: "#e69f56"
extensions:
- .groovy
- .gradle
- .grt
- .gtpl
- .gvy
@@ -844,7 +917,6 @@ HTML:
extensions:
- .html
- .htm
- .html.hl
- .st
- .xhtml
@@ -864,9 +936,7 @@ HTML+ERB:
- erb
extensions:
- .erb
- .erb.deface
- .html.erb
- .html.erb.deface
- .deface
HTML+PHP:
type: markup
@@ -884,17 +954,14 @@ Haml:
type: markup
extensions:
- .haml
- .haml.deface
- .html.haml.deface
- .deface
Handlebars:
type: markup
lexer: Text only
lexer: Handlebars
extensions:
- .handlebars
- .hbs
- .html.handlebars
- .html.hbs
Harbour:
type: programming
@@ -920,7 +987,7 @@ Haxe:
Hy:
type: programming
lexer: Clojure
lexer: Hy
ace_mode: clojure
color: "#7891b1"
extensions:
@@ -932,6 +999,13 @@ IDL:
color: "#e3592c"
extensions:
- .pro
- .dlm
IGOR Pro:
type: programming
lexer: Igor
extensions:
- .ipf
INI:
type: data
@@ -954,7 +1028,7 @@ Idris:
Inform 7:
type: programming
lexer: Text only
lexer: Inform 7
wrap: true
extensions:
- .ni
@@ -1006,6 +1080,7 @@ JSON:
searchable: false
extensions:
- .json
- .lock
- .sublime-keymap
- .sublime-mousemap
- .sublime-project
@@ -1128,12 +1203,31 @@ LLVM:
extensions:
- .ll
LSL:
type: programming
lexer: LSL
ace_mode: lsl
extensions:
- .lsl
interpreters:
- lsl
color: '#3d9970'
LabVIEW:
type: programming
lexer: Text only
extensions:
- .lvproj
Lasso:
type: programming
lexer: Lasso
color: "#2584c3"
extensions:
- .lasso
- .las
- .lasso9
- .ldml
Latte:
type: markup
@@ -1212,6 +1306,14 @@ Logtalk:
- .lgt
- .logtalk
LookML:
type: programming
lexer: YAML
ace_mode: yaml
color: "#652B81"
extensions:
- .lookml
Lua:
type: programming
ace_mode: lua
@@ -1219,6 +1321,7 @@ Lua:
extensions:
- .lua
- .nse
- .pd_lua
- .rbxs
interpreters:
- lua
@@ -1284,7 +1387,7 @@ Mathematica:
- .mathematica
- .m
- .nb
lexer: Text only
lexer: Mathematica
Matlab:
type: programming
@@ -1364,6 +1467,7 @@ Myghty:
NSIS:
extensions:
- .nsi
- .nsh
Nemerle:
type: programming
@@ -1428,6 +1532,7 @@ OCaml:
color: "#3be133"
extensions:
- .ml
- .eliom
- .eliomi
- .ml4
- .mli
@@ -1448,6 +1553,7 @@ Objective-C:
- objc
extensions:
- .m
- .h
Objective-C++:
type: programming
@@ -1479,6 +1585,13 @@ Opa:
extensions:
- .opa
Opal:
type: programming
color: "#f7ede0"
lexer: Text only
extensions:
- .opal
OpenCL:
type: programming
group: C
@@ -1495,6 +1608,13 @@ OpenEdge ABL:
- abl
extensions:
- .p
- .cls
OpenSCAD:
type: programming
lexer: Text only
extensions:
- .scad
Org:
type: prose
@@ -1533,6 +1653,7 @@ PHP:
- .php
- .aw
- .ctp
- .module
- .php3
- .php4
- .php5
@@ -1544,7 +1665,7 @@ PHP:
Pan:
type: programming
lexer: Text only
lexer: Pan
color: '#cc0000'
extensions:
- .pan
@@ -1581,6 +1702,7 @@ Pascal:
extensions:
- .pas
- .dfm
- .dpr
- .lpr
Perl:
@@ -1590,12 +1712,15 @@ Perl:
extensions:
- .pl
- .PL
- .cgi
- .fcgi
- .perl
- .ph
- .plx
- .pm
- .pod
- .psgi
- .t
interpreters:
- perl
@@ -1612,6 +1737,13 @@ Perl6:
- .pl6
- .pm6
PigLatin:
type: programming
color: "#fcd7de"
lexer: Text only
extensions:
- .pig
Pike:
type: programming
color: "#066ab2"
@@ -1662,9 +1794,9 @@ Prolog:
type: programming
color: "#74283c"
extensions:
- .prolog
- .ecl
- .pl
- .ecl
- .prolog
Propeller Spin:
type: programming
@@ -1709,6 +1841,7 @@ Python:
color: "#3581ba"
extensions:
- .py
- .cgi
- .gyp
- .lmi
- .pyde
@@ -1764,7 +1897,7 @@ R:
RDoc:
type: prose
lexer: Text only
lexer: Rd
ace_mode: rdoc
wrap: true
extensions:
@@ -1804,6 +1937,7 @@ Racket:
- .rkt
- .rktd
- .rktl
- .scrbl
Ragel in Ruby Host:
type: programming
@@ -1873,7 +2007,10 @@ Ruby:
- .god
- .irbrc
- .mspec
- .pluginspec
- .podspec
- .rabl
- .rake
- .rbuild
- .rbw
- .rbx
@@ -1918,6 +2055,14 @@ SCSS:
extensions:
- .scss
SQF:
type: programming
color: "#FFCB1F"
lexer: C++
extensions:
- .sqf
- .hqf
SQL:
type: data
ace_mode: sql
@@ -1947,6 +2092,7 @@ Sass:
group: CSS
extensions:
- .sass
- .scss
Scala:
type: programming
@@ -1954,6 +2100,7 @@ Scala:
color: "#7dd3b0"
extensions:
- .scala
- .sbt
- .sc
Scaml:
@@ -1969,6 +2116,7 @@ Scheme:
- .scm
- .sld
- .sls
- .sps
- .ss
interpreters:
- guile
@@ -1980,6 +2128,8 @@ Scilab:
type: programming
extensions:
- .sci
- .sce
- .tst
Self:
type: programming
@@ -1999,8 +2149,11 @@ Shell:
- zsh
extensions:
- .sh
- .bash
- .bats
- .cgi
- .tmux
- .zsh
interpreters:
- bash
- sh
@@ -2067,6 +2220,7 @@ Standard ML:
extensions:
- .ML
- .fun
- .sig
- .sml
Stata:
@@ -2147,10 +2301,13 @@ TeX:
extensions:
- .tex
- .aux
- .bbx
- .bib
- .cbx
- .cls
- .dtx
- .ins
- .lbx
- .ltx
- .mkii
- .mkiv
@@ -2267,6 +2424,7 @@ Visual Basic:
extensions:
- .vb
- .bas
- .cls
- .frm
- .frx
- .vba
@@ -2295,6 +2453,7 @@ XML:
- wsdl
extensions:
- .xml
- .ant
- .axml
- .ccxml
- .clixml
@@ -2308,6 +2467,7 @@ XML:
- .fsproj
- .glade
- .grxml
- .ivy
- .jelly
- .kml
- .launch

File diff suppressed because it is too large Load Diff

View File

@@ -36,6 +36,10 @@
# Bootstrap minified css and js
- (^|/)bootstrap([^.]*)(\.min)?\.(js|css)$
# Font Awesome
- font-awesome.min.css
- font-awesome.css
# Foundation css
- foundation.min.css
- foundation.css
@@ -43,8 +47,17 @@
# Normalize.css
- normalize.css
# Bourbon SCSS
- (^|/)[Bb]ourbon/.*\.css$
- (^|/)[Bb]ourbon/.*\.scss$
# Animate.css
- animate.css
- animate.min.css
# Vendored dependencies
- thirdparty/
- third[-_]?party/
- 3rd[-_]?party/
- vendors?/
- extern(al)?/
@@ -112,6 +125,10 @@
- (^|/)modernizr\-\d\.\d+(\.\d+)?(\.min)?\.js$
- (^|/)modernizr\.custom\.\d+\.js$
# Knockout
- (^|/)knockout-(\d+\.){3}(debug\.)?js$
- knockout-min.js
## Python ##
# django
@@ -198,6 +215,9 @@
- (^|/)cordova([^.]*)(\.min)?\.js$
- (^|/)cordova\-\d\.\d(\.\d)?(\.min)?\.js$
# Foundation js
- foundation(\..*)?\.js$
# Vagrant
- ^Vagrantfile$

View File

@@ -1,3 +1,3 @@
module Linguist
VERSION = "3.1.0"
VERSION = "3.1.5"
end