From 9ae19a1f9470a6f15a1ae70f870c044f55e9d8f5 Mon Sep 17 00:00:00 2001 From: John Gardner Date: Thu, 5 May 2016 07:07:01 +1000 Subject: [PATCH] Add support for World of Warcraft .toc files * Add language rule and heuristic for WoW Addon data * Add test fixtures for the .toc extension * Add grammar for syntax highlighting * Define colour of WoW .toc files * Refine heuristic to include a commonly-used keyword * Check whitespace in WoW-token heuristic * Include additional TeX keywords in .toc heuristic * Update grammar submodules * Cache license for WoW-toc grammar * Reverting sourcepawn update --- .gitmodules | 3 +++ grammars.yml | 3 ++- lib/linguist/heuristics.rb | 8 ++++++ lib/linguist/languages.yml | 8 ++++++ samples/TeX/beispiel.toc | 9 +++++++ samples/TeX/perl.toc | 19 ++++++++++++++ .../World of Warcraft Addon Data/addon.toc | 6 +++++ .../World of Warcraft Addon Data/lingua.toc | 11 ++++++++ .../World of Warcraft Addon Data/linguist.toc | 24 ++++++++++++++++++ vendor/grammars/AutoHotkey | 2 +- vendor/grammars/SublimePapyrus | 2 +- vendor/grammars/language-babel | 2 +- vendor/grammars/language-javascript | 2 +- vendor/grammars/language-toc-wow | 1 + vendor/grammars/vue-syntax-highlight | 2 +- vendor/licenses/grammar/language-toc-wow.txt | 25 +++++++++++++++++++ 16 files changed, 121 insertions(+), 6 deletions(-) create mode 100644 samples/TeX/beispiel.toc create mode 100644 samples/TeX/perl.toc create mode 100644 samples/World of Warcraft Addon Data/addon.toc create mode 100644 samples/World of Warcraft Addon Data/lingua.toc create mode 100644 samples/World of Warcraft Addon Data/linguist.toc create mode 160000 vendor/grammars/language-toc-wow create mode 100644 vendor/licenses/grammar/language-toc-wow.txt diff --git a/.gitmodules b/.gitmodules index d1a4d9d1..551b9450 100644 --- a/.gitmodules +++ b/.gitmodules @@ -710,6 +710,9 @@ [submodule "vendor/grammars/language-graphql"] path = vendor/grammars/language-graphql url = https://github.com/rmosolgo/language-graphql +[submodule "vendor/grammars/language-toc-wow"] + path = vendor/grammars/language-toc-wow + url = https://github.com/nebularg/language-toc-wow [submodule "vendor/grammars/sublime-autoit"] path = vendor/grammars/sublime-autoit url = https://github.com/AutoIt/SublimeAutoItScript diff --git a/grammars.yml b/grammars.yml index 27193028..90c6ebcf 100755 --- a/grammars.yml +++ b/grammars.yml @@ -124,7 +124,6 @@ vendor/grammars/SublimeBrainfuck: vendor/grammars/SublimeClarion/: - source.clarion vendor/grammars/SublimePapyrus/: -- source.papyrus.fallout4 - source.papyrus.skyrim vendor/grammars/SublimePuppet/: - source.puppet @@ -372,6 +371,8 @@ vendor/grammars/language-shellscript: - text.shell-session vendor/grammars/language-supercollider: - source.supercollider +vendor/grammars/language-toc-wow: +- source.toc vendor/grammars/language-xbase: - source.harbour vendor/grammars/language-yaml: diff --git a/lib/linguist/heuristics.rb b/lib/linguist/heuristics.rb index 97808975..1b2332b5 100644 --- a/lib/linguist/heuristics.rb +++ b/lib/linguist/heuristics.rb @@ -390,6 +390,14 @@ module Linguist Language["SQL"] end end + + disambiguate ".toc" do |data| + if /^## |@no-lib-strip@/.match(data) + Language["World of Warcraft Addon Data"] + elsif /^\\(contentsline|defcounter|beamer|boolfalse)/.match(data) + Language["TeX"] + end + end disambiguate ".ts" do |data| if data.include?("