Compare commits

...

11 Commits

Author SHA1 Message Date
Colin Seymour
fb77fdcd53 Update submod sha 2018-02-12 14:12:16 +00:00
Colin Seymour
5306d65e79 Force use of my test branch 2018-02-12 14:07:26 +00:00
Colin Seymour
24fa4c82f3 Use lildude's fork 2018-02-12 13:56:06 +00:00
Nathaniel J. Smith
2abf488e65 Treat "python3" as an alias for "python" (#4026)
Pygments has separate highlighters for "python" (meaning python 2) and "python3" (meaning python 3). As a result, there are lots of files out there (especially ReSTructured text) that contain code blocks whose language is explicitly given as "python3" or "py3". Currently these are unrecognized by linguist. Instead, we should use our python highlighter for them (which works for both python 2 and python 3).

References:
  http://pygments.org/docs/lexers/#pygments.lexers.python.Python3Lexer
  https://github.com/github/markup/issues/1019
  https://github.com/python-trio/async_generator/pull/12
2018-02-08 09:52:21 +00:00
Tobias V. Langhoff
812797b51d Add "asm" as alias for assembly (#4019) 2018-01-31 11:56:47 +00:00
Tobias V. Langhoff
dc32876113 Fix anchor link in README.md (#4018) 2018-01-30 21:41:45 +01:00
Colin Seymour
a18ad1d489 Release v6.0.1 (#4016)
* Update grammar submodule refs

* Bump version to v.6.0.1
2018-01-30 15:17:58 +00:00
Vicent Martí
25ac140d58 compiler: Allow loading grammars from syntaxes folder (#4015) 2018-01-30 12:49:28 +01:00
Vicent Martí
f7835f7119 compiler: Do not load TreeSitter grammars (#4013) 2018-01-29 18:14:14 +01:00
Vicent Martí
a7f835a653 compiler: Prefer specific grammar formats (#4012)
* compiler: Simplify the Dockerfile

* compiler: Prefer grammar extensions based on type
2018-01-29 14:40:23 +01:00
Ilias Van Peer
6220286f42 Re-enable Elm support (#4007)
The submodule was pointing to a repo which no longer has a tmLanguage
definition. We've now reinstated such a repo, with a tmLanguage file
existing in the master branch.

Since we reinstated this repo with the same name (as the old name
redirected to a new repo), the commit used is the only change.
2018-01-28 09:22:47 +00:00
17 changed files with 67 additions and 34 deletions

7
.gitmodules vendored
View File

@@ -739,9 +739,6 @@
[submodule "vendor/grammars/language-emacs-lisp"]
path = vendor/grammars/language-emacs-lisp
url = https://github.com/Alhadis/language-emacs-lisp
[submodule "vendor/grammars/language-babel"]
path = vendor/grammars/language-babel
url = https://github.com/github-linguist/language-babel
[submodule "vendor/CodeMirror"]
path = vendor/CodeMirror
url = https://github.com/codemirror/CodeMirror
@@ -898,3 +895,7 @@
[submodule "vendor/grammars/atom-language-nextflow"]
path = vendor/grammars/atom-language-nextflow
url = https://github.com/nextflow-io/atom-language-nextflow
[submodule "vendor/grammars/language-babel"]
path = vendor/grammars/language-babel
url = https://github.com/lildude/language-babel
branch = make-pcre-friendly

View File

@@ -97,7 +97,7 @@ If the language stats bar is reporting a language that you don't expect:
1. If the files are misclassified, search for [open issues][issues] to see if anyone else has already reported the issue. Any information you can add, especially links to public repositories, is helpful. You can also use the [manual overrides](#overrides) feature to correctly classify them in your repository.
1. If there are no reported issues of this misclassification, [open an issue][new-issue] and include a link to the repository or a sample of the code that is being misclassified.
Keep in mind that the repository language stats are only [updated when you push changes](#how-linguist-works-on-github-com), and the results are cached for the lifetime of your repository. If you have not made any changes to your repository in a while, you may find pushing another change will correct the stats.
Keep in mind that the repository language stats are only [updated when you push changes](#how-linguist-works-on-githubcom), and the results are cached for the lifetime of your repository. If you have not made any changes to your repository in a while, you may find pushing another change will correct the stats.
### My repository isn't showing my language

View File

@@ -301,6 +301,7 @@ Assembly:
type: programming
color: "#6E4C13"
aliases:
- asm
- nasm
extensions:
- ".asm"
@@ -3631,6 +3632,7 @@ Python:
- python3
aliases:
- rusthon
- python3
language_id: 303
Python console:
type: programming

View File

@@ -1,3 +1,3 @@
module Linguist
VERSION = "6.0.0"
VERSION = "6.0.1"
end

View File

@@ -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"]

View File

@@ -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
}

View File

@@ -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/README.md vendored
View File

@@ -181,7 +181,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
- **JSON5:** [atom/language-javascript](https://github.com/atom/language-javascript)
- **JSONiq:** [wcandillon/language-jsoniq](https://github.com/wcandillon/language-jsoniq)
- **JSONLD:** [atom/language-javascript](https://github.com/atom/language-javascript)
- **JSX:** [github-linguist/language-babel](https://github.com/github-linguist/language-babel)
- **JSX:** [lildude/language-babel](https://github.com/lildude/language-babel)
- **Julia:** [JuliaEditorSupport/atom-language-julia](https://github.com/JuliaEditorSupport/atom-language-julia)
- **Jupyter Notebook:** [textmate/json.tmbundle](https://github.com/textmate/json.tmbundle)
- **KiCad Layout:** [Alhadis/language-pcb](https://github.com/Alhadis/language-pcb)