diff --git a/.gitmodules b/.gitmodules index 4d513637..f44815ba 100644 --- a/.gitmodules +++ b/.gitmodules @@ -788,3 +788,6 @@ url = https://github.com/austinwagner/sublime-sourcepawn [submodule "vendor/grammars/language-rpm-spec"] path = vendor/grammars/language-rpm-spec url = https://github.com/waveclaw/language-rpm-spec +[submodule "vendor/grammars/language-emacs-lisp"] + path = vendor/grammars/language-emacs-lisp + url = https://github.com/Alhadis/language-emacs-lisp diff --git a/bin/git-linguist b/bin/git-linguist index 9e525bb5..d390530e 100755 --- a/bin/git-linguist +++ b/bin/git-linguist @@ -23,7 +23,7 @@ class GitLinguist if @incremental && stats = load_language_stats old_commit_oid, old_stats = stats - # A cache with NULL oid means that we want to froze + # A cache with NULL oid means that we want to freeze # these language stats in place and stop computing # them (for performance reasons) return old_stats if old_commit_oid == NULL_OID @@ -111,7 +111,7 @@ def git_linguist(args) parser.parse!(args) git_dir = `git rev-parse --git-dir`.strip - raise "git-linguist must be ran in a Git repository (#{Dir.pwd})" unless $?.success? + raise "git-linguist must be run in a Git repository (#{Dir.pwd})" unless $?.success? wrapper = GitLinguist.new(git_dir, commit, incremental) case args.pop diff --git a/grammars.yml b/grammars.yml index 1bb97490..d5a71fc0 100755 --- a/grammars.yml +++ b/grammars.yml @@ -22,6 +22,8 @@ vendor/grammars/Docker.tmbundle: - source.dockerfile vendor/grammars/Elm/: - source.elm +- text.html.mediawiki.elm-build-output +- text.html.mediawiki.elm-documentation vendor/grammars/FreeMarker.tmbundle: - text.html.ftl vendor/grammars/G-Code/: @@ -354,6 +356,8 @@ vendor/grammars/language-csound: - source.csound - source.csound-document - source.csound-score +vendor/grammars/language-emacs-lisp: +- source.emacs.lisp vendor/grammars/language-gfm: - source.gfm vendor/grammars/language-graphql: @@ -603,6 +607,8 @@ vendor/grammars/sublime-text-ox/: vendor/grammars/sublime-typescript/: - source.ts - source.tsx +- text.error-list +- text.find-refs vendor/grammars/sublime-varnish: - source.varnish.vcl vendor/grammars/sublime_cobol: diff --git a/lib/linguist/heuristics.rb b/lib/linguist/heuristics.rb index 48b7e54f..ad4f4504 100644 --- a/lib/linguist/heuristics.rb +++ b/lib/linguist/heuristics.rb @@ -354,7 +354,7 @@ module Linguist disambiguate ".r" do |data| if /\bRebol\b/i.match(data) Language["Rebol"] - elsif data.include?("<-") + elsif /<-|^\s*#/.match(data) Language["R"] end end diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 7c646105..4ff0200f 100755 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -12,7 +12,7 @@ # listed alphabetically) # interpreters - An Array of associated interpreters # searchable - Boolean flag to enable searching (defaults to true) -# search_term - Deprecated: Some languages maybe indexed under a +# search_term - Deprecated: Some languages may be indexed under a # different alias. Avoid defining new exceptions. # color - CSS hex color to represent the language. # tm_scope - The TextMate scope that represents this programming @@ -23,9 +23,9 @@ # in the statistics as the parent language. # # Any additions or modifications (even trivial) should have corresponding -# test change in `test/test_blob.rb`. +# test changes in `test/test_blob.rb`. # -# Please keep this list alphabetized. Capitalization comes before lower case. +# Please keep this list alphabetized. Capitalization comes before lowercase. 1C Enterprise: type: programming @@ -1027,7 +1027,7 @@ Elm: Emacs Lisp: type: programming - tm_scope: source.lisp + tm_scope: source.emacs.lisp color: "#c065db" aliases: - elisp @@ -1035,6 +1035,7 @@ Emacs Lisp: filenames: - .emacs - .emacs.desktop + - .spacemacs extensions: - .el - .emacs @@ -4148,6 +4149,7 @@ XML: - .rdf - .resx - .rss + - .sch - .scxml - .sfproj - .srdf diff --git a/samples/Emacs Lisp/filenames/.spacemacs b/samples/Emacs Lisp/filenames/.spacemacs new file mode 100644 index 00000000..a646eba0 --- /dev/null +++ b/samples/Emacs Lisp/filenames/.spacemacs @@ -0,0 +1,197 @@ +;; -*- mode: emacs-lisp -*- +;; This file is loaded by Spacemacs at startup. +;; It must be stored in your home directory. + +(defun dotspacemacs/layers () + "Configuration Layers declaration." + (setq-default + ;; List of additional paths where to look for configuration layers. + ;; Paths must have a trailing slash (i.e. `~/.mycontribs/') + dotspacemacs-configuration-layer-path '() + ;; List of configuration layers to load. If it is the symbol `all' instead + ;; of a list then all discovered layers will be installed. + dotspacemacs-configuration-layers + '( + ;; ---------------------------------------------------------------- + ;; Example of useful layers you may want to use right away. + ;; Uncomment some layer names and press (Vim style) or + ;; (Emacs style) to install them. + ;; ---------------------------------------------------------------- + emacs-lisp + charlock_holmes + escape_utils + mime-types + rugged + minitest + mocha + plist + pry + rake + yajl-ruby + colour-proximity + licensed + licensee + ;; List of additional packages that will be installed without being + ;; wrapped in a layer. If you need some configuration for these + ;; packages then consider to create a layer, you can also put the + ;; configuration in `dotspacemacs/config'. + dotspacemacs-additional-packages '() + ;; A list of packages and/or extensions that will not be install and loaded. + dotspacemacs-excluded-packages '() + ;; If non-nil spacemacs will delete any orphan packages, i.e. packages that + ;; are declared in a layer which is not a member of + ;; the list `dotspacemacs-configuration-layers' + dotspacemacs-delete-orphan-packages t)) + +(defun dotspacemacs/init () + "Initialization function. +This function is called at the very startup of Spacemacs initialization +before layers configuration." + ;; This setq-default sexp is an exhaustive list of all the supported + ;; spacemacs settings. + (setq-default + ;; Either `vim' or `emacs'. Evil is always enabled but if the variable + ;; is `emacs' then the `holy-mode' is enabled at startup. + dotspacemacs-editing-style 'vim + ;; If non nil output loading progress in `*Messages*' buffer. + dotspacemacs-verbose-loading nil + ;; Specify the startup banner. Default value is `official', it displays + ;; the official spacemacs logo. An integer value is the index of text + ;; banner, `random' chooses a random text banner in `core/banners' + ;; directory. A string value must be a path to an image format supported + ;; by your Emacs build. + ;; If the value is nil then no banner is displayed. + dotspacemacs-startup-banner 'official + ;; List of items to show in the startup buffer. If nil it is disabled. + ;; Possible values are: `recents' `bookmarks' `projects'." + dotspacemacs-startup-lists '(bookmarks projects recents) + ;; List of themes, the first of the list is loaded when spacemacs starts. + ;; Press T n to cycle to the next theme in the list (works great + ;; with 2 themes variants, one dark and one light) + dotspacemacs-themes '( + spacemacs-dark + spacemacs-light + solarized-dark + solarized-light + atom-light-ui + atom-dark-ui + atom-material-ui + zenburn + ;; If non nil the cursor colour matches the state colour. + dotspacemacs-colorize-cursor-according-to-state t + ;; Default font. `powerline-scale' allows to quickly tweak the mode-line + ;; size to make separators look not too crappy. + dotspacemacs-default-font '("Menloco" + :size 11 + :weight normal + :width normal + :powerline-scale 1.1) + ;; The leader key + dotspacemacs-leader-key "SPC" + ;; The leader key accessible in `emacs state' and `insert state' + dotspacemacs-emacs-leader-key "M-m" + ;; Major mode leader key is a shortcut key which is the equivalent of + ;; pressing ` m`. Set it to `nil` to disable it. + dotspacemacs-major-mode-leader-key "," + ;; Major mode leader key accessible in `emacs state' and `insert state' + dotspacemacs-major-mode-emacs-leader-key "C-M-m" + ;; The command key used for Evil commands (ex-commands) and + ;; Emacs commands (M-x). + ;; By default the command key is `:' so ex-commands are executed like in Vim + ;; with `:' and Emacs commands are executed with ` :'. + dotspacemacs-command-key ":" + ;; Location where to auto-save files. Possible values are `original' to + ;; auto-save the file in-place, `cache' to auto-save the file to another + ;; file stored in the cache directory and `nil' to disable auto-saving. + ;; Default value is `cache'. + dotspacemacs-auto-save-file-location 'cache + ;; If non nil then `ido' replaces `helm' for some commands. For now only + ;; `find-files' (SPC f f) is replaced. + dotspacemacs-use-ido nil + ;; If non nil the paste micro-state is enabled. When enabled pressing `p` + ;; several times cycle between the kill ring content. + dotspacemacs-enable-paste-micro-state nil + ;; Guide-key delay in seconds. The Guide-key is the popup buffer listing + ;; the commands bound to the current keystrokes. + dotspacemacs-guide-key-delay 0.4 + ;; If non nil a progress bar is displayed when spacemacs is loading. This + ;; may increase the boot time on some systems and emacs builds, set it to + ;; nil ;; to boost the loading time. + dotspacemacs-loading-progress-bar t + ;; If non nil the frame is fullscreen when Emacs starts up. + ;; (Emacs 24.4+ only) + dotspacemacs-fullscreen-at-startup nil + ;; If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen. + ;; Use to disable fullscreen animations in OSX." + dotspacemacs-fullscreen-use-non-native nil + ;; If non nil the frame is maximized when Emacs starts up. + ;; Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil. + ;; (Emacs 24.4+ only) + dotspacemacs-maximized-at-startup nil + ;; A value from the range (0..100), in increasing opacity, which describes + ;; the transparency level of a frame when it's active or selected. + ;; Transparency can be toggled through `toggle-transparency'. + dotspacemacs-active-transparency 90 + ;; A value from the range (0..100), in increasing opacity, which describes + ;; the transparency level of a frame when it's inactive or deselected. + ;; Transparency can be toggled through `toggle-transparency'. + dotspacemacs-inactive-transparency 90 + ;; If non nil unicode symbols are displayed in the mode line. + dotspacemacs-mode-line-unicode-symbols t + ;; If non nil smooth scrolling (native-scrolling) is enabled. Smooth + ;; scrolling overrides the default behavior of Emacs which recenters the + ;; point when it reaches the top or bottom of the screen. + dotspacemacs-smooth-scrolling t + ;; If non-nil smartparens-strict-mode will be enabled in programming modes. + dotspacemacs-smartparens-strict-mode nil + ;; Select a scope to highlight delimiters. Possible value is `all', + ;; `current' or `nil'. Default is `all' + dotspacemacs-highlight-delimiters 'all + ;; If non nil advises quit functions to keep server open when quitting. + dotspacemacs-persistent-server nil + ;; List of search tool executable names. Spacemacs uses the first installed + ;; tool of the list. Supported tools are `ag', `pt', `ack' and `grep'. + dotspacemacs-search-tools '("ag" "pt" "ack" "grep") + ;; The default package repository used if no explicit repository has been + ;; specified with an installed package. + ;; Not used for now. + dotspacemacs-default-package-repository nil + + ;; If non nil line numbers are turned on in all `prog-mode' and `text-mode' + ;; derivatives. If set to `relative', also turns on relative line numbers. + ;; (default nil) + dotspacemacs-line-numbers 'relative + + ;; Delete whitespace while saving buffer. Possible values are `all', + ;; `trailing', `changed' or `nil'. Default is `changed' (cleanup whitespace + ;; on changed lines) (default 'changed) + dotspacemacs-whitespace-cleanup 'changed + ) + ;; User initialization goes here + ) + +(defun dotspacemacs/user-config () + "Configuration function. + This function is called at the very end of Spacemacs initialization after +layers configuration." + (add-hook 'alchemist-mode-hook 'company-mode) + + (add-hook 'projectile-mode-hook 'projectile-rails-on) + (setq ruby-insert-encoding-magic-comment nil) + + (setq web-mode-markup-indent-offset 2) + (setq web-mode-code-indent-offset 2) + + (spacemacs/toggle-golden-ratio-on) + (spacemacs/toggle-indent-guide-globally-on) + (spacemacs/toggle-centered-point-globally-on) +) + +;; Do not write anything past this comment. This is where Emacs will +;; auto-generate custom variable definitions. +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. +) diff --git a/samples/XML/HITSP_C32.sch b/samples/XML/HITSP_C32.sch new file mode 100644 index 00000000..62750fdd --- /dev/null +++ b/samples/XML/HITSP_C32.sch @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + +]> + + + HITSP_C32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + &ent-2.16.840.1.113883.3.88.11.32.1; + + + + + &ent-2.16.840.1.113883.3.88.11.32.2; + + + + + &ent-2.16.840.1.113883.3.88.11.32.3; + + + + + &ent-2.16.840.1.113883.3.88.11.32.4; + + + + + &ent-2.16.840.1.113883.3.88.11.32.5; + + + + + &ent-2.16.840.1.113883.3.88.11.32.6; + + + + + &ent-2.16.840.1.113883.3.88.11.32.7; + + + + + &ent-2.16.840.1.113883.3.88.11.32.8; + + + + + &ent-2.16.840.1.113883.3.88.11.32.9; + + + + + &ent-2.16.840.1.113883.3.88.11.32.10; + + + + + &ent-2.16.840.1.113883.3.88.11.32.11; + + + + + &ent-2.16.840.1.113883.3.88.11.32.12; + + + + + &ent-2.16.840.1.113883.3.88.11.32.13; + + + + + &ent-2.16.840.1.113883.3.88.11.32.14; + + + + + &ent-2.16.840.1.113883.3.88.11.32.15; + + + + + &ent-2.16.840.1.113883.3.88.11.32.16; + + + + + &ent-2.16.840.1.113883.3.88.11.32.17; + + diff --git a/samples/XML/namespace-strict.sch b/samples/XML/namespace-strict.sch new file mode 100644 index 00000000..f55a5143 --- /dev/null +++ b/samples/XML/namespace-strict.sch @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + > + + + + + + + + + + + + + Unrecognized namespace prefix: + + + + Unrecognized namespace URI: + + + + + + Prefix + assigned incorrectly: + + + + + + + Namespace may not be declared here. + + + Namespace may not be undeclared here. + + + + + + + + + + \ No newline at end of file diff --git a/samples/XML/oasis-table.sch b/samples/XML/oasis-table.sch new file mode 100644 index 00000000..c947aeb2 --- /dev/null +++ b/samples/XML/oasis-table.sch @@ -0,0 +1,151 @@ + + + + + + + + + OASIS/CALS table validation + + + + + + + + + + + + + + + + tgroup/@cols is not given + @cols should be a natural number + (integer greater than zero). + The tgroup has + colspec, + but its @cols is given as ''. + tgroup/@cols is given as + , but all rows have entr. + + Without assigning @char or @charoff to everything, + assigning @align='char' to tgroup only aligns contents to right of center. + + + + + Malformed @colwidth. + @colwidth unit + () is not consistent with the + units on other colspecs. + + @colwidth must be positive + The same unit of measure should be used on every + colspec/@colwidth. + + @colnum + '' does not correspond to + the column's actual number () + The same @colname is assigned to more than + one colspec. + @align='char', but no @char is given. + @char is given, but alignment is not 'char'. + @charoff is given, but alignment is not 'char'. + + + + + + + + The row doesn't have enough entries ( + expected; + given). + + + + + No colspec is + named . + Entry's end + column () must follow its start column + (). + No colspec is + named . + No colspec is + named . + Entry is assigned an end + column () but not a start column. + Entry is assigned to column , + so it can't start at column . + + + + Entry must be assigned to a free column (after its preceding entries). + + + This entry doesn't fit into + its . + + + A row in which this entry appears has too many entries. + + + + Entry does not fit in row. ( are allowed; entry + is in column .) + + + + @char is given, but alignment is not 'char'. + @charoff is given, but alignment is not 'char'. + @charoff must be a whole number between 0 and 100. + + Entry is designated for character alignment, but no character (@char) is given on it or its colspec. + + + Entry is assigned an alignment character () + different from its column's (). + With @align='char', markup of + entry contents () will be ignored. + + + \ No newline at end of file diff --git a/script/convert-grammars b/script/convert-grammars index ec3287db..e267907d 100755 --- a/script/convert-grammars +++ b/script/convert-grammars @@ -42,7 +42,7 @@ class DirectoryPackage case File.extname(path.downcase) when '.plist' path.split('/')[-2] == 'Syntaxes' - when '.tmlanguage' + when '.tmlanguage', '.yaml-tmlanguage', '.sublime-syntax' true when '.cson', '.json' path.split('/')[-2] == 'grammars' @@ -114,7 +114,7 @@ class SVNPackage def fetch(tmp_dir) `svn export -q "#{url}/Syntaxes" "#{tmp_dir}/Syntaxes"` raise "Failed to export SVN repository: #{url}: #{$?.to_s}" unless $?.success? - Dir["#{tmp_dir}/Syntaxes/*.{plist,tmLanguage,tmlanguage}"] + Dir["#{tmp_dir}/Syntaxes/*.{plist,tmLanguage,tmlanguage,YAML-tmLanguage,sublime-syntax}"] end end @@ -148,6 +148,17 @@ def load_grammar(path) case File.extname(path.downcase) when '.plist', '.tmlanguage' Plist::parse_xml(path) + when '.yaml-tmlanguage', '.sublime-syntax' + content = File.read(path) + # Attempt to parse YAML file even if it has a YAML 1.2 header + if content.lines[0] =~ /^%YAML[ :]1\.2/ + content = content.lines[1..-1].join + end + begin + YAML.load(content) + rescue Psych::SyntaxError => e + $stderr.puts "Failed to parse YAML grammar '#{path}'" + end when '.cson' cson = `"#{CSONC}" "#{path}"` raise "Failed to convert CSON grammar '#{path}': #{$?.to_s}" unless $?.success? @@ -169,7 +180,7 @@ def load_grammars(tmp_dir, source, all_scopes) else SingleFile.new(source) end - elsif source.end_with?('.tmLanguage', '.plist') + elsif source.end_with?('.tmLanguage', '.plist', '.YAML-tmLanguage', '.sublime-syntax') SingleGrammar.new(source) elsif source.start_with?('https://github.com') GitHubPackage.new(source) @@ -185,7 +196,7 @@ def load_grammars(tmp_dir, source, all_scopes) p.fetch(tmp_dir).map do |path| grammar = load_grammar(path) - scope = grammar['scopeName'] + scope = grammar['scopeName'] || grammar['scope'] if all_scopes.key?(scope) unless all_scopes[scope] == p.url @@ -204,7 +215,7 @@ def install_grammars(grammars, path) installed = [] grammars.each do |grammar| - scope = grammar['scopeName'] + scope = grammar['scopeName'] || grammar['scope'] File.write(File.join(GRAMMARS_PATH, "#{scope}.json"), JSON.pretty_generate(grammar)) installed << scope end diff --git a/vendor/grammars/NSIS b/vendor/grammars/NSIS index e0524002..b9be931f 160000 --- a/vendor/grammars/NSIS +++ b/vendor/grammars/NSIS @@ -1 +1 @@ -Subproject commit e052400204103acc26c14feeb624dd7ce6157611 +Subproject commit b9be931f41ac6039208494f8e98fd53a2394e517 diff --git a/vendor/grammars/awk-sublime b/vendor/grammars/awk-sublime index 7ec7d154..792d9215 160000 --- a/vendor/grammars/awk-sublime +++ b/vendor/grammars/awk-sublime @@ -1 +1 @@ -Subproject commit 7ec7d154469c05780cfeecca8fc00fda6f9ac0e7 +Subproject commit 792d9215315758c505a44a325b910bedc87bd10b diff --git a/vendor/grammars/language-emacs-lisp b/vendor/grammars/language-emacs-lisp new file mode 160000 index 00000000..76ec86a3 --- /dev/null +++ b/vendor/grammars/language-emacs-lisp @@ -0,0 +1 @@ +Subproject commit 76ec86a3eb1bc819a4f19de7295a19602a935c09 diff --git a/vendor/licenses/grammar/language-emacs-lisp.txt b/vendor/licenses/grammar/language-emacs-lisp.txt new file mode 100644 index 00000000..46603bd3 --- /dev/null +++ b/vendor/licenses/grammar/language-emacs-lisp.txt @@ -0,0 +1,18 @@ +--- +type: grammar +name: language-emacs-lisp +license: isc +--- +Copyright (c) 2016, John Gardner + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.