mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d761658f8b | ||
|
|
3719214aba | ||
|
|
47b109be36 | ||
|
|
1ec4db97c2 | ||
|
|
9fe5fe0de2 | ||
|
|
b36ea7ac9d | ||
|
|
625b06c30d | ||
|
|
28bce533b2 | ||
|
|
93ec1922cb | ||
|
|
5d09fb67dd | ||
|
|
93dcb61742 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
*.gem
|
||||
/Gemfile.lock
|
||||
.bundle/
|
||||
.idea
|
||||
|
||||
8
.gitmodules
vendored
8
.gitmodules
vendored
@@ -244,15 +244,12 @@
|
||||
[submodule "vendor/grammars/cpp-qt.tmbundle"]
|
||||
path = vendor/grammars/cpp-qt.tmbundle
|
||||
url = https://github.com/textmate/cpp-qt.tmbundle
|
||||
[submodule "vendor/grammars/css.tmbundle"]
|
||||
path = vendor/grammars/css.tmbundle
|
||||
url = https://github.com/textmate/css.tmbundle
|
||||
[submodule "vendor/grammars/d.tmbundle"]
|
||||
path = vendor/grammars/d.tmbundle
|
||||
url = https://github.com/textmate/d.tmbundle
|
||||
[submodule "vendor/grammars/diff.tmbundle"]
|
||||
path = vendor/grammars/diff.tmbundle
|
||||
url = https://github.com/kivikakk/diff.tmbundle
|
||||
url = https://github.com/textmate/diff.tmbundle
|
||||
[submodule "vendor/grammars/dylan.tmbundle"]
|
||||
path = vendor/grammars/dylan.tmbundle
|
||||
url = https://github.com/textmate/dylan.tmbundle
|
||||
@@ -815,3 +812,6 @@
|
||||
[submodule "vendor/grammars/atom-language-rust"]
|
||||
path = vendor/grammars/atom-language-rust
|
||||
url = https://github.com/zargony/atom-language-rust
|
||||
[submodule "vendor/grammars/language-css"]
|
||||
path = vendor/grammars/language-css
|
||||
url = https://github.com/atom/language-css
|
||||
|
||||
@@ -17,7 +17,7 @@ To add support for a new extension:
|
||||
In addition, if this extension is already listed in [`languages.yml`][languages] then sometimes a few more steps will need to be taken:
|
||||
|
||||
0. Make sure that example `.yourextension` files are present in the [samples directory][samples] for each language that uses `.yourextension`.
|
||||
0. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.yourextension` files. (ping **@arfon** or **@bkeepers** to help with this) to ensure we're not misclassifying files.
|
||||
0. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.yourextension` files. (ping **@bkeepers** to help with this) to ensure we're not misclassifying files.
|
||||
0. If the Bayesian classifier does a bad job with the sample `.yourextension` files then a [heuristic](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb) may need to be written to help.
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ To add support for a new language:
|
||||
In addition, if your new language defines an extension that's already listed in [`languages.yml`][languages] (such as `.foo`) then sometimes a few more steps will need to be taken:
|
||||
|
||||
0. Make sure that example `.foo` files are present in the [samples directory][samples] for each language that uses `.foo`.
|
||||
0. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.foo` files. (ping **@arfon** or **@bkeepers** to help with this) to ensure we're not misclassifying files.
|
||||
0. Test the performance of the Bayesian classifier with a relatively large number (1000s) of sample `.foo` files. (ping **@bkeepers** to help with this) to ensure we're not misclassifying files.
|
||||
0. If the Bayesian classifier does a bad job with the sample `.foo` files then a [heuristic](https://github.com/github/linguist/blob/master/lib/linguist/heuristics.rb) may need to be written to help.
|
||||
|
||||
Remember, the goal here is to try and avoid false positives!
|
||||
@@ -80,7 +80,6 @@ Here's our current build status: [
|
||||
- **@larsbrinkhoff**
|
||||
- **@lildude** (GitHub staff)
|
||||
|
||||
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
||||
s.add_dependency 'charlock_holmes', '~> 0.7.3'
|
||||
s.add_dependency 'escape_utils', '~> 1.1.0'
|
||||
s.add_dependency 'mime-types', '>= 1.19'
|
||||
s.add_dependency 'rugged', '0.25.0b10'
|
||||
s.add_dependency 'rugged', '0.25.1.1'
|
||||
|
||||
s.add_development_dependency 'minitest', '>= 5.0'
|
||||
s.add_development_dependency 'mocha'
|
||||
|
||||
@@ -234,8 +234,6 @@ vendor/grammars/cpp-qt.tmbundle:
|
||||
- source.qmake
|
||||
vendor/grammars/creole:
|
||||
- text.html.creole
|
||||
vendor/grammars/css.tmbundle:
|
||||
- source.css
|
||||
vendor/grammars/cucumber-tmbundle:
|
||||
- source.ruby.rspec.cucumber.steps
|
||||
- text.gherkin.feature
|
||||
@@ -369,6 +367,8 @@ vendor/grammars/language-csound:
|
||||
- source.csound
|
||||
- source.csound-document
|
||||
- source.csound-score
|
||||
vendor/grammars/language-css:
|
||||
- source.css
|
||||
vendor/grammars/language-emacs-lisp:
|
||||
- source.emacs.lisp
|
||||
vendor/grammars/language-fontforge:
|
||||
|
||||
@@ -80,7 +80,8 @@ module Linguist
|
||||
generated_jflex? ||
|
||||
generated_grammarkit? ||
|
||||
generated_roxygen2? ||
|
||||
generated_jison?
|
||||
generated_jison? ||
|
||||
generated_yarn_lock?
|
||||
end
|
||||
|
||||
# Internal: Is the blob an Xcode file?
|
||||
@@ -479,5 +480,14 @@ module Linguist
|
||||
return lines[0].start_with?("/* parser generated by jison ") ||
|
||||
lines[0].start_with?("/* generated by jison-lex ")
|
||||
end
|
||||
|
||||
# Internal: Is the blob a generated yarn lockfile?
|
||||
#
|
||||
# Returns true or false.
|
||||
def generated_yarn_lock?
|
||||
return false unless name.match(/yarn\.lock/)
|
||||
return false unless lines.count > 0
|
||||
return lines[0].include?("# THIS IS AN AUTOGENERATED FILE")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -278,7 +278,7 @@ module Linguist
|
||||
disambiguate ".mod" do |data|
|
||||
if data.include?('<!ENTITY ')
|
||||
Language["XML"]
|
||||
elsif /MODULE\s\w+\s*;/i.match(data) || /^\s*END \w+;$/i.match(data)
|
||||
elsif /^\s*MODULE [\w\.]+;/i.match(data) || /^\s*END [\w\.]+;/i.match(data)
|
||||
Language["Modula-2"]
|
||||
else
|
||||
[Language["Linux Kernel Module"], Language["AMPL"]]
|
||||
|
||||
@@ -215,7 +215,14 @@ module Linguist
|
||||
# Returns the Language or nil if none was found.
|
||||
def self.[](name)
|
||||
return nil if name.to_s.empty?
|
||||
name && (@index[name.downcase] || @index[name.split(',').first.downcase])
|
||||
|
||||
lang = @index[name.downcase]
|
||||
return lang if lang
|
||||
|
||||
name = name.split(',').first
|
||||
return nil if name.to_s.empty?
|
||||
|
||||
@index[name.downcase]
|
||||
end
|
||||
|
||||
# Public: A List of popular languages
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
module Linguist
|
||||
VERSION = "5.0.1"
|
||||
VERSION = "5.0.4"
|
||||
end
|
||||
|
||||
@@ -51,7 +51,7 @@ SUBMODULES.partition { |submodule| SLOW_SUBMODULES.include?(submodule) }.flatten
|
||||
submodules.push(submodule)
|
||||
end
|
||||
|
||||
8.times do
|
||||
(ARGV.first || 8).to_i.times do
|
||||
Thread.new { run_thread(submodules, results) }
|
||||
end
|
||||
|
||||
|
||||
9
test/fixtures/Data/yarn.lock
vendored
Normal file
9
test/fixtures/Data/yarn.lock
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
abab@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d"
|
||||
|
||||
abbrev@1, abbrev@1.0.x:
|
||||
version "1.0.9"
|
||||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135"
|
||||
@@ -79,6 +79,9 @@ class TestGenerated < Minitest::Test
|
||||
generated_fixture_loading_data("Data/sourcemap.v3.map")
|
||||
generated_fixture_loading_data("Data/sourcemap.v1.map")
|
||||
|
||||
# Yarn locfile
|
||||
generated_fixture_loading_data("Data/yarn.lock")
|
||||
|
||||
# Specflow
|
||||
generated_fixture_without_loading_data("Features/BindingCulture.feature.cs")
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ class TestGrammars < Minitest::Test
|
||||
"241e5ddbb4423d792216783e9f668bd670b026e4", # ant.tmbundle
|
||||
"bdab9fdc21e6790b479ccb5945b78bc0f6ce2493", # language-blade
|
||||
"81711c69aa40135de7266c88b2f6ab28dbc1d81e", # atom-language-perl6
|
||||
"808e27f5e44167113198d277f47926c5d482eac8" # atom-language-rust
|
||||
"808e27f5e44167113198d277f47926c5d482eac8", # atom-language-rust
|
||||
"304be6184f7f344d44a1d13bddf511019624fd22", # language-css
|
||||
].freeze
|
||||
|
||||
# List of allowed SPDX license names
|
||||
|
||||
@@ -460,4 +460,8 @@ class TestLanguage < Minitest::Test
|
||||
assert !language.color, "Unused colour assigned to #{language.name}"
|
||||
end
|
||||
end
|
||||
|
||||
def test_non_crash_on_comma
|
||||
assert_nil Language[',']
|
||||
end
|
||||
end
|
||||
|
||||
2
vendor/CodeMirror
vendored
2
vendor/CodeMirror
vendored
Submodule vendor/CodeMirror updated: 0fb17df669...268cf99055
4
vendor/README.md
vendored
4
vendor/README.md
vendored
@@ -76,7 +76,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
|
||||
- **Csound:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound)
|
||||
- **Csound Document:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound)
|
||||
- **Csound Score:** [nwhetsell/language-csound](https://github.com/nwhetsell/language-csound)
|
||||
- **CSS:** [textmate/css.tmbundle](https://github.com/textmate/css.tmbundle)
|
||||
- **CSS:** [atom/language-css](https://github.com/atom/language-css)
|
||||
- **Cuda:** [harrism/sublimetext-cuda-cpp](https://github.com/harrism/sublimetext-cuda-cpp)
|
||||
- **Cycript:** [atom/language-javascript](https://github.com/atom/language-javascript)
|
||||
- **Cython:** [textmate/cython.tmbundle](https://github.com/textmate/cython.tmbundle)
|
||||
@@ -84,7 +84,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting
|
||||
- **D-ObjDump:** [nanoant/assembly.tmbundle](https://github.com/nanoant/assembly.tmbundle)
|
||||
- **Dart:** [guillermooo/dart-sublime-bundle](https://github.com/guillermooo/dart-sublime-bundle)
|
||||
- **desktop:** [Mailaender/desktop.tmbundle](https://github.com/Mailaender/desktop.tmbundle)
|
||||
- **Diff:** [textmate/diff.tmbundle](https://github.com/textmate/diff.tmbundle)
|
||||
- **Diff:** [kivikakk/diff.tmbundle](https://github.com/kivikakk/diff.tmbundle)
|
||||
- **DM:** [PJB3005/atomic-dreams](https://github.com/PJB3005/atomic-dreams)
|
||||
- **DNS Zone:** [sixty4k/st2-zonefile](https://github.com/sixty4k/st2-zonefile)
|
||||
- **Dockerfile:** [asbjornenge/Docker.tmbundle](https://github.com/asbjornenge/Docker.tmbundle)
|
||||
|
||||
2
vendor/grammars/Elm
vendored
2
vendor/grammars/Elm
vendored
Submodule vendor/grammars/Elm updated: 8e8af4a712...64315b1f86
2
vendor/grammars/SublimePapyrus
vendored
2
vendor/grammars/SublimePapyrus
vendored
Submodule vendor/grammars/SublimePapyrus updated: 374ebd6444...b87e7c5238
2
vendor/grammars/applescript.tmbundle
vendored
2
vendor/grammars/applescript.tmbundle
vendored
Submodule vendor/grammars/applescript.tmbundle updated: 5067ef67a5...df46dd96d8
2
vendor/grammars/atom-language-perl6
vendored
2
vendor/grammars/atom-language-perl6
vendored
Submodule vendor/grammars/atom-language-perl6 updated: 6896ff2a72...519adffd86
2
vendor/grammars/atom-language-rust
vendored
2
vendor/grammars/atom-language-rust
vendored
Submodule vendor/grammars/atom-language-rust updated: 2f514baad7...092cc6a8a0
1
vendor/grammars/css.tmbundle
vendored
1
vendor/grammars/css.tmbundle
vendored
Submodule vendor/grammars/css.tmbundle deleted from d79e9c0137
2
vendor/grammars/diff.tmbundle
vendored
2
vendor/grammars/diff.tmbundle
vendored
Submodule vendor/grammars/diff.tmbundle updated: 372abaaeb1...0593bb775e
2
vendor/grammars/elixir-tmbundle
vendored
2
vendor/grammars/elixir-tmbundle
vendored
Submodule vendor/grammars/elixir-tmbundle updated: 319bbe2022...50846fe555
2
vendor/grammars/language-blade
vendored
2
vendor/grammars/language-blade
vendored
Submodule vendor/grammars/language-blade updated: 14104c18a9...0282a2c5aa
2
vendor/grammars/language-csharp
vendored
2
vendor/grammars/language-csharp
vendored
Submodule vendor/grammars/language-csharp updated: 71b8930b31...f1462897f9
2
vendor/grammars/language-csound
vendored
2
vendor/grammars/language-csound
vendored
Submodule vendor/grammars/language-csound updated: 8f8668a38e...c1c5b4db72
1
vendor/grammars/language-css
vendored
Submodule
1
vendor/grammars/language-css
vendored
Submodule
Submodule vendor/grammars/language-css added at 5d4af2db39
2
vendor/grammars/language-javascript
vendored
2
vendor/grammars/language-javascript
vendored
Submodule vendor/grammars/language-javascript updated: 31ec605571...245162fea4
2
vendor/grammars/language-less
vendored
2
vendor/grammars/language-less
vendored
Submodule vendor/grammars/language-less updated: ce6a54dd17...c9abeea663
2
vendor/grammars/language-rpm-spec
vendored
2
vendor/grammars/language-rpm-spec
vendored
Submodule vendor/grammars/language-rpm-spec updated: 549b424107...b639f16683
2
vendor/grammars/language-shellscript
vendored
2
vendor/grammars/language-shellscript
vendored
Submodule vendor/grammars/language-shellscript updated: 3cd0b6bb5e...29eecbc416
2
vendor/grammars/language-yaml
vendored
2
vendor/grammars/language-yaml
vendored
Submodule vendor/grammars/language-yaml updated: 6be651ae57...252a0c19c6
2
vendor/grammars/latex.tmbundle
vendored
2
vendor/grammars/latex.tmbundle
vendored
Submodule vendor/grammars/latex.tmbundle updated: acbc3453c4...4f20bf6e8c
2
vendor/grammars/perl.tmbundle
vendored
2
vendor/grammars/perl.tmbundle
vendored
Submodule vendor/grammars/perl.tmbundle updated: 7a786e331d...c0b7a4bd65
2
vendor/grammars/php.tmbundle
vendored
2
vendor/grammars/php.tmbundle
vendored
Submodule vendor/grammars/php.tmbundle updated: 010cc1c22c...3ed4837b43
2
vendor/grammars/reason
vendored
2
vendor/grammars/reason
vendored
Submodule vendor/grammars/reason updated: 77ede65142...f18549ccd3
15
vendor/licenses/grammar/css.tmbundle.txt
vendored
15
vendor/licenses/grammar/css.tmbundle.txt
vendored
@@ -1,15 +0,0 @@
|
||||
---
|
||||
type: grammar
|
||||
name: css.tmbundle
|
||||
license: permissive
|
||||
curated: true
|
||||
---
|
||||
|
||||
If not otherwise specified (see below), files in this repository fall under the following license:
|
||||
|
||||
Permission to copy, use, modify, sell and distribute this
|
||||
software is granted. This software is provided "as is" without
|
||||
express or implied warranty, and with no claim as to its
|
||||
suitability for any purpose.
|
||||
|
||||
An exception is made for files in readable text which contain their own license information, or files where an accompanying file exists (in the same directory) with a “-license” suffix added to the base-name name of the original file, and an extension of txt, html, or similar. For example “tidy” is accompanied by “tidy-license.txt”.
|
||||
36
vendor/licenses/grammar/language-css.txt
vendored
Normal file
36
vendor/licenses/grammar/language-css.txt
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
type: grammar
|
||||
name: language-css
|
||||
license: mit
|
||||
---
|
||||
Copyright (c) 2014 GitHub Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
--------------------------------------------------------------------
|
||||
|
||||
This package was derived from a TextMate bundle located at
|
||||
https://github.com/textmate/css.tmbundle and distributed under the following
|
||||
license, located in `README.mdown`:
|
||||
|
||||
Permission to copy, use, modify, sell and distribute this
|
||||
software is granted. This software is provided "as is" without
|
||||
express or implied warranty, and with no claim as to its
|
||||
suitability for any purpose.
|
||||
Reference in New Issue
Block a user