Merge branch 'master' into objc-mercury

This commit is contained in:
Arfon Smith
2015-01-30 08:34:50 -06:00
27 changed files with 1140 additions and 89 deletions

View File

@@ -112,6 +112,15 @@ module Linguist
end
end
disambiguate "GAP", "Scilab" do |data|
if (data.include?("gap> "))
Language["GAP"]
# Heads up - we don't usually write heuristics like this (with no regex match)
else
Language["Scilab"]
end
end
disambiguate "Common Lisp", "OpenCL", "Cool" do |data|
if data.include?("(defun ")
Language["Common Lisp"]
@@ -186,6 +195,14 @@ module Linguist
end
end
disambiguate "Common Lisp", "NewLisp" do |data|
if /^\s*\((defun|in-package|defpackage) /.match(data)
Language["Common Lisp"]
elsif /^\s*\(define /.match(data)
Language["NewLisp"]
end
end
disambiguate "TypeScript", "XML" do |data|
if data.include?("<TS ")
Language["XML"]

View File

@@ -155,7 +155,7 @@ module Linguist
# Language.find_by_alias('cpp')
# # => #<Language name="C++">
#
# Returns the Lexer or nil if none was found.
# Returns the Language or nil if none was found.
def self.find_by_alias(name)
name && @alias_index[name.downcase]
end
@@ -219,7 +219,7 @@ module Linguist
end
# Public: Look up Language by its name or lexer.
# Public: Look up Language by its name.
#
# name - The String name of the Language
#
@@ -243,7 +243,7 @@ module Linguist
#
# This list is configured in "popular.yml".
#
# Returns an Array of Lexers.
# Returns an Array of Languages.
def self.popular
@popular ||= all.select(&:popular?).sort_by { |lang| lang.name.downcase }
end
@@ -255,7 +255,7 @@ module Linguist
#
# This list is created from all the languages not listed in "popular.yml".
#
# Returns an Array of Lexers.
# Returns an Array of Languages.
def self.unpopular
@unpopular ||= all.select(&:unpopular?).sort_by { |lang| lang.name.downcase }
end
@@ -375,11 +375,6 @@ module Linguist
# Returns the name String
attr_reader :search_term
# Public: Get Lexer
#
# Returns the Lexer
attr_reader :lexer
# Public: Get the name of a TextMate-compatible scope
#
# Returns the scope
@@ -495,16 +490,6 @@ module Linguist
@searchable
end
# Public: Highlight syntax of text
#
# text - String of code to be highlighted
# options - A Hash of options (defaults to {})
#
# Returns html String
def colorize(text, options = {})
lexer.highlight(text, options)
end
# Public: Return name as String representation
def to_s
name
@@ -580,7 +565,6 @@ module Linguist
:color => options['color'],
:type => options['type'],
:aliases => options['aliases'],
:lexer => options['lexer'],
:tm_scope => options['tm_scope'],
:ace_mode => options['ace_mode'],
:wrap => options['wrap'],

View File

@@ -61,6 +61,7 @@ ASP:
type: programming
color: "#6a40fd"
search_term: aspx-vb
tm_scope: text.html.asp
aliases:
- aspx
- aspx-vb
@@ -956,6 +957,7 @@ GAP:
- .gap
- .gd
- .gi
- .tst
tm_scope: none
ace_mode: text
@@ -1596,7 +1598,7 @@ Liquid:
type: markup
extensions:
- .liquid
tm_scope: none
tm_scope: text.html.liquid
ace_mode: liquid
Literate Agda:
@@ -1883,6 +1885,19 @@ NetLogo:
tm_scope: source.lisp
ace_mode: lisp
NewLisp:
type: programming
lexer: NewLisp
color: "#eedd66"
extensions:
- .nl
- .lisp
- .lsp
interpreters:
- newlisp
tm_scope: source.lisp
ace_mode: lisp
Nginx:
type: markup
extensions:
@@ -2055,7 +2070,7 @@ OpenSCAD:
extensions:
- .scad
tm_scope: none
ace_mode: text
ace_mode: scad
Org:
type: prose
@@ -2426,7 +2441,6 @@ R:
RAML:
type: data
lexer: YAML
ace_mode: yaml
tm_scope: source.yaml
color: "#77d9fb"

View File

@@ -33,7 +33,8 @@ module Linguist
['<!--', '-->'], # XML
['{-', '-}'], # Haskell
['(*', '*)'], # Coq
['"""', '"""'] # Python
['"""', '"""'], # Python
["'''", "'''"] # Python
]
START_SINGLE_LINE_COMMENT = Regexp.compile(SINGLE_LINE_COMMENTS.map { |c|