3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
20 * Class provides functionality to map Ace lexer definitions
22 class SyntaxHighlightAce {
23 /** @var array This map is inverted, because it is easier to maintain this way */
24 private static $aceLexers = [
27 'ActionScript' => [ 'actionscript', 'actionscript3' ],
28 'ADA' => [ 'ada', 'ada2005', 'ada95' ],
29 'Apache_Conf' => [ 'apache', 'apacheconf', 'aconf' ],
31 'Assembly_x86' => [ 'nasm' ],
32 'AutoHotKey' => [ 'autohotkey', 'ah' ],
33 'BatchFile' => [ 'bat', 'batch', 'dosbatch', 'winbatch' ],
34 'C_Cpp' => [ 'cpp', 'c++' ],
36 'Cirru' => [ 'cirru' ],
37 'Clojure' => [ 'clojure', 'clj' ],
38 'Cobol' => [ 'cobol' ],
39 'coffee' => [ 'coffee', 'coffeescript', 'coffee-script' ],
40 'ColdFusion' => [ 'cfm' ],
41 'CSharp' => [ 'csharp', '#' ],
46 'Diff' => [ 'diff', 'udiff' ],
47 'Django' => [ 'django', 'html+django', 'html+jinja', 'htmldjango' ],
48 'Dockerfile' => [ 'Dockerfile', 'docker' ],
52 'Eiffel' => [ 'eiffel' ],
54 'Elixir' => [ 'elixer', 'ex', 'exs' ],
56 'Erlang' => [ 'erlang' ],
58 'Fortran' => [ 'fortran' ],
61 'Gherkin' => [ 'cucumber', 'gherkin' ],
66 'Groovy' => [ 'groovy' ],
68 'Handlebars' => [ 'html+handlebars' ],
69 'Haskell' => [ 'haskell', 'hs' ],
70 'haXe' => [ 'hx', 'haxe', 'hxsl' ],
73 'HTML_Ruby' => [ 'rhtml', 'html+erb', 'html+ruby' ],
74 'INI' => [ 'ini', 'cfg', 'dosini' ],
79 'JavaScript' => [ 'Javascript', 'js' ],
84 'Julia' => [ 'julia', 'jl' ],
85 'LaTeX' => [ 'latex' ],
88 'Liquid' => [ 'liquid' ],
89 'Lisp' => [ 'lisp', 'common-lisp', 'cl' ],
90 'LiveScript' => [ 'Livescript', 'live-script' ],
96 'Makefile' => [ 'make', 'makefile', 'mf', 'bsdmake' ],
99 'MATLAB' => [ 'matlab' ],
103 'MySQL' => [ 'mysql' ],
104 'Nix' => [ 'nix', 'nixos' ],
105 'NSIS' => [ 'nsis', 'nsi', 'nsh' ],
106 'ObjectiveC' => [ 'objectivec', 'objective-c', 'obj-c', 'objc',
107 'objective-c++', 'objectivec++', 'obj-c++', 'objc++' ],
108 'OCaml' => [ 'ocaml' ],
109 'Pascal' => [ 'pascal', 'delphi', 'pas', 'objectpascal' ],
110 'Perl' => [ 'perl', 'pl', 'perl6', 'pl6' ],
111 'pgSQL' => [ 'postgresql', 'postgres' ],
112 'PHP' => [ 'php', 'php3', 'php4', 'php5', 'html+php' ],
113 'Powershell' => [ 'powershell', 'posh', 'ps1', 'psm1' ],
114 'Praat' => [ 'praat' ],
115 'Prolog' => [ 'prolog' ],
116 'Properties' => [ 'properties', 'jproperties' ],
117 'Protobuf' => [ 'protobuf', 'proto' ],
118 'Python' => [ 'python', 'py', 'sage', 'pyton3', 'py3' ],
122 'RHTML' => [], // HTML with Rcode, not ruby
123 'RST' => [ 'rst', 'rest', 'restructuredtext' ],
124 'Ruby' => [ 'ruby', 'rb', 'duby' ],
125 'Rust' => [ 'rust' ],
126 'SASS' => [ 'sass' ],
128 'Scala' => [ 'scala' ],
129 'Scheme' => [ 'scheme', 'scm' ],
130 'SCSS' => [ 'scss' ],
131 'SH' => [ 'sh', 'bash', 'ksh', 'shell' ],
133 'Smarty' => [ 'smarty', 'html+smarty' ],
135 'Soy_Template' => [],
141 'Swift' => [ 'swift' ],
144 'Text' => [ 'text' ],
147 'Twig' => [ 'html+twig', 'twig' ],
148 'Typescript' => [ 'typescript', 'ts' ],
149 'Vala' => [ 'vala', 'vapi' ],
151 'Velocity' => [ 'velocity', 'html+velocity' ],
152 'Verilog' => [ 'verilog', 'v', 'systemverilog', 'sv' ],
153 'VHDL' => [ 'vhdl' ],
156 'XQuery' => [ 'xquery', 'xqy', 'xq', 'xql', 'xqm' ],
157 'YAML' => [ 'yaml' ],
160 public static function getPygmentsToAceMap() {
162 foreach ( self::$aceLexers as $aceName => $pygmentsLexers ) {
163 foreach ( $pygmentsLexers as $lexer ) {
164 if ( strcasecmp( $lexer, $aceName ) === 0 ) {
167 if ( !array_key_exists( $lexer, $result ) ) {
168 $result[ $lexer ] = $aceName;