mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Compare commits
8 Commits
vmg/empty-
...
v6.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a18ad1d489 | ||
|
|
25ac140d58 | ||
|
|
f7835f7119 | ||
|
|
a7f835a653 | ||
|
|
6220286f42 | ||
|
|
15e2b74dec | ||
|
|
969333610c | ||
|
|
8438c6cd3e |
6
.gitmodules
vendored
6
.gitmodules
vendored
@@ -301,9 +301,6 @@
|
||||
[submodule "vendor/grammars/make.tmbundle"]
|
||||
path = vendor/grammars/make.tmbundle
|
||||
url = https://github.com/textmate/make.tmbundle
|
||||
[submodule "vendor/grammars/matlab.tmbundle"]
|
||||
path = vendor/grammars/matlab.tmbundle
|
||||
url = https://github.com/textmate/matlab.tmbundle
|
||||
[submodule "vendor/grammars/maven.tmbundle"]
|
||||
path = vendor/grammars/maven.tmbundle
|
||||
url = https://github.com/textmate/maven.tmbundle
|
||||
@@ -886,6 +883,9 @@
|
||||
[submodule "vendor/grammars/Syntax-highlighting-for-PostCSS"]
|
||||
path = vendor/grammars/Syntax-highlighting-for-PostCSS
|
||||
url = https://github.com/hudochenkov/Syntax-highlighting-for-PostCSS
|
||||
[submodule "vendor/grammars/MATLAB-Language-grammar"]
|
||||
path = vendor/grammars/MATLAB-Language-grammar
|
||||
url = https://github.com/mathworks/MATLAB-Language-grammar
|
||||
[submodule "vendor/grammars/javadoc.tmbundle"]
|
||||
path = vendor/grammars/javadoc.tmbundle
|
||||
url = https://github.com/textmate/javadoc.tmbundle
|
||||
|
||||
@@ -2,7 +2,7 @@ require File.expand_path('../lib/linguist/version', __FILE__)
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = 'github-linguist'
|
||||
s.version = Linguist::VERSION
|
||||
s.version = ENV['GEM_VERSION'] || Linguist::VERSION
|
||||
s.summary = "GitHub Language detection"
|
||||
s.description = 'We use this library at GitHub to detect blob languages, highlight code, ignore binary files, suppress generated files in diffs, and generate language breakdown graphs.'
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@ vendor/grammars/Lean.tmbundle:
|
||||
- source.lean
|
||||
vendor/grammars/LiveScript.tmbundle:
|
||||
- source.livescript
|
||||
vendor/grammars/MATLAB-Language-grammar:
|
||||
- source.matlab
|
||||
vendor/grammars/MQL5-sublime:
|
||||
- source.mql5
|
||||
vendor/grammars/MagicPython:
|
||||
@@ -541,9 +543,6 @@ vendor/grammars/marko-tmbundle:
|
||||
- text.marko
|
||||
vendor/grammars/mathematica-tmbundle:
|
||||
- source.mathematica
|
||||
vendor/grammars/matlab.tmbundle:
|
||||
- source.matlab
|
||||
- source.octave
|
||||
vendor/grammars/maven.tmbundle:
|
||||
- text.xml.pom
|
||||
vendor/grammars/mediawiki.tmbundle:
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Linguist
|
||||
VERSION = "5.3.3"
|
||||
VERSION = "6.0.1"
|
||||
end
|
||||
|
||||
@@ -6,6 +6,8 @@ cd "$(dirname "$0")/.."
|
||||
image="linguist/grammar-compiler:latest"
|
||||
mkdir -p grammars
|
||||
|
||||
docker pull $image
|
||||
|
||||
exec docker run --rm \
|
||||
-u $(id -u $USER):$(id -g $USER) \
|
||||
-v $PWD:/src/linguist \
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
FROM golang:1.9.2
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get upgrade -y
|
||||
RUN apt-get install -y curl gnupg
|
||||
WORKDIR /go/src/github.com/github/linguist/tools/grammars
|
||||
|
||||
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
|
||||
RUN apt-get install -y nodejs
|
||||
RUN npm install -g season
|
||||
|
||||
RUN apt-get install -y cmake
|
||||
RUN cd /tmp && git clone https://github.com/vmg/pcre
|
||||
RUN mkdir -p /tmp/pcre/build && cd /tmp/pcre/build && \
|
||||
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - && \
|
||||
apt-get update && \
|
||||
apt-get install -y nodejs cmake && \
|
||||
npm install -g season && \
|
||||
cd /tmp && git clone https://github.com/vmg/pcre && \
|
||||
mkdir -p /tmp/pcre/build && cd /tmp/pcre/build && \
|
||||
cmake .. \
|
||||
-DPCRE_SUPPORT_JIT=ON \
|
||||
-DPCRE_SUPPORT_UTF=ON \
|
||||
@@ -22,14 +19,12 @@ RUN mkdir -p /tmp/pcre/build && cd /tmp/pcre/build && \
|
||||
-DPCRE_BUILD_PCREGREP=OFF \
|
||||
-DPCRE_BUILD_TESTS=OFF \
|
||||
-G "Unix Makefiles" && \
|
||||
make && make install
|
||||
RUN rm -rf /tmp/pcre
|
||||
make && make install && \
|
||||
rm -rf /tmp/pcre && \
|
||||
cd /go && go get -u github.com/golang/dep/cmd/dep && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN go get -u github.com/golang/dep/cmd/dep
|
||||
WORKDIR /go/src/github.com/github/linguist/tools/grammars
|
||||
COPY . .
|
||||
|
||||
RUN dep ensure
|
||||
RUN go install ./cmd/grammar-compiler
|
||||
RUN dep ensure && go install ./cmd/grammar-compiler
|
||||
|
||||
ENTRYPOINT ["grammar-compiler"]
|
||||
|
||||
@@ -145,7 +145,10 @@ func (conv *Converter) ConvertGrammars(update bool) error {
|
||||
repo.FixRules(knownScopes)
|
||||
|
||||
if update {
|
||||
conv.grammars[source] = repo.Scopes()
|
||||
scopes := repo.Scopes()
|
||||
if len(scopes) > 0 {
|
||||
conv.grammars[source] = scopes
|
||||
}
|
||||
} else {
|
||||
expected := conv.grammars[source]
|
||||
repo.CompareScopes(expected)
|
||||
|
||||
@@ -108,6 +108,11 @@ func isValidGrammar(path string, info os.FileInfo) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Tree-Sitter grammars are not supported
|
||||
if strings.HasPrefix(filepath.Base(path), "tree-sitter-") {
|
||||
return false
|
||||
}
|
||||
|
||||
dir := filepath.Dir(path)
|
||||
ext := filepath.Ext(path)
|
||||
|
||||
@@ -117,7 +122,7 @@ func isValidGrammar(path string, info os.FileInfo) bool {
|
||||
case ".tmlanguage", ".yaml-tmlanguage":
|
||||
return true
|
||||
case ".cson", ".json":
|
||||
return strings.HasSuffix(dir, "/grammars")
|
||||
return strings.HasSuffix(dir, "/grammars") || strings.HasSuffix(dir, "/syntaxes")
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -14,14 +15,43 @@ type fsLoader struct {
|
||||
abspath string
|
||||
}
|
||||
|
||||
var preferredGrammars = map[string]int{
|
||||
".tmlanguage": 0,
|
||||
".cson": 1,
|
||||
".json": 1,
|
||||
".plist": 2,
|
||||
".yaml-tmlanguage": 3,
|
||||
}
|
||||
|
||||
func findPreferredExtension(ext []string) string {
|
||||
if len(ext) > 1 {
|
||||
sort.Slice(ext, func(i, j int) bool {
|
||||
a := strings.ToLower(ext[i])
|
||||
b := strings.ToLower(ext[j])
|
||||
return preferredGrammars[a] < preferredGrammars[b]
|
||||
})
|
||||
}
|
||||
return ext[0]
|
||||
}
|
||||
|
||||
func (l *fsLoader) findGrammars() (files []string, err error) {
|
||||
grammars := make(map[string][]string)
|
||||
|
||||
err = filepath.Walk(l.abspath,
|
||||
func(path string, info os.FileInfo, err error) error {
|
||||
if err == nil && isValidGrammar(path, info) {
|
||||
files = append(files, path)
|
||||
ext := filepath.Ext(path)
|
||||
base := path[0 : len(path)-len(ext)]
|
||||
grammars[base] = append(grammars[base], ext)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
for base, ext := range grammars {
|
||||
pref := findPreferredExtension(ext)
|
||||
files = append(files, base+pref)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
2
vendor/CodeMirror
vendored
2
vendor/CodeMirror
vendored
Submodule vendor/CodeMirror updated: 97290a687e...15d9d4e201
2
vendor/README.md
vendored
2
vendor/README.md
vendored
@@ -213,7 +213,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
|
||||
- **Marko:** [marko-js/marko-tmbundle](https://github.com/marko-js/marko-tmbundle)
|
||||
- **Mask:** [tenbits/sublime-mask](https://github.com/tenbits/sublime-mask)
|
||||
- **Mathematica:** [shadanan/mathematica-tmbundle](https://github.com/shadanan/mathematica-tmbundle)
|
||||
- **Matlab:** [textmate/matlab.tmbundle](https://github.com/textmate/matlab.tmbundle)
|
||||
- **Matlab:** [mathworks/MATLAB-Language-grammar](https://github.com/mathworks/MATLAB-Language-grammar)
|
||||
- **Maven POM:** [textmate/maven.tmbundle](https://github.com/textmate/maven.tmbundle)
|
||||
- **Max:** [textmate/json.tmbundle](https://github.com/textmate/json.tmbundle)
|
||||
- **MAXScript:** [Alhadis/language-maxscript](https://github.com/Alhadis/language-maxscript)
|
||||
|
||||
2
vendor/grammars/Docker.tmbundle
vendored
2
vendor/grammars/Docker.tmbundle
vendored
Submodule vendor/grammars/Docker.tmbundle updated: 41b5d53ca4...6e521ead6c
2
vendor/grammars/Elm
vendored
2
vendor/grammars/Elm
vendored
Submodule vendor/grammars/Elm updated: 581b9e6f5b...6bbbca9ccd
2
vendor/grammars/JSyntax
vendored
2
vendor/grammars/JSyntax
vendored
Submodule vendor/grammars/JSyntax updated: 4647952123...1a918545c8
1
vendor/grammars/MATLAB-Language-grammar
vendored
Submodule
1
vendor/grammars/MATLAB-Language-grammar
vendored
Submodule
Submodule vendor/grammars/MATLAB-Language-grammar added at ef1281a78f
2
vendor/grammars/NimLime
vendored
2
vendor/grammars/NimLime
vendored
Submodule vendor/grammars/NimLime updated: bf48175e71...443f9d48df
2
vendor/grammars/Stylus
vendored
2
vendor/grammars/Stylus
vendored
Submodule vendor/grammars/Stylus updated: 4b382d28fb...30908e3b57
2
vendor/grammars/SublimeEthereum
vendored
2
vendor/grammars/SublimeEthereum
vendored
Submodule vendor/grammars/SublimeEthereum updated: 396ba0fbef...ab901fdf94
2
vendor/grammars/TypeScript-TmLanguage
vendored
2
vendor/grammars/TypeScript-TmLanguage
vendored
Submodule vendor/grammars/TypeScript-TmLanguage updated: 4b614e2efd...0247d1444a
2
vendor/grammars/atom-language-julia
vendored
2
vendor/grammars/atom-language-julia
vendored
Submodule vendor/grammars/atom-language-julia updated: 4e8896ed0b...7803a437f8
2
vendor/grammars/atom-language-nextflow
vendored
2
vendor/grammars/atom-language-nextflow
vendored
Submodule vendor/grammars/atom-language-nextflow updated: a8a91d7e10...557669e2ae
2
vendor/grammars/atom-language-rust
vendored
2
vendor/grammars/atom-language-rust
vendored
Submodule vendor/grammars/atom-language-rust updated: 59893b659a...179f449a69
2
vendor/grammars/atom-language-stan
vendored
2
vendor/grammars/atom-language-stan
vendored
Submodule vendor/grammars/atom-language-stan updated: 0a79d383b7...3e3bbe67bf
2
vendor/grammars/chapel-tmbundle
vendored
2
vendor/grammars/chapel-tmbundle
vendored
Submodule vendor/grammars/chapel-tmbundle updated: fe50e0bf1e...c79a23e40b
2
vendor/grammars/d.tmbundle
vendored
2
vendor/grammars/d.tmbundle
vendored
Submodule vendor/grammars/d.tmbundle updated: 927f34339a...4e3b5eca5d
2
vendor/grammars/dartlang
vendored
2
vendor/grammars/dartlang
vendored
Submodule vendor/grammars/dartlang updated: 18fa15059b...85c0396407
2
vendor/grammars/elixir-tmbundle
vendored
2
vendor/grammars/elixir-tmbundle
vendored
Submodule vendor/grammars/elixir-tmbundle updated: f7cd93d6b4...441f6bb774
2
vendor/grammars/idl.tmbundle
vendored
2
vendor/grammars/idl.tmbundle
vendored
Submodule vendor/grammars/idl.tmbundle updated: 4853189bad...6895ac67f8
2
vendor/grammars/jflex.tmbundle
vendored
2
vendor/grammars/jflex.tmbundle
vendored
Submodule vendor/grammars/jflex.tmbundle updated: 12a7a88b7a...879cc0ebc9
2
vendor/grammars/language-agc
vendored
2
vendor/grammars/language-agc
vendored
Submodule vendor/grammars/language-agc updated: 645d332f50...6fb398ee11
2
vendor/grammars/language-apl
vendored
2
vendor/grammars/language-apl
vendored
Submodule vendor/grammars/language-apl updated: 3a951edcb8...1240b6fb99
2
vendor/grammars/language-babel
vendored
2
vendor/grammars/language-babel
vendored
Submodule vendor/grammars/language-babel updated: 656d5d3b42...4b43df39fe
2
vendor/grammars/language-ballerina
vendored
2
vendor/grammars/language-ballerina
vendored
Submodule vendor/grammars/language-ballerina updated: 91c724bec6...3d7c2793b1
2
vendor/grammars/language-blade
vendored
2
vendor/grammars/language-blade
vendored
Submodule vendor/grammars/language-blade updated: 5b2611c46b...8586e34a66
2
vendor/grammars/language-clojure
vendored
2
vendor/grammars/language-clojure
vendored
Submodule vendor/grammars/language-clojure updated: eade1d0401...a6dcd90d25
2
vendor/grammars/language-coffee-script
vendored
2
vendor/grammars/language-coffee-script
vendored
Submodule vendor/grammars/language-coffee-script updated: b0465e3e80...0ce1815211
2
vendor/grammars/language-crystal
vendored
2
vendor/grammars/language-crystal
vendored
Submodule vendor/grammars/language-crystal updated: 6e966bb589...17a8dfa66b
2
vendor/grammars/language-csharp
vendored
2
vendor/grammars/language-csharp
vendored
Submodule vendor/grammars/language-csharp updated: 364ba38ee2...cc00335ae8
2
vendor/grammars/language-csound
vendored
2
vendor/grammars/language-csound
vendored
Submodule vendor/grammars/language-csound updated: b24783820b...b6cfb93ef4
2
vendor/grammars/language-css
vendored
2
vendor/grammars/language-css
vendored
Submodule vendor/grammars/language-css updated: f4e032d6f3...d57ce703cd
2
vendor/grammars/language-cwl
vendored
2
vendor/grammars/language-cwl
vendored
Submodule vendor/grammars/language-cwl updated: 204ab237d3...f3b938f1da
2
vendor/grammars/language-emacs-lisp
vendored
2
vendor/grammars/language-emacs-lisp
vendored
Submodule vendor/grammars/language-emacs-lisp updated: ee4168aeac...def2b3e032
2
vendor/grammars/language-gfm
vendored
2
vendor/grammars/language-gfm
vendored
Submodule vendor/grammars/language-gfm updated: 76ddd7e2fd...1a81e5f1ca
2
vendor/grammars/language-haskell
vendored
2
vendor/grammars/language-haskell
vendored
Submodule vendor/grammars/language-haskell updated: c8778adf83...730e3c34d7
2
vendor/grammars/language-javascript
vendored
2
vendor/grammars/language-javascript
vendored
Submodule vendor/grammars/language-javascript updated: 58cb09d773...4b1b2fcca0
2
vendor/grammars/language-less
vendored
2
vendor/grammars/language-less
vendored
Submodule vendor/grammars/language-less updated: c244adad61...15411a47c0
2
vendor/grammars/language-maxscript
vendored
2
vendor/grammars/language-maxscript
vendored
Submodule vendor/grammars/language-maxscript updated: 56f89d2715...d873ebb6b8
2
vendor/grammars/language-pan
vendored
2
vendor/grammars/language-pan
vendored
Submodule vendor/grammars/language-pan updated: 47914b9872...fc6c535a6a
2
vendor/grammars/language-pcb
vendored
2
vendor/grammars/language-pcb
vendored
Submodule vendor/grammars/language-pcb updated: bc4ba99fbd...3d27661a97
2
vendor/grammars/language-restructuredtext
vendored
2
vendor/grammars/language-restructuredtext
vendored
Submodule vendor/grammars/language-restructuredtext updated: 61a0a6b4ba...a4b230f8d8
2
vendor/grammars/language-roff
vendored
2
vendor/grammars/language-roff
vendored
Submodule vendor/grammars/language-roff updated: 0b77518f17...34a71f8c56
2
vendor/grammars/language-shellscript
vendored
2
vendor/grammars/language-shellscript
vendored
Submodule vendor/grammars/language-shellscript updated: 152ffbd359...6c4a3f7c39
2
vendor/grammars/language-viml
vendored
2
vendor/grammars/language-viml
vendored
Submodule vendor/grammars/language-viml updated: f405a61327...87ac83b917
2
vendor/grammars/language-wavefront
vendored
2
vendor/grammars/language-wavefront
vendored
Submodule vendor/grammars/language-wavefront updated: 4bebab3f9a...ac1ef19761
2
vendor/grammars/marko-tmbundle
vendored
2
vendor/grammars/marko-tmbundle
vendored
Submodule vendor/grammars/marko-tmbundle updated: 36732334f3...75d334b6b7
1
vendor/grammars/matlab.tmbundle
vendored
1
vendor/grammars/matlab.tmbundle
vendored
Submodule vendor/grammars/matlab.tmbundle deleted from 2cdc1f8414
2
vendor/grammars/pawn-sublime-language
vendored
2
vendor/grammars/pawn-sublime-language
vendored
Submodule vendor/grammars/pawn-sublime-language updated: 8b115b302f...d6b6690caa
2
vendor/grammars/powershell
vendored
2
vendor/grammars/powershell
vendored
Submodule vendor/grammars/powershell updated: b4ea52c51c...61eac16114
2
vendor/grammars/rascal-syntax-highlighting
vendored
2
vendor/grammars/rascal-syntax-highlighting
vendored
Submodule vendor/grammars/rascal-syntax-highlighting updated: 3388b060f4...3032840be2
2
vendor/grammars/sublime-glsl
vendored
2
vendor/grammars/sublime-glsl
vendored
Submodule vendor/grammars/sublime-glsl updated: 8b47c2f844...0b60caf056
2
vendor/grammars/sublime-mask
vendored
2
vendor/grammars/sublime-mask
vendored
Submodule vendor/grammars/sublime-mask updated: a9c981e66a...ac22df6662
2
vendor/grammars/sublime-nearley
vendored
2
vendor/grammars/sublime-nearley
vendored
Submodule vendor/grammars/sublime-nearley updated: a2ed99ef50...e45515f8d2
2
vendor/grammars/sublime-rexx
vendored
2
vendor/grammars/sublime-rexx
vendored
Submodule vendor/grammars/sublime-rexx updated: 5352891ae4...4bccb3784f
2
vendor/grammars/sublime-spintools
vendored
2
vendor/grammars/sublime-spintools
vendored
Submodule vendor/grammars/sublime-spintools updated: 32de20d948...c661bf71a2
2
vendor/grammars/sublime-varnish
vendored
2
vendor/grammars/sublime-varnish
vendored
Submodule vendor/grammars/sublime-varnish updated: 4915dcb3f1...c129dce0f1
2
vendor/grammars/sublime_cobol
vendored
2
vendor/grammars/sublime_cobol
vendored
Submodule vendor/grammars/sublime_cobol updated: f9a840a846...1b5b100d47
2
vendor/grammars/sublimeprolog
vendored
2
vendor/grammars/sublimeprolog
vendored
Submodule vendor/grammars/sublimeprolog updated: 555af289e0...29a6f0bac1
2
vendor/grammars/sublimetext-cuda-cpp
vendored
2
vendor/grammars/sublimetext-cuda-cpp
vendored
Submodule vendor/grammars/sublimetext-cuda-cpp updated: e51269fc22...2bf66d1532
2
vendor/grammars/vue-syntax-highlight
vendored
2
vendor/grammars/vue-syntax-highlight
vendored
Submodule vendor/grammars/vue-syntax-highlight updated: 52a41f4074...5c2b5afbb3
Submodule vendor/grammars/wdl-sublime-syntax-highlighter updated: 403407906d...810fcf2ee8
14
vendor/licenses/grammar/MATLAB-Language-grammar.txt
vendored
Normal file
14
vendor/licenses/grammar/MATLAB-Language-grammar.txt
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
type: grammar
|
||||
name: MATLAB-Language-grammar
|
||||
license: bsd-2-clause
|
||||
---
|
||||
Copyright 2018 The MathWorks, Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
Reference in New Issue
Block a user