mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Fixed M lexer name. Merged with upstream's latest changes.
This commit is contained in:
@@ -2,8 +2,7 @@ before_install: sudo apt-get install libicu-dev -y
|
|||||||
rvm:
|
rvm:
|
||||||
- 1.8.7
|
- 1.8.7
|
||||||
- 1.9.2
|
- 1.9.2
|
||||||
- jruby
|
- 1.9.3
|
||||||
- rbx
|
|
||||||
- ree
|
- ree
|
||||||
notifications:
|
notifications:
|
||||||
disabled: true
|
disabled: true
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ module Linguist
|
|||||||
#
|
#
|
||||||
# Returns a content type String.
|
# Returns a content type String.
|
||||||
def content_type
|
def content_type
|
||||||
@content_type ||= binary? ? mime_type :
|
@content_type ||= (binary_mime_type? || binary?) ? mime_type :
|
||||||
(encoding ? "text/plain; charset=#{encoding.downcase}" : "text/plain")
|
(encoding ? "text/plain; charset=#{encoding.downcase}" : "text/plain")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -160,6 +160,29 @@ module Linguist
|
|||||||
size.to_i > MEGABYTE
|
size.to_i > MEGABYTE
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Public: Is the blob safe to colorize?
|
||||||
|
#
|
||||||
|
# We use Pygments.rb for syntax highlighting blobs, which
|
||||||
|
# has some quirks and also is essentially 'un-killable' via
|
||||||
|
# normal timeout. To workaround this we try to
|
||||||
|
# carefully handling Pygments.rb anything it can't handle.
|
||||||
|
#
|
||||||
|
# Return true or false
|
||||||
|
def safe_to_colorize?
|
||||||
|
text? && !large? && !high_ratio_of_long_lines?
|
||||||
|
end
|
||||||
|
|
||||||
|
# Internal: Does the blob have a ratio of long lines?
|
||||||
|
#
|
||||||
|
# These types of files are usually going to make Pygments.rb
|
||||||
|
# angry if we try to colorize them.
|
||||||
|
#
|
||||||
|
# Return true or false
|
||||||
|
def high_ratio_of_long_lines?
|
||||||
|
return false if loc == 0
|
||||||
|
size / loc > 5000
|
||||||
|
end
|
||||||
|
|
||||||
# Public: Is the blob viewable?
|
# Public: Is the blob viewable?
|
||||||
#
|
#
|
||||||
# Non-viewable blobs will just show a "View Raw" link
|
# Non-viewable blobs will just show a "View Raw" link
|
||||||
@@ -451,27 +474,29 @@ module Linguist
|
|||||||
# Internal: Guess language of .m files.
|
# Internal: Guess language of .m files.
|
||||||
#
|
#
|
||||||
# Objective-C heuristics:
|
# Objective-C heuristics:
|
||||||
# * Keywords
|
# * Keywords ("#import", "#include", "#ifdef", #define, "@end") or "//" and opening "\*" comments
|
||||||
#
|
#
|
||||||
# Matlab heuristics:
|
# Matlab heuristics:
|
||||||
# * Leading function keyword
|
# * Leading "function " of "classdef " keyword
|
||||||
# * "%" comments
|
# * "%" comments
|
||||||
#
|
#
|
||||||
# M heuristics:
|
# M heuristics:
|
||||||
# * Look at first line. It is either a comment (1st regex) or label/code (2nd regex)
|
# * Look at first line. It is either a comment (1st regex) or label/code (2nd regex)
|
||||||
#
|
#
|
||||||
|
# Note: All "#" keywords, e.g., "#import", are guaranteed to be Objective-C. Because the ampersand
|
||||||
|
# is used to created function handles and anonymous functions in Matlab, most "@" keywords are not
|
||||||
|
# safe heuristics. However, "end" is a reserved term in Matlab and can't be used to create a valid
|
||||||
|
# function handle. Because @end is required to close any @implementation, @property, @interface,
|
||||||
|
# @synthesize, etc. directive in Objective-C, only @end needs to be checked for.
|
||||||
|
#
|
||||||
# Returns a Language.
|
# Returns a Language.
|
||||||
def guess_m_language
|
def guess_m_language
|
||||||
# Objective-C keywords
|
# Objective-C keywords or comments
|
||||||
if lines.grep(/^#import|@(interface|implementation|property|synthesize|end)/).any?
|
if lines.grep(/^#(import|include|ifdef|define)|@end/).any? || lines.grep(/^\s*\/\//).any? || lines.grep(/^\s*\/\*/).any?
|
||||||
Language['Objective-C']
|
Language['Objective-C']
|
||||||
|
|
||||||
# Matlab leading function keyword
|
# Matlab file function or class or comments
|
||||||
elsif lines.first.to_s =~ /^function /
|
elsif lines.any? && lines.first.match(/^\s*(function |classdef )/) || lines.grep(/^\s*%/).any?
|
||||||
Language['Matlab']
|
|
||||||
|
|
||||||
# Matlab comment
|
|
||||||
elsif lines.grep(/^%/).any?
|
|
||||||
Language['Matlab']
|
Language['Matlab']
|
||||||
|
|
||||||
# M (see M heuristics above)
|
# M (see M heuristics above)
|
||||||
@@ -647,7 +672,7 @@ module Linguist
|
|||||||
#
|
#
|
||||||
# Returns html String
|
# Returns html String
|
||||||
def colorize(options = {})
|
def colorize(options = {})
|
||||||
return if !text? || large? || generated?
|
return unless safe_to_colorize?
|
||||||
options[:options] ||= {}
|
options[:options] ||= {}
|
||||||
options[:options][:encoding] ||= encoding
|
options[:options][:encoding] ||= encoding
|
||||||
lexer.highlight(data, options)
|
lexer.highlight(data, options)
|
||||||
|
|||||||
@@ -194,6 +194,13 @@ module Linguist
|
|||||||
@unpopular ||= all.select(&:unpopular?).sort_by { |lang| lang.name.downcase }
|
@unpopular ||= all.select(&:unpopular?).sort_by { |lang| lang.name.downcase }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Public: A List of languages with assigned colors.
|
||||||
|
#
|
||||||
|
# Returns an Array of Languages.
|
||||||
|
def self.colors
|
||||||
|
@colors ||= all.select(&:color).sort_by { |lang| lang.name.downcase }
|
||||||
|
end
|
||||||
|
|
||||||
# Public: A List of languages compatible with Ace.
|
# Public: A List of languages compatible with Ace.
|
||||||
#
|
#
|
||||||
# Returns an Array of Languages.
|
# Returns an Array of Languages.
|
||||||
@@ -214,6 +221,8 @@ module Linguist
|
|||||||
raise ArgumentError, "invalid type: #{@type}"
|
raise ArgumentError, "invalid type: #{@type}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@color = attributes[:color]
|
||||||
|
|
||||||
# Set aliases
|
# Set aliases
|
||||||
@aliases = [default_alias_name] + (attributes[:aliases] || [])
|
@aliases = [default_alias_name] + (attributes[:aliases] || [])
|
||||||
|
|
||||||
@@ -269,6 +278,11 @@ module Linguist
|
|||||||
# Returns a type Symbol or nil.
|
# Returns a type Symbol or nil.
|
||||||
attr_reader :type
|
attr_reader :type
|
||||||
|
|
||||||
|
# Public: Get color.
|
||||||
|
#
|
||||||
|
# Returns a hex color String.
|
||||||
|
attr_reader :color
|
||||||
|
|
||||||
# Public: Get aliases
|
# Public: Get aliases
|
||||||
#
|
#
|
||||||
# Examples
|
# Examples
|
||||||
@@ -434,6 +448,7 @@ module Linguist
|
|||||||
YAML.load_file(File.expand_path("../languages.yml", __FILE__)).each do |name, options|
|
YAML.load_file(File.expand_path("../languages.yml", __FILE__)).each do |name, options|
|
||||||
Language.create(
|
Language.create(
|
||||||
:name => name,
|
:name => name,
|
||||||
|
:color => options['color'],
|
||||||
:type => options['type'],
|
:type => options['type'],
|
||||||
:aliases => options['aliases'],
|
:aliases => options['aliases'],
|
||||||
:lexer => options['lexer'],
|
:lexer => options['lexer'],
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
# searchable - Boolean flag to enable searching (defaults to true)
|
# searchable - Boolean flag to enable searching (defaults to true)
|
||||||
# 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.
|
||||||
#
|
#
|
||||||
# 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`.
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
|
|
||||||
ASP:
|
ASP:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#6a40fd"
|
||||||
lexer: aspx-vb
|
lexer: aspx-vb
|
||||||
search_term: aspx-vb
|
search_term: aspx-vb
|
||||||
aliases:
|
aliases:
|
||||||
@@ -43,6 +45,7 @@ ASP:
|
|||||||
ActionScript:
|
ActionScript:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: ActionScript 3
|
lexer: ActionScript 3
|
||||||
|
color: "#e3491a"
|
||||||
search_term: as3
|
search_term: as3
|
||||||
aliases:
|
aliases:
|
||||||
- as3
|
- as3
|
||||||
@@ -51,6 +54,7 @@ ActionScript:
|
|||||||
|
|
||||||
Ada:
|
Ada:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#02f88c"
|
||||||
extensions:
|
extensions:
|
||||||
- .adb
|
- .adb
|
||||||
- .ads
|
- .ads
|
||||||
@@ -71,12 +75,14 @@ AppleScript:
|
|||||||
|
|
||||||
Arc:
|
Arc:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#ca2afe"
|
||||||
lexer: Text only
|
lexer: Text only
|
||||||
extensions:
|
extensions:
|
||||||
- .arc
|
- .arc
|
||||||
|
|
||||||
Arduino:
|
Arduino:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#bd79d1"
|
||||||
lexer: C++
|
lexer: C++
|
||||||
extensions:
|
extensions:
|
||||||
- .ino
|
- .ino
|
||||||
@@ -84,15 +90,22 @@ Arduino:
|
|||||||
Assembly:
|
Assembly:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: NASM
|
lexer: NASM
|
||||||
|
color: "#a67219"
|
||||||
search_term: nasm
|
search_term: nasm
|
||||||
aliases:
|
aliases:
|
||||||
- nasm
|
- nasm
|
||||||
extensions:
|
extensions:
|
||||||
- .asm
|
- .asm
|
||||||
|
|
||||||
|
Augeas:
|
||||||
|
type: programming
|
||||||
|
extensions:
|
||||||
|
- .aug
|
||||||
|
|
||||||
AutoHotkey:
|
AutoHotkey:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: autohotkey
|
lexer: autohotkey
|
||||||
|
color: "#6594b9"
|
||||||
aliases:
|
aliases:
|
||||||
- ahk
|
- ahk
|
||||||
extensions:
|
extensions:
|
||||||
@@ -119,6 +132,7 @@ BlitzMax:
|
|||||||
|
|
||||||
Boo:
|
Boo:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#d4bec1"
|
||||||
extensions:
|
extensions:
|
||||||
- .boo
|
- .boo
|
||||||
|
|
||||||
@@ -134,6 +148,7 @@ Bro:
|
|||||||
|
|
||||||
C:
|
C:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#555"
|
||||||
overrides:
|
overrides:
|
||||||
- .h
|
- .h
|
||||||
primary_extension: .c
|
primary_extension: .c
|
||||||
@@ -146,6 +161,7 @@ C#:
|
|||||||
type: programming
|
type: programming
|
||||||
ace_mode: csharp
|
ace_mode: csharp
|
||||||
search_term: csharp
|
search_term: csharp
|
||||||
|
color: "#5a25a2"
|
||||||
aliases:
|
aliases:
|
||||||
- csharp
|
- csharp
|
||||||
extensions:
|
extensions:
|
||||||
@@ -155,6 +171,7 @@ C++:
|
|||||||
type: programming
|
type: programming
|
||||||
ace_mode: c_cpp
|
ace_mode: c_cpp
|
||||||
search_term: cpp
|
search_term: cpp
|
||||||
|
color: "#f34b7d"
|
||||||
aliases:
|
aliases:
|
||||||
- cpp
|
- cpp
|
||||||
primary_extension: .cpp
|
primary_extension: .cpp
|
||||||
@@ -206,6 +223,7 @@ ChucK:
|
|||||||
Clojure:
|
Clojure:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: clojure
|
ace_mode: clojure
|
||||||
|
color: "#db5855"
|
||||||
primary_extension: .clj
|
primary_extension: .clj
|
||||||
extensions:
|
extensions:
|
||||||
- .clj
|
- .clj
|
||||||
@@ -214,10 +232,12 @@ Clojure:
|
|||||||
CoffeeScript:
|
CoffeeScript:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: coffee
|
ace_mode: coffee
|
||||||
|
color: "#244776"
|
||||||
aliases:
|
aliases:
|
||||||
- coffee
|
- coffee
|
||||||
|
primary_extension: .coffee
|
||||||
extensions:
|
extensions:
|
||||||
- .coffee
|
- ._coffee
|
||||||
filenames:
|
filenames:
|
||||||
- Cakefile
|
- Cakefile
|
||||||
|
|
||||||
@@ -225,6 +245,7 @@ ColdFusion:
|
|||||||
type: programming
|
type: programming
|
||||||
lexer: Coldfusion HTML
|
lexer: Coldfusion HTML
|
||||||
ace_mode: coldfusion
|
ace_mode: coldfusion
|
||||||
|
color: "#ed2cd6"
|
||||||
search_term: cfm
|
search_term: cfm
|
||||||
aliases:
|
aliases:
|
||||||
- cfm
|
- cfm
|
||||||
@@ -235,16 +256,17 @@ ColdFusion:
|
|||||||
|
|
||||||
Common Lisp:
|
Common Lisp:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#3fb68b"
|
||||||
aliases:
|
aliases:
|
||||||
- lisp
|
- lisp
|
||||||
primary_extension: .lisp
|
primary_extension: .lisp
|
||||||
extensions:
|
extensions:
|
||||||
- .lisp
|
- .lisp
|
||||||
|
- .lsp
|
||||||
- .ny
|
- .ny
|
||||||
|
|
||||||
Coq:
|
Coq:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Coq
|
|
||||||
extensions:
|
extensions:
|
||||||
- .v
|
- .v
|
||||||
|
|
||||||
@@ -272,6 +294,7 @@ Cython:
|
|||||||
|
|
||||||
D:
|
D:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#fcd46d"
|
||||||
extensions:
|
extensions:
|
||||||
- .d
|
- .d
|
||||||
- .di
|
- .di
|
||||||
@@ -290,14 +313,30 @@ Darcs Patch:
|
|||||||
- .darcspatch
|
- .darcspatch
|
||||||
- .dpatch
|
- .dpatch
|
||||||
|
|
||||||
|
Dart:
|
||||||
|
type: programming
|
||||||
|
extensions:
|
||||||
|
- .dart
|
||||||
|
|
||||||
Delphi:
|
Delphi:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#b0ce4e"
|
||||||
primary_extension: .pas
|
primary_extension: .pas
|
||||||
extensions:
|
extensions:
|
||||||
- .dpr
|
- .dpr
|
||||||
- .lpr
|
- .lpr
|
||||||
- .pas
|
- .pas
|
||||||
|
|
||||||
|
DCPU-16 ASM:
|
||||||
|
type: programming
|
||||||
|
lexer: dasm16
|
||||||
|
primary_extension: .dasm16
|
||||||
|
extensions:
|
||||||
|
- .dasm
|
||||||
|
- .dasm16
|
||||||
|
aliases:
|
||||||
|
- dasm16
|
||||||
|
|
||||||
Diff:
|
Diff:
|
||||||
extensions:
|
extensions:
|
||||||
- .diff
|
- .diff
|
||||||
@@ -305,17 +344,27 @@ Diff:
|
|||||||
|
|
||||||
Dylan:
|
Dylan:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#3ebc27"
|
||||||
extensions:
|
extensions:
|
||||||
- .dylan
|
- .dylan
|
||||||
|
|
||||||
|
Ecere Projects:
|
||||||
|
type: data
|
||||||
|
group: JavaScript
|
||||||
|
lexer: JSON
|
||||||
|
extensions:
|
||||||
|
- .epj
|
||||||
|
|
||||||
Eiffel:
|
Eiffel:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Text only
|
lexer: Text only
|
||||||
|
color: "#946d57"
|
||||||
extensions:
|
extensions:
|
||||||
- .e
|
- .e
|
||||||
|
|
||||||
Elixir:
|
Elixir:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#6e4a7e"
|
||||||
primary_extension: .ex
|
primary_extension: .ex
|
||||||
extensions:
|
extensions:
|
||||||
- .ex
|
- .ex
|
||||||
@@ -324,6 +373,7 @@ Elixir:
|
|||||||
Emacs Lisp:
|
Emacs Lisp:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Scheme
|
lexer: Scheme
|
||||||
|
color: "#c065db"
|
||||||
aliases:
|
aliases:
|
||||||
- elisp
|
- elisp
|
||||||
- emacs
|
- emacs
|
||||||
@@ -334,6 +384,7 @@ Emacs Lisp:
|
|||||||
|
|
||||||
Erlang:
|
Erlang:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#949e0e"
|
||||||
primary_extension: .erl
|
primary_extension: .erl
|
||||||
extensions:
|
extensions:
|
||||||
- .erl
|
- .erl
|
||||||
@@ -341,7 +392,8 @@ Erlang:
|
|||||||
|
|
||||||
F#:
|
F#:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: OCaml
|
lexer: FSharp
|
||||||
|
color: "#b845fc"
|
||||||
search_term: ocaml
|
search_term: ocaml
|
||||||
extensions:
|
extensions:
|
||||||
- .fs
|
- .fs
|
||||||
@@ -351,6 +403,7 @@ F#:
|
|||||||
FORTRAN:
|
FORTRAN:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Fortran
|
lexer: Fortran
|
||||||
|
color: "#4d41b1"
|
||||||
primary_extension: .f90
|
primary_extension: .f90
|
||||||
extensions:
|
extensions:
|
||||||
- .F
|
- .F
|
||||||
@@ -372,19 +425,23 @@ FORTRAN:
|
|||||||
|
|
||||||
Factor:
|
Factor:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#636746"
|
||||||
extensions:
|
extensions:
|
||||||
- .factor
|
- .factor
|
||||||
|
|
||||||
Fancy:
|
Fancy:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#7b9db4"
|
||||||
primary_extension: .fy
|
primary_extension: .fy
|
||||||
extensions:
|
extensions:
|
||||||
- .fancypack
|
- .fancypack
|
||||||
- .fy
|
- .fy
|
||||||
|
filenames:
|
||||||
|
- Fakefile
|
||||||
|
|
||||||
Fantom:
|
Fantom:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Java
|
color: "#dbded5"
|
||||||
extensions:
|
extensions:
|
||||||
- .fan
|
- .fan
|
||||||
|
|
||||||
@@ -423,11 +480,13 @@ Gettext Catalog:
|
|||||||
|
|
||||||
Go:
|
Go:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#8d04eb"
|
||||||
extensions:
|
extensions:
|
||||||
- .go
|
- .go
|
||||||
|
|
||||||
Gosu:
|
Gosu:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#82937f"
|
||||||
primary_extension: .gs
|
primary_extension: .gs
|
||||||
extensions:
|
extensions:
|
||||||
- .gs
|
- .gs
|
||||||
@@ -450,8 +509,8 @@ Groff:
|
|||||||
|
|
||||||
Groovy:
|
Groovy:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Java
|
|
||||||
ace_mode: groovy
|
ace_mode: groovy
|
||||||
|
color: "#e69f56"
|
||||||
primary_extension: .groovy
|
primary_extension: .groovy
|
||||||
extensions:
|
extensions:
|
||||||
- .gradle
|
- .gradle
|
||||||
@@ -475,7 +534,6 @@ HTML:
|
|||||||
- .htm
|
- .htm
|
||||||
- .html
|
- .html
|
||||||
- .xhtml
|
- .xhtml
|
||||||
- .xslt
|
|
||||||
|
|
||||||
HTML+Django:
|
HTML+Django:
|
||||||
type: markup
|
type: markup
|
||||||
@@ -503,6 +561,7 @@ HaXe:
|
|||||||
type: programming
|
type: programming
|
||||||
lexer: haXe
|
lexer: haXe
|
||||||
ace_mode: haxe
|
ace_mode: haxe
|
||||||
|
color: "#346d51"
|
||||||
extensions:
|
extensions:
|
||||||
- .hx
|
- .hx
|
||||||
- .hxml
|
- .hxml
|
||||||
@@ -516,6 +575,7 @@ Haml:
|
|||||||
|
|
||||||
Haskell:
|
Haskell:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#29b544"
|
||||||
extensions:
|
extensions:
|
||||||
- .hs
|
- .hs
|
||||||
- .hsc
|
- .hsc
|
||||||
@@ -540,18 +600,19 @@ IRC log:
|
|||||||
|
|
||||||
Io:
|
Io:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#a9188d"
|
||||||
extensions:
|
extensions:
|
||||||
- .io
|
- .io
|
||||||
|
|
||||||
Ioke:
|
Ioke:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#078193"
|
||||||
extensions:
|
extensions:
|
||||||
- .ik
|
- .ik
|
||||||
|
|
||||||
JSON:
|
JSON:
|
||||||
type: data
|
type: data
|
||||||
group: JavaScript
|
group: JavaScript
|
||||||
lexer: JavaScript
|
|
||||||
ace_mode: json
|
ace_mode: json
|
||||||
searchable: false
|
searchable: false
|
||||||
extensions:
|
extensions:
|
||||||
@@ -560,6 +621,7 @@ JSON:
|
|||||||
Java:
|
Java:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: java
|
ace_mode: java
|
||||||
|
color: "#b07219"
|
||||||
extensions:
|
extensions:
|
||||||
- .java
|
- .java
|
||||||
- .pde
|
- .pde
|
||||||
@@ -576,14 +638,17 @@ Java Server Pages:
|
|||||||
JavaScript:
|
JavaScript:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: javascript
|
ace_mode: javascript
|
||||||
|
color: "#f15501"
|
||||||
aliases:
|
aliases:
|
||||||
- js
|
- js
|
||||||
- node
|
- node
|
||||||
primary_extension: .js
|
primary_extension: .js
|
||||||
extensions:
|
extensions:
|
||||||
|
- ._js
|
||||||
- .bones
|
- .bones
|
||||||
- .jake
|
- .jake
|
||||||
- .js
|
- .js
|
||||||
|
- .jsfl
|
||||||
- .jsm
|
- .jsm
|
||||||
- .jss
|
- .jss
|
||||||
- .jsx
|
- .jsx
|
||||||
@@ -593,6 +658,18 @@ JavaScript:
|
|||||||
filenames:
|
filenames:
|
||||||
- Jakefile
|
- Jakefile
|
||||||
|
|
||||||
|
Julia:
|
||||||
|
type: programming
|
||||||
|
extensions:
|
||||||
|
- .jl
|
||||||
|
|
||||||
|
Kotlin:
|
||||||
|
type: programming
|
||||||
|
extensions:
|
||||||
|
- .kt
|
||||||
|
- .ktm
|
||||||
|
- .kts
|
||||||
|
|
||||||
LLVM:
|
LLVM:
|
||||||
extensions:
|
extensions:
|
||||||
- .ll
|
- .ll
|
||||||
@@ -615,21 +692,20 @@ Literate Haskell:
|
|||||||
|
|
||||||
Logtalk:
|
Logtalk:
|
||||||
type: programming
|
type: programming
|
||||||
primary_extension: .lgt
|
|
||||||
extensions:
|
extensions:
|
||||||
- .lgt
|
- .lgt
|
||||||
|
|
||||||
Lua:
|
Lua:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: lua
|
ace_mode: lua
|
||||||
primary_extension: .lua
|
color: "#fa1fa1"
|
||||||
extensions:
|
extensions:
|
||||||
- .lua
|
- .lua
|
||||||
- .nse
|
- .nse
|
||||||
|
|
||||||
M:
|
M:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: common-lisp
|
lexer: Common Lisp
|
||||||
aliases:
|
aliases:
|
||||||
- mumps
|
- mumps
|
||||||
extensions:
|
extensions:
|
||||||
@@ -663,6 +739,7 @@ Markdown:
|
|||||||
|
|
||||||
Matlab:
|
Matlab:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#bb92ac"
|
||||||
primary_extension: .matlab
|
primary_extension: .matlab
|
||||||
extensions:
|
extensions:
|
||||||
- .m
|
- .m
|
||||||
@@ -670,6 +747,7 @@ Matlab:
|
|||||||
|
|
||||||
Max/MSP:
|
Max/MSP:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#ce279c"
|
||||||
lexer: Text only
|
lexer: Text only
|
||||||
extensions:
|
extensions:
|
||||||
- .mxt
|
- .mxt
|
||||||
@@ -682,6 +760,7 @@ Mirah:
|
|||||||
type: programming
|
type: programming
|
||||||
lexer: Ruby
|
lexer: Ruby
|
||||||
search_term: ruby
|
search_term: ruby
|
||||||
|
color: "#c7a938"
|
||||||
extensions:
|
extensions:
|
||||||
- .duby
|
- .duby
|
||||||
- .mir
|
- .mir
|
||||||
@@ -698,11 +777,13 @@ Myghty:
|
|||||||
|
|
||||||
Nemerle:
|
Nemerle:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#0d3c6e"
|
||||||
extensions:
|
extensions:
|
||||||
- .n
|
- .n
|
||||||
|
|
||||||
Nimrod:
|
Nimrod:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#37775b"
|
||||||
extensions:
|
extensions:
|
||||||
- .nim
|
- .nim
|
||||||
- .nimrod
|
- .nimrod
|
||||||
@@ -710,6 +791,7 @@ Nimrod:
|
|||||||
Nu:
|
Nu:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Scheme
|
lexer: Scheme
|
||||||
|
color: "#c9df40"
|
||||||
aliases:
|
aliases:
|
||||||
- nush
|
- nush
|
||||||
extensions:
|
extensions:
|
||||||
@@ -728,6 +810,7 @@ NumPy:
|
|||||||
OCaml:
|
OCaml:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: ocaml
|
ace_mode: ocaml
|
||||||
|
color: "#3be133"
|
||||||
primary_extension: .ml
|
primary_extension: .ml
|
||||||
extensions:
|
extensions:
|
||||||
- .ml
|
- .ml
|
||||||
@@ -743,6 +826,7 @@ ObjDump:
|
|||||||
|
|
||||||
Objective-C:
|
Objective-C:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#438eff"
|
||||||
overrides:
|
overrides:
|
||||||
- .m
|
- .m
|
||||||
primary_extension: .m
|
primary_extension: .m
|
||||||
@@ -753,13 +837,13 @@ Objective-C:
|
|||||||
|
|
||||||
Objective-J:
|
Objective-J:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#ff0c5a"
|
||||||
extensions:
|
extensions:
|
||||||
- .j
|
- .j
|
||||||
- .sj
|
- .sj
|
||||||
|
|
||||||
Opa:
|
Opa:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Text only
|
|
||||||
extensions:
|
extensions:
|
||||||
- .opa
|
- .opa
|
||||||
|
|
||||||
@@ -784,6 +868,7 @@ OpenEdge ABL:
|
|||||||
PHP:
|
PHP:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: php
|
ace_mode: php
|
||||||
|
color: "#6e03c1"
|
||||||
extensions:
|
extensions:
|
||||||
- .aw
|
- .aw
|
||||||
- .ctp
|
- .ctp
|
||||||
@@ -792,9 +877,12 @@ PHP:
|
|||||||
- .php4
|
- .php4
|
||||||
- .php5
|
- .php5
|
||||||
- .phpt
|
- .phpt
|
||||||
|
filenames:
|
||||||
|
- Phakefile
|
||||||
|
|
||||||
Parrot:
|
Parrot:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#f3ca0a"
|
||||||
lexer: Text only
|
lexer: Text only
|
||||||
primary_extension: .parrot # Dummy extension
|
primary_extension: .parrot # Dummy extension
|
||||||
|
|
||||||
@@ -819,6 +907,7 @@ Parrot Assembly:
|
|||||||
Perl:
|
Perl:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: perl
|
ace_mode: perl
|
||||||
|
color: "#0298c3"
|
||||||
overrides:
|
overrides:
|
||||||
- .pl
|
- .pl
|
||||||
- .t
|
- .t
|
||||||
@@ -830,13 +919,13 @@ Perl:
|
|||||||
- .pl
|
- .pl
|
||||||
- .plx
|
- .plx
|
||||||
- .pm
|
- .pm
|
||||||
|
- .pm6
|
||||||
- .pod
|
- .pod
|
||||||
- .psgi
|
- .psgi
|
||||||
- .t
|
- .t
|
||||||
|
|
||||||
Powershell:
|
PowerShell:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Text only
|
|
||||||
ace_mode: powershell
|
ace_mode: powershell
|
||||||
aliases:
|
aliases:
|
||||||
- posh
|
- posh
|
||||||
@@ -846,6 +935,7 @@ Powershell:
|
|||||||
|
|
||||||
Prolog:
|
Prolog:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#74283c"
|
||||||
extensions:
|
extensions:
|
||||||
- .pl
|
- .pl
|
||||||
- .pro
|
- .pro
|
||||||
@@ -853,12 +943,15 @@ Prolog:
|
|||||||
|
|
||||||
Puppet:
|
Puppet:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Text only
|
color: "#cc5555"
|
||||||
extensions:
|
extensions:
|
||||||
- .pp
|
- .pp
|
||||||
|
filenames:
|
||||||
|
- Modulefile
|
||||||
|
|
||||||
Pure Data:
|
Pure Data:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#91de79"
|
||||||
lexer: Text only
|
lexer: Text only
|
||||||
extensions:
|
extensions:
|
||||||
- .pd
|
- .pd
|
||||||
@@ -866,12 +959,15 @@ Pure Data:
|
|||||||
Python:
|
Python:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: python
|
ace_mode: python
|
||||||
|
color: "#3581ba"
|
||||||
primary_extension: .py
|
primary_extension: .py
|
||||||
extensions:
|
extensions:
|
||||||
- .py
|
- .py
|
||||||
- .pyw
|
- .pyw
|
||||||
- .wsgi
|
- .wsgi
|
||||||
- .xpy
|
- .xpy
|
||||||
|
filenames:
|
||||||
|
- wscript
|
||||||
|
|
||||||
Python traceback:
|
Python traceback:
|
||||||
type: data
|
type: data
|
||||||
@@ -883,6 +979,7 @@ Python traceback:
|
|||||||
|
|
||||||
R:
|
R:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#198ce7"
|
||||||
lexer: S
|
lexer: S
|
||||||
overrides:
|
overrides:
|
||||||
- .r
|
- .r
|
||||||
@@ -900,6 +997,7 @@ RHTML:
|
|||||||
Racket:
|
Racket:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Scheme
|
lexer: Scheme
|
||||||
|
color: "#ae17ff"
|
||||||
primary_extension: .rkt
|
primary_extension: .rkt
|
||||||
extensions:
|
extensions:
|
||||||
- .rkt
|
- .rkt
|
||||||
@@ -917,6 +1015,7 @@ Raw token data:
|
|||||||
Rebol:
|
Rebol:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: REBOL
|
lexer: REBOL
|
||||||
|
color: "#358a5b"
|
||||||
extensions:
|
extensions:
|
||||||
- .r
|
- .r
|
||||||
- .r2
|
- .r2
|
||||||
@@ -930,6 +1029,7 @@ Redcode:
|
|||||||
Ruby:
|
Ruby:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: ruby
|
ace_mode: ruby
|
||||||
|
color: "#701516"
|
||||||
aliases:
|
aliases:
|
||||||
- jruby
|
- jruby
|
||||||
- macruby
|
- macruby
|
||||||
@@ -962,8 +1062,8 @@ Ruby:
|
|||||||
|
|
||||||
Rust:
|
Rust:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#dea584"
|
||||||
lexer: Text only
|
lexer: Text only
|
||||||
primary_extension: .rs
|
|
||||||
extensions:
|
extensions:
|
||||||
- .rs
|
- .rs
|
||||||
|
|
||||||
@@ -985,7 +1085,6 @@ Sage:
|
|||||||
type: programming
|
type: programming
|
||||||
lexer: Python
|
lexer: Python
|
||||||
group: Python
|
group: Python
|
||||||
primary_extension: .sage
|
|
||||||
extensions:
|
extensions:
|
||||||
- .sage
|
- .sage
|
||||||
|
|
||||||
@@ -998,6 +1097,7 @@ Sass:
|
|||||||
Scala:
|
Scala:
|
||||||
type: programming
|
type: programming
|
||||||
ace_mode: scala
|
ace_mode: scala
|
||||||
|
color: "#7dd3b0"
|
||||||
primary_extension: .scala
|
primary_extension: .scala
|
||||||
extensions:
|
extensions:
|
||||||
- .sbt
|
- .sbt
|
||||||
@@ -1005,6 +1105,7 @@ Scala:
|
|||||||
|
|
||||||
Scheme:
|
Scheme:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#1e4aec"
|
||||||
primary_extension: .scm
|
primary_extension: .scm
|
||||||
extensions:
|
extensions:
|
||||||
- .scm
|
- .scm
|
||||||
@@ -1021,6 +1122,7 @@ Scilab:
|
|||||||
|
|
||||||
Self:
|
Self:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#0579aa"
|
||||||
lexer: Text only
|
lexer: Text only
|
||||||
extensions:
|
extensions:
|
||||||
- .self
|
- .self
|
||||||
@@ -1029,6 +1131,7 @@ Shell:
|
|||||||
type: programming
|
type: programming
|
||||||
lexer: Bash
|
lexer: Bash
|
||||||
search_term: bash
|
search_term: bash
|
||||||
|
color: "#5861ce"
|
||||||
aliases:
|
aliases:
|
||||||
- sh
|
- sh
|
||||||
- bash
|
- bash
|
||||||
@@ -1047,9 +1150,11 @@ Shell:
|
|||||||
- .zshrc
|
- .zshrc
|
||||||
- bashrc
|
- bashrc
|
||||||
- zshrc
|
- zshrc
|
||||||
|
- PKGBUILD
|
||||||
|
|
||||||
Smalltalk:
|
Smalltalk:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#596706"
|
||||||
extensions:
|
extensions:
|
||||||
- .st
|
- .st
|
||||||
|
|
||||||
@@ -1059,7 +1164,7 @@ Smarty:
|
|||||||
|
|
||||||
Standard ML:
|
Standard ML:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Standard ML
|
color: "#dc566d"
|
||||||
aliases:
|
aliases:
|
||||||
- sml
|
- sml
|
||||||
primary_extension: .sml
|
primary_extension: .sml
|
||||||
@@ -1069,12 +1174,14 @@ Standard ML:
|
|||||||
|
|
||||||
SuperCollider:
|
SuperCollider:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#46390b"
|
||||||
lexer: Text only
|
lexer: Text only
|
||||||
extensions:
|
extensions:
|
||||||
- .sc
|
- .sc
|
||||||
|
|
||||||
Tcl:
|
Tcl:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#e4cc98"
|
||||||
extensions:
|
extensions:
|
||||||
- .tcl
|
- .tcl
|
||||||
|
|
||||||
@@ -1102,6 +1209,11 @@ TeX:
|
|||||||
- .tex
|
- .tex
|
||||||
- .toc
|
- .toc
|
||||||
|
|
||||||
|
Tea:
|
||||||
|
type: markup
|
||||||
|
extensions:
|
||||||
|
- .tea
|
||||||
|
|
||||||
Text:
|
Text:
|
||||||
type: data
|
type: data
|
||||||
lexer: Text only
|
lexer: Text only
|
||||||
@@ -1118,8 +1230,8 @@ Textile:
|
|||||||
|
|
||||||
Turing:
|
Turing:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#45f715"
|
||||||
lexer: Text only
|
lexer: Text only
|
||||||
primary_extension: .t
|
|
||||||
extensions:
|
extensions:
|
||||||
- .t
|
- .t
|
||||||
- .tu
|
- .tu
|
||||||
@@ -1133,14 +1245,15 @@ Twig:
|
|||||||
|
|
||||||
VHDL:
|
VHDL:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Text only
|
lexer: vhdl
|
||||||
primary_extension: .vhd
|
color: "#543978"
|
||||||
extensions:
|
extensions:
|
||||||
- .vhd
|
- .vhd
|
||||||
- .vhdl
|
- .vhdl
|
||||||
|
|
||||||
Vala:
|
Vala:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#ee7d06"
|
||||||
extensions:
|
extensions:
|
||||||
- .vala
|
- .vala
|
||||||
- .vapi
|
- .vapi
|
||||||
@@ -1148,6 +1261,7 @@ Vala:
|
|||||||
Verilog:
|
Verilog:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: verilog
|
lexer: verilog
|
||||||
|
color: "#848bf3"
|
||||||
overrides:
|
overrides:
|
||||||
- .v
|
- .v
|
||||||
extensions:
|
extensions:
|
||||||
@@ -1155,6 +1269,7 @@ Verilog:
|
|||||||
|
|
||||||
VimL:
|
VimL:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#199c4b"
|
||||||
search_term: vim
|
search_term: vim
|
||||||
aliases:
|
aliases:
|
||||||
- vim
|
- vim
|
||||||
@@ -1169,6 +1284,7 @@ VimL:
|
|||||||
Visual Basic:
|
Visual Basic:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: VB.net
|
lexer: VB.net
|
||||||
|
color: "#945db7"
|
||||||
primary_extension: .vb
|
primary_extension: .vb
|
||||||
extensions:
|
extensions:
|
||||||
- .bas
|
- .bas
|
||||||
@@ -1206,6 +1322,7 @@ XML:
|
|||||||
|
|
||||||
XQuery:
|
XQuery:
|
||||||
type: programming
|
type: programming
|
||||||
|
color: "#2700e2"
|
||||||
extensions:
|
extensions:
|
||||||
- .xq
|
- .xq
|
||||||
- .xqm
|
- .xqm
|
||||||
@@ -1217,6 +1334,12 @@ XS:
|
|||||||
extensions:
|
extensions:
|
||||||
- .xs
|
- .xs
|
||||||
|
|
||||||
|
XSLT:
|
||||||
|
type: markup
|
||||||
|
group: XML
|
||||||
|
extensions:
|
||||||
|
- .xslt
|
||||||
|
|
||||||
YAML:
|
YAML:
|
||||||
type: markup
|
type: markup
|
||||||
primary_extension: .yml
|
primary_extension: .yml
|
||||||
@@ -1226,6 +1349,14 @@ YAML:
|
|||||||
filenames:
|
filenames:
|
||||||
- .gemrc
|
- .gemrc
|
||||||
|
|
||||||
|
eC:
|
||||||
|
type: programming
|
||||||
|
search_term: ec
|
||||||
|
primary_extension: .ec
|
||||||
|
extensions:
|
||||||
|
- .ec
|
||||||
|
- .eh
|
||||||
|
|
||||||
mupad:
|
mupad:
|
||||||
lexer: MuPAD
|
lexer: MuPAD
|
||||||
extensions:
|
extensions:
|
||||||
@@ -1234,6 +1365,7 @@ mupad:
|
|||||||
ooc:
|
ooc:
|
||||||
type: programming
|
type: programming
|
||||||
lexer: Ooc
|
lexer: Ooc
|
||||||
|
color: "#b0b77e"
|
||||||
extensions:
|
extensions:
|
||||||
- .ooc
|
- .ooc
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
require 'mime/types'
|
require 'mime/types'
|
||||||
require 'yaml'
|
require 'yaml'
|
||||||
|
|
||||||
|
class MIME::Type
|
||||||
|
attr_accessor :override
|
||||||
|
end
|
||||||
|
|
||||||
# Register additional mime type extensions
|
# Register additional mime type extensions
|
||||||
#
|
#
|
||||||
# Follows same format as mime-types data file
|
# Follows same format as mime-types data file
|
||||||
@@ -33,6 +37,8 @@ File.read(File.expand_path("../mimes.yml", __FILE__)).lines.each do |line|
|
|||||||
mime_type.encoding = encoding
|
mime_type.encoding = encoding
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mime_type.override = true
|
||||||
|
|
||||||
# Kind of hacky, but we need to reindex the mime type after making changes
|
# Kind of hacky, but we need to reindex the mime type after making changes
|
||||||
MIME::Types.add_type_variant(mime_type)
|
MIME::Types.add_type_variant(mime_type)
|
||||||
MIME::Types.index_extensions(mime_type)
|
MIME::Types.index_extensions(mime_type)
|
||||||
@@ -72,8 +78,11 @@ module Linguist
|
|||||||
guesses = ::MIME::Types.type_for(ext_or_mime_type)
|
guesses = ::MIME::Types.type_for(ext_or_mime_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Prefer text mime types over binary
|
# Use custom override first
|
||||||
guesses.detect { |type| type.ascii? } ||
|
guesses.detect { |type| type.override } ||
|
||||||
|
|
||||||
|
# Prefer text mime types over binary
|
||||||
|
guesses.detect { |type| type.ascii? } ||
|
||||||
|
|
||||||
# Otherwise use the first guess
|
# Otherwise use the first guess
|
||||||
guesses.first
|
guesses.first
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ application/x-supercollider @sc :8bit
|
|||||||
application/x-troff-ms :8bit
|
application/x-troff-ms :8bit
|
||||||
application/x-wais-source :8bit
|
application/x-wais-source :8bit
|
||||||
application/xaml+xml @xaml :8bit
|
application/xaml+xml @xaml :8bit
|
||||||
|
application/xslt+xml @xslt :8bit
|
||||||
image/x-icns @icns
|
image/x-icns @icns
|
||||||
text/cache-manifest @manifest
|
text/cache-manifest @manifest
|
||||||
text/plain @cu,cxx
|
text/plain @cu,cxx
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
- ^tools/
|
- ^tools/
|
||||||
|
|
||||||
# Node depedencies
|
# Node depedencies
|
||||||
- ^node_modules/
|
- node_modules/
|
||||||
|
|
||||||
# Vendored depedencies
|
# Vendored depedencies
|
||||||
- vendor/
|
- vendor/
|
||||||
@@ -88,3 +88,9 @@
|
|||||||
|
|
||||||
# NuGet
|
# NuGet
|
||||||
- ^[Pp]ackages/
|
- ^[Pp]ackages/
|
||||||
|
|
||||||
|
# ExtJS
|
||||||
|
- (^|/)extjs/
|
||||||
|
|
||||||
|
# Samples folders
|
||||||
|
- ^[Ss]amples/
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|||||||
|
|
||||||
s.add_dependency 'charlock_holmes', '~> 0.6.6'
|
s.add_dependency 'charlock_holmes', '~> 0.6.6'
|
||||||
s.add_dependency 'escape_utils', '~> 0.2.3'
|
s.add_dependency 'escape_utils', '~> 0.2.3'
|
||||||
s.add_dependency 'mime-types', '~> 1.16'
|
s.add_dependency 'mime-types', '~> 1.18'
|
||||||
s.add_dependency 'pygments.rb', '~> 0.2.7'
|
s.add_dependency 'pygments.rb', '~> 0.2.11'
|
||||||
s.add_development_dependency 'rake'
|
s.add_development_dependency 'rake'
|
||||||
end
|
end
|
||||||
|
|||||||
47
test/fixtures/Foo.kt
vendored
Normal file
47
test/fixtures/Foo.kt
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package addressbook
|
||||||
|
|
||||||
|
class Contact(
|
||||||
|
val name : String,
|
||||||
|
val emails : List<EmailAddress>,
|
||||||
|
val addresses : List<PostalAddress>,
|
||||||
|
val phonenums : List<PhoneNumber>
|
||||||
|
)
|
||||||
|
|
||||||
|
class EmailAddress(
|
||||||
|
val user : String,
|
||||||
|
val host : String
|
||||||
|
)
|
||||||
|
|
||||||
|
class PostalAddress(
|
||||||
|
val streetAddress : String,
|
||||||
|
val city : String,
|
||||||
|
val zip : String,
|
||||||
|
val state : USState?,
|
||||||
|
val country : Country
|
||||||
|
) {
|
||||||
|
assert {(state == null) xor (country == Countries["US"]) }
|
||||||
|
}
|
||||||
|
|
||||||
|
class PhoneNumber(
|
||||||
|
val country : Country,
|
||||||
|
val areaCode : Int,
|
||||||
|
val number : Long
|
||||||
|
)
|
||||||
|
|
||||||
|
object Countries {
|
||||||
|
fun get(id : CountryID) : Country = countryTable[id]
|
||||||
|
|
||||||
|
private var table : Map<String, Country>? = null
|
||||||
|
private val countryTable : Map<String, Country>
|
||||||
|
get() {
|
||||||
|
if (table == null) {
|
||||||
|
table = HashMap()
|
||||||
|
for (line in TextFile("countries.txt").lines(stripWhiteSpace = true)) {
|
||||||
|
table[line] = Country(line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return table
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Country(val name : String)
|
||||||
43
test/fixtures/PKGBUILD
vendored
Normal file
43
test/fixtures/PKGBUILD
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# Maintainer: Daniel Micay <danielmicay@gmail.com>
|
||||||
|
pkgname=stud-git
|
||||||
|
pkgver=20120316
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="The Scalable TLS Unwrapping Daemon"
|
||||||
|
arch=(i686 x86_64)
|
||||||
|
url="https://github.com/bumptech/stud"
|
||||||
|
license=('BSD')
|
||||||
|
depends=(libev openssl)
|
||||||
|
makedepends=(git)
|
||||||
|
provides=(stud)
|
||||||
|
conflicts=(stud)
|
||||||
|
|
||||||
|
_gitroot=https://github.com/bumptech/stud.git
|
||||||
|
_gitname=stud
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "$srcdir"
|
||||||
|
msg "Connecting to GIT server...."
|
||||||
|
|
||||||
|
if [[ -d "$_gitname" ]]; then
|
||||||
|
cd "$_gitname" && git pull origin
|
||||||
|
msg "The local files are updated."
|
||||||
|
else
|
||||||
|
git clone "$_gitroot" "$_gitname"
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg "GIT checkout done or server timeout"
|
||||||
|
msg "Starting build..."
|
||||||
|
|
||||||
|
rm -rf "$srcdir/$_gitname-build"
|
||||||
|
git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
|
||||||
|
cd "$srcdir/$_gitname-build"
|
||||||
|
|
||||||
|
make
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "$srcdir/$_gitname-build"
|
||||||
|
make PREFIX=/usr DESTDIR="$pkgdir/" install
|
||||||
|
install -Dm755 init.stud "$pkgdir/etc/rc.d/stud"
|
||||||
|
mkdir -p "$pkgdir/etc/stud"
|
||||||
|
}
|
||||||
0
test/fixtures/empty.m
vendored
Normal file
0
test/fixtures/empty.m
vendored
Normal file
1
test/fixtures/foo.tea
vendored
Normal file
1
test/fixtures/foo.tea
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<% template foo() %>
|
||||||
14
test/fixtures/foo.vhd
vendored
Normal file
14
test/fixtures/foo.vhd
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
-- VHDL example file
|
||||||
|
|
||||||
|
library ieee;
|
||||||
|
use ieee.std_logic_1164.all;
|
||||||
|
|
||||||
|
entity inverter is
|
||||||
|
port(a : in std_logic;
|
||||||
|
b : out std_logic);
|
||||||
|
end entity;
|
||||||
|
|
||||||
|
architecture rtl of inverter is
|
||||||
|
begin
|
||||||
|
b <= not a;
|
||||||
|
end architecture;
|
||||||
29
test/fixtures/matlab_class.m
vendored
Normal file
29
test/fixtures/matlab_class.m
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
classdef matlab_class
|
||||||
|
properties
|
||||||
|
R;
|
||||||
|
G;
|
||||||
|
B;
|
||||||
|
end
|
||||||
|
methods
|
||||||
|
function obj = matlab_class(r,g,b)
|
||||||
|
obj.R = r;
|
||||||
|
obj.G = g;
|
||||||
|
obj.B = b;
|
||||||
|
end
|
||||||
|
function disp(obj)
|
||||||
|
disp(['Red: ' num2str(obj.R) ...
|
||||||
|
', Green: ' num2str(obj.G) ...
|
||||||
|
', Blue: ' num2str(obj.B)]);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
enumeration
|
||||||
|
red (1,0,0)
|
||||||
|
green (0,1,0)
|
||||||
|
blue (0,0,1)
|
||||||
|
cyan (0,1,1)
|
||||||
|
magenta (1,0,1)
|
||||||
|
yellow (1,1,0)
|
||||||
|
black (0,0,0)
|
||||||
|
white (1,1,1)
|
||||||
|
end
|
||||||
|
end
|
||||||
33
test/fixtures/matlab_function2.m
vendored
Normal file
33
test/fixtures/matlab_function2.m
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
function ret = matlab_function2(A,B)
|
||||||
|
% Simple function that combines two values using function handles and displays
|
||||||
|
% the return value
|
||||||
|
|
||||||
|
% create function handles
|
||||||
|
fun1=@interface;
|
||||||
|
fun2=@implementation;
|
||||||
|
fun3=@property;
|
||||||
|
fun4=@synthesize;
|
||||||
|
|
||||||
|
% use function handles
|
||||||
|
ret = fun1(A)+fun2(A)+fun3(B)+fun4(B);
|
||||||
|
|
||||||
|
% Display the return value
|
||||||
|
disp('Return value in function');
|
||||||
|
disp(ret);
|
||||||
|
|
||||||
|
|
||||||
|
function A=interface(A)
|
||||||
|
% simple sub-function with same name Objective-C @keyword
|
||||||
|
A=2*A;
|
||||||
|
|
||||||
|
function A=implementation(A)
|
||||||
|
% simple sub-function with same name Objective-C @keyword
|
||||||
|
A=A^2;
|
||||||
|
|
||||||
|
function B=property(B)
|
||||||
|
% simple sub-function with same name Objective-C @keyword
|
||||||
|
B=2*B;
|
||||||
|
|
||||||
|
function B=synthesize(B)
|
||||||
|
% simple sub-function with same name Objective-C @keyword
|
||||||
|
B=B^2;
|
||||||
13
test/fixtures/matlab_script2.m
vendored
Normal file
13
test/fixtures/matlab_script2.m
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
% Matlab example script 2
|
||||||
|
% Comments precended with arbitrary whitespace (spaces or tabs)
|
||||||
|
|
||||||
|
%Call matlab_function function which resides in the same directory
|
||||||
|
|
||||||
|
value1 = 5 % semicolon at end of line is not mandatory, only suppresses output to command line.
|
||||||
|
value2 = 3
|
||||||
|
|
||||||
|
% Calculate sum of value1 and value2
|
||||||
|
result = matlab_function(value1,value2);
|
||||||
|
|
||||||
|
disp('called from script')
|
||||||
|
disp(result);
|
||||||
15
test/fixtures/point.dart
vendored
Normal file
15
test/fixtures/point.dart
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
class Point {
|
||||||
|
Point(this.x, this.y);
|
||||||
|
distanceTo(Point other) {
|
||||||
|
var dx = x - other.x;
|
||||||
|
var dy = y - other.y;
|
||||||
|
return Math.sqrt(dx * dx + dy * dy);
|
||||||
|
}
|
||||||
|
var x, y;
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
Point p = new Point(2, 3);
|
||||||
|
Point q = new Point(3, 4);
|
||||||
|
print('distance from p to q = ${p.distanceTo(q)}');
|
||||||
|
}
|
||||||
24
test/fixtures/steelseries-min.js
vendored
Normal file
24
test/fixtures/steelseries-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
37
test/fixtures/stockcorr.jl
vendored
Normal file
37
test/fixtures/stockcorr.jl
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
## Test case from Issue #445
|
||||||
|
|
||||||
|
#STOCKCORR - The original, unoptimised code that simulates two correlated assets
|
||||||
|
function stockcorr()
|
||||||
|
|
||||||
|
## Correlated asset information
|
||||||
|
CurrentPrice = [78. 102.] # Initial Prices of the two stocks
|
||||||
|
Corr = [1. 0.4; 0.4 1.] # Correlation Matrix
|
||||||
|
T = 500 # Number of days to simulate = 2years = 500days
|
||||||
|
n = 100000 # Number of simulations
|
||||||
|
dt = 1/250 # Time step (1year = 250days)
|
||||||
|
Div=[0.01 0.01] # Dividend
|
||||||
|
Vol=[0.2 0.3] # Volatility
|
||||||
|
|
||||||
|
## Market Information
|
||||||
|
r = 0.03 # Risk-free rate
|
||||||
|
|
||||||
|
## Define storages
|
||||||
|
SimulPriceA = zeros(T,n) # Simulated Price of Asset A
|
||||||
|
SimulPriceA[1,:] = CurrentPrice[1]
|
||||||
|
SimulPriceB = zeros(T,n) # Simulated Price of Asset B
|
||||||
|
SimulPriceB[1,:] = CurrentPrice[2]
|
||||||
|
|
||||||
|
## Generating the paths of stock prices by Geometric Brownian Motion
|
||||||
|
UpperTriangle=chol(Corr) # UpperTriangle Matrix by Cholesky decomposition
|
||||||
|
|
||||||
|
for i = 1:n
|
||||||
|
Wiener = randn(T-1,2)
|
||||||
|
CorrWiener = Wiener*UpperTriangle
|
||||||
|
for j = 2:T
|
||||||
|
SimulPriceA[j,i] = SimulPriceA[j-1,i]*exp((r-Div[1]-Vol[1]^2/2)*dt+Vol[1]*sqrt(dt)*CorrWiener[j-1,1])
|
||||||
|
SimulPriceB[j,i] = SimulPriceB[j-1,i]*exp((r-Div[2]-Vol[2]^2/2)*dt+Vol[2]*sqrt(dt)*CorrWiener[j-1,2])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return (SimulPriceA, SimulPriceB)
|
||||||
|
end
|
||||||
25
test/fixtures/test.xslt
vendored
Normal file
25
test/fixtures/test.xslt
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||||
|
|
||||||
|
<xsl:template match="/">
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<h2>My CD Collection</h2>
|
||||||
|
<table border="1">
|
||||||
|
<tr bgcolor="#9acd32">
|
||||||
|
<th>Title</th>
|
||||||
|
<th>Artist</th>
|
||||||
|
</tr>
|
||||||
|
<xsl:for-each select="catalog/cd">
|
||||||
|
<tr>
|
||||||
|
<td><xsl:value-of select="title"/></td>
|
||||||
|
<td><xsl:value-of select="artist"/></td>
|
||||||
|
</tr>
|
||||||
|
</xsl:for-each>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
||||||
@@ -33,6 +33,7 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_mime_type
|
def test_mime_type
|
||||||
assert_equal "application/octet-stream", blob("dog.o").mime_type
|
assert_equal "application/octet-stream", blob("dog.o").mime_type
|
||||||
|
assert_equal "application/ogg", blob("foo.ogg").mime_type
|
||||||
assert_equal "application/postscript", blob("octocat.ai").mime_type
|
assert_equal "application/postscript", blob("octocat.ai").mime_type
|
||||||
assert_equal "application/x-ruby", blob("grit.rb").mime_type
|
assert_equal "application/x-ruby", blob("grit.rb").mime_type
|
||||||
assert_equal "application/x-sh", blob("script.sh").mime_type
|
assert_equal "application/x-sh", blob("script.sh").mime_type
|
||||||
@@ -42,6 +43,7 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_content_type
|
def test_content_type
|
||||||
assert_equal "application/octet-stream", blob("dog.o").content_type
|
assert_equal "application/octet-stream", blob("dog.o").content_type
|
||||||
|
assert_equal "application/ogg", blob("foo.ogg").content_type
|
||||||
assert_equal "application/pdf", blob("foo.pdf").content_type
|
assert_equal "application/pdf", blob("foo.pdf").content_type
|
||||||
assert_equal "image/png", blob("foo.png").content_type
|
assert_equal "image/png", blob("foo.png").content_type
|
||||||
assert_equal "text/plain; charset=iso-8859-2", blob("README").content_type
|
assert_equal "text/plain; charset=iso-8859-2", blob("README").content_type
|
||||||
@@ -179,6 +181,7 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_vendored
|
def test_vendored
|
||||||
assert !blob("README").vendored?
|
assert !blob("README").vendored?
|
||||||
|
assert !blob("ext/extconf.rb").vendored?
|
||||||
|
|
||||||
# Node depedencies
|
# Node depedencies
|
||||||
assert blob("node_modules/coffee-script/lib/coffee-script.js").vendored?
|
assert blob("node_modules/coffee-script/lib/coffee-script.js").vendored?
|
||||||
@@ -260,7 +263,7 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
def test_indexable
|
def test_indexable
|
||||||
assert blob("file.txt").indexable?
|
assert blob("file.txt").indexable?
|
||||||
assert blob("foo.rb").indexable?
|
assert blob("foo.rb").indexable?
|
||||||
assert !blob("defun.kt").indexable?
|
assert !blob("defu.nkt").indexable?
|
||||||
assert !blob("dump.sql").indexable?
|
assert !blob("dump.sql").indexable?
|
||||||
assert !blob("github.po").indexable?
|
assert !blob("github.po").indexable?
|
||||||
assert !blob("linguist.gem").indexable?
|
assert !blob("linguist.gem").indexable?
|
||||||
@@ -285,6 +288,7 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
assert_equal Language['Ruby'], blob("script.rb").language
|
assert_equal Language['Ruby'], blob("script.rb").language
|
||||||
assert_equal Language['Ruby'], blob("wrong_shebang.rb").language
|
assert_equal Language['Ruby'], blob("wrong_shebang.rb").language
|
||||||
assert_equal Language['Arduino'], blob("hello.ino").language
|
assert_equal Language['Arduino'], blob("hello.ino").language
|
||||||
|
assert_equal Language['VHDL'], blob("foo.vhd").language
|
||||||
assert_nil blob("octocat.png").language
|
assert_nil blob("octocat.png").language
|
||||||
|
|
||||||
# .cls disambiguation
|
# .cls disambiguation
|
||||||
@@ -303,10 +307,14 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
assert_equal Language['Perl'], blob("test-perl2.pl").language
|
assert_equal Language['Perl'], blob("test-perl2.pl").language
|
||||||
|
|
||||||
# .m disambiguation
|
# .m disambiguation
|
||||||
|
assert_equal Language['Objective-C'], blob("empty.m").language
|
||||||
assert_equal Language['Objective-C'], blob("Foo.m").language
|
assert_equal Language['Objective-C'], blob("Foo.m").language
|
||||||
assert_equal Language['Objective-C'], blob("hello.m").language
|
assert_equal Language['Objective-C'], blob("hello.m").language
|
||||||
assert_equal Language['Matlab'], blob("matlab_function.m").language
|
assert_equal Language['Matlab'], blob("matlab_function.m").language
|
||||||
assert_equal Language['Matlab'], blob("matlab_script.m").language
|
assert_equal Language['Matlab'], blob("matlab_script.m").language
|
||||||
|
assert_equal Language['Matlab'], blob("matlab_function2.m").language
|
||||||
|
assert_equal Language['Matlab'], blob("matlab_script2.m").language
|
||||||
|
assert_equal Language['Matlab'], blob("matlab_class.m").language
|
||||||
assert_equal Language['M'], blob("m_simple.m").language
|
assert_equal Language['M'], blob("m_simple.m").language
|
||||||
|
|
||||||
# .r disambiguation
|
# .r disambiguation
|
||||||
@@ -419,6 +427,24 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
|
|
||||||
# OpenEdge ABL / Progress
|
# OpenEdge ABL / Progress
|
||||||
assert_equal Language['OpenEdge ABL'], blob("openedge.p").language
|
assert_equal Language['OpenEdge ABL'], blob("openedge.p").language
|
||||||
|
|
||||||
|
# Tea
|
||||||
|
assert_equal Language['Tea'], blob("foo.tea").language
|
||||||
|
|
||||||
|
# Kotlin
|
||||||
|
assert_equal Language['Kotlin'], blob("Foo.kt").language
|
||||||
|
|
||||||
|
# Julia: http://julialang.org/
|
||||||
|
assert_equal Language['Julia'], blob("stockcorr.jl").language
|
||||||
|
|
||||||
|
# Dart: http://dartlang.org/
|
||||||
|
assert_equal Language['Dart'], blob("point.dart").language
|
||||||
|
|
||||||
|
# Arch Linux PKGBUILD
|
||||||
|
assert_equal Language['Shell'], blob("PKGBUILD").language
|
||||||
|
|
||||||
|
# XML
|
||||||
|
assert_equal Language['XSLT'], blob("test.xslt").language
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_lexer
|
def test_lexer
|
||||||
@@ -428,6 +454,11 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
assert_equal Lexer['Ruby'], blob("grit.rb").lexer
|
assert_equal Lexer['Ruby'], blob("grit.rb").lexer
|
||||||
assert_equal Lexer['Scheme'], blob("dude.el").lexer
|
assert_equal Lexer['Scheme'], blob("dude.el").lexer
|
||||||
assert_equal Lexer['Text only'], blob("README").lexer
|
assert_equal Lexer['Text only'], blob("README").lexer
|
||||||
|
assert_equal Lexer['Tea'], blob("foo.tea").lexer
|
||||||
|
assert_equal Lexer['vhdl'], blob("foo.vhd").lexer
|
||||||
|
assert_equal Lexer['Julia'], blob("stockcorr.jl").lexer
|
||||||
|
assert_equal Lexer['Dart'], blob("point.dart").lexer
|
||||||
|
assert_equal Lexer['Bash'], blob("PKGBUILD").lexer
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_shebang_script
|
def test_shebang_script
|
||||||
@@ -483,7 +514,12 @@ class TestBlob < Test::Unit::TestCase
|
|||||||
HTML
|
HTML
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_colorize_skips_minified_files
|
def test_colorize_does_skip_minified_files
|
||||||
assert_nil blob("jquery-1.6.1.min.js").colorize
|
assert_nil blob("jquery-1.6.1.min.js").colorize
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Pygments.rb was taking exceeding long on this particular file
|
||||||
|
def test_colorize_doesnt_blow_up_with_files_with_high_ratio_of_long_lines
|
||||||
|
assert_nil blob("steelseries-min.js").colorize
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -41,24 +41,24 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
assert_equal Lexer['C++'], Language['C++'].lexer
|
assert_equal Lexer['C++'], Language['C++'].lexer
|
||||||
assert_equal Lexer['Coldfusion HTML'], Language['ColdFusion'].lexer
|
assert_equal Lexer['Coldfusion HTML'], Language['ColdFusion'].lexer
|
||||||
assert_equal Lexer['Coq'], Language['Coq'].lexer
|
assert_equal Lexer['Coq'], Language['Coq'].lexer
|
||||||
|
assert_equal Lexer['FSharp'], Language['F#'].lexer
|
||||||
|
assert_equal Lexer['FSharp'], Language['F#'].lexer
|
||||||
assert_equal Lexer['Fortran'], Language['FORTRAN'].lexer
|
assert_equal Lexer['Fortran'], Language['FORTRAN'].lexer
|
||||||
assert_equal Lexer['Gherkin'], Language['Cucumber'].lexer
|
assert_equal Lexer['Gherkin'], Language['Cucumber'].lexer
|
||||||
|
assert_equal Lexer['Groovy'], Language['Groovy'].lexer
|
||||||
assert_equal Lexer['HTML'], Language['HTML'].lexer
|
assert_equal Lexer['HTML'], Language['HTML'].lexer
|
||||||
assert_equal Lexer['HTML+Django/Jinja'], Language['HTML+Django'].lexer
|
assert_equal Lexer['HTML+Django/Jinja'], Language['HTML+Django'].lexer
|
||||||
assert_equal Lexer['HTML+PHP'], Language['HTML+PHP'].lexer
|
assert_equal Lexer['HTML+PHP'], Language['HTML+PHP'].lexer
|
||||||
|
assert_equal Lexer['JSON'], Language['JSON'].lexer
|
||||||
assert_equal Lexer['Java'], Language['ChucK'].lexer
|
assert_equal Lexer['Java'], Language['ChucK'].lexer
|
||||||
assert_equal Lexer['Java'], Language['Groovy'].lexer
|
|
||||||
assert_equal Lexer['Java'], Language['Java'].lexer
|
assert_equal Lexer['Java'], Language['Java'].lexer
|
||||||
assert_equal Lexer['JavaScript'], Language['JSON'].lexer
|
|
||||||
assert_equal Lexer['JavaScript'], Language['JavaScript'].lexer
|
assert_equal Lexer['JavaScript'], Language['JavaScript'].lexer
|
||||||
assert_equal Lexer['MOOCode'], Language['Moocode'].lexer
|
assert_equal Lexer['MOOCode'], Language['Moocode'].lexer
|
||||||
assert_equal Lexer['MuPAD'], Language['mupad'].lexer
|
assert_equal Lexer['MuPAD'], Language['mupad'].lexer
|
||||||
assert_equal Lexer['NASM'], Language['Assembly'].lexer
|
assert_equal Lexer['NASM'], Language['Assembly'].lexer
|
||||||
assert_equal Lexer['OCaml'], Language['F#'].lexer
|
|
||||||
assert_equal Lexer['OCaml'], Language['OCaml'].lexer
|
assert_equal Lexer['OCaml'], Language['OCaml'].lexer
|
||||||
assert_equal Lexer['OpenEdge ABL'], Language['OpenEdge ABL'].lexer
|
|
||||||
assert_equal Lexer['Standard ML'], Language['Standard ML'].lexer
|
|
||||||
assert_equal Lexer['Ooc'], Language['ooc'].lexer
|
assert_equal Lexer['Ooc'], Language['ooc'].lexer
|
||||||
|
assert_equal Lexer['OpenEdge ABL'], Language['OpenEdge ABL'].lexer
|
||||||
assert_equal Lexer['REBOL'], Language['Rebol'].lexer
|
assert_equal Lexer['REBOL'], Language['Rebol'].lexer
|
||||||
assert_equal Lexer['RHTML'], Language['HTML+ERB'].lexer
|
assert_equal Lexer['RHTML'], Language['HTML+ERB'].lexer
|
||||||
assert_equal Lexer['RHTML'], Language['RHTML'].lexer
|
assert_equal Lexer['RHTML'], Language['RHTML'].lexer
|
||||||
@@ -69,9 +69,11 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
assert_equal Lexer['Scheme'], Language['Nu'].lexer
|
assert_equal Lexer['Scheme'], Language['Nu'].lexer
|
||||||
assert_equal Lexer['Scheme'], Language['Racket'].lexer
|
assert_equal Lexer['Scheme'], Language['Racket'].lexer
|
||||||
assert_equal Lexer['Scheme'], Language['Scheme'].lexer
|
assert_equal Lexer['Scheme'], Language['Scheme'].lexer
|
||||||
|
assert_equal Lexer['Standard ML'], Language['Standard ML'].lexer
|
||||||
assert_equal Lexer['TeX'], Language['TeX'].lexer
|
assert_equal Lexer['TeX'], Language['TeX'].lexer
|
||||||
assert_equal Lexer['Text only'], Language['Text'].lexer
|
assert_equal Lexer['Text only'], Language['Text'].lexer
|
||||||
assert_equal Lexer['Verilog'], Language['Verilog'].lexer
|
assert_equal Lexer['Verilog'], Language['Verilog'].lexer
|
||||||
|
assert_equal Lexer['XSLT'], Language['XSLT'].lexer
|
||||||
assert_equal Lexer['aspx-vb'], Language['ASP'].lexer
|
assert_equal Lexer['aspx-vb'], Language['ASP'].lexer
|
||||||
assert_equal Lexer['haXe'], Language['HaXe'].lexer
|
assert_equal Lexer['haXe'], Language['HaXe'].lexer
|
||||||
assert_equal Lexer['reStructuredText'], Language['reStructuredText'].lexer
|
assert_equal Lexer['reStructuredText'], Language['reStructuredText'].lexer
|
||||||
@@ -94,6 +96,7 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
assert_equal Language['Common Lisp'], Language.find_by_alias('common-lisp')
|
assert_equal Language['Common Lisp'], Language.find_by_alias('common-lisp')
|
||||||
assert_equal Language['Common Lisp'], Language.find_by_alias('lisp')
|
assert_equal Language['Common Lisp'], Language.find_by_alias('lisp')
|
||||||
assert_equal Language['Darcs Patch'], Language.find_by_alias('dpatch')
|
assert_equal Language['Darcs Patch'], Language.find_by_alias('dpatch')
|
||||||
|
assert_equal Language['Dart'], Language.find_by_alias('dart')
|
||||||
assert_equal Language['Emacs Lisp'], Language.find_by_alias('elisp')
|
assert_equal Language['Emacs Lisp'], Language.find_by_alias('elisp')
|
||||||
assert_equal Language['Emacs Lisp'], Language.find_by_alias('emacs')
|
assert_equal Language['Emacs Lisp'], Language.find_by_alias('emacs')
|
||||||
assert_equal Language['Emacs Lisp'], Language.find_by_alias('emacs-lisp')
|
assert_equal Language['Emacs Lisp'], Language.find_by_alias('emacs-lisp')
|
||||||
@@ -112,7 +115,7 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
assert_equal Language['OpenEdge ABL'], Language.find_by_alias('progress')
|
assert_equal Language['OpenEdge ABL'], Language.find_by_alias('progress')
|
||||||
assert_equal Language['OpenEdge ABL'], Language.find_by_alias('abl')
|
assert_equal Language['OpenEdge ABL'], Language.find_by_alias('abl')
|
||||||
assert_equal Language['Parrot Internal Representation'], Language.find_by_alias('pir')
|
assert_equal Language['Parrot Internal Representation'], Language.find_by_alias('pir')
|
||||||
assert_equal Language['Powershell'], Language.find_by_alias('posh')
|
assert_equal Language['PowerShell'], Language.find_by_alias('posh')
|
||||||
assert_equal Language['Puppet'], Language.find_by_alias('puppet')
|
assert_equal Language['Puppet'], Language.find_by_alias('puppet')
|
||||||
assert_equal Language['Pure Data'], Language.find_by_alias('pure-data')
|
assert_equal Language['Pure Data'], Language.find_by_alias('pure-data')
|
||||||
assert_equal Language['Raw token data'], Language.find_by_alias('raw')
|
assert_equal Language['Raw token data'], Language.find_by_alias('raw')
|
||||||
@@ -146,6 +149,7 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
assert_equal Language['Shell'], Language['Gentoo Ebuild'].group
|
assert_equal Language['Shell'], Language['Gentoo Ebuild'].group
|
||||||
assert_equal Language['Shell'], Language['Gentoo Eclass'].group
|
assert_equal Language['Shell'], Language['Gentoo Eclass'].group
|
||||||
assert_equal Language['Shell'], Language['Tcsh'].group
|
assert_equal Language['Shell'], Language['Tcsh'].group
|
||||||
|
assert_equal Language['XML'], Language['XSLT'].group
|
||||||
|
|
||||||
# Ensure everyone has a group
|
# Ensure everyone has a group
|
||||||
Language.all.each do |language|
|
Language.all.each do |language|
|
||||||
@@ -196,7 +200,7 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
def test_programming
|
def test_programming
|
||||||
assert_equal :programming, Language['JavaScript'].type
|
assert_equal :programming, Language['JavaScript'].type
|
||||||
assert_equal :programming, Language['Perl'].type
|
assert_equal :programming, Language['Perl'].type
|
||||||
assert_equal :programming, Language['Powershell'].type
|
assert_equal :programming, Language['PowerShell'].type
|
||||||
assert_equal :programming, Language['Python'].type
|
assert_equal :programming, Language['Python'].type
|
||||||
assert_equal :programming, Language['Ruby'].type
|
assert_equal :programming, Language['Ruby'].type
|
||||||
end
|
end
|
||||||
@@ -241,6 +245,7 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
def test_find_by_extension
|
def test_find_by_extension
|
||||||
assert_equal Language['Ruby'], Language.find_by_extension('.rb')
|
assert_equal Language['Ruby'], Language.find_by_extension('.rb')
|
||||||
assert_equal Language['Ruby'], Language.find_by_extension('rb')
|
assert_equal Language['Ruby'], Language.find_by_extension('rb')
|
||||||
|
assert_equal Language['Dart'], Language.find_by_extension('dart')
|
||||||
assert_equal Language['Groff'], Language.find_by_extension('man')
|
assert_equal Language['Groff'], Language.find_by_extension('man')
|
||||||
assert_equal Language['Groff'], Language.find_by_extension('1')
|
assert_equal Language['Groff'], Language.find_by_extension('1')
|
||||||
assert_equal Language['Groff'], Language.find_by_extension('2')
|
assert_equal Language['Groff'], Language.find_by_extension('2')
|
||||||
@@ -249,9 +254,14 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
assert_equal Language['PHP'], Language.find_by_extension('php3')
|
assert_equal Language['PHP'], Language.find_by_extension('php3')
|
||||||
assert_equal Language['PHP'], Language.find_by_extension('php4')
|
assert_equal Language['PHP'], Language.find_by_extension('php4')
|
||||||
assert_equal Language['PHP'], Language.find_by_extension('php5')
|
assert_equal Language['PHP'], Language.find_by_extension('php5')
|
||||||
assert_equal Language['Powershell'], Language.find_by_extension('psm1')
|
assert_equal Language['PowerShell'], Language.find_by_extension('psm1')
|
||||||
assert_equal Language['Powershell'], Language.find_by_extension('ps1')
|
assert_equal Language['PowerShell'], Language.find_by_extension('ps1')
|
||||||
assert_nil Language.find_by_extension('.kt')
|
|
||||||
|
# Aliases for Streamline.js ( https://github.com/Sage/streamlinejs )
|
||||||
|
assert_equal Language['JavaScript'], Language.find_by_extension('_js')
|
||||||
|
assert_equal Language['CoffeeScript'], Language.find_by_extension('_coffee')
|
||||||
|
|
||||||
|
assert_nil Language.find_by_extension('.nkt')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_find_all_by_extension
|
def test_find_all_by_extension
|
||||||
@@ -265,12 +275,13 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_find_by_filename
|
def test_find_by_filename
|
||||||
|
assert_equal Language['Shell'], Language.find_by_filename('PKGBUILD')
|
||||||
assert_equal Language['Ruby'], Language.find_by_filename('foo.rb')
|
assert_equal Language['Ruby'], Language.find_by_filename('foo.rb')
|
||||||
assert_equal Language['Ruby'], Language.find_by_filename('foo/bar.rb')
|
assert_equal Language['Ruby'], Language.find_by_filename('foo/bar.rb')
|
||||||
assert_equal Language['Ruby'], Language.find_by_filename('Rakefile')
|
assert_equal Language['Ruby'], Language.find_by_filename('Rakefile')
|
||||||
assert_nil Language.find_by_filename('rb')
|
assert_nil Language.find_by_filename('rb')
|
||||||
assert_nil Language.find_by_filename('.rb')
|
assert_nil Language.find_by_filename('.rb')
|
||||||
assert_nil Language.find_by_filename('.kt')
|
assert_nil Language.find_by_filename('.nkt')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_find
|
def test_find
|
||||||
@@ -306,6 +317,17 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_color
|
||||||
|
assert_equal '#701516', Language['Ruby'].color
|
||||||
|
assert_equal '#3581ba', Language['Python'].color
|
||||||
|
assert_equal '#f15501', Language['JavaScript'].color
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_colors
|
||||||
|
assert Language.colors.include?(Language['Ruby'])
|
||||||
|
assert Language.colors.include?(Language['Python'])
|
||||||
|
end
|
||||||
|
|
||||||
def test_ace_mode
|
def test_ace_mode
|
||||||
assert_equal 'c_cpp', Language['C++'].ace_mode
|
assert_equal 'c_cpp', Language['C++'].ace_mode
|
||||||
assert_equal 'coffee', Language['CoffeeScript'].ace_mode
|
assert_equal 'coffee', Language['CoffeeScript'].ace_mode
|
||||||
@@ -331,6 +353,8 @@ class TestLanguage < Test::Unit::TestCase
|
|||||||
assert_equal '.pl', Language['Perl'].primary_extension
|
assert_equal '.pl', Language['Perl'].primary_extension
|
||||||
assert_equal '.py', Language['Python'].primary_extension
|
assert_equal '.py', Language['Python'].primary_extension
|
||||||
assert_equal '.rb', Language['Ruby'].primary_extension
|
assert_equal '.rb', Language['Ruby'].primary_extension
|
||||||
|
assert_equal '.js', Language['JavaScript'].primary_extension
|
||||||
|
assert_equal '.coffee', Language['CoffeeScript'].primary_extension
|
||||||
|
|
||||||
# This is a nasty requirement, but theres some code in GitHub that
|
# This is a nasty requirement, but theres some code in GitHub that
|
||||||
# expects this. Really want to drop this.
|
# expects this. Really want to drop this.
|
||||||
|
|||||||
@@ -14,6 +14,20 @@ class TestMime < Test::Unit::TestCase
|
|||||||
# in mimes.yml. Its still useful to test even trivial cases since
|
# in mimes.yml. Its still useful to test even trivial cases since
|
||||||
# MIME::Type's extension lookup may return multiple matches and we
|
# MIME::Type's extension lookup may return multiple matches and we
|
||||||
# only pick one of them. Please keep this list alphabetized.
|
# only pick one of them. Please keep this list alphabetized.
|
||||||
|
assert_equal 'application/javascript', Mime.mime_for('.js')
|
||||||
|
assert_equal 'application/octet-stream', Mime.mime_for('.dll')
|
||||||
|
assert_equal 'application/octet-stream', Mime.mime_for('.dmg')
|
||||||
|
assert_equal 'application/octet-stream', Mime.mime_for('.exe')
|
||||||
|
assert_equal 'application/ogg', Mime.mime_for('.ogg')
|
||||||
|
assert_equal 'application/postscript', Mime.mime_for('.ai')
|
||||||
|
assert_equal 'application/postscript', Mime.mime_for('.eps')
|
||||||
|
assert_equal 'application/postscript', Mime.mime_for('.ps')
|
||||||
|
assert_equal 'application/vnd.adobe.air-application-installer-package+zip', Mime.mime_for('.air')
|
||||||
|
assert_equal 'application/vnd.oasis.opendocument.presentation', Mime.mime_for('.odp')
|
||||||
|
assert_equal 'application/vnd.oasis.opendocument.spreadsheet', Mime.mime_for('.ods')
|
||||||
|
assert_equal 'application/vnd.oasis.opendocument.text', Mime.mime_for('.odt')
|
||||||
|
assert_equal 'application/vnd.openofficeorg.extension', Mime.mime_for('.oxt')
|
||||||
|
assert_equal 'application/vnd.openxmlformats-officedocument.presentationml.presentation', Mime.mime_for('.pptx')
|
||||||
assert_equal 'application/x-chrome-extension', Mime.mime_for('.crx')
|
assert_equal 'application/x-chrome-extension', Mime.mime_for('.crx')
|
||||||
assert_equal 'application/x-debian-package', Mime.mime_for('.deb')
|
assert_equal 'application/x-debian-package', Mime.mime_for('.deb')
|
||||||
assert_equal 'application/x-iwork-keynote-sffkey', Mime.mime_for('.key')
|
assert_equal 'application/x-iwork-keynote-sffkey', Mime.mime_for('.key')
|
||||||
@@ -22,37 +36,19 @@ class TestMime < Test::Unit::TestCase
|
|||||||
assert_equal 'application/x-java-archive', Mime.mime_for('.ear')
|
assert_equal 'application/x-java-archive', Mime.mime_for('.ear')
|
||||||
assert_equal 'application/x-java-archive', Mime.mime_for('.jar')
|
assert_equal 'application/x-java-archive', Mime.mime_for('.jar')
|
||||||
assert_equal 'application/x-java-archive', Mime.mime_for('.war')
|
assert_equal 'application/x-java-archive', Mime.mime_for('.war')
|
||||||
assert_equal 'application/javascript', Mime.mime_for('.js')
|
|
||||||
assert_equal 'application/x-latex', Mime.mime_for('.latex')
|
assert_equal 'application/x-latex', Mime.mime_for('.latex')
|
||||||
assert_equal 'application/x-ms-xbap', Mime.mime_for('.xbap')
|
assert_equal 'application/x-ms-xbap', Mime.mime_for('.xbap')
|
||||||
assert_equal 'application/octet-stream', Mime.mime_for('.dll')
|
|
||||||
assert_equal 'application/octet-stream', Mime.mime_for('.dmg')
|
|
||||||
assert_equal 'application/octet-stream', Mime.mime_for('.exe')
|
|
||||||
assert_equal 'application/x-perl', Mime.mime_for('.pl')
|
assert_equal 'application/x-perl', Mime.mime_for('.pl')
|
||||||
assert_equal 'application/x-perl', Mime.mime_for('.pm')
|
assert_equal 'application/x-perl', Mime.mime_for('.pm')
|
||||||
assert_equal 'application/postscript', Mime.mime_for('.ai')
|
|
||||||
assert_equal 'application/postscript', Mime.mime_for('.eps')
|
|
||||||
assert_equal 'application/postscript', Mime.mime_for('.ps')
|
|
||||||
assert_equal 'application/x-python', Mime.mime_for('.py')
|
assert_equal 'application/x-python', Mime.mime_for('.py')
|
||||||
assert_equal 'application/x-ruby', Mime.mime_for('.rb')
|
assert_equal 'application/x-ruby', Mime.mime_for('.rb')
|
||||||
assert_equal 'application/x-sh', Mime.mime_for('.sh')
|
assert_equal 'application/x-sh', Mime.mime_for('.sh')
|
||||||
assert_equal 'application/x-shockwave-flash', Mime.mime_for('.swf')
|
assert_equal 'application/x-shockwave-flash', Mime.mime_for('.swf')
|
||||||
assert_equal 'application/x-silverlight-app', Mime.mime_for('.xap')
|
assert_equal 'application/x-silverlight-app', Mime.mime_for('.xap')
|
||||||
assert_equal 'application/x-supercollider', Mime.mime_for('.sc')
|
assert_equal 'application/x-supercollider', Mime.mime_for('.sc')
|
||||||
assert_equal 'application/vnd.adobe.air-application-installer-package+zip', Mime.mime_for('.air')
|
|
||||||
assert_equal 'application/vnd.oasis.opendocument.presentation', Mime.mime_for('.odp')
|
|
||||||
assert_equal 'application/vnd.oasis.opendocument.spreadsheet', Mime.mime_for('.ods')
|
|
||||||
assert_equal 'application/vnd.oasis.opendocument.text', Mime.mime_for('.odt')
|
|
||||||
assert_equal 'application/vnd.openofficeorg.extension', Mime.mime_for('.oxt')
|
|
||||||
assert_equal 'application/vnd.openxmlformats-officedocument.presentationml.presentation', Mime.mime_for('.pptx')
|
|
||||||
assert_equal 'application/xaml+xml', Mime.mime_for('.xaml')
|
assert_equal 'application/xaml+xml', Mime.mime_for('.xaml')
|
||||||
assert_equal 'text/cache-manifest', Mime.mime_for('.manifest')
|
assert_equal 'text/cache-manifest', Mime.mime_for('.manifest')
|
||||||
assert_equal 'text/html', Mime.mime_for('.html')
|
assert_equal 'text/html', Mime.mime_for('.html')
|
||||||
assert_equal 'text/x-nemerle', Mime.mime_for('.n')
|
|
||||||
assert_equal 'text/x-nimrod', Mime.mime_for('.nim')
|
|
||||||
assert_equal 'text/x-ocaml', Mime.mime_for('.ml')
|
|
||||||
assert_equal 'text/x-ocaml', Mime.mime_for('.sig')
|
|
||||||
assert_equal 'text/x-ocaml', Mime.mime_for('.sml')
|
|
||||||
assert_equal 'text/plain', Mime.mime_for('.c')
|
assert_equal 'text/plain', Mime.mime_for('.c')
|
||||||
assert_equal 'text/plain', Mime.mime_for('.cc')
|
assert_equal 'text/plain', Mime.mime_for('.cc')
|
||||||
assert_equal 'text/plain', Mime.mime_for('.cpp')
|
assert_equal 'text/plain', Mime.mime_for('.cpp')
|
||||||
@@ -63,8 +59,13 @@ class TestMime < Test::Unit::TestCase
|
|||||||
assert_equal 'text/plain', Mime.mime_for('.hpp')
|
assert_equal 'text/plain', Mime.mime_for('.hpp')
|
||||||
assert_equal 'text/plain', Mime.mime_for('.kt')
|
assert_equal 'text/plain', Mime.mime_for('.kt')
|
||||||
assert_equal 'text/x-logtalk', Mime.mime_for('.lgt')
|
assert_equal 'text/x-logtalk', Mime.mime_for('.lgt')
|
||||||
assert_equal 'text/x-rust', Mime.mime_for('.rs')
|
assert_equal 'text/x-nemerle', Mime.mime_for('.n')
|
||||||
|
assert_equal 'text/x-nimrod', Mime.mime_for('.nim')
|
||||||
|
assert_equal 'text/x-ocaml', Mime.mime_for('.ml')
|
||||||
|
assert_equal 'text/x-ocaml', Mime.mime_for('.sig')
|
||||||
|
assert_equal 'text/x-ocaml', Mime.mime_for('.sml')
|
||||||
assert_equal 'text/x-rust', Mime.mime_for('.rc')
|
assert_equal 'text/x-rust', Mime.mime_for('.rc')
|
||||||
|
assert_equal 'text/x-rust', Mime.mime_for('.rs')
|
||||||
assert_equal 'video/quicktime', Mime.mime_for('.mov')
|
assert_equal 'video/quicktime', Mime.mime_for('.mov')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class TestPathname < Test::Unit::TestCase
|
|||||||
assert_equal Language['Python'], Pathname.new("itty.py").language
|
assert_equal Language['Python'], Pathname.new("itty.py").language
|
||||||
assert_equal Language['Nu'], Pathname.new("itty.nu").language
|
assert_equal Language['Nu'], Pathname.new("itty.nu").language
|
||||||
|
|
||||||
assert_nil Pathname.new("defun.kt").language
|
assert_nil Pathname.new("defu.nkt").language
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_lexer
|
def test_lexer
|
||||||
@@ -50,13 +50,13 @@ class TestPathname < Test::Unit::TestCase
|
|||||||
assert_equal Lexer['Bash'], Pathname.new("file.ebuild").lexer
|
assert_equal Lexer['Bash'], Pathname.new("file.ebuild").lexer
|
||||||
assert_equal Lexer['Python'], Pathname.new("itty.py").lexer
|
assert_equal Lexer['Python'], Pathname.new("itty.py").lexer
|
||||||
assert_equal Lexer['Scheme'], Pathname.new("itty.nu").lexer
|
assert_equal Lexer['Scheme'], Pathname.new("itty.nu").lexer
|
||||||
assert_equal Lexer['Text only'], Pathname.new("defun.kt").lexer
|
assert_equal Lexer['Text only'], Pathname.new("defu.nkt").lexer
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_mime_type
|
def test_mime_type
|
||||||
assert_equal 'application/x-ruby', Pathname.new("file.rb").mime_type
|
assert_equal 'application/x-ruby', Pathname.new("file.rb").mime_type
|
||||||
assert_equal 'application/javascript', Pathname.new("file.js").mime_type
|
assert_equal 'application/javascript', Pathname.new("file.js").mime_type
|
||||||
assert_equal 'application/x-python', Pathname.new("itty.py").mime_type
|
assert_equal 'application/x-python', Pathname.new("itty.py").mime_type
|
||||||
assert_equal 'text/plain', Pathname.new("defun.kt").mime_type
|
assert_equal 'text/plain', Pathname.new("defu.nkt").mime_type
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user