mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-08 20:38:47 +00:00
Merge pull request #1 from pchaigno/pythonmultiline
Multiline comments for Python during tokenization
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,4 @@
|
|||||||
Gemfile.lock
|
/Gemfile.lock
|
||||||
.bundle/
|
.bundle/
|
||||||
benchmark/
|
benchmark/
|
||||||
lib/linguist/samples.json
|
lib/linguist/samples.json
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ before_install:
|
|||||||
- git fetch origin master:master
|
- git fetch origin master:master
|
||||||
- git fetch origin v2.0.0:v2.0.0
|
- git fetch origin v2.0.0:v2.0.0
|
||||||
- git fetch origin test/attributes:test/attributes
|
- git fetch origin test/attributes:test/attributes
|
||||||
|
- git fetch origin test/master:test/master
|
||||||
- sudo apt-get install libicu-dev -y
|
- sudo apt-get install libicu-dev -y
|
||||||
rvm:
|
rvm:
|
||||||
- 1.9.3
|
- 1.9.3
|
||||||
|
|||||||
31
CONTRIBUTING.md
Normal file
31
CONTRIBUTING.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
## Contributing
|
||||||
|
|
||||||
|
The majority of contributions won't need to touch any Ruby code at all. The [master language list][languages] is just a YAML configuration file.
|
||||||
|
|
||||||
|
Almost all bug fixes or new language additions should come with some additional code samples. Just drop them under [`samples/`][samples] in the correct subdirectory and our test suite will automatically test them. In most cases you shouldn't need to add any new assertions.
|
||||||
|
|
||||||
|
### My code is detected as the wrong language
|
||||||
|
|
||||||
|
This can usually be solved either by adding a new filename or file name extension to the language's entry in [`languages.yml`][languages] or adding more [samples][samples] for your language to the repository to make Linguist's classifier smarter.
|
||||||
|
|
||||||
|
### Syntax highlighting looks wrong
|
||||||
|
|
||||||
|
Assuming your code is being detected as the right language (see above), in most cases this is due to a bug in the language grammar rather than a bug in Linguist. [`grammars.yml`][grammars] lists all the grammars we use for syntax highlighting on github.com. Find the one corresponding to your code's programming language and submit a bug report upstream.
|
||||||
|
|
||||||
|
You can also try to fix the bug yourself and submit a Pull Request. [This piece from TextMate's documentation](http://manual.macromates.com/en/language_grammars) offers a good introduction on how to work with TextMate-compatible grammars.
|
||||||
|
|
||||||
|
Once the bug has been fixed upstream, please let us know and we'll pick it up for GitHub.
|
||||||
|
|
||||||
|
### I want to add support for the `X` programming language
|
||||||
|
|
||||||
|
Great! You'll need to:
|
||||||
|
|
||||||
|
0. Add an entry for your language to [`languages.yml`][languages].
|
||||||
|
0. Add a grammar for your language to [`grammars.yml`][grammars] by running `script/download-grammars --add URL`. Please only add grammars that have a license that permits redistribution.
|
||||||
|
0. Add samples for your language to the [samples directory][samples].
|
||||||
|
|
||||||
|
We try only to add languages once they have some usage on GitHub, so please note in-the-wild usage examples in your pull request. In most cases we prefer that languages already be in use in hundreds of repositories before supporting them in Linguist.
|
||||||
|
|
||||||
|
[grammars]: /grammars.yml
|
||||||
|
[languages]: /lib/linguist/languages.yml
|
||||||
|
[samples]: /samples
|
||||||
20
README.md
20
README.md
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
We use this library at GitHub to detect blob languages, ignore binary files, suppress generated files in diffs, and generate language breakdown graphs.
|
We use this library at GitHub to detect blob languages, ignore binary files, suppress generated files in diffs, and generate language breakdown graphs.
|
||||||
|
|
||||||
|
Tips for filing issues and creating pull requests can be found in [`CONTRIBUTING.md`](/CONTRIBUTING.md).
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
### Language detection
|
### Language detection
|
||||||
@@ -26,15 +28,7 @@ See [lib/linguist/language.rb](https://github.com/github/linguist/blob/master/li
|
|||||||
|
|
||||||
Syntax highlighting in GitHub is performed using TextMate-compatible grammars. These are the same grammars that TextMate, Sublime Text and Atom use.
|
Syntax highlighting in GitHub is performed using TextMate-compatible grammars. These are the same grammars that TextMate, Sublime Text and Atom use.
|
||||||
|
|
||||||
Every language in `languages.yml` is mapped to its corresponding TM `scope`. This scope will be used when picking up a grammar for highlighting. **When adding a new language to Linguist, please add its corrsponding scope too (assuming there's an existing TextMate bundle) so syntax highlighting works for it**.
|
Every language in `languages.yml` is mapped to its corresponding TM `scope`. This scope will be used when picking up a grammar for highlighting. **When adding a new language to Linguist, please add its corresponding scope too (assuming there's an existing TextMate bundle, Sublime Text package, or Atom package) so syntax highlighting works for it**.
|
||||||
|
|
||||||
#### I found a bug!
|
|
||||||
|
|
||||||
The `grammars.yml` file contains the list of all the repositories where we fetch TextMate grammars for highlighting. If you find a bug in the highlighting for any given language, please consult this Grammars list to find the source of the grammar, and submit the bug report upstream.
|
|
||||||
|
|
||||||
You can also try to fix the bug yourself and submit a Pull Request. [This piece from TextMate's documentation](http://manual.macromates.com/en/language_grammars) offers a good introduction on how to work with TextMate-compatible grammars.
|
|
||||||
|
|
||||||
Once the bug has been fixed upstream, please let us know and we'll pick it up for GitHub.
|
|
||||||
|
|
||||||
### Stats
|
### Stats
|
||||||
|
|
||||||
@@ -153,14 +147,6 @@ To run the tests:
|
|||||||
|
|
||||||
bundle exec rake test
|
bundle exec rake test
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
The majority of contributions won't need to touch any Ruby code at all. The [master language list](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml) is just a YAML configuration file.
|
|
||||||
|
|
||||||
We try to only add languages once they have some usage on GitHub, so please note in-the-wild usage examples in your pull request.
|
|
||||||
|
|
||||||
Almost all bug fixes or new language additions should come with some additional code samples. Just drop them under [`samples/`](https://github.com/github/linguist/tree/master/samples) in the correct subdirectory and our test suite will automatically test them. In most cases you shouldn't need to add any new assertions.
|
|
||||||
|
|
||||||
### A note on language extensions
|
### A note on language extensions
|
||||||
|
|
||||||
Linguist has a number of methods available to it for identifying the language of a particular file. The initial lookup is based upon the extension of the file, possible file extensions are defined in an array called `extensions`. Take a look at this example for example for `Perl`:
|
Linguist has a number of methods available to it for identifying the language of a particular file. The initial lookup is based upon the extension of the file, possible file extensions are defined in an array called `extensions`. Take a look at this example for example for `Perl`:
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ Gem::Specification.new do |s|
|
|||||||
|
|
||||||
s.add_dependency 'charlock_holmes', '~> 0.7.3'
|
s.add_dependency 'charlock_holmes', '~> 0.7.3'
|
||||||
s.add_dependency 'escape_utils', '~> 1.0.1'
|
s.add_dependency 'escape_utils', '~> 1.0.1'
|
||||||
s.add_dependency 'mime-types', '~> 1.19'
|
s.add_dependency 'mime-types', '>= 1.19'
|
||||||
s.add_dependency 'rugged', '~> 0.21.1b2'
|
s.add_dependency 'rugged', '~> 0.22.0b4'
|
||||||
|
|
||||||
s.add_development_dependency 'mocha'
|
s.add_development_dependency 'mocha'
|
||||||
s.add_development_dependency 'pry'
|
s.add_development_dependency 'pry'
|
||||||
|
|||||||
21
grammars.yml
21
grammars.yml
@@ -1,6 +1,4 @@
|
|||||||
---
|
---
|
||||||
http://hww3.riverweb.com/dist/Pike_TextMate.tar.gz:
|
|
||||||
- source.pike
|
|
||||||
http://svn.edgewall.org/repos/genshi/contrib/textmate/Genshi.tmbundle/Syntaxes/Markup%20Template%20%28XML%29.tmLanguage:
|
http://svn.edgewall.org/repos/genshi/contrib/textmate/Genshi.tmbundle/Syntaxes/Markup%20Template%20%28XML%29.tmLanguage:
|
||||||
- text.xml.genshi
|
- text.xml.genshi
|
||||||
http://svn.textmate.org/trunk/Review/Bundles/BlitzMax.tmbundle:
|
http://svn.textmate.org/trunk/Review/Bundles/BlitzMax.tmbundle:
|
||||||
@@ -40,10 +38,14 @@ https://github.com/Drako/SublimeBrainfuck/raw/master/Brainfuck.tmLanguage:
|
|||||||
- source.bf
|
- source.bf
|
||||||
https://github.com/JohnNilsson/awk-sublime/raw/master/AWK.tmLanguage:
|
https://github.com/JohnNilsson/awk-sublime/raw/master/AWK.tmLanguage:
|
||||||
- source.awk
|
- source.awk
|
||||||
|
https://github.com/JonBons/Sublime-SQF-Language:
|
||||||
|
- source.sqf
|
||||||
https://github.com/MarioRicalde/SCSS.tmbundle:
|
https://github.com/MarioRicalde/SCSS.tmbundle:
|
||||||
- source.scss
|
- source.scss
|
||||||
https://github.com/Oldes/Sublime-REBOL:
|
https://github.com/Oldes/Sublime-REBOL:
|
||||||
- source.rebol
|
- source.rebol
|
||||||
|
https://github.com/PogiNate/Sublime-Inform:
|
||||||
|
- source.Inform7
|
||||||
https://github.com/Red-Nova-Technologies/autoitv3-tmbundle:
|
https://github.com/Red-Nova-Technologies/autoitv3-tmbundle:
|
||||||
- source.autoit.3
|
- source.autoit.3
|
||||||
https://github.com/SalGnt/Sublime-VimL:
|
https://github.com/SalGnt/Sublime-VimL:
|
||||||
@@ -70,6 +72,8 @@ https://github.com/aroben/ruby.tmbundle@4636a3023153c3034eb6ffc613899ba9cf33b41f
|
|||||||
- text.html.erb
|
- text.html.erb
|
||||||
https://github.com/asbjornenge/Docker.tmbundle:
|
https://github.com/asbjornenge/Docker.tmbundle:
|
||||||
- source.dockerfile
|
- source.dockerfile
|
||||||
|
https://github.com/atom/language-clojure:
|
||||||
|
- source.clojure
|
||||||
https://github.com/atom/language-coffee-script:
|
https://github.com/atom/language-coffee-script:
|
||||||
- source.coffee
|
- source.coffee
|
||||||
- source.litcoffee
|
- source.litcoffee
|
||||||
@@ -95,6 +99,8 @@ https://github.com/bholt/chapel-tmbundle:
|
|||||||
- source.chapel
|
- source.chapel
|
||||||
https://github.com/brandonwamboldt/sublime-nginx:
|
https://github.com/brandonwamboldt/sublime-nginx:
|
||||||
- source.nginx
|
- source.nginx
|
||||||
|
https://github.com/bro/bro-sublime:
|
||||||
|
- source.bro
|
||||||
https://github.com/carsonoid/sublime_man_page_support/raw/master/man-groff.tmLanguage:
|
https://github.com/carsonoid/sublime_man_page_support/raw/master/man-groff.tmLanguage:
|
||||||
- text.groff
|
- text.groff
|
||||||
https://github.com/ccreutzig/sublime-MuPAD:
|
https://github.com/ccreutzig/sublime-MuPAD:
|
||||||
@@ -135,6 +141,8 @@ https://github.com/guillermooo/dart-sublime-bundle/raw/master/Dart.tmLanguage:
|
|||||||
- source.dart
|
- source.dart
|
||||||
https://github.com/harrism/sublimetext-cuda-cpp/raw/master/cuda-c%2B%2B.tmLanguage:
|
https://github.com/harrism/sublimetext-cuda-cpp/raw/master/cuda-c%2B%2B.tmLanguage:
|
||||||
- source.cuda-c++
|
- source.cuda-c++
|
||||||
|
https://github.com/hww3/pike-textmate:
|
||||||
|
- source.pike
|
||||||
https://github.com/jeancharles-roger/ceylon-sublimetext/raw/master/Ceylon.tmLanguage:
|
https://github.com/jeancharles-roger/ceylon-sublimetext/raw/master/Ceylon.tmLanguage:
|
||||||
- source.ceylon
|
- source.ceylon
|
||||||
https://github.com/jfairbank/Sublime-Text-2-OpenEdge-ABL:
|
https://github.com/jfairbank/Sublime-Text-2-OpenEdge-ABL:
|
||||||
@@ -211,16 +219,11 @@ https://github.com/slavapestov/factor/raw/master/misc/Factor.tmbundle/Syntaxes/F
|
|||||||
- source.factor
|
- source.factor
|
||||||
https://github.com/slim-template/ruby-slim.tmbundle:
|
https://github.com/slim-template/ruby-slim.tmbundle:
|
||||||
- text.slim
|
- text.slim
|
||||||
https://github.com/smiledawgg/Bro.tmbundle:
|
|
||||||
- source.bro
|
|
||||||
- source.bro.sig
|
|
||||||
https://github.com/staltz/SublimeXtend:
|
https://github.com/staltz/SublimeXtend:
|
||||||
- source.xtend
|
- source.xtend
|
||||||
https://github.com/statatmbundle/Stata.tmbundle:
|
https://github.com/statatmbundle/Stata.tmbundle:
|
||||||
- source.mata
|
- source.mata
|
||||||
- source.stata
|
- source.stata
|
||||||
https://github.com/swannodette/textmate-clojure:
|
|
||||||
- source.clojure
|
|
||||||
https://github.com/technosophos/Vala-TMBundle:
|
https://github.com/technosophos/Vala-TMBundle:
|
||||||
- source.vala
|
- source.vala
|
||||||
https://github.com/textmate/ant.tmbundle:
|
https://github.com/textmate/ant.tmbundle:
|
||||||
@@ -240,6 +243,7 @@ https://github.com/textmate/bison.tmbundle:
|
|||||||
https://github.com/textmate/c.tmbundle:
|
https://github.com/textmate/c.tmbundle:
|
||||||
- source.c
|
- source.c
|
||||||
- source.c++
|
- source.c++
|
||||||
|
- source.c.platform
|
||||||
https://github.com/textmate/capnproto.tmbundle:
|
https://github.com/textmate/capnproto.tmbundle:
|
||||||
- source.capnp
|
- source.capnp
|
||||||
https://github.com/textmate/cmake.tmbundle:
|
https://github.com/textmate/cmake.tmbundle:
|
||||||
@@ -277,8 +281,6 @@ https://github.com/textmate/haskell.tmbundle:
|
|||||||
- text.tex.latex.haskell
|
- text.tex.latex.haskell
|
||||||
https://github.com/textmate/html.tmbundle:
|
https://github.com/textmate/html.tmbundle:
|
||||||
- text.html.basic
|
- text.html.basic
|
||||||
https://github.com/textmate/inform.tmbundle:
|
|
||||||
- source.inform
|
|
||||||
https://github.com/textmate/ini.tmbundle:
|
https://github.com/textmate/ini.tmbundle:
|
||||||
- source.ini
|
- source.ini
|
||||||
https://github.com/textmate/io.tmbundle:
|
https://github.com/textmate/io.tmbundle:
|
||||||
@@ -327,6 +329,7 @@ https://github.com/textmate/ninja.tmbundle:
|
|||||||
https://github.com/textmate/objective-c.tmbundle:
|
https://github.com/textmate/objective-c.tmbundle:
|
||||||
- source.objc
|
- source.objc
|
||||||
- source.objc++
|
- source.objc++
|
||||||
|
- source.objc.platform
|
||||||
- source.strings
|
- source.strings
|
||||||
https://github.com/textmate/ocaml.tmbundle:
|
https://github.com/textmate/ocaml.tmbundle:
|
||||||
- source.camlp4.ocaml
|
- source.camlp4.ocaml
|
||||||
|
|||||||
@@ -146,6 +146,13 @@ module Linguist
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Public: Is the blob empty?
|
||||||
|
#
|
||||||
|
# Return true or false
|
||||||
|
def empty?
|
||||||
|
data.nil? || data == ""
|
||||||
|
end
|
||||||
|
|
||||||
# Public: Is the blob text?
|
# Public: Is the blob text?
|
||||||
#
|
#
|
||||||
# Return true or false
|
# Return true or false
|
||||||
|
|||||||
@@ -51,21 +51,20 @@ module Linguist
|
|||||||
#
|
#
|
||||||
# Return true or false
|
# Return true or false
|
||||||
def generated?
|
def generated?
|
||||||
name == 'Gemfile.lock' ||
|
minified_files? ||
|
||||||
minified_files? ||
|
compiled_coffeescript? ||
|
||||||
compiled_coffeescript? ||
|
xcode_file? ||
|
||||||
xcode_file? ||
|
generated_parser? ||
|
||||||
generated_parser? ||
|
generated_net_docfile? ||
|
||||||
generated_net_docfile? ||
|
generated_net_designer_file? ||
|
||||||
generated_net_designer_file? ||
|
generated_postscript? ||
|
||||||
generated_postscript? ||
|
generated_protocol_buffer? ||
|
||||||
generated_protocol_buffer? ||
|
generated_jni_header? ||
|
||||||
generated_jni_header? ||
|
composer_lock? ||
|
||||||
composer_lock? ||
|
node_modules? ||
|
||||||
node_modules? ||
|
godeps? ||
|
||||||
godeps? ||
|
vcr_cassette? ||
|
||||||
vcr_cassette? ||
|
generated_by_zephir?
|
||||||
generated_by_zephir?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Internal: Is the blob an Xcode file?
|
# Internal: Is the blob an Xcode file?
|
||||||
@@ -265,4 +264,3 @@ module Linguist
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -13,26 +13,31 @@ module Linguist
|
|||||||
# Returns an array of Languages or []
|
# Returns an array of Languages or []
|
||||||
def self.find_by_heuristics(data, languages)
|
def self.find_by_heuristics(data, languages)
|
||||||
if active?
|
if active?
|
||||||
|
result = []
|
||||||
|
|
||||||
if languages.all? { |l| ["Perl", "Prolog"].include?(l) }
|
if languages.all? { |l| ["Perl", "Prolog"].include?(l) }
|
||||||
result = disambiguate_pl(data, languages)
|
result = disambiguate_pl(data)
|
||||||
end
|
end
|
||||||
if languages.all? { |l| ["ECL", "Prolog"].include?(l) }
|
if languages.all? { |l| ["ECL", "Prolog"].include?(l) }
|
||||||
result = disambiguate_ecl(data, languages)
|
result = disambiguate_ecl(data)
|
||||||
end
|
end
|
||||||
if languages.all? { |l| ["IDL", "Prolog"].include?(l) }
|
if languages.all? { |l| ["IDL", "Prolog"].include?(l) }
|
||||||
result = disambiguate_pro(data, languages)
|
result = disambiguate_pro(data)
|
||||||
end
|
end
|
||||||
if languages.all? { |l| ["Common Lisp", "OpenCL"].include?(l) }
|
if languages.all? { |l| ["Common Lisp", "OpenCL"].include?(l) }
|
||||||
result = disambiguate_cl(data, languages)
|
result = disambiguate_cl(data)
|
||||||
end
|
end
|
||||||
if languages.all? { |l| ["Hack", "PHP"].include?(l) }
|
if languages.all? { |l| ["Hack", "PHP"].include?(l) }
|
||||||
result = disambiguate_hack(data, languages)
|
result = disambiguate_hack(data)
|
||||||
end
|
end
|
||||||
if languages.all? { |l| ["Scala", "SuperCollider"].include?(l) }
|
if languages.all? { |l| ["Scala", "SuperCollider"].include?(l) }
|
||||||
result = disambiguate_sc(data, languages)
|
result = disambiguate_sc(data)
|
||||||
end
|
end
|
||||||
if languages.all? { |l| ["AsciiDoc", "AGS Script"].include?(l) }
|
if languages.all? { |l| ["AsciiDoc", "AGS Script"].include?(l) }
|
||||||
result = disambiguate_asc(data, languages)
|
result = disambiguate_asc(data)
|
||||||
|
end
|
||||||
|
if languages.all? { |l| ["FORTRAN", "Forth"].include?(l) }
|
||||||
|
result = disambiguate_f(data)
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
@@ -42,28 +47,37 @@ module Linguist
|
|||||||
# We want to shortcut look for Objective-C _and_ now C++ too!
|
# We want to shortcut look for Objective-C _and_ now C++ too!
|
||||||
#
|
#
|
||||||
# Returns an array of Languages or []
|
# Returns an array of Languages or []
|
||||||
def self.disambiguate_c(data, languages)
|
def self.disambiguate_c(data)
|
||||||
matches = []
|
matches = []
|
||||||
matches << Language["Objective-C"] if data.include?("@interface")
|
if data.include?("@interface")
|
||||||
matches << Language["C++"] if data.include?("#include <cstdint>")
|
matches << Language["Objective-C"]
|
||||||
|
elsif data.include?("#include <cstdint>")
|
||||||
|
matches << Language["C++"]
|
||||||
|
end
|
||||||
matches
|
matches
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.disambiguate_pl(data, languages)
|
def self.disambiguate_pl(data)
|
||||||
matches = []
|
matches = []
|
||||||
matches << Language["Prolog"] if data.include?(":-")
|
if data.include?("use strict")
|
||||||
matches << Language["Perl"] if data.include?("use strict")
|
matches << Language["Perl"]
|
||||||
|
elsif data.include?(":-")
|
||||||
|
matches << Language["Prolog"]
|
||||||
|
end
|
||||||
matches
|
matches
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.disambiguate_ecl(data, languages)
|
def self.disambiguate_ecl(data)
|
||||||
matches = []
|
matches = []
|
||||||
matches << Language["Prolog"] if data.include?(":-")
|
if data.include?(":-")
|
||||||
matches << Language["ECL"] if data.include?(":=")
|
matches << Language["Prolog"]
|
||||||
|
elsif data.include?(":=")
|
||||||
|
matches << Language["ECL"]
|
||||||
|
end
|
||||||
matches
|
matches
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.disambiguate_pro(data, languages)
|
def self.disambiguate_pro(data)
|
||||||
matches = []
|
matches = []
|
||||||
if (data.include?(":-"))
|
if (data.include?(":-"))
|
||||||
matches << Language["Prolog"]
|
matches << Language["Prolog"]
|
||||||
@@ -73,7 +87,7 @@ module Linguist
|
|||||||
matches
|
matches
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.disambiguate_ts(data, languages)
|
def self.disambiguate_ts(data)
|
||||||
matches = []
|
matches = []
|
||||||
if (data.include?("</translation>"))
|
if (data.include?("</translation>"))
|
||||||
matches << Language["XML"]
|
matches << Language["XML"]
|
||||||
@@ -83,21 +97,24 @@ module Linguist
|
|||||||
matches
|
matches
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.disambiguate_cl(data, languages)
|
def self.disambiguate_cl(data)
|
||||||
matches = []
|
matches = []
|
||||||
matches << Language["Common Lisp"] if data.include?("(defun ")
|
if data.include?("(defun ")
|
||||||
matches << Language["OpenCL"] if /\/\* |\/\/ |^\}/.match(data)
|
matches << Language["Common Lisp"]
|
||||||
|
elsif /\/\* |\/\/ |^\}/.match(data)
|
||||||
|
matches << Language["OpenCL"]
|
||||||
|
end
|
||||||
matches
|
matches
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.disambiguate_r(data, languages)
|
def self.disambiguate_r(data)
|
||||||
matches = []
|
matches = []
|
||||||
matches << Language["Rebol"] if /\bRebol\b/i.match(data)
|
matches << Language["Rebol"] if /\bRebol\b/i.match(data)
|
||||||
matches << Language["R"] if data.include?("<-")
|
matches << Language["R"] if data.include?("<-")
|
||||||
matches
|
matches
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.disambiguate_hack(data, languages)
|
def self.disambiguate_hack(data)
|
||||||
matches = []
|
matches = []
|
||||||
if data.include?("<?hh")
|
if data.include?("<?hh")
|
||||||
matches << Language["Hack"]
|
matches << Language["Hack"]
|
||||||
@@ -107,7 +124,7 @@ module Linguist
|
|||||||
matches
|
matches
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.disambiguate_sc(data, languages)
|
def self.disambiguate_sc(data)
|
||||||
matches = []
|
matches = []
|
||||||
if (/\^(this|super)\./.match(data) || /^\s*(\+|\*)\s*\w+\s*{/.match(data) || /^\s*~\w+\s*=\./.match(data))
|
if (/\^(this|super)\./.match(data) || /^\s*(\+|\*)\s*\w+\s*{/.match(data) || /^\s*~\w+\s*=\./.match(data))
|
||||||
matches << Language["SuperCollider"]
|
matches << Language["SuperCollider"]
|
||||||
@@ -118,12 +135,22 @@ module Linguist
|
|||||||
matches
|
matches
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.disambiguate_asc(data, languages)
|
def self.disambiguate_asc(data)
|
||||||
matches = []
|
matches = []
|
||||||
matches << Language["AsciiDoc"] if /^=+(\s|\n)/.match(data)
|
matches << Language["AsciiDoc"] if /^=+(\s|\n)/.match(data)
|
||||||
matches
|
matches
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.disambiguate_f(data)
|
||||||
|
matches = []
|
||||||
|
if /^: /.match(data)
|
||||||
|
matches << Language["Forth"]
|
||||||
|
elsif /^([c*][^a-z]| subroutine\s)/i.match(data)
|
||||||
|
matches << Language["FORTRAN"]
|
||||||
|
end
|
||||||
|
matches
|
||||||
|
end
|
||||||
|
|
||||||
def self.active?
|
def self.active?
|
||||||
!!ACTIVE
|
!!ACTIVE
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -100,12 +100,8 @@ module Linguist
|
|||||||
def self.detect(blob)
|
def self.detect(blob)
|
||||||
name = blob.name.to_s
|
name = blob.name.to_s
|
||||||
|
|
||||||
# Check if the blob is possibly binary and bail early; this is a cheap
|
# Bail early if the blob is binary or empty.
|
||||||
# test that uses the extension name to guess a binary binary mime type.
|
return nil if blob.likely_binary? || blob.binary? || blob.empty?
|
||||||
#
|
|
||||||
# We'll perform a more comprehensive test later which actually involves
|
|
||||||
# looking for binary characters in the blob
|
|
||||||
return nil if blob.likely_binary? || blob.binary?
|
|
||||||
|
|
||||||
# A bit of an elegant hack. If the file is executable but extensionless,
|
# A bit of an elegant hack. If the file is executable but extensionless,
|
||||||
# append a "magic" extension so it can be classified with other
|
# append a "magic" extension so it can be classified with other
|
||||||
@@ -124,16 +120,18 @@ module Linguist
|
|||||||
if possible_languages.length > 1
|
if possible_languages.length > 1
|
||||||
data = blob.data
|
data = blob.data
|
||||||
possible_language_names = possible_languages.map(&:name)
|
possible_language_names = possible_languages.map(&:name)
|
||||||
|
heuristic_languages = Heuristics.find_by_heuristics(data, possible_language_names)
|
||||||
|
|
||||||
|
if heuristic_languages.size > 1
|
||||||
|
possible_language_names = heuristic_languages.map(&:name)
|
||||||
|
end
|
||||||
|
|
||||||
# Don't bother with binary contents or an empty file
|
|
||||||
if data.nil? || data == ""
|
|
||||||
nil
|
|
||||||
# Check if there's a shebang line and use that as authoritative
|
# Check if there's a shebang line and use that as authoritative
|
||||||
elsif (result = find_by_shebang(data)) && !result.empty?
|
if (result = find_by_shebang(data)) && !result.empty?
|
||||||
result.first
|
result.first
|
||||||
# No shebang. Still more work to do. Try to find it with our heuristics.
|
# No shebang. Still more work to do. Try to find it with our heuristics.
|
||||||
elsif (determined = Heuristics.find_by_heuristics(data, possible_language_names)) && !determined.empty?
|
elsif heuristic_languages.size == 1
|
||||||
determined.first
|
heuristic_languages.first
|
||||||
# Lastly, fall back to the probabilistic classifier.
|
# Lastly, fall back to the probabilistic classifier.
|
||||||
elsif classified = Classifier.classify(Samples.cache, data, possible_language_names).first
|
elsif classified = Classifier.classify(Samples.cache, data, possible_language_names).first
|
||||||
# Return the actual Language object based of the string language name (i.e., first element of `#classify`)
|
# Return the actual Language object based of the string language name (i.e., first element of `#classify`)
|
||||||
@@ -433,11 +431,6 @@ module Linguist
|
|||||||
# Returns the extensions Array
|
# Returns the extensions Array
|
||||||
attr_reader :filenames
|
attr_reader :filenames
|
||||||
|
|
||||||
# Public: Return all possible extensions for language
|
|
||||||
def all_extensions
|
|
||||||
(extensions + [primary_extension]).uniq
|
|
||||||
end
|
|
||||||
|
|
||||||
# Deprecated: Get primary extension
|
# Deprecated: Get primary extension
|
||||||
#
|
#
|
||||||
# Defaults to the first extension but can be overridden
|
# Defaults to the first extension but can be overridden
|
||||||
@@ -595,9 +588,9 @@ module Linguist
|
|||||||
:ace_mode => options['ace_mode'],
|
:ace_mode => options['ace_mode'],
|
||||||
:wrap => options['wrap'],
|
:wrap => options['wrap'],
|
||||||
:group_name => options['group'],
|
:group_name => options['group'],
|
||||||
:searchable => options.key?('searchable') ? options['searchable'] : true,
|
:searchable => options.fetch('searchable', true),
|
||||||
:search_term => options['search_term'],
|
:search_term => options['search_term'],
|
||||||
:extensions => [options['extensions'].first] + options['extensions'][1..-1].sort,
|
:extensions => Array(options['extensions']),
|
||||||
:interpreters => options['interpreters'].sort,
|
:interpreters => options['interpreters'].sort,
|
||||||
:filenames => options['filenames'],
|
:filenames => options['filenames'],
|
||||||
:popular => popular.include?(name)
|
:popular => popular.include?(name)
|
||||||
|
|||||||
@@ -12,6 +12,10 @@
|
|||||||
# search_term - Deprecated: Some languages maybe indexed under a
|
# search_term - Deprecated: Some languages maybe indexed under a
|
||||||
# different alias. Avoid defining new exceptions.
|
# different alias. Avoid defining new exceptions.
|
||||||
# color - CSS hex color to represent the language.
|
# color - CSS hex color to represent the language.
|
||||||
|
# tm_scope - The TextMate scope that represents this programming
|
||||||
|
# language. This should match one of the scopes listed in
|
||||||
|
# the grammars.yml file. Use "none" if there is no grammar
|
||||||
|
# for this language.
|
||||||
#
|
#
|
||||||
# Any additions or modifications (even trivial) should have corresponding
|
# Any additions or modifications (even trivial) should have corresponding
|
||||||
# test change in `test/test_blob.rb`.
|
# test change in `test/test_blob.rb`.
|
||||||
@@ -33,15 +37,6 @@ AGS Script:
|
|||||||
- .ash
|
- .ash
|
||||||
tm_scope: source.c++
|
tm_scope: source.c++
|
||||||
|
|
||||||
Ant Build System:
|
|
||||||
type: data
|
|
||||||
tm_scope: text.xml.ant
|
|
||||||
extensions:
|
|
||||||
- .ant.xml
|
|
||||||
filenames:
|
|
||||||
- build.xml
|
|
||||||
- ant.xml
|
|
||||||
|
|
||||||
ANTLR:
|
ANTLR:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#9DC3FF"
|
color: "#9DC3FF"
|
||||||
@@ -54,6 +49,7 @@ APL:
|
|||||||
extensions:
|
extensions:
|
||||||
- .apl
|
- .apl
|
||||||
- .dyalog
|
- .dyalog
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
ASP:
|
ASP:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -117,6 +113,13 @@ Alloy:
|
|||||||
extensions:
|
extensions:
|
||||||
- .als
|
- .als
|
||||||
|
|
||||||
|
Ant Build System:
|
||||||
|
type: data
|
||||||
|
tm_scope: text.xml.ant
|
||||||
|
filenames:
|
||||||
|
- ant.xml
|
||||||
|
- build.xml
|
||||||
|
|
||||||
ApacheConf:
|
ApacheConf:
|
||||||
type: markup
|
type: markup
|
||||||
aliases:
|
aliases:
|
||||||
@@ -148,6 +151,7 @@ Arc:
|
|||||||
color: "#ca2afe"
|
color: "#ca2afe"
|
||||||
extensions:
|
extensions:
|
||||||
- .arc
|
- .arc
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Arduino:
|
Arduino:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -164,12 +168,14 @@ AsciiDoc:
|
|||||||
- .asciidoc
|
- .asciidoc
|
||||||
- .adoc
|
- .adoc
|
||||||
- .asc
|
- .asc
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
AspectJ:
|
AspectJ:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#1957b0"
|
color: "#1957b0"
|
||||||
extensions:
|
extensions:
|
||||||
- .aj
|
- .aj
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Assembly:
|
Assembly:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -187,6 +193,7 @@ Augeas:
|
|||||||
type: programming
|
type: programming
|
||||||
extensions:
|
extensions:
|
||||||
- .aug
|
- .aug
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
AutoHotkey:
|
AutoHotkey:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -196,6 +203,7 @@ AutoHotkey:
|
|||||||
extensions:
|
extensions:
|
||||||
- .ahk
|
- .ahk
|
||||||
- .ahkl
|
- .ahkl
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
AutoIt:
|
AutoIt:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -288,6 +296,7 @@ Brightscript:
|
|||||||
type: programming
|
type: programming
|
||||||
extensions:
|
extensions:
|
||||||
- .brs
|
- .brs
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Bro:
|
Bro:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -361,6 +370,7 @@ CLIPS:
|
|||||||
type: programming
|
type: programming
|
||||||
extensions:
|
extensions:
|
||||||
- .clp
|
- .clp
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
CMake:
|
CMake:
|
||||||
extensions:
|
extensions:
|
||||||
@@ -423,6 +433,7 @@ Clean:
|
|||||||
extensions:
|
extensions:
|
||||||
- .icl
|
- .icl
|
||||||
- .dcl
|
- .dcl
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Clojure:
|
Clojure:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -451,6 +462,7 @@ CoffeeScript:
|
|||||||
extensions:
|
extensions:
|
||||||
- .coffee
|
- .coffee
|
||||||
- ._coffee
|
- ._coffee
|
||||||
|
- .cjsx
|
||||||
- .cson
|
- .cson
|
||||||
- .iced
|
- .iced
|
||||||
filenames:
|
filenames:
|
||||||
@@ -539,6 +551,7 @@ Creole:
|
|||||||
wrap: true
|
wrap: true
|
||||||
extensions:
|
extensions:
|
||||||
- .creole
|
- .creole
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Crystal:
|
Crystal:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -606,6 +619,7 @@ Darcs Patch:
|
|||||||
extensions:
|
extensions:
|
||||||
- .darcspatch
|
- .darcspatch
|
||||||
- .dpatch
|
- .dpatch
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Dart:
|
Dart:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -633,6 +647,7 @@ Dogescript:
|
|||||||
color: "#cca760"
|
color: "#cca760"
|
||||||
extensions:
|
extensions:
|
||||||
- .djs
|
- .djs
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Dylan:
|
Dylan:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -648,13 +663,7 @@ E:
|
|||||||
color: "#ccce35"
|
color: "#ccce35"
|
||||||
extensions:
|
extensions:
|
||||||
- .E
|
- .E
|
||||||
|
tm_scope: none
|
||||||
Ecere Projects:
|
|
||||||
type: data
|
|
||||||
group: JavaScript
|
|
||||||
extensions:
|
|
||||||
- .epj
|
|
||||||
tm_scope: source.json
|
|
||||||
|
|
||||||
ECL:
|
ECL:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -662,6 +671,7 @@ ECL:
|
|||||||
extensions:
|
extensions:
|
||||||
- .ecl
|
- .ecl
|
||||||
- .eclxml
|
- .eclxml
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Eagle:
|
Eagle:
|
||||||
type: markup
|
type: markup
|
||||||
@@ -671,6 +681,13 @@ Eagle:
|
|||||||
- .brd
|
- .brd
|
||||||
tm_scope: text.xml
|
tm_scope: text.xml
|
||||||
|
|
||||||
|
Ecere Projects:
|
||||||
|
type: data
|
||||||
|
group: JavaScript
|
||||||
|
extensions:
|
||||||
|
- .epj
|
||||||
|
tm_scope: source.json
|
||||||
|
|
||||||
Eiffel:
|
Eiffel:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#946d57"
|
color: "#946d57"
|
||||||
@@ -738,6 +755,7 @@ FLUX:
|
|||||||
extensions:
|
extensions:
|
||||||
- .fx
|
- .fx
|
||||||
- .flux
|
- .flux
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
FORTRAN:
|
FORTRAN:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -767,8 +785,8 @@ Factor:
|
|||||||
extensions:
|
extensions:
|
||||||
- .factor
|
- .factor
|
||||||
filenames:
|
filenames:
|
||||||
- .factor-rc
|
|
||||||
- .factor-boot-rc
|
- .factor-boot-rc
|
||||||
|
- .factor-rc
|
||||||
|
|
||||||
Fancy:
|
Fancy:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -792,6 +810,9 @@ Forth:
|
|||||||
extensions:
|
extensions:
|
||||||
- .fth
|
- .fth
|
||||||
- .4th
|
- .4th
|
||||||
|
- .F
|
||||||
|
- .f
|
||||||
|
- .for
|
||||||
- .forth
|
- .forth
|
||||||
- .frt
|
- .frt
|
||||||
|
|
||||||
@@ -808,18 +829,13 @@ G-code:
|
|||||||
- .g
|
- .g
|
||||||
- .gco
|
- .gco
|
||||||
- .gcode
|
- .gcode
|
||||||
|
tm_scope: none
|
||||||
Game Maker Language:
|
|
||||||
type: programming
|
|
||||||
color: "#8ad353"
|
|
||||||
extensions:
|
|
||||||
- .gml
|
|
||||||
tm_scope: source.js
|
|
||||||
|
|
||||||
GAMS:
|
GAMS:
|
||||||
type: programming
|
type: programming
|
||||||
extensions:
|
extensions:
|
||||||
- .gms
|
- .gms
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
GAP:
|
GAP:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -828,6 +844,7 @@ GAP:
|
|||||||
- .gap
|
- .gap
|
||||||
- .gd
|
- .gd
|
||||||
- .gi
|
- .gi
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
GAS:
|
GAS:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -841,6 +858,7 @@ GDScript:
|
|||||||
type: programming
|
type: programming
|
||||||
extensions:
|
extensions:
|
||||||
- .gd
|
- .gd
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
GLSL:
|
GLSL:
|
||||||
group: C
|
group: C
|
||||||
@@ -860,6 +878,13 @@ GLSL:
|
|||||||
- .vrx
|
- .vrx
|
||||||
- .vshader
|
- .vshader
|
||||||
|
|
||||||
|
Game Maker Language:
|
||||||
|
type: programming
|
||||||
|
color: "#8ad353"
|
||||||
|
extensions:
|
||||||
|
- .gml
|
||||||
|
tm_scope: source.js
|
||||||
|
|
||||||
Genshi:
|
Genshi:
|
||||||
extensions:
|
extensions:
|
||||||
- .kid
|
- .kid
|
||||||
@@ -918,6 +943,7 @@ Golo:
|
|||||||
color: "#f6a51f"
|
color: "#f6a51f"
|
||||||
extensions:
|
extensions:
|
||||||
- .golo
|
- .golo
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Gosu:
|
Gosu:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -933,6 +959,7 @@ Grace:
|
|||||||
type: programming
|
type: programming
|
||||||
extensions:
|
extensions:
|
||||||
- .grace
|
- .grace
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Grammatical Framework:
|
Grammatical Framework:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -949,6 +976,7 @@ Graph Modeling Language:
|
|||||||
type: data
|
type: data
|
||||||
extensions:
|
extensions:
|
||||||
- .gml
|
- .gml
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Graphviz (DOT):
|
Graphviz (DOT):
|
||||||
type: data
|
type: data
|
||||||
@@ -1003,6 +1031,7 @@ HTML:
|
|||||||
- .html
|
- .html
|
||||||
- .htm
|
- .htm
|
||||||
- .st
|
- .st
|
||||||
|
- .xht
|
||||||
- .xhtml
|
- .xhtml
|
||||||
|
|
||||||
HTML+Django:
|
HTML+Django:
|
||||||
@@ -1038,6 +1067,7 @@ HTTP:
|
|||||||
type: data
|
type: data
|
||||||
extensions:
|
extensions:
|
||||||
- .http
|
- .http
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Hack:
|
Hack:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1045,6 +1075,7 @@ Hack:
|
|||||||
extensions:
|
extensions:
|
||||||
- .hh
|
- .hh
|
||||||
- .php
|
- .php
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Haml:
|
Haml:
|
||||||
group: HTML
|
group: HTML
|
||||||
@@ -1067,6 +1098,7 @@ Harbour:
|
|||||||
color: "#0e60e3"
|
color: "#0e60e3"
|
||||||
extensions:
|
extensions:
|
||||||
- .hb
|
- .hb
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Haskell:
|
Haskell:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1092,6 +1124,7 @@ Hy:
|
|||||||
- .hy
|
- .hy
|
||||||
aliases:
|
aliases:
|
||||||
- hylang
|
- hylang
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
IDL:
|
IDL:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1107,6 +1140,7 @@ IGOR Pro:
|
|||||||
aliases:
|
aliases:
|
||||||
- igor
|
- igor
|
||||||
- igorpro
|
- igorpro
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
INI:
|
INI:
|
||||||
type: data
|
type: data
|
||||||
@@ -1119,9 +1153,15 @@ INI:
|
|||||||
aliases:
|
aliases:
|
||||||
- dosini
|
- dosini
|
||||||
|
|
||||||
Inno Setup:
|
IRC log:
|
||||||
|
search_term: irc
|
||||||
|
aliases:
|
||||||
|
- irc
|
||||||
|
- irc logs
|
||||||
extensions:
|
extensions:
|
||||||
- .iss
|
- .irclog
|
||||||
|
- .weechatlog
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Idris:
|
Idris:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1135,7 +1175,7 @@ Inform 7:
|
|||||||
extensions:
|
extensions:
|
||||||
- .ni
|
- .ni
|
||||||
- .i7x
|
- .i7x
|
||||||
tm_scope: source.inform
|
tm_scope: source.Inform7
|
||||||
aliases:
|
aliases:
|
||||||
- i7
|
- i7
|
||||||
- inform7
|
- inform7
|
||||||
@@ -1143,15 +1183,7 @@ Inform 7:
|
|||||||
Inno Setup:
|
Inno Setup:
|
||||||
extensions:
|
extensions:
|
||||||
- .iss
|
- .iss
|
||||||
|
tm_scope: none
|
||||||
IRC log:
|
|
||||||
search_term: irc
|
|
||||||
aliases:
|
|
||||||
- irc
|
|
||||||
- irc logs
|
|
||||||
extensions:
|
|
||||||
- .irclog
|
|
||||||
- .weechatlog
|
|
||||||
|
|
||||||
Io:
|
Io:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1170,11 +1202,13 @@ Isabelle:
|
|||||||
color: "#fdcd00"
|
color: "#fdcd00"
|
||||||
extensions:
|
extensions:
|
||||||
- .thy
|
- .thy
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
J:
|
J:
|
||||||
type: programming
|
type: programming
|
||||||
extensions:
|
extensions:
|
||||||
- .ijs
|
- .ijs
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
JSON:
|
JSON:
|
||||||
type: data
|
type: data
|
||||||
@@ -1282,6 +1316,7 @@ KRL:
|
|||||||
color: "#f5c800"
|
color: "#f5c800"
|
||||||
extensions:
|
extensions:
|
||||||
- .krl
|
- .krl
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Kit:
|
Kit:
|
||||||
type: markup
|
type: markup
|
||||||
@@ -1315,6 +1350,7 @@ LOLCODE:
|
|||||||
extensions:
|
extensions:
|
||||||
- .lol
|
- .lol
|
||||||
color: "#cc9900"
|
color: "#cc9900"
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
LSL:
|
LSL:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1329,6 +1365,7 @@ LabVIEW:
|
|||||||
type: programming
|
type: programming
|
||||||
extensions:
|
extensions:
|
||||||
- .lvproj
|
- .lvproj
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Lasso:
|
Lasso:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1367,12 +1404,14 @@ Liquid:
|
|||||||
type: markup
|
type: markup
|
||||||
extensions:
|
extensions:
|
||||||
- .liquid
|
- .liquid
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Literate Agda:
|
Literate Agda:
|
||||||
type: programming
|
type: programming
|
||||||
group: Agda
|
group: Agda
|
||||||
extensions:
|
extensions:
|
||||||
- .lagda
|
- .lagda
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Literate CoffeeScript:
|
Literate CoffeeScript:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1462,6 +1501,7 @@ MTML:
|
|||||||
tm_scope: text.html.basic
|
tm_scope: text.html.basic
|
||||||
|
|
||||||
Makefile:
|
Makefile:
|
||||||
|
type: programming
|
||||||
aliases:
|
aliases:
|
||||||
- bsdmake
|
- bsdmake
|
||||||
- make
|
- make
|
||||||
@@ -1470,9 +1510,9 @@ Makefile:
|
|||||||
- .mak
|
- .mak
|
||||||
- .mk
|
- .mk
|
||||||
filenames:
|
filenames:
|
||||||
- makefile
|
|
||||||
- Makefile
|
|
||||||
- GNUmakefile
|
- GNUmakefile
|
||||||
|
- Makefile
|
||||||
|
- makefile
|
||||||
interpreters:
|
interpreters:
|
||||||
- make
|
- make
|
||||||
|
|
||||||
@@ -1525,8 +1565,6 @@ Matlab:
|
|||||||
Maven POM:
|
Maven POM:
|
||||||
type: data
|
type: data
|
||||||
tm_scope: text.xml.pom
|
tm_scope: text.xml.pom
|
||||||
extensions:
|
|
||||||
- .pom.xml
|
|
||||||
filenames:
|
filenames:
|
||||||
- pom.xml
|
- pom.xml
|
||||||
|
|
||||||
@@ -1550,6 +1588,7 @@ MediaWiki:
|
|||||||
wrap: true
|
wrap: true
|
||||||
extensions:
|
extensions:
|
||||||
- .mediawiki
|
- .mediawiki
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Mercury:
|
Mercury:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1564,6 +1603,7 @@ MiniD: # Legacy
|
|||||||
searchable: false
|
searchable: false
|
||||||
extensions:
|
extensions:
|
||||||
- .minid # Dummy extension
|
- .minid # Dummy extension
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Mirah:
|
Mirah:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1585,6 +1625,7 @@ Moocode:
|
|||||||
type: programming
|
type: programming
|
||||||
extensions:
|
extensions:
|
||||||
- .moo
|
- .moo
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
MoonScript:
|
MoonScript:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1596,6 +1637,7 @@ MoonScript:
|
|||||||
Myghty:
|
Myghty:
|
||||||
extensions:
|
extensions:
|
||||||
- .myt
|
- .myt
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
NSIS:
|
NSIS:
|
||||||
extensions:
|
extensions:
|
||||||
@@ -1641,6 +1683,7 @@ Nit:
|
|||||||
color: "#0d8921"
|
color: "#0d8921"
|
||||||
extensions:
|
extensions:
|
||||||
- .nit
|
- .nit
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Nix:
|
Nix:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1648,6 +1691,7 @@ Nix:
|
|||||||
- .nix
|
- .nix
|
||||||
aliases:
|
aliases:
|
||||||
- nixos
|
- nixos
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Nu:
|
Nu:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1666,6 +1710,7 @@ NumPy:
|
|||||||
- .numpy
|
- .numpy
|
||||||
- .numpyw
|
- .numpyw
|
||||||
- .numsc
|
- .numsc
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
OCaml:
|
OCaml:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1726,6 +1771,7 @@ Omgrofl:
|
|||||||
extensions:
|
extensions:
|
||||||
- .omgrofl
|
- .omgrofl
|
||||||
color: "#cabbff"
|
color: "#cabbff"
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Opa:
|
Opa:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1737,6 +1783,7 @@ Opal:
|
|||||||
color: "#f7ede0"
|
color: "#f7ede0"
|
||||||
extensions:
|
extensions:
|
||||||
- .opal
|
- .opal
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
OpenCL:
|
OpenCL:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1761,12 +1808,14 @@ OpenSCAD:
|
|||||||
type: programming
|
type: programming
|
||||||
extensions:
|
extensions:
|
||||||
- .scad
|
- .scad
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Org:
|
Org:
|
||||||
type: prose
|
type: prose
|
||||||
wrap: true
|
wrap: true
|
||||||
extensions:
|
extensions:
|
||||||
- .org
|
- .org
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Ox:
|
Ox:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1774,12 +1823,14 @@ Ox:
|
|||||||
- .ox
|
- .ox
|
||||||
- .oxh
|
- .oxh
|
||||||
- .oxo
|
- .oxo
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Oxygene:
|
Oxygene:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#5a63a3"
|
color: "#5a63a3"
|
||||||
extensions:
|
extensions:
|
||||||
- .oxygene
|
- .oxygene
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
PAWN:
|
PAWN:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1815,18 +1866,30 @@ Pan:
|
|||||||
color: '#cc0000'
|
color: '#cc0000'
|
||||||
extensions:
|
extensions:
|
||||||
- .pan
|
- .pan
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Papyrus:
|
Papyrus:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#6600cc"
|
color: "#6600cc"
|
||||||
extensions:
|
extensions:
|
||||||
- .psc
|
- .psc
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Parrot:
|
Parrot:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#f3ca0a"
|
color: "#f3ca0a"
|
||||||
extensions:
|
extensions:
|
||||||
- .parrot # Dummy extension
|
- .parrot # Dummy extension
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
|
Parrot Assembly:
|
||||||
|
group: Parrot
|
||||||
|
type: programming
|
||||||
|
aliases:
|
||||||
|
- pasm
|
||||||
|
extensions:
|
||||||
|
- .pasm
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Parrot Internal Representation:
|
Parrot Internal Representation:
|
||||||
group: Parrot
|
group: Parrot
|
||||||
@@ -1837,14 +1900,6 @@ Parrot Internal Representation:
|
|||||||
extensions:
|
extensions:
|
||||||
- .pir
|
- .pir
|
||||||
|
|
||||||
Parrot Assembly:
|
|
||||||
group: Parrot
|
|
||||||
type: programming
|
|
||||||
aliases:
|
|
||||||
- pasm
|
|
||||||
extensions:
|
|
||||||
- .pasm
|
|
||||||
|
|
||||||
Pascal:
|
Pascal:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#b0ce4e"
|
color: "#b0ce4e"
|
||||||
@@ -1886,12 +1941,14 @@ Perl6:
|
|||||||
- .p6m
|
- .p6m
|
||||||
- .pl6
|
- .pl6
|
||||||
- .pm6
|
- .pm6
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
PigLatin:
|
PigLatin:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#fcd7de"
|
color: "#fcd7de"
|
||||||
extensions:
|
extensions:
|
||||||
- .pig
|
- .pig
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Pike:
|
Pike:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -1906,12 +1963,14 @@ Pod:
|
|||||||
wrap: true
|
wrap: true
|
||||||
extensions:
|
extensions:
|
||||||
- .pod
|
- .pod
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
PogoScript:
|
PogoScript:
|
||||||
type: programming
|
type: programming
|
||||||
color: "#d80074"
|
color: "#d80074"
|
||||||
extensions:
|
extensions:
|
||||||
- .pogo
|
- .pogo
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
PostScript:
|
PostScript:
|
||||||
type: markup
|
type: markup
|
||||||
@@ -1952,6 +2011,7 @@ Propeller Spin:
|
|||||||
color: "#2b446d"
|
color: "#2b446d"
|
||||||
extensions:
|
extensions:
|
||||||
- .spin
|
- .spin
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Protocol Buffer:
|
Protocol Buffer:
|
||||||
type: markup
|
type: markup
|
||||||
@@ -1975,6 +2035,7 @@ Pure Data:
|
|||||||
color: "#91de79"
|
color: "#91de79"
|
||||||
extensions:
|
extensions:
|
||||||
- .pd
|
- .pd
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
PureScript:
|
PureScript:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -2001,10 +2062,10 @@ Python:
|
|||||||
- .wsgi
|
- .wsgi
|
||||||
- .xpy
|
- .xpy
|
||||||
filenames:
|
filenames:
|
||||||
- wscript
|
|
||||||
- SConstruct
|
|
||||||
- SConscript
|
|
||||||
- BUILD
|
- BUILD
|
||||||
|
- SConscript
|
||||||
|
- SConstruct
|
||||||
|
- wscript
|
||||||
interpreters:
|
interpreters:
|
||||||
- python
|
- python
|
||||||
|
|
||||||
@@ -2070,7 +2131,7 @@ RHTML:
|
|||||||
group: HTML
|
group: HTML
|
||||||
extensions:
|
extensions:
|
||||||
- .rhtml
|
- .rhtml
|
||||||
tm_scope: text.html.ruby
|
tm_scope: text.html.erb
|
||||||
aliases:
|
aliases:
|
||||||
- html+ruby
|
- html+ruby
|
||||||
|
|
||||||
@@ -2081,6 +2142,7 @@ RMarkdown:
|
|||||||
extensions:
|
extensions:
|
||||||
- .rmd
|
- .rmd
|
||||||
- .Rmd
|
- .Rmd
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Racket:
|
Racket:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -2100,6 +2162,7 @@ Ragel in Ruby Host:
|
|||||||
aliases:
|
aliases:
|
||||||
- ragel-rb
|
- ragel-rb
|
||||||
- ragel-ruby
|
- ragel-ruby
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Raw token data:
|
Raw token data:
|
||||||
search_term: raw
|
search_term: raw
|
||||||
@@ -2107,6 +2170,7 @@ Raw token data:
|
|||||||
- raw
|
- raw
|
||||||
extensions:
|
extensions:
|
||||||
- .raw
|
- .raw
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Rebol:
|
Rebol:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -2126,10 +2190,12 @@ Red:
|
|||||||
- .reds
|
- .reds
|
||||||
aliases:
|
aliases:
|
||||||
- red/system
|
- red/system
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Redcode:
|
Redcode:
|
||||||
extensions:
|
extensions:
|
||||||
- .cw
|
- .cw
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
RobotFramework:
|
RobotFramework:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -2203,6 +2269,7 @@ SAS:
|
|||||||
color: "#1E90FF"
|
color: "#1E90FF"
|
||||||
extensions:
|
extensions:
|
||||||
- .sas
|
- .sas
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
SCSS:
|
SCSS:
|
||||||
type: markup
|
type: markup
|
||||||
@@ -2218,7 +2285,7 @@ SQF:
|
|||||||
extensions:
|
extensions:
|
||||||
- .sqf
|
- .sqf
|
||||||
- .hqf
|
- .hqf
|
||||||
tm_scope: source.c++
|
tm_scope: source.sqf
|
||||||
|
|
||||||
SQL:
|
SQL:
|
||||||
type: data
|
type: data
|
||||||
@@ -2296,6 +2363,7 @@ Self:
|
|||||||
color: "#0579aa"
|
color: "#0579aa"
|
||||||
extensions:
|
extensions:
|
||||||
- .self
|
- .self
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Shell:
|
Shell:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -2334,6 +2402,7 @@ Shen:
|
|||||||
color: "#120F14"
|
color: "#120F14"
|
||||||
extensions:
|
extensions:
|
||||||
- .shen
|
- .shen
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Slash:
|
Slash:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -2404,6 +2473,7 @@ Stylus:
|
|||||||
group: CSS
|
group: CSS
|
||||||
extensions:
|
extensions:
|
||||||
- .styl
|
- .styl
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
SuperCollider:
|
SuperCollider:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -2411,6 +2481,7 @@ SuperCollider:
|
|||||||
extensions:
|
extensions:
|
||||||
- .scd
|
- .scd
|
||||||
- .sc
|
- .sc
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Swift:
|
Swift:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -2436,6 +2507,7 @@ TXL:
|
|||||||
type: programming
|
type: programming
|
||||||
extensions:
|
extensions:
|
||||||
- .txl
|
- .txl
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Tcl:
|
Tcl:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -2492,6 +2564,7 @@ Textile:
|
|||||||
wrap: true
|
wrap: true
|
||||||
extensions:
|
extensions:
|
||||||
- .textile
|
- .textile
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Thrift:
|
Thrift:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -2505,6 +2578,7 @@ Turing:
|
|||||||
extensions:
|
extensions:
|
||||||
- .t
|
- .t
|
||||||
- .tu
|
- .tu
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
Twig:
|
Twig:
|
||||||
type: markup
|
type: markup
|
||||||
@@ -2584,8 +2658,8 @@ VimL:
|
|||||||
filenames:
|
filenames:
|
||||||
- .vimrc
|
- .vimrc
|
||||||
- _vimrc
|
- _vimrc
|
||||||
- vimrc
|
|
||||||
- gvimrc
|
- gvimrc
|
||||||
|
- vimrc
|
||||||
|
|
||||||
Visual Basic:
|
Visual Basic:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -2687,12 +2761,12 @@ XML:
|
|||||||
filenames:
|
filenames:
|
||||||
- .classpath
|
- .classpath
|
||||||
- .project
|
- .project
|
||||||
|
- Web.Debug.config
|
||||||
|
- Web.Release.config
|
||||||
|
- Web.config
|
||||||
- build.xml.dist
|
- build.xml.dist
|
||||||
- packages.config
|
- packages.config
|
||||||
- phpunit.xml.dist
|
- phpunit.xml.dist
|
||||||
- Web.config
|
|
||||||
- Web.Debug.config
|
|
||||||
- Web.Release.config
|
|
||||||
|
|
||||||
XProc:
|
XProc:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -2765,6 +2839,7 @@ Zimpl:
|
|||||||
- .zimpl
|
- .zimpl
|
||||||
- .zmpl
|
- .zmpl
|
||||||
- .zpl
|
- .zpl
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
eC:
|
eC:
|
||||||
type: programming
|
type: programming
|
||||||
@@ -2772,6 +2847,7 @@ eC:
|
|||||||
extensions:
|
extensions:
|
||||||
- .ec
|
- .ec
|
||||||
- .eh
|
- .eh
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
edn:
|
edn:
|
||||||
type: data
|
type: data
|
||||||
@@ -2786,6 +2862,7 @@ fish:
|
|||||||
group: Shell
|
group: Shell
|
||||||
extensions:
|
extensions:
|
||||||
- .fish
|
- .fish
|
||||||
|
tm_scope: none
|
||||||
|
|
||||||
mupad:
|
mupad:
|
||||||
extensions:
|
extensions:
|
||||||
@@ -2826,3 +2903,4 @@ xBase:
|
|||||||
color: "#3a4040"
|
color: "#3a4040"
|
||||||
extensions:
|
extensions:
|
||||||
- .prg
|
- .prg
|
||||||
|
tm_scope: none
|
||||||
|
|||||||
@@ -110,6 +110,12 @@
|
|||||||
# MathJax
|
# MathJax
|
||||||
- (^|/)MathJax/
|
- (^|/)MathJax/
|
||||||
|
|
||||||
|
# Chart.js
|
||||||
|
- (^|/)Chart\.js$
|
||||||
|
|
||||||
|
# Codemirror
|
||||||
|
- (^|/)[Cc]ode[Mm]irror/(lib|mode|theme|addon|keymap)
|
||||||
|
|
||||||
# SyntaxHighlighter - http://alexgorbatchev.com/
|
# SyntaxHighlighter - http://alexgorbatchev.com/
|
||||||
- (^|/)shBrush([^.]*)\.js$
|
- (^|/)shBrush([^.]*)\.js$
|
||||||
- (^|/)shCore\.js$
|
- (^|/)shCore\.js$
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
module Linguist
|
module Linguist
|
||||||
VERSION = "4.0.0"
|
VERSION = "4.0.3"
|
||||||
end
|
end
|
||||||
|
|||||||
110
samples/Ant Build System/filenames/ant.xml
Normal file
110
samples/Ant Build System/filenames/ant.xml
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
|
<project name="WebBuild">
|
||||||
|
|
||||||
|
<!-- generate timestamps -->
|
||||||
|
<tstamp />
|
||||||
|
|
||||||
|
<!-- Debugging Macro -->
|
||||||
|
<import file="echopath.xml" />
|
||||||
|
|
||||||
|
<!-- JS build files macro -->
|
||||||
|
<import file="rhinoscript.xml" />
|
||||||
|
|
||||||
|
<!-- Component Build Files -->
|
||||||
|
<import file="setup.xml" />
|
||||||
|
<import file="clean.xml" />
|
||||||
|
<import file="copy.xml" />
|
||||||
|
<import file="file.transform.xml" />
|
||||||
|
<import file="external.tools.xml" />
|
||||||
|
<import file="rename.xml" />
|
||||||
|
<import file="js.xml" />
|
||||||
|
<import file="css.xml" />
|
||||||
|
<import file="img.xml" />
|
||||||
|
<import file="png8.xml" />
|
||||||
|
<import file="yui.xml" />
|
||||||
|
<import file="cdn.xml" />
|
||||||
|
<import file="datauri.xml" />
|
||||||
|
<import file="devlive.xml" />
|
||||||
|
|
||||||
|
<!-- This dirname is the only complete path we know for sure, everything builds off of it -->
|
||||||
|
<dirname property="dir.build" file="${ant.file.WebBuild}" />
|
||||||
|
|
||||||
|
<!-- get name for newly built folder -->
|
||||||
|
<basename property="app.name" file="${basedir}" />
|
||||||
|
|
||||||
|
<!-- read global properties file -->
|
||||||
|
<property file="${dir.build}\build.properties" />
|
||||||
|
|
||||||
|
<!-- Build Directories -->
|
||||||
|
<property name="dir.build.js" location="${dir.build}/js" />
|
||||||
|
|
||||||
|
<!-- App Directories -->
|
||||||
|
<property name="dir.app" location="${dir.result}/${app.name}" />
|
||||||
|
<property name="dir.app.temp" location="${dir.temp}/${app.name}" />
|
||||||
|
<property name="dir.app.files" location="${dir.app.temp}/${dir.files}" />
|
||||||
|
|
||||||
|
<!-- Files -->
|
||||||
|
<property name="mapping.js" location="${dir.app.temp}/${mapping.file.js}" />
|
||||||
|
<property name="mapping.css" location="${dir.app.temp}/${mapping.file.css}" />
|
||||||
|
<property name="mapping.img" location="${dir.app.temp}/${mapping.file.img}" />
|
||||||
|
<property name="mapping.swf" location="${dir.app.temp}/${mapping.file.swf}" />
|
||||||
|
<property name="mapping.fonts" location="${dir.app.temp}/${mapping.file.fonts}" />
|
||||||
|
|
||||||
|
<!-- Tool Directories -->
|
||||||
|
<property name="dir.bin" location="${dir.build}/Bin" />
|
||||||
|
<property name="dir.jar" location="${dir.bin}/jar" />
|
||||||
|
|
||||||
|
<!-- Tool Files -->
|
||||||
|
<property name="tools.compressor" location="${dir.jar}/${tools.file.compressor}" />
|
||||||
|
<property name="tools.cssembed" location="${dir.jar}/${tools.file.cssembed}" />
|
||||||
|
<property name="tools.filetransform" location="${dir.jar}/${tools.file.filetransform}" />
|
||||||
|
<property name="tools.optipng" location="${dir.bin}/${tools.file.optipng}" />
|
||||||
|
<property name="tools.jpegtran" location="${dir.bin}/${tools.file.jpegtran}" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- BUILD TARGETS -->
|
||||||
|
|
||||||
|
<!-- low level utility build targets -->
|
||||||
|
|
||||||
|
<!-- Build the tools -->
|
||||||
|
<target name="-setup.build.tools"
|
||||||
|
depends="-define.filetransform, -define.cssembed, -define.yuicompressor, -define.jsclasspath"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- set up filesystem properties -->
|
||||||
|
<target
|
||||||
|
name="-setup"
|
||||||
|
depends="-setup.mode, -setup.conditions, -setup.js, -setup.css, -setup.swf, -setup.img, -setup.fonts, -setup.yui"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- utility-ish targets -->
|
||||||
|
<target name="copy" depends="clean, tools, -copy" />
|
||||||
|
<target name="tools" depends="-setup.build.tools" />
|
||||||
|
<target name="finalize" depends="copy, -finalize" />
|
||||||
|
<target name="-prepare" depends="copy, -setup" />
|
||||||
|
|
||||||
|
<!-- individual component build targets (empty descriptions are to make sure they show in "ant -p") -->
|
||||||
|
<target name="devlive" depends="-prepare, -devlive" description="" />
|
||||||
|
<target name="js" depends="-prepare, -js" description="" />
|
||||||
|
<target name="css" depends="-prepare, -css" description="" />
|
||||||
|
<target name="rename" depends="-prepare, -rename" description="" />
|
||||||
|
<target name="yui" depends="-prepare, rename, -yui" description="" />
|
||||||
|
<target name="cdn" depends="-prepare, -cdn" description="" />
|
||||||
|
|
||||||
|
<!-- high level build targets (Excluding of images is on purpose here, it's slow) -->
|
||||||
|
<target name="core"
|
||||||
|
depends="devlive, js, css, cdn, rename, yui, -js.inline"
|
||||||
|
description="Core build work"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<target name="prod"
|
||||||
|
depends="core, finalize"
|
||||||
|
description="Full Production Build"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- debug target -->
|
||||||
|
<target name="debug" depends="-setup">
|
||||||
|
<echoproperties/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
</project>
|
||||||
1
samples/Ant Build System/filenames/build.xml
Symbolic link
1
samples/Ant Build System/filenames/build.xml
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
ant.xml
|
||||||
40
samples/CoffeeScript/example.cjsx
Normal file
40
samples/CoffeeScript/example.cjsx
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
###* @cjsx React.DOM ###
|
||||||
|
define 'myProject.ReactExampleComponent', [
|
||||||
|
'React'
|
||||||
|
'myProject.ExampleStore'
|
||||||
|
'myProject.ExampleActions'
|
||||||
|
'myProject.ReactExampleTable'
|
||||||
|
], (React, ExampleStore, ExampleActions, ReactExampleTable ) ->
|
||||||
|
|
||||||
|
ReactExampleComponent = React.createClass
|
||||||
|
mixins: [ListenMixin]
|
||||||
|
|
||||||
|
getInitialState: ->
|
||||||
|
rows: ExampleStore.getRows()
|
||||||
|
meta: ExampleStore.getMeta()
|
||||||
|
|
||||||
|
componentWillMount: ->
|
||||||
|
@listenTo ExampleStore
|
||||||
|
|
||||||
|
componentDidMount: ->
|
||||||
|
ExampleActions.getExampleData()
|
||||||
|
|
||||||
|
onStoreChange: ->
|
||||||
|
if this.isMounted()
|
||||||
|
@setState
|
||||||
|
rows: ExampleStore.getRows()
|
||||||
|
meta: ExampleStore.getMeta()
|
||||||
|
|
||||||
|
componentWillUnmount: ->
|
||||||
|
@stopListening ExampleStore
|
||||||
|
|
||||||
|
render: ->
|
||||||
|
<div className="page-wrap">
|
||||||
|
<header>
|
||||||
|
<strong> {@state.title} </strong>
|
||||||
|
<header>
|
||||||
|
<ReactExampleTable
|
||||||
|
rows={@state.rows},
|
||||||
|
meta={@state.meta}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
25
samples/FORTRAN/sample1.f
Normal file
25
samples/FORTRAN/sample1.f
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
c comment
|
||||||
|
* comment
|
||||||
|
|
||||||
|
program main
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
subroutine foo( i, x, b )
|
||||||
|
INTEGER i
|
||||||
|
REAL x
|
||||||
|
LOGICAL b
|
||||||
|
|
||||||
|
if( i.ne.0 ) then
|
||||||
|
call bar( -i )
|
||||||
|
end if
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
double complex function baz()
|
||||||
|
|
||||||
|
baz = (0.0d0,0.0d0)
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
25
samples/FORTRAN/sample1.for
Normal file
25
samples/FORTRAN/sample1.for
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
c comment
|
||||||
|
* comment
|
||||||
|
|
||||||
|
program main
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
subroutine foo( i, x, b )
|
||||||
|
INTEGER i
|
||||||
|
REAL x
|
||||||
|
LOGICAL b
|
||||||
|
|
||||||
|
if( i.ne.0 ) then
|
||||||
|
call bar( -i )
|
||||||
|
end if
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
double complex function baz()
|
||||||
|
|
||||||
|
baz = (0.0d0,0.0d0)
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
25
samples/FORTRAN/sample2.f
Normal file
25
samples/FORTRAN/sample2.f
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
PROGRAM MAIN
|
||||||
|
|
||||||
|
END
|
||||||
|
|
||||||
|
C comment
|
||||||
|
* comment
|
||||||
|
|
||||||
|
SUBROUTINE foo( i, x, b )
|
||||||
|
INTEGER i
|
||||||
|
REAL x
|
||||||
|
LOGICAL b
|
||||||
|
|
||||||
|
IF( i.NE.0 ) THEN
|
||||||
|
CALL bar( -i )
|
||||||
|
END IF
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
|
|
||||||
|
DOUBLE COMPLEX FUNCTION baz()
|
||||||
|
|
||||||
|
baz = (0.0d0,0.0d0)
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
END
|
||||||
25
samples/FORTRAN/sample3.F
Normal file
25
samples/FORTRAN/sample3.F
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
c comment
|
||||||
|
* comment
|
||||||
|
|
||||||
|
program main
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
subroutine foo( i, x, b )
|
||||||
|
INTEGER i
|
||||||
|
REAL x
|
||||||
|
LOGICAL b
|
||||||
|
|
||||||
|
if( i.ne.0 ) then
|
||||||
|
call bar( -i )
|
||||||
|
end if
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
double complex function baz()
|
||||||
|
|
||||||
|
baz = (0.0d0,0.0d0)
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
252
samples/Forth/core.f
Normal file
252
samples/Forth/core.f
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
: immediate lastxt @ dup c@ negate swap c! ;
|
||||||
|
|
||||||
|
: \ source nip >in ! ; immediate \ Copyright 2004, 2012 Lars Brinkhoff
|
||||||
|
|
||||||
|
: char \ ( "word" -- char )
|
||||||
|
bl-word here 1+ c@ ;
|
||||||
|
|
||||||
|
: ahead here 0 , ;
|
||||||
|
|
||||||
|
: resolve here swap ! ;
|
||||||
|
|
||||||
|
: ' bl-word here find 0branch [ ahead ] exit [ resolve ] 0 ;
|
||||||
|
|
||||||
|
: postpone-nonimmediate [ ' literal , ' compile, ] literal , ;
|
||||||
|
|
||||||
|
: create dovariable_code header, reveal ;
|
||||||
|
|
||||||
|
create postponers
|
||||||
|
' postpone-nonimmediate ,
|
||||||
|
' abort ,
|
||||||
|
' , ,
|
||||||
|
|
||||||
|
: word \ ( char "<chars>string<char>" -- caddr )
|
||||||
|
drop bl-word here ;
|
||||||
|
|
||||||
|
: postpone \ ( C: "word" -- )
|
||||||
|
bl word find 1+ cells postponers + @ execute ; immediate
|
||||||
|
|
||||||
|
: unresolved \ ( C: "word" -- orig )
|
||||||
|
postpone postpone postpone ahead ; immediate
|
||||||
|
|
||||||
|
: chars \ ( n1 -- n2 )
|
||||||
|
;
|
||||||
|
|
||||||
|
: else \ ( -- ) ( C: orig1 -- orig2 )
|
||||||
|
unresolved branch swap resolve ; immediate
|
||||||
|
|
||||||
|
: if \ ( flag -- ) ( C: -- orig )
|
||||||
|
unresolved 0branch ; immediate
|
||||||
|
|
||||||
|
: then \ ( -- ) ( C: orig -- )
|
||||||
|
resolve ; immediate
|
||||||
|
|
||||||
|
: [char] \ ( "word" -- )
|
||||||
|
char postpone literal ; immediate
|
||||||
|
|
||||||
|
: (does>) lastxt @ dodoes_code over >code ! r> swap >does ! ;
|
||||||
|
|
||||||
|
: does> postpone (does>) ; immediate
|
||||||
|
|
||||||
|
: begin \ ( -- ) ( C: -- dest )
|
||||||
|
here ; immediate
|
||||||
|
|
||||||
|
: while \ ( x -- ) ( C: dest -- orig dest )
|
||||||
|
unresolved 0branch swap ; immediate
|
||||||
|
|
||||||
|
: repeat \ ( -- ) ( C: orig dest -- )
|
||||||
|
postpone branch , resolve ; immediate
|
||||||
|
|
||||||
|
: until \ ( x -- ) ( C: dest -- )
|
||||||
|
postpone 0branch , ; immediate
|
||||||
|
|
||||||
|
: recurse lastxt @ compile, ; immediate
|
||||||
|
|
||||||
|
: pad \ ( -- addr )
|
||||||
|
here 1024 + ;
|
||||||
|
|
||||||
|
: parse \ ( char "string<char>" -- addr n )
|
||||||
|
pad >r begin
|
||||||
|
source? if <source 2dup <> else 0 0 then
|
||||||
|
while
|
||||||
|
r@ c! r> 1+ >r
|
||||||
|
repeat 2drop pad r> over - ;
|
||||||
|
|
||||||
|
: ( \ ( "string<paren>" -- )
|
||||||
|
[ char ) ] literal parse 2drop ; immediate
|
||||||
|
\ TODO: If necessary, refill and keep parsing.
|
||||||
|
|
||||||
|
: string, ( addr n -- )
|
||||||
|
here over allot align swap cmove ;
|
||||||
|
|
||||||
|
: (s") ( -- addr n ) ( R: ret1 -- ret2 )
|
||||||
|
r> dup @ swap cell+ 2dup + aligned >r swap ;
|
||||||
|
|
||||||
|
create squote 128 allot
|
||||||
|
|
||||||
|
: s" ( "string<quote>" -- addr n )
|
||||||
|
state @ if
|
||||||
|
postpone (s") [char] " parse dup , string,
|
||||||
|
else
|
||||||
|
[char] " parse >r squote r@ cmove squote r>
|
||||||
|
then ; immediate
|
||||||
|
|
||||||
|
: (abort") ( ... addr n -- ) ( R: ... -- )
|
||||||
|
cr type cr abort ;
|
||||||
|
|
||||||
|
: abort" ( ... x "string<quote>" -- ) ( R: ... -- )
|
||||||
|
postpone if postpone s" postpone (abort") postpone then ; immediate
|
||||||
|
|
||||||
|
\ ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
( Core words. )
|
||||||
|
|
||||||
|
\ TODO: #
|
||||||
|
\ TODO: #>
|
||||||
|
\ TODO: #s
|
||||||
|
|
||||||
|
: and ( x y -- x&y ) nand invert ;
|
||||||
|
|
||||||
|
: * 1 2>r 0 swap begin r@ while
|
||||||
|
r> r> swap 2dup dup + 2>r and if swap over + swap then dup +
|
||||||
|
repeat r> r> 2drop drop ;
|
||||||
|
|
||||||
|
\ TODO: */mod
|
||||||
|
|
||||||
|
: +loop ( -- ) ( C: nest-sys -- )
|
||||||
|
postpone (+loop) postpone 0branch , postpone unloop ; immediate
|
||||||
|
|
||||||
|
: space bl emit ;
|
||||||
|
|
||||||
|
: ?.- dup 0 < if [char] - emit negate then ;
|
||||||
|
|
||||||
|
: digit [char] 0 + emit ;
|
||||||
|
|
||||||
|
: (.) base @ /mod ?dup if recurse then digit ;
|
||||||
|
|
||||||
|
: ." ( "string<quote>" -- ) postpone s" postpone type ; immediate
|
||||||
|
|
||||||
|
: . ( x -- ) ?.- (.) space ;
|
||||||
|
|
||||||
|
: postpone-number ( caddr -- )
|
||||||
|
0 0 rot count >number dup 0= if
|
||||||
|
2drop nip
|
||||||
|
postpone (literal) postpone (literal) postpone ,
|
||||||
|
postpone literal postpone ,
|
||||||
|
else
|
||||||
|
." Undefined: " type cr abort
|
||||||
|
then ;
|
||||||
|
|
||||||
|
' postpone-number postponers cell+ !
|
||||||
|
|
||||||
|
: / ( x y -- x/y ) /mod nip ;
|
||||||
|
|
||||||
|
: 0< ( n -- flag ) 0 < ;
|
||||||
|
|
||||||
|
: 1- ( n -- n-1 ) -1 + ;
|
||||||
|
|
||||||
|
: 2! ( x1 x2 addr -- ) swap over ! cell+ ! ;
|
||||||
|
|
||||||
|
: 2* ( n -- 2n ) dup + ;
|
||||||
|
|
||||||
|
\ Kernel: 2/
|
||||||
|
|
||||||
|
: 2@ ( addr -- x1 x2 ) dup cell+ @ swap @ ;
|
||||||
|
|
||||||
|
\ Kernel: 2drop
|
||||||
|
\ Kernel: 2dup
|
||||||
|
|
||||||
|
\ TODO: 2over ( x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2 )
|
||||||
|
\ 3 pick 3 pick ;
|
||||||
|
|
||||||
|
\ TODO: 2swap
|
||||||
|
|
||||||
|
\ TODO: <#
|
||||||
|
|
||||||
|
: abs ( n -- |n| )
|
||||||
|
dup 0< if negate then ;
|
||||||
|
|
||||||
|
\ TODO: accept
|
||||||
|
|
||||||
|
: c, ( n -- )
|
||||||
|
here c! 1 chars allot ;
|
||||||
|
|
||||||
|
: char+ ( n1 -- n2 )
|
||||||
|
1+ ;
|
||||||
|
|
||||||
|
: constant create , does> @ ;
|
||||||
|
|
||||||
|
: decimal ( -- )
|
||||||
|
10 base ! ;
|
||||||
|
|
||||||
|
: depth ( -- n )
|
||||||
|
data_stack 100 cells + 'SP @ - /cell / 2 - ;
|
||||||
|
|
||||||
|
: do ( n1 n2 -- ) ( R: -- loop-sys ) ( C: -- do-sys )
|
||||||
|
postpone 2>r here ; immediate
|
||||||
|
|
||||||
|
\ TODO: environment?
|
||||||
|
\ TODO: evaluate
|
||||||
|
\ TODO: fill
|
||||||
|
\ TODO: fm/mod )
|
||||||
|
\ TODO: hold
|
||||||
|
|
||||||
|
: j ( -- x1 ) ( R: x1 x2 x3 -- x1 x2 x3 )
|
||||||
|
'RP @ 3 cells + @ ;
|
||||||
|
|
||||||
|
\ TODO: leave
|
||||||
|
|
||||||
|
: loop ( -- ) ( C: nest-sys -- )
|
||||||
|
postpone 1 postpone (+loop)
|
||||||
|
postpone 0branch ,
|
||||||
|
postpone unloop ; immediate
|
||||||
|
|
||||||
|
: lshift begin ?dup while 1- swap dup + swap repeat ;
|
||||||
|
|
||||||
|
: rshift 1 begin over while dup + swap 1- swap repeat nip
|
||||||
|
2>r 0 1 begin r@ while
|
||||||
|
r> r> 2dup swap dup + 2>r and if swap over + swap then dup +
|
||||||
|
repeat r> r> 2drop drop ;
|
||||||
|
|
||||||
|
: max ( x y -- max[x,y] )
|
||||||
|
2dup > if drop else nip then ;
|
||||||
|
|
||||||
|
\ Kernel: min
|
||||||
|
\ TODO: mod
|
||||||
|
\ TODO: move
|
||||||
|
|
||||||
|
: (quit) ( R: ... -- )
|
||||||
|
return_stack 100 cells + 'RP !
|
||||||
|
0 'source-id ! tib ''source ! #tib ''#source !
|
||||||
|
postpone [
|
||||||
|
begin
|
||||||
|
refill
|
||||||
|
while
|
||||||
|
interpret state @ 0= if ." ok" cr then
|
||||||
|
repeat
|
||||||
|
bye ;
|
||||||
|
|
||||||
|
' (quit) ' quit >body cell+ !
|
||||||
|
|
||||||
|
\ TODO: s>d
|
||||||
|
\ TODO: sign
|
||||||
|
\ TODO: sm/rem
|
||||||
|
|
||||||
|
: spaces ( n -- )
|
||||||
|
0 do space loop ;
|
||||||
|
|
||||||
|
\ TODO: u.
|
||||||
|
|
||||||
|
: signbit ( -- n ) -1 1 rshift invert ;
|
||||||
|
|
||||||
|
: xor ( x y -- x^y ) 2dup nand >r r@ nand swap r> nand nand ;
|
||||||
|
|
||||||
|
: u< ( x y -- flag ) signbit xor swap signbit xor > ;
|
||||||
|
|
||||||
|
\ TODO: um/mod
|
||||||
|
|
||||||
|
: variable ( "word" -- )
|
||||||
|
create /cell allot ;
|
||||||
|
|
||||||
|
: ['] \ ( C: "word" -- )
|
||||||
|
' postpone literal ; immediate
|
||||||
252
samples/Forth/core.for
Normal file
252
samples/Forth/core.for
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
: immediate lastxt @ dup c@ negate swap c! ;
|
||||||
|
|
||||||
|
: \ source nip >in ! ; immediate \ Copyright 2004, 2012 Lars Brinkhoff
|
||||||
|
|
||||||
|
: char \ ( "word" -- char )
|
||||||
|
bl-word here 1+ c@ ;
|
||||||
|
|
||||||
|
: ahead here 0 , ;
|
||||||
|
|
||||||
|
: resolve here swap ! ;
|
||||||
|
|
||||||
|
: ' bl-word here find 0branch [ ahead ] exit [ resolve ] 0 ;
|
||||||
|
|
||||||
|
: postpone-nonimmediate [ ' literal , ' compile, ] literal , ;
|
||||||
|
|
||||||
|
: create dovariable_code header, reveal ;
|
||||||
|
|
||||||
|
create postponers
|
||||||
|
' postpone-nonimmediate ,
|
||||||
|
' abort ,
|
||||||
|
' , ,
|
||||||
|
|
||||||
|
: word \ ( char "<chars>string<char>" -- caddr )
|
||||||
|
drop bl-word here ;
|
||||||
|
|
||||||
|
: postpone \ ( C: "word" -- )
|
||||||
|
bl word find 1+ cells postponers + @ execute ; immediate
|
||||||
|
|
||||||
|
: unresolved \ ( C: "word" -- orig )
|
||||||
|
postpone postpone postpone ahead ; immediate
|
||||||
|
|
||||||
|
: chars \ ( n1 -- n2 )
|
||||||
|
;
|
||||||
|
|
||||||
|
: else \ ( -- ) ( C: orig1 -- orig2 )
|
||||||
|
unresolved branch swap resolve ; immediate
|
||||||
|
|
||||||
|
: if \ ( flag -- ) ( C: -- orig )
|
||||||
|
unresolved 0branch ; immediate
|
||||||
|
|
||||||
|
: then \ ( -- ) ( C: orig -- )
|
||||||
|
resolve ; immediate
|
||||||
|
|
||||||
|
: [char] \ ( "word" -- )
|
||||||
|
char postpone literal ; immediate
|
||||||
|
|
||||||
|
: (does>) lastxt @ dodoes_code over >code ! r> swap >does ! ;
|
||||||
|
|
||||||
|
: does> postpone (does>) ; immediate
|
||||||
|
|
||||||
|
: begin \ ( -- ) ( C: -- dest )
|
||||||
|
here ; immediate
|
||||||
|
|
||||||
|
: while \ ( x -- ) ( C: dest -- orig dest )
|
||||||
|
unresolved 0branch swap ; immediate
|
||||||
|
|
||||||
|
: repeat \ ( -- ) ( C: orig dest -- )
|
||||||
|
postpone branch , resolve ; immediate
|
||||||
|
|
||||||
|
: until \ ( x -- ) ( C: dest -- )
|
||||||
|
postpone 0branch , ; immediate
|
||||||
|
|
||||||
|
: recurse lastxt @ compile, ; immediate
|
||||||
|
|
||||||
|
: pad \ ( -- addr )
|
||||||
|
here 1024 + ;
|
||||||
|
|
||||||
|
: parse \ ( char "string<char>" -- addr n )
|
||||||
|
pad >r begin
|
||||||
|
source? if <source 2dup <> else 0 0 then
|
||||||
|
while
|
||||||
|
r@ c! r> 1+ >r
|
||||||
|
repeat 2drop pad r> over - ;
|
||||||
|
|
||||||
|
: ( \ ( "string<paren>" -- )
|
||||||
|
[ char ) ] literal parse 2drop ; immediate
|
||||||
|
\ TODO: If necessary, refill and keep parsing.
|
||||||
|
|
||||||
|
: string, ( addr n -- )
|
||||||
|
here over allot align swap cmove ;
|
||||||
|
|
||||||
|
: (s") ( -- addr n ) ( R: ret1 -- ret2 )
|
||||||
|
r> dup @ swap cell+ 2dup + aligned >r swap ;
|
||||||
|
|
||||||
|
create squote 128 allot
|
||||||
|
|
||||||
|
: s" ( "string<quote>" -- addr n )
|
||||||
|
state @ if
|
||||||
|
postpone (s") [char] " parse dup , string,
|
||||||
|
else
|
||||||
|
[char] " parse >r squote r@ cmove squote r>
|
||||||
|
then ; immediate
|
||||||
|
|
||||||
|
: (abort") ( ... addr n -- ) ( R: ... -- )
|
||||||
|
cr type cr abort ;
|
||||||
|
|
||||||
|
: abort" ( ... x "string<quote>" -- ) ( R: ... -- )
|
||||||
|
postpone if postpone s" postpone (abort") postpone then ; immediate
|
||||||
|
|
||||||
|
\ ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
( Core words. )
|
||||||
|
|
||||||
|
\ TODO: #
|
||||||
|
\ TODO: #>
|
||||||
|
\ TODO: #s
|
||||||
|
|
||||||
|
: and ( x y -- x&y ) nand invert ;
|
||||||
|
|
||||||
|
: * 1 2>r 0 swap begin r@ while
|
||||||
|
r> r> swap 2dup dup + 2>r and if swap over + swap then dup +
|
||||||
|
repeat r> r> 2drop drop ;
|
||||||
|
|
||||||
|
\ TODO: */mod
|
||||||
|
|
||||||
|
: +loop ( -- ) ( C: nest-sys -- )
|
||||||
|
postpone (+loop) postpone 0branch , postpone unloop ; immediate
|
||||||
|
|
||||||
|
: space bl emit ;
|
||||||
|
|
||||||
|
: ?.- dup 0 < if [char] - emit negate then ;
|
||||||
|
|
||||||
|
: digit [char] 0 + emit ;
|
||||||
|
|
||||||
|
: (.) base @ /mod ?dup if recurse then digit ;
|
||||||
|
|
||||||
|
: ." ( "string<quote>" -- ) postpone s" postpone type ; immediate
|
||||||
|
|
||||||
|
: . ( x -- ) ?.- (.) space ;
|
||||||
|
|
||||||
|
: postpone-number ( caddr -- )
|
||||||
|
0 0 rot count >number dup 0= if
|
||||||
|
2drop nip
|
||||||
|
postpone (literal) postpone (literal) postpone ,
|
||||||
|
postpone literal postpone ,
|
||||||
|
else
|
||||||
|
." Undefined: " type cr abort
|
||||||
|
then ;
|
||||||
|
|
||||||
|
' postpone-number postponers cell+ !
|
||||||
|
|
||||||
|
: / ( x y -- x/y ) /mod nip ;
|
||||||
|
|
||||||
|
: 0< ( n -- flag ) 0 < ;
|
||||||
|
|
||||||
|
: 1- ( n -- n-1 ) -1 + ;
|
||||||
|
|
||||||
|
: 2! ( x1 x2 addr -- ) swap over ! cell+ ! ;
|
||||||
|
|
||||||
|
: 2* ( n -- 2n ) dup + ;
|
||||||
|
|
||||||
|
\ Kernel: 2/
|
||||||
|
|
||||||
|
: 2@ ( addr -- x1 x2 ) dup cell+ @ swap @ ;
|
||||||
|
|
||||||
|
\ Kernel: 2drop
|
||||||
|
\ Kernel: 2dup
|
||||||
|
|
||||||
|
\ TODO: 2over ( x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2 )
|
||||||
|
\ 3 pick 3 pick ;
|
||||||
|
|
||||||
|
\ TODO: 2swap
|
||||||
|
|
||||||
|
\ TODO: <#
|
||||||
|
|
||||||
|
: abs ( n -- |n| )
|
||||||
|
dup 0< if negate then ;
|
||||||
|
|
||||||
|
\ TODO: accept
|
||||||
|
|
||||||
|
: c, ( n -- )
|
||||||
|
here c! 1 chars allot ;
|
||||||
|
|
||||||
|
: char+ ( n1 -- n2 )
|
||||||
|
1+ ;
|
||||||
|
|
||||||
|
: constant create , does> @ ;
|
||||||
|
|
||||||
|
: decimal ( -- )
|
||||||
|
10 base ! ;
|
||||||
|
|
||||||
|
: depth ( -- n )
|
||||||
|
data_stack 100 cells + 'SP @ - /cell / 2 - ;
|
||||||
|
|
||||||
|
: do ( n1 n2 -- ) ( R: -- loop-sys ) ( C: -- do-sys )
|
||||||
|
postpone 2>r here ; immediate
|
||||||
|
|
||||||
|
\ TODO: environment?
|
||||||
|
\ TODO: evaluate
|
||||||
|
\ TODO: fill
|
||||||
|
\ TODO: fm/mod )
|
||||||
|
\ TODO: hold
|
||||||
|
|
||||||
|
: j ( -- x1 ) ( R: x1 x2 x3 -- x1 x2 x3 )
|
||||||
|
'RP @ 3 cells + @ ;
|
||||||
|
|
||||||
|
\ TODO: leave
|
||||||
|
|
||||||
|
: loop ( -- ) ( C: nest-sys -- )
|
||||||
|
postpone 1 postpone (+loop)
|
||||||
|
postpone 0branch ,
|
||||||
|
postpone unloop ; immediate
|
||||||
|
|
||||||
|
: lshift begin ?dup while 1- swap dup + swap repeat ;
|
||||||
|
|
||||||
|
: rshift 1 begin over while dup + swap 1- swap repeat nip
|
||||||
|
2>r 0 1 begin r@ while
|
||||||
|
r> r> 2dup swap dup + 2>r and if swap over + swap then dup +
|
||||||
|
repeat r> r> 2drop drop ;
|
||||||
|
|
||||||
|
: max ( x y -- max[x,y] )
|
||||||
|
2dup > if drop else nip then ;
|
||||||
|
|
||||||
|
\ Kernel: min
|
||||||
|
\ TODO: mod
|
||||||
|
\ TODO: move
|
||||||
|
|
||||||
|
: (quit) ( R: ... -- )
|
||||||
|
return_stack 100 cells + 'RP !
|
||||||
|
0 'source-id ! tib ''source ! #tib ''#source !
|
||||||
|
postpone [
|
||||||
|
begin
|
||||||
|
refill
|
||||||
|
while
|
||||||
|
interpret state @ 0= if ." ok" cr then
|
||||||
|
repeat
|
||||||
|
bye ;
|
||||||
|
|
||||||
|
' (quit) ' quit >body cell+ !
|
||||||
|
|
||||||
|
\ TODO: s>d
|
||||||
|
\ TODO: sign
|
||||||
|
\ TODO: sm/rem
|
||||||
|
|
||||||
|
: spaces ( n -- )
|
||||||
|
0 do space loop ;
|
||||||
|
|
||||||
|
\ TODO: u.
|
||||||
|
|
||||||
|
: signbit ( -- n ) -1 1 rshift invert ;
|
||||||
|
|
||||||
|
: xor ( x y -- x^y ) 2dup nand >r r@ nand swap r> nand nand ;
|
||||||
|
|
||||||
|
: u< ( x y -- flag ) signbit xor swap signbit xor > ;
|
||||||
|
|
||||||
|
\ TODO: um/mod
|
||||||
|
|
||||||
|
: variable ( "word" -- )
|
||||||
|
create /cell allot ;
|
||||||
|
|
||||||
|
: ['] \ ( C: "word" -- )
|
||||||
|
' postpone literal ; immediate
|
||||||
252
samples/Forth/core1.F
Normal file
252
samples/Forth/core1.F
Normal file
@@ -0,0 +1,252 @@
|
|||||||
|
: immediate lastxt @ dup c@ negate swap c! ;
|
||||||
|
|
||||||
|
: \ source nip >in ! ; immediate \ Copyright 2004, 2012 Lars Brinkhoff
|
||||||
|
|
||||||
|
: char \ ( "word" -- char )
|
||||||
|
bl-word here 1+ c@ ;
|
||||||
|
|
||||||
|
: ahead here 0 , ;
|
||||||
|
|
||||||
|
: resolve here swap ! ;
|
||||||
|
|
||||||
|
: ' bl-word here find 0branch [ ahead ] exit [ resolve ] 0 ;
|
||||||
|
|
||||||
|
: postpone-nonimmediate [ ' literal , ' compile, ] literal , ;
|
||||||
|
|
||||||
|
: create dovariable_code header, reveal ;
|
||||||
|
|
||||||
|
create postponers
|
||||||
|
' postpone-nonimmediate ,
|
||||||
|
' abort ,
|
||||||
|
' , ,
|
||||||
|
|
||||||
|
: word \ ( char "<chars>string<char>" -- caddr )
|
||||||
|
drop bl-word here ;
|
||||||
|
|
||||||
|
: postpone \ ( C: "word" -- )
|
||||||
|
bl word find 1+ cells postponers + @ execute ; immediate
|
||||||
|
|
||||||
|
: unresolved \ ( C: "word" -- orig )
|
||||||
|
postpone postpone postpone ahead ; immediate
|
||||||
|
|
||||||
|
: chars \ ( n1 -- n2 )
|
||||||
|
;
|
||||||
|
|
||||||
|
: else \ ( -- ) ( C: orig1 -- orig2 )
|
||||||
|
unresolved branch swap resolve ; immediate
|
||||||
|
|
||||||
|
: if \ ( flag -- ) ( C: -- orig )
|
||||||
|
unresolved 0branch ; immediate
|
||||||
|
|
||||||
|
: then \ ( -- ) ( C: orig -- )
|
||||||
|
resolve ; immediate
|
||||||
|
|
||||||
|
: [char] \ ( "word" -- )
|
||||||
|
char postpone literal ; immediate
|
||||||
|
|
||||||
|
: (does>) lastxt @ dodoes_code over >code ! r> swap >does ! ;
|
||||||
|
|
||||||
|
: does> postpone (does>) ; immediate
|
||||||
|
|
||||||
|
: begin \ ( -- ) ( C: -- dest )
|
||||||
|
here ; immediate
|
||||||
|
|
||||||
|
: while \ ( x -- ) ( C: dest -- orig dest )
|
||||||
|
unresolved 0branch swap ; immediate
|
||||||
|
|
||||||
|
: repeat \ ( -- ) ( C: orig dest -- )
|
||||||
|
postpone branch , resolve ; immediate
|
||||||
|
|
||||||
|
: until \ ( x -- ) ( C: dest -- )
|
||||||
|
postpone 0branch , ; immediate
|
||||||
|
|
||||||
|
: recurse lastxt @ compile, ; immediate
|
||||||
|
|
||||||
|
: pad \ ( -- addr )
|
||||||
|
here 1024 + ;
|
||||||
|
|
||||||
|
: parse \ ( char "string<char>" -- addr n )
|
||||||
|
pad >r begin
|
||||||
|
source? if <source 2dup <> else 0 0 then
|
||||||
|
while
|
||||||
|
r@ c! r> 1+ >r
|
||||||
|
repeat 2drop pad r> over - ;
|
||||||
|
|
||||||
|
: ( \ ( "string<paren>" -- )
|
||||||
|
[ char ) ] literal parse 2drop ; immediate
|
||||||
|
\ TODO: If necessary, refill and keep parsing.
|
||||||
|
|
||||||
|
: string, ( addr n -- )
|
||||||
|
here over allot align swap cmove ;
|
||||||
|
|
||||||
|
: (s") ( -- addr n ) ( R: ret1 -- ret2 )
|
||||||
|
r> dup @ swap cell+ 2dup + aligned >r swap ;
|
||||||
|
|
||||||
|
create squote 128 allot
|
||||||
|
|
||||||
|
: s" ( "string<quote>" -- addr n )
|
||||||
|
state @ if
|
||||||
|
postpone (s") [char] " parse dup , string,
|
||||||
|
else
|
||||||
|
[char] " parse >r squote r@ cmove squote r>
|
||||||
|
then ; immediate
|
||||||
|
|
||||||
|
: (abort") ( ... addr n -- ) ( R: ... -- )
|
||||||
|
cr type cr abort ;
|
||||||
|
|
||||||
|
: abort" ( ... x "string<quote>" -- ) ( R: ... -- )
|
||||||
|
postpone if postpone s" postpone (abort") postpone then ; immediate
|
||||||
|
|
||||||
|
\ ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
( Core words. )
|
||||||
|
|
||||||
|
\ TODO: #
|
||||||
|
\ TODO: #>
|
||||||
|
\ TODO: #s
|
||||||
|
|
||||||
|
: and ( x y -- x&y ) nand invert ;
|
||||||
|
|
||||||
|
: * 1 2>r 0 swap begin r@ while
|
||||||
|
r> r> swap 2dup dup + 2>r and if swap over + swap then dup +
|
||||||
|
repeat r> r> 2drop drop ;
|
||||||
|
|
||||||
|
\ TODO: */mod
|
||||||
|
|
||||||
|
: +loop ( -- ) ( C: nest-sys -- )
|
||||||
|
postpone (+loop) postpone 0branch , postpone unloop ; immediate
|
||||||
|
|
||||||
|
: space bl emit ;
|
||||||
|
|
||||||
|
: ?.- dup 0 < if [char] - emit negate then ;
|
||||||
|
|
||||||
|
: digit [char] 0 + emit ;
|
||||||
|
|
||||||
|
: (.) base @ /mod ?dup if recurse then digit ;
|
||||||
|
|
||||||
|
: ." ( "string<quote>" -- ) postpone s" postpone type ; immediate
|
||||||
|
|
||||||
|
: . ( x -- ) ?.- (.) space ;
|
||||||
|
|
||||||
|
: postpone-number ( caddr -- )
|
||||||
|
0 0 rot count >number dup 0= if
|
||||||
|
2drop nip
|
||||||
|
postpone (literal) postpone (literal) postpone ,
|
||||||
|
postpone literal postpone ,
|
||||||
|
else
|
||||||
|
." Undefined: " type cr abort
|
||||||
|
then ;
|
||||||
|
|
||||||
|
' postpone-number postponers cell+ !
|
||||||
|
|
||||||
|
: / ( x y -- x/y ) /mod nip ;
|
||||||
|
|
||||||
|
: 0< ( n -- flag ) 0 < ;
|
||||||
|
|
||||||
|
: 1- ( n -- n-1 ) -1 + ;
|
||||||
|
|
||||||
|
: 2! ( x1 x2 addr -- ) swap over ! cell+ ! ;
|
||||||
|
|
||||||
|
: 2* ( n -- 2n ) dup + ;
|
||||||
|
|
||||||
|
\ Kernel: 2/
|
||||||
|
|
||||||
|
: 2@ ( addr -- x1 x2 ) dup cell+ @ swap @ ;
|
||||||
|
|
||||||
|
\ Kernel: 2drop
|
||||||
|
\ Kernel: 2dup
|
||||||
|
|
||||||
|
\ TODO: 2over ( x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2 )
|
||||||
|
\ 3 pick 3 pick ;
|
||||||
|
|
||||||
|
\ TODO: 2swap
|
||||||
|
|
||||||
|
\ TODO: <#
|
||||||
|
|
||||||
|
: abs ( n -- |n| )
|
||||||
|
dup 0< if negate then ;
|
||||||
|
|
||||||
|
\ TODO: accept
|
||||||
|
|
||||||
|
: c, ( n -- )
|
||||||
|
here c! 1 chars allot ;
|
||||||
|
|
||||||
|
: char+ ( n1 -- n2 )
|
||||||
|
1+ ;
|
||||||
|
|
||||||
|
: constant create , does> @ ;
|
||||||
|
|
||||||
|
: decimal ( -- )
|
||||||
|
10 base ! ;
|
||||||
|
|
||||||
|
: depth ( -- n )
|
||||||
|
data_stack 100 cells + 'SP @ - /cell / 2 - ;
|
||||||
|
|
||||||
|
: do ( n1 n2 -- ) ( R: -- loop-sys ) ( C: -- do-sys )
|
||||||
|
postpone 2>r here ; immediate
|
||||||
|
|
||||||
|
\ TODO: environment?
|
||||||
|
\ TODO: evaluate
|
||||||
|
\ TODO: fill
|
||||||
|
\ TODO: fm/mod )
|
||||||
|
\ TODO: hold
|
||||||
|
|
||||||
|
: j ( -- x1 ) ( R: x1 x2 x3 -- x1 x2 x3 )
|
||||||
|
'RP @ 3 cells + @ ;
|
||||||
|
|
||||||
|
\ TODO: leave
|
||||||
|
|
||||||
|
: loop ( -- ) ( C: nest-sys -- )
|
||||||
|
postpone 1 postpone (+loop)
|
||||||
|
postpone 0branch ,
|
||||||
|
postpone unloop ; immediate
|
||||||
|
|
||||||
|
: lshift begin ?dup while 1- swap dup + swap repeat ;
|
||||||
|
|
||||||
|
: rshift 1 begin over while dup + swap 1- swap repeat nip
|
||||||
|
2>r 0 1 begin r@ while
|
||||||
|
r> r> 2dup swap dup + 2>r and if swap over + swap then dup +
|
||||||
|
repeat r> r> 2drop drop ;
|
||||||
|
|
||||||
|
: max ( x y -- max[x,y] )
|
||||||
|
2dup > if drop else nip then ;
|
||||||
|
|
||||||
|
\ Kernel: min
|
||||||
|
\ TODO: mod
|
||||||
|
\ TODO: move
|
||||||
|
|
||||||
|
: (quit) ( R: ... -- )
|
||||||
|
return_stack 100 cells + 'RP !
|
||||||
|
0 'source-id ! tib ''source ! #tib ''#source !
|
||||||
|
postpone [
|
||||||
|
begin
|
||||||
|
refill
|
||||||
|
while
|
||||||
|
interpret state @ 0= if ." ok" cr then
|
||||||
|
repeat
|
||||||
|
bye ;
|
||||||
|
|
||||||
|
' (quit) ' quit >body cell+ !
|
||||||
|
|
||||||
|
\ TODO: s>d
|
||||||
|
\ TODO: sign
|
||||||
|
\ TODO: sm/rem
|
||||||
|
|
||||||
|
: spaces ( n -- )
|
||||||
|
0 do space loop ;
|
||||||
|
|
||||||
|
\ TODO: u.
|
||||||
|
|
||||||
|
: signbit ( -- n ) -1 1 rshift invert ;
|
||||||
|
|
||||||
|
: xor ( x y -- x^y ) 2dup nand >r r@ nand swap r> nand nand ;
|
||||||
|
|
||||||
|
: u< ( x y -- flag ) signbit xor swap signbit xor > ;
|
||||||
|
|
||||||
|
\ TODO: um/mod
|
||||||
|
|
||||||
|
: variable ( "word" -- )
|
||||||
|
create /cell allot ;
|
||||||
|
|
||||||
|
: ['] \ ( C: "word" -- )
|
||||||
|
' postpone literal ; immediate
|
||||||
17
samples/HTML/example.xht
Normal file
17
samples/HTML/example.xht
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<title>This is a XHTML sample file</title>
|
||||||
|
<style type="text/css"><![CDATA[
|
||||||
|
#example {
|
||||||
|
background-color: yellow;
|
||||||
|
}
|
||||||
|
]]></style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="example">
|
||||||
|
Just a simple <strong>XHTML</strong> test page.
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
(function() {
|
|
||||||
|
|
||||||
}).call(this);
|
|
||||||
207
samples/Maven POM/filenames/pom.xml
Normal file
207
samples/Maven POM/filenames/pom.xml
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>renpengben</groupId>
|
||||||
|
<artifactId>spring4mvc-jpa</artifactId>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>spring4mvc-jpa Maven Webapp</name>
|
||||||
|
|
||||||
|
<url>https://renpengben.github.io</url>
|
||||||
|
|
||||||
|
<description>spring4mvc-jpa</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<java.version>1.7</java.version>
|
||||||
|
<junit.version>4.11</junit.version>
|
||||||
|
<slf4j.version>1.7.7</slf4j.version>
|
||||||
|
<log4j.version>1.2.17</log4j.version>
|
||||||
|
|
||||||
|
<spring.version>4.0.5.RELEASE</spring.version>
|
||||||
|
<spring.data.jpa.version>1.6.0.RELEASE</spring.data.jpa.version>
|
||||||
|
<cglib.version>2.1_3</cglib.version>
|
||||||
|
|
||||||
|
<mysql.version>5.1.31</mysql.version>
|
||||||
|
<hibernate.version>4.3.5.Final</hibernate.version>
|
||||||
|
<hibernate-validator.version>5.1.1.Final</hibernate-validator.version>
|
||||||
|
<druid-version>1.0.6</druid-version>
|
||||||
|
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>${slf4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
<version>${slf4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>log4j</groupId>
|
||||||
|
<artifactId>log4j</artifactId>
|
||||||
|
<version>${log4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Spring -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-core</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-beans</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-aop</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-expression</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-tx</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-aspects</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context-support</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-jdbc</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-orm</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-webmvc</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-test</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.data</groupId>
|
||||||
|
<artifactId>spring-data-jpa</artifactId>
|
||||||
|
<version>${spring.data.jpa.version}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>junit-dep</artifactId>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cglib</groupId>
|
||||||
|
<artifactId>cglib-nodep</artifactId>
|
||||||
|
<version>${cglib.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- JPA -->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate</groupId>
|
||||||
|
<artifactId>hibernate-core</artifactId>
|
||||||
|
<version>${hibernate.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate</groupId>
|
||||||
|
<artifactId>hibernate-entitymanager</artifactId>
|
||||||
|
<version>${hibernate.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate</groupId>
|
||||||
|
<artifactId>hibernate-validator</artifactId>
|
||||||
|
<version>${hibernate-validator.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>${mysql.version}</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid</artifactId>
|
||||||
|
<version>${druid-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>2.0.2</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.7</source>
|
||||||
|
<target>1.7</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
42
samples/Ruby/filenames/Gemfile.lock
Normal file
42
samples/Ruby/filenames/Gemfile.lock
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
PATH
|
||||||
|
remote: .
|
||||||
|
specs:
|
||||||
|
github-linguist (4.0.1)
|
||||||
|
charlock_holmes (~> 0.7.3)
|
||||||
|
escape_utils (~> 1.0.1)
|
||||||
|
mime-types (>= 1.19)
|
||||||
|
rugged (~> 0.22.0b1)
|
||||||
|
github-linguist-grammars (4.0.1)
|
||||||
|
|
||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
charlock_holmes (0.7.3)
|
||||||
|
coderay (1.1.0)
|
||||||
|
escape_utils (1.0.1)
|
||||||
|
metaclass (0.0.4)
|
||||||
|
method_source (0.8.2)
|
||||||
|
mime-types (2.4.3)
|
||||||
|
mocha (1.1.0)
|
||||||
|
metaclass (~> 0.0.1)
|
||||||
|
plist (3.1.0)
|
||||||
|
pry (0.10.1)
|
||||||
|
coderay (~> 1.1.0)
|
||||||
|
method_source (~> 0.8.1)
|
||||||
|
slop (~> 3.4)
|
||||||
|
rake (10.3.2)
|
||||||
|
rugged (0.22.0b1)
|
||||||
|
slop (3.6.0)
|
||||||
|
yajl-ruby (1.2.1)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
ruby
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
github-linguist!
|
||||||
|
github-linguist-grammars!
|
||||||
|
mocha
|
||||||
|
plist (~> 3.1)
|
||||||
|
pry
|
||||||
|
rake
|
||||||
|
yajl-ruby
|
||||||
@@ -193,8 +193,8 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
assert blob("Binary/MainMenu.nib").generated?
|
assert blob("Binary/MainMenu.nib").generated?
|
||||||
assert !blob("XML/project.pbxproj").generated?
|
assert !blob("XML/project.pbxproj").generated?
|
||||||
|
|
||||||
# Gemfile.locks
|
# Gemfile.lock is NOT generated
|
||||||
assert blob("Gemfile.lock").generated?
|
assert !blob("Gemfile.lock").generated?
|
||||||
|
|
||||||
# Generated .NET Docfiles
|
# Generated .NET Docfiles
|
||||||
assert blob("XML/net_docfile.xml").generated?
|
assert blob("XML/net_docfile.xml").generated?
|
||||||
@@ -226,7 +226,6 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
assert !blob("PostScript/sierpinski.ps").generated?
|
assert !blob("PostScript/sierpinski.ps").generated?
|
||||||
|
|
||||||
# These examples are too basic to tell
|
# These examples are too basic to tell
|
||||||
assert !blob("JavaScript/empty.js").generated?
|
|
||||||
assert !blob("JavaScript/hello.js").generated?
|
assert !blob("JavaScript/hello.js").generated?
|
||||||
|
|
||||||
assert blob("JavaScript/intro-old.js").generated?
|
assert blob("JavaScript/intro-old.js").generated?
|
||||||
@@ -298,6 +297,13 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
assert blob("deps/http_parser/http_parser.c").vendored?
|
assert blob("deps/http_parser/http_parser.c").vendored?
|
||||||
assert blob("deps/v8/src/v8.h").vendored?
|
assert blob("deps/v8/src/v8.h").vendored?
|
||||||
|
|
||||||
|
# Chart.js
|
||||||
|
assert blob("some/vendored/path/Chart.js").vendored?
|
||||||
|
assert !blob("some/vendored/path/chart.js").vendored?
|
||||||
|
|
||||||
|
# Codemirror deps
|
||||||
|
assert blob("codemirror/mode/blah.js").vendored?
|
||||||
|
|
||||||
# Debian packaging
|
# Debian packaging
|
||||||
assert blob("debian/cron.d").vendored?
|
assert blob("debian/cron.d").vendored?
|
||||||
|
|
||||||
@@ -469,4 +475,13 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
def test_minified_files_not_safe_to_highlight
|
def test_minified_files_not_safe_to_highlight
|
||||||
assert !blob("JavaScript/jquery-1.6.1.min.js").safe_to_colorize?
|
assert !blob("JavaScript/jquery-1.6.1.min.js").safe_to_colorize?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_empty
|
||||||
|
blob = Struct.new(:data) { include Linguist::BlobHelper }
|
||||||
|
|
||||||
|
assert blob.new("").empty?
|
||||||
|
assert blob.new(nil).empty?
|
||||||
|
refute blob.new(" ").empty?
|
||||||
|
refute blob.new("nope").empty?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,18 +20,18 @@ class TestHeuristcs < Test::Unit::TestCase
|
|||||||
Dir.glob("#{samples_path}/#{language_name}/#{file}")
|
Dir.glob("#{samples_path}/#{language_name}/#{file}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["C++", "Objective-C"]
|
||||||
def test_obj_c_by_heuristics
|
def test_obj_c_by_heuristics
|
||||||
languages = ["C++", "Objective-C"]
|
|
||||||
# Only calling out '.h' filenames as these are the ones causing issues
|
# Only calling out '.h' filenames as these are the ones causing issues
|
||||||
all_fixtures("Objective-C", "*.h").each do |fixture|
|
all_fixtures("Objective-C", "*.h").each do |fixture|
|
||||||
results = Heuristics.disambiguate_c(fixture("Objective-C/#{File.basename(fixture)}"), languages)
|
results = Heuristics.disambiguate_c(fixture("Objective-C/#{File.basename(fixture)}"))
|
||||||
assert_equal Language["Objective-C"], results.first
|
assert_equal Language["Objective-C"], results.first
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["C++", "Objective-C"]
|
||||||
def test_cpp_by_heuristics
|
def test_cpp_by_heuristics
|
||||||
languages = ["C++", "Objective-C"]
|
results = Heuristics.disambiguate_c(fixture("C++/render_adapter.cpp"))
|
||||||
results = Heuristics.disambiguate_c(fixture("C++/render_adapter.cpp"), languages)
|
|
||||||
assert_equal Language["C++"], results.first
|
assert_equal Language["C++"], results.first
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -41,57 +41,57 @@ class TestHeuristcs < Test::Unit::TestCase
|
|||||||
assert_equal Language["Objective-C"], match
|
assert_equal Language["Objective-C"], match
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["Perl", "Prolog"]
|
||||||
def test_pl_prolog_by_heuristics
|
def test_pl_prolog_by_heuristics
|
||||||
languages = ["Perl", "Prolog"]
|
results = Heuristics.disambiguate_pl(fixture("Prolog/turing.pl"))
|
||||||
results = Heuristics.disambiguate_pl(fixture("Prolog/turing.pl"), languages)
|
|
||||||
assert_equal Language["Prolog"], results.first
|
assert_equal Language["Prolog"], results.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["Perl", "Prolog"]
|
||||||
def test_pl_perl_by_heuristics
|
def test_pl_perl_by_heuristics
|
||||||
languages = ["Perl", "Prolog"]
|
results = Heuristics.disambiguate_pl(fixture("Perl/perl-test.t"))
|
||||||
results = Heuristics.disambiguate_pl(fixture("Perl/perl-test.t"), languages)
|
|
||||||
assert_equal Language["Perl"], results.first
|
assert_equal Language["Perl"], results.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["ECL", "Prolog"]
|
||||||
def test_ecl_prolog_by_heuristics
|
def test_ecl_prolog_by_heuristics
|
||||||
languages = ["ECL", "Prolog"]
|
results = Heuristics.disambiguate_ecl(fixture("Prolog/or-constraint.ecl"))
|
||||||
results = Heuristics.disambiguate_ecl(fixture("Prolog/or-constraint.ecl"), languages)
|
|
||||||
assert_equal Language["Prolog"], results.first
|
assert_equal Language["Prolog"], results.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["ECL", "Prolog"]
|
||||||
def test_ecl_ecl_by_heuristics
|
def test_ecl_ecl_by_heuristics
|
||||||
languages = ["ECL", "Prolog"]
|
results = Heuristics.disambiguate_ecl(fixture("ECL/sample.ecl"))
|
||||||
results = Heuristics.disambiguate_ecl(fixture("ECL/sample.ecl"), languages)
|
|
||||||
assert_equal Language["ECL"], results.first
|
assert_equal Language["ECL"], results.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["IDL", "Prolog"]
|
||||||
def test_pro_prolog_by_heuristics
|
def test_pro_prolog_by_heuristics
|
||||||
languages = ["IDL", "Prolog"]
|
results = Heuristics.disambiguate_pro(fixture("Prolog/logic-problem.pro"))
|
||||||
results = Heuristics.disambiguate_pro(fixture("Prolog/logic-problem.pro"), languages)
|
|
||||||
assert_equal Language["Prolog"], results.first
|
assert_equal Language["Prolog"], results.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["IDL", "Prolog"]
|
||||||
def test_pro_idl_by_heuristics
|
def test_pro_idl_by_heuristics
|
||||||
languages = ["IDL", "Prolog"]
|
results = Heuristics.disambiguate_pro(fixture("IDL/mg_acosh.pro"))
|
||||||
results = Heuristics.disambiguate_pro(fixture("IDL/mg_acosh.pro"), languages)
|
|
||||||
assert_equal Language["IDL"], results.first
|
assert_equal Language["IDL"], results.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["AGS Script", "AsciiDoc"]
|
||||||
def test_asc_asciidoc_by_heuristics
|
def test_asc_asciidoc_by_heuristics
|
||||||
languages = ["AGS Script", "AsciiDoc"]
|
results = Heuristics.disambiguate_asc(fixture("AsciiDoc/list.asc"))
|
||||||
results = Heuristics.disambiguate_asc(fixture("AsciiDoc/list.asc"), languages)
|
|
||||||
assert_equal Language["AsciiDoc"], results.first
|
assert_equal Language["AsciiDoc"], results.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["TypeScript", "XML"]
|
||||||
def test_ts_typescript_by_heuristics
|
def test_ts_typescript_by_heuristics
|
||||||
languages = ["TypeScript", "XML"]
|
results = Heuristics.disambiguate_ts(fixture("TypeScript/classes.ts"))
|
||||||
results = Heuristics.disambiguate_ts(fixture("TypeScript/classes.ts"), languages)
|
|
||||||
assert_equal Language["TypeScript"], results.first
|
assert_equal Language["TypeScript"], results.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["TypeScript", "XML"]
|
||||||
def test_ts_xml_by_heuristics
|
def test_ts_xml_by_heuristics
|
||||||
languages = ["TypeScript", "XML"]
|
results = Heuristics.disambiguate_ts(fixture("XML/pt_BR.xml"))
|
||||||
results = Heuristics.disambiguate_ts(fixture("XML/pt_BR.xml"), languages)
|
|
||||||
assert_equal Language["XML"], results.first
|
assert_equal Language["XML"], results.first
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -99,27 +99,37 @@ class TestHeuristcs < Test::Unit::TestCase
|
|||||||
languages = ["Common Lisp", "OpenCL"]
|
languages = ["Common Lisp", "OpenCL"]
|
||||||
languages.each do |language|
|
languages.each do |language|
|
||||||
all_fixtures(language).each do |fixture|
|
all_fixtures(language).each do |fixture|
|
||||||
results = Heuristics.disambiguate_cl(fixture("#{language}/#{File.basename(fixture)}"), languages)
|
results = Heuristics.disambiguate_cl(fixture("#{language}/#{File.basename(fixture)}"))
|
||||||
assert_equal Language[language], results.first
|
assert_equal Language[language], results.first
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_f_by_heuristics
|
||||||
|
languages = ["FORTRAN", "Forth"]
|
||||||
|
languages.each do |language|
|
||||||
|
all_fixtures(language).each do |fixture|
|
||||||
|
results = Heuristics.disambiguate_f(fixture("#{language}/#{File.basename(fixture)}"))
|
||||||
|
assert_equal Language[language], results.first
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["Hack", "PHP"]
|
||||||
def test_hack_by_heuristics
|
def test_hack_by_heuristics
|
||||||
languages = ["Hack", "PHP"]
|
results = Heuristics.disambiguate_hack(fixture("Hack/funs.php"))
|
||||||
results = Heuristics.disambiguate_hack(fixture("Hack/funs.php"), languages)
|
|
||||||
assert_equal Language["Hack"], results.first
|
assert_equal Language["Hack"], results.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["Scala", "SuperCollider"]
|
||||||
def test_sc_supercollider_by_heuristics
|
def test_sc_supercollider_by_heuristics
|
||||||
languages = ["Scala", "SuperCollider"]
|
results = Heuristics.disambiguate_sc(fixture("SuperCollider/WarpPreset.sc"))
|
||||||
results = Heuristics.disambiguate_sc(fixture("SuperCollider/WarpPreset.sc"), languages)
|
|
||||||
assert_equal Language["SuperCollider"], results.first
|
assert_equal Language["SuperCollider"], results.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Candidate languages = ["Scala", "SuperCollider"]
|
||||||
def test_sc_scala_by_heuristics
|
def test_sc_scala_by_heuristics
|
||||||
languages = ["Scala", "SuperCollider"]
|
results = Heuristics.disambiguate_sc(fixture("Scala/node11.sc"))
|
||||||
results = Heuristics.disambiguate_sc(fixture("Scala/node11.sc"), languages)
|
|
||||||
assert_equal Language["Scala"], results.first
|
assert_equal Language["Scala"], results.first
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
require 'linguist/language'
|
require 'linguist/language'
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
require 'yaml'
|
||||||
|
|
||||||
class TestLanguage < Test::Unit::TestCase
|
class TestLanguage < Test::Unit::TestCase
|
||||||
include Linguist
|
include Linguist
|
||||||
@@ -139,6 +140,7 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
assert_equal :programming, Language['Python'].type
|
assert_equal :programming, Language['Python'].type
|
||||||
assert_equal :programming, Language['Ruby'].type
|
assert_equal :programming, Language['Ruby'].type
|
||||||
assert_equal :programming, Language['TypeScript'].type
|
assert_equal :programming, Language['TypeScript'].type
|
||||||
|
assert_equal :programming, Language['Makefile'].type
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_markup
|
def test_markup
|
||||||
@@ -157,7 +159,6 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_other
|
def test_other
|
||||||
assert_nil Language['Brainfuck'].type
|
assert_nil Language['Brainfuck'].type
|
||||||
assert_nil Language['Makefile'].type
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_searchable
|
def test_searchable
|
||||||
@@ -349,12 +350,6 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
assert_equal '.coffee', Language['CoffeeScript'].primary_extension
|
assert_equal '.coffee', Language['CoffeeScript'].primary_extension
|
||||||
assert_equal '.t', Language['Turing'].primary_extension
|
assert_equal '.t', Language['Turing'].primary_extension
|
||||||
assert_equal '.ts', Language['TypeScript'].primary_extension
|
assert_equal '.ts', Language['TypeScript'].primary_extension
|
||||||
|
|
||||||
# This is a nasty requirement, but there's some code in GitHub that
|
|
||||||
# expects this. Really want to drop this.
|
|
||||||
Language.all.each do |language|
|
|
||||||
assert language.primary_extension, "#{language} has no primary extension"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_eql
|
def test_eql
|
||||||
@@ -365,4 +360,15 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
def test_by_type
|
def test_by_type
|
||||||
assert !Language.by_type(:prose).nil?
|
assert !Language.by_type(:prose).nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_all_languages_have_grammars
|
||||||
|
scopes = YAML.load(File.read(File.expand_path("../../grammars.yml", __FILE__))).values.flatten
|
||||||
|
missing = Language.all.reject { |language| language.tm_scope == "none" || scopes.include?(language.tm_scope) }
|
||||||
|
message = "The following languages' scopes are not listed in grammars.yml. Please add grammars for all new languages.\n"
|
||||||
|
message << "If no grammar exists for a language, mark the language with `tm_scope: none` in lib/linguist/languages.yml.\n"
|
||||||
|
|
||||||
|
width = missing.map { |language| language.name.length }.max
|
||||||
|
message << missing.map { |language| sprintf("%-#{width}s %s", language.name, language.tm_scope) }.sort.join("\n")
|
||||||
|
assert missing.empty?, message
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,57 +1,30 @@
|
|||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
require 'yaml'
|
||||||
|
|
||||||
class TestPedantic < Test::Unit::TestCase
|
class TestPedantic < Test::Unit::TestCase
|
||||||
Lib = File.expand_path("../../lib/linguist", __FILE__)
|
filename = File.expand_path("../../lib/linguist/languages.yml", __FILE__)
|
||||||
|
LANGUAGES = YAML.load(File.read(filename))
|
||||||
def file(name)
|
|
||||||
File.read(File.join(Lib, name))
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_language_names_are_sorted
|
def test_language_names_are_sorted
|
||||||
languages = []
|
assert_sorted LANGUAGES.keys
|
||||||
file("languages.yml").lines.each do |line|
|
|
||||||
if line =~ /^(\w+):$/
|
|
||||||
languages << $1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
assert_sorted languages
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_extensions_are_sorted
|
def test_extensions_are_sorted
|
||||||
extensions = nil
|
LANGUAGES.each do |name, language|
|
||||||
file("languages.yml").lines.each do |line|
|
extensions = language['extensions']
|
||||||
if line =~ /^ extensions:$/
|
assert_sorted extensions[1..-1] if extensions && extensions.size > 1
|
||||||
extensions = []
|
|
||||||
elsif extensions && line =~ /^ - \.([\w\-\.]+)( *#.*)?$/
|
|
||||||
extensions << $1
|
|
||||||
else
|
|
||||||
assert_sorted extensions[1..-1] if extensions
|
|
||||||
extensions = nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_filenames_are_sorted
|
def test_filenames_are_sorted
|
||||||
filenames = nil
|
LANGUAGES.each do |name, language|
|
||||||
file("languages.yml").lines.each do |line|
|
assert_sorted language['filenames'] if language['filenames']
|
||||||
if line =~ /^ filenames:$/
|
|
||||||
filenames = []
|
|
||||||
elsif filenames && line =~ /^ - \.(\w+)$/
|
|
||||||
filenames << $1
|
|
||||||
else
|
|
||||||
assert_sorted filenames if filenames
|
|
||||||
filenames = nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_sorted(list)
|
def assert_sorted(list)
|
||||||
previous = nil
|
list.each_cons(2) do |previous, item|
|
||||||
list.each do |item|
|
flunk "#{previous} should come after #{item}" if previous > item
|
||||||
if previous && previous > item
|
|
||||||
flunk "#{previous} should come after #{item}"
|
|
||||||
end
|
|
||||||
previous = item
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -55,20 +55,28 @@ class TestSamples < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
# If a language extension isn't globally unique then make sure there are samples
|
# If a language extension isn't globally unique then make sure there are samples
|
||||||
def test_presence
|
Linguist::Language.all.each do |language|
|
||||||
Linguist::Language.all.each do |language|
|
define_method "test_#{language.name}_has_samples" do
|
||||||
language.all_extensions.each do |extension|
|
language.extensions.each do |extension|
|
||||||
language_matches = Language.find_by_filename("foo#{extension}")
|
language_matches = Language.find_by_extension(extension)
|
||||||
|
|
||||||
# If there is more than one language match for a given extension
|
# Check for samples if more than one language matches the given extension.
|
||||||
# then check that there are examples for that language with the extension
|
|
||||||
if language_matches.length > 1
|
if language_matches.length > 1
|
||||||
language_matches.each do |language|
|
language_matches.each do |match|
|
||||||
assert File.directory?("samples/#{language.name}"), "#{language.name} is missing a samples directory"
|
samples = "samples/#{match.name}/*#{extension}"
|
||||||
assert Dir.glob("samples/#{language.name}/*#{extension}").any?, "#{language.name} is missing samples for extension #{extension}"
|
assert Dir.glob(samples).any?, "Missing samples in #{samples.inspect}. See https://github.com/github/linguist/blob/master/CONTRIBUTING.md"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
language.filenames.each do |filename|
|
||||||
|
# Check for samples if more than one language matches the given filename
|
||||||
|
if Language.find_by_filename(filename).size > 1
|
||||||
|
sample = "samples/#{language.name}/filenames/#{filename}"
|
||||||
|
assert File.exists?(sample),
|
||||||
|
"Missing sample in #{sample.inspect}. See https://github.com/github/linguist/blob/master/CONTRIBUTING.md"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ class TestTokenizer < Test::Unit::TestCase
|
|||||||
assert_equal %w(foo), tokenize("foo {- Comment -}")
|
assert_equal %w(foo), tokenize("foo {- Comment -}")
|
||||||
assert_equal %w(foo), tokenize("foo (* Comment *)")
|
assert_equal %w(foo), tokenize("foo (* Comment *)")
|
||||||
assert_equal %w(%), tokenize("2 % 10\n% Comment")
|
assert_equal %w(%), tokenize("2 % 10\n% Comment")
|
||||||
|
assert_equal %w(foo bar), tokenize("foo\n\"\"\"\nComment\n\"\"\"\nbar")
|
||||||
|
assert_equal %w(foo bar), tokenize("foo\n'''\nComment\n'''\nbar")
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_sgml_tags
|
def test_sgml_tags
|
||||||
|
|||||||
BIN
vendor/cache/mime-types-1.25.1.gem
vendored
BIN
vendor/cache/mime-types-1.25.1.gem
vendored
Binary file not shown.
BIN
vendor/cache/mime-types-2.4.3.gem
vendored
Normal file
BIN
vendor/cache/mime-types-2.4.3.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/rugged-0.21.1b2.gem
vendored
BIN
vendor/cache/rugged-0.21.1b2.gem
vendored
Binary file not shown.
BIN
vendor/cache/rugged-0.22.0b4.gem
vendored
Normal file
BIN
vendor/cache/rugged-0.22.0b4.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/yajl-ruby-1.2.1.gem
vendored
Normal file
BIN
vendor/cache/yajl-ruby-1.2.1.gem
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user