You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  2. // Distributed under an MIT license: https://codemirror.net/LICENSE
  3. (function (mod) {
  4. if (typeof exports == "object" && typeof module == "object") // CommonJS
  5. mod(require("../lib/codemirror"));
  6. else if (typeof define == "function" && define.amd) // AMD
  7. define(["../lib/codemirror"], mod);
  8. else // Plain browser env
  9. mod(CodeMirror);
  10. })(function (CodeMirror) {
  11. "use strict";
  12. CodeMirror.modeInfo = [
  13. {name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]},
  14. {
  15. name: "PGP",
  16. mimes: ["application/pgp", "application/pgp-encrypted", "application/pgp-keys", "application/pgp-signature"],
  17. mode: "asciiarmor",
  18. ext: ["asc", "pgp", "sig"]
  19. },
  20. {name: "ASN.1", mime: "text/x-ttcn-asn", mode: "asn.1", ext: ["asn", "asn1"]},
  21. {name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i},
  22. {name: "Brainfuck", mime: "text/x-brainfuck", mode: "brainfuck", ext: ["b", "bf"]},
  23. {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h", "ino"]},
  24. {
  25. name: "C++",
  26. mime: "text/x-c++src",
  27. mode: "clike",
  28. ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"],
  29. alias: ["cpp"]
  30. },
  31. {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]},
  32. {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp", "cs"]},
  33. {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]},
  34. {name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]},
  35. {name: "Closure Stylesheets (GSS)", mime: "text/x-gss", mode: "css", ext: ["gss"]},
  36. {name: "CMake", mime: "text/x-cmake", mode: "cmake", ext: ["cmake", "cmake.in"], file: /^CMakeLists\.txt$/},
  37. {
  38. name: "CoffeeScript",
  39. mimes: ["application/vnd.coffeescript", "text/coffeescript", "text/x-coffeescript"],
  40. mode: "coffeescript",
  41. ext: ["coffee"],
  42. alias: ["coffee", "coffee-script"]
  43. },
  44. {
  45. name: "Common Lisp",
  46. mime: "text/x-common-lisp",
  47. mode: "commonlisp",
  48. ext: ["cl", "lisp", "el"],
  49. alias: ["lisp"]
  50. },
  51. {name: "Cypher", mime: "application/x-cypher-query", mode: "cypher", ext: ["cyp", "cypher"]},
  52. {name: "Cython", mime: "text/x-cython", mode: "python", ext: ["pyx", "pxd", "pxi"]},
  53. {name: "Crystal", mime: "text/x-crystal", mode: "crystal", ext: ["cr"]},
  54. {name: "CSS", mime: "text/css", mode: "css", ext: ["css"]},
  55. {name: "CQL", mime: "text/x-cassandra", mode: "sql", ext: ["cql"]},
  56. {name: "D", mime: "text/x-d", mode: "d", ext: ["d"]},
  57. {name: "Dart", mimes: ["application/dart", "text/x-dart"], mode: "dart", ext: ["dart"]},
  58. {name: "diff", mime: "text/x-diff", mode: "diff", ext: ["diff", "patch"]},
  59. {name: "Django", mime: "text/x-django", mode: "django"},
  60. {name: "Dockerfile", mime: "text/x-dockerfile", mode: "dockerfile", file: /^Dockerfile$/},
  61. {name: "DTD", mime: "application/xml-dtd", mode: "dtd", ext: ["dtd"]},
  62. {name: "Dylan", mime: "text/x-dylan", mode: "dylan", ext: ["dylan", "dyl", "intr"]},
  63. {name: "EBNF", mime: "text/x-ebnf", mode: "ebnf"},
  64. {name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]},
  65. {name: "edn", mime: "application/edn", mode: "clojure", ext: ["edn"]},
  66. {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]},
  67. {name: "Elm", mime: "text/x-elm", mode: "elm", ext: ["elm"]},
  68. {name: "Embedded JavaScript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]},
  69. {name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]},
  70. {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]},
  71. {name: "Esper", mime: "text/x-esper", mode: "sql"},
  72. {name: "Factor", mime: "text/x-factor", mode: "factor", ext: ["factor"]},
  73. {name: "FCL", mime: "text/x-fcl", mode: "fcl"},
  74. {name: "Forth", mime: "text/x-forth", mode: "forth", ext: ["forth", "fth", "4th"]},
  75. {name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90", "f95"]},
  76. {name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]},
  77. {name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]},
  78. {name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]},
  79. {
  80. name: "GitHub Flavored Markdown",
  81. mime: "text/x-gfm",
  82. mode: "gfm",
  83. file: /^(readme|contributing|history)\.md$/i
  84. },
  85. {name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]},
  86. {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy", "gradle"], file: /^Jenkinsfile$/},
  87. {name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]},
  88. {name: "Haskell", mime: "text/x-haskell", mode: "haskell", ext: ["hs"]},
  89. {name: "Haskell (Literate)", mime: "text/x-literate-haskell", mode: "haskell-literate", ext: ["lhs"]},
  90. {name: "Haxe", mime: "text/x-haxe", mode: "haxe", ext: ["hx"]},
  91. {name: "HXML", mime: "text/x-hxml", mode: "haxe", ext: ["hxml"]},
  92. {name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded", ext: ["aspx"], alias: ["asp", "aspx"]},
  93. {
  94. name: "HTML",
  95. mime: "text/html",
  96. mode: "htmlmixed",
  97. ext: ["html", "htm", "handlebars", "hbs"],
  98. alias: ["xhtml"]
  99. },
  100. {name: "HTTP", mime: "message/http", mode: "http"},
  101. {name: "IDL", mime: "text/x-idl", mode: "idl", ext: ["pro"]},
  102. {name: "Pug", mime: "text/x-pug", mode: "pug", ext: ["jade", "pug"], alias: ["jade"]},
  103. {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]},
  104. {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]},
  105. {
  106. name: "JavaScript",
  107. mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"],
  108. mode: "javascript",
  109. ext: ["js"],
  110. alias: ["ecmascript", "js", "node"]
  111. },
  112. {
  113. name: "JSON",
  114. mimes: ["application/json", "application/x-json"],
  115. mode: "javascript",
  116. ext: ["json", "map"],
  117. alias: ["json5"]
  118. },
  119. {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]},
  120. {name: "JSX", mime: "text/jsx", mode: "jsx", ext: ["jsx"]},
  121. {name: "Jinja2", mime: "text/jinja2", mode: "jinja2", ext: ["j2", "jinja", "jinja2"]},
  122. {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]},
  123. {name: "Kotlin", mime: "text/x-kotlin", mode: "clike", ext: ["kt"]},
  124. {name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]},
  125. {name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]},
  126. {name: "Lua", mime: "text/x-lua", mode: "lua", ext: ["lua"]},
  127. {name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]},
  128. {name: "mIRC", mime: "text/mirc", mode: "mirc"},
  129. {name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"},
  130. {name: "Mathematica", mime: "text/x-mathematica", mode: "mathematica", ext: ["m", "nb", "wl", "wls"]},
  131. {name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]},
  132. {name: "MUMPS", mime: "text/x-mumps", mode: "mumps", ext: ["mps"]},
  133. {name: "MS SQL", mime: "text/x-mssql", mode: "sql"},
  134. {name: "mbox", mime: "application/mbox", mode: "mbox", ext: ["mbox"]},
  135. {name: "MySQL", mime: "text/x-mysql", mode: "sql"},
  136. {name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx", file: /nginx.*\.conf$/i},
  137. {name: "NSIS", mime: "text/x-nsis", mode: "nsis", ext: ["nsh", "nsi"]},
  138. {
  139. name: "NTriples", mimes: ["application/n-triples", "application/n-quads", "text/n-triples"],
  140. mode: "ntriples", ext: ["nt", "nq"]
  141. },
  142. {name: "Objective-C", mime: "text/x-objectivec", mode: "clike", ext: ["m"], alias: ["objective-c", "objc"]},
  143. {
  144. name: "Objective-C++",
  145. mime: "text/x-objectivec++",
  146. mode: "clike",
  147. ext: ["mm"],
  148. alias: ["objective-c++", "objc++"]
  149. },
  150. {name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]},
  151. {name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]},
  152. {name: "Oz", mime: "text/x-oz", mode: "oz", ext: ["oz"]},
  153. {name: "Pascal", mime: "text/x-pascal", mode: "pascal", ext: ["p", "pas"]},
  154. {name: "PEG.js", mime: "null", mode: "pegjs", ext: ["jsonld"]},
  155. {name: "Perl", mime: "text/x-perl", mode: "perl", ext: ["pl", "pm"]},
  156. {
  157. name: "PHP",
  158. mimes: ["text/x-php", "application/x-httpd-php", "application/x-httpd-php-open"],
  159. mode: "php",
  160. ext: ["php", "php3", "php4", "php5", "php7", "phtml"]
  161. },
  162. {name: "Pig", mime: "text/x-pig", mode: "pig", ext: ["pig"]},
  163. {name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]},
  164. {name: "PLSQL", mime: "text/x-plsql", mode: "sql", ext: ["pls"]},
  165. {name: "PostgreSQL", mime: "text/x-pgsql", mode: "sql"},
  166. {name: "PowerShell", mime: "application/x-powershell", mode: "powershell", ext: ["ps1", "psd1", "psm1"]},
  167. {
  168. name: "Properties files",
  169. mime: "text/x-properties",
  170. mode: "properties",
  171. ext: ["properties", "ini", "in"],
  172. alias: ["ini", "properties"]
  173. },
  174. {name: "ProtoBuf", mime: "text/x-protobuf", mode: "protobuf", ext: ["proto"]},
  175. {
  176. name: "Python",
  177. mime: "text/x-python",
  178. mode: "python",
  179. ext: ["BUILD", "bzl", "py", "pyw"],
  180. file: /^(BUCK|BUILD)$/
  181. },
  182. {name: "Puppet", mime: "text/x-puppet", mode: "puppet", ext: ["pp"]},
  183. {name: "Q", mime: "text/x-q", mode: "q", ext: ["q"]},
  184. {name: "R", mime: "text/x-rsrc", mode: "r", ext: ["r", "R"], alias: ["rscript"]},
  185. {name: "reStructuredText", mime: "text/x-rst", mode: "rst", ext: ["rst"], alias: ["rst"]},
  186. {name: "RPM Changes", mime: "text/x-rpm-changes", mode: "rpm"},
  187. {name: "RPM Spec", mime: "text/x-rpm-spec", mode: "rpm", ext: ["spec"]},
  188. {
  189. name: "Ruby",
  190. mime: "text/x-ruby",
  191. mode: "ruby",
  192. ext: ["rb"],
  193. alias: ["jruby", "macruby", "rake", "rb", "rbx"]
  194. },
  195. {name: "Rust", mime: "text/x-rustsrc", mode: "rust", ext: ["rs"]},
  196. {name: "SAS", mime: "text/x-sas", mode: "sas", ext: ["sas"]},
  197. {name: "Sass", mime: "text/x-sass", mode: "sass", ext: ["sass"]},
  198. {name: "Scala", mime: "text/x-scala", mode: "clike", ext: ["scala"]},
  199. {name: "Scheme", mime: "text/x-scheme", mode: "scheme", ext: ["scm", "ss"]},
  200. {name: "SCSS", mime: "text/x-scss", mode: "css", ext: ["scss"]},
  201. {
  202. name: "Shell",
  203. mimes: ["text/x-sh", "application/x-sh"],
  204. mode: "shell",
  205. ext: ["sh", "ksh", "bash"],
  206. alias: ["bash", "sh", "zsh"],
  207. file: /^PKGBUILD$/
  208. },
  209. {name: "Sieve", mime: "application/sieve", mode: "sieve", ext: ["siv", "sieve"]},
  210. {name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim", ext: ["slim"]},
  211. {name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]},
  212. {name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]},
  213. {name: "Solr", mime: "text/x-solr", mode: "solr"},
  214. {name: "SML", mime: "text/x-sml", mode: "mllike", ext: ["sml", "sig", "fun", "smackspec"]},
  215. {name: "Soy", mime: "text/x-soy", mode: "soy", ext: ["soy"], alias: ["closure template"]},
  216. {name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]},
  217. {name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]},
  218. {name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]},
  219. {name: "SQLite", mime: "text/x-sqlite", mode: "sql"},
  220. {name: "Squirrel", mime: "text/x-squirrel", mode: "clike", ext: ["nut"]},
  221. {name: "Stylus", mime: "text/x-styl", mode: "stylus", ext: ["styl"]},
  222. {name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]},
  223. {name: "sTeX", mime: "text/x-stex", mode: "stex"},
  224. {name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx", "tex"], alias: ["tex"]},
  225. {name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v", "sv", "svh"]},
  226. {name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]},
  227. {name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]},
  228. {name: "TiddlyWiki", mime: "text/x-tiddlywiki", mode: "tiddlywiki"},
  229. {name: "Tiki wiki", mime: "text/tiki", mode: "tiki"},
  230. {name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]},
  231. {name: "Tornado", mime: "text/x-tornado", mode: "tornado"},
  232. {name: "troff", mime: "text/troff", mode: "troff", ext: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]},
  233. {name: "TTCN", mime: "text/x-ttcn", mode: "ttcn", ext: ["ttcn", "ttcn3", "ttcnpp"]},
  234. {name: "TTCN_CFG", mime: "text/x-ttcn-cfg", mode: "ttcn-cfg", ext: ["cfg"]},
  235. {name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]},
  236. {name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]},
  237. {name: "TypeScript-JSX", mime: "text/typescript-jsx", mode: "jsx", ext: ["tsx"], alias: ["tsx"]},
  238. {name: "Twig", mime: "text/x-twig", mode: "twig"},
  239. {name: "Web IDL", mime: "text/x-webidl", mode: "webidl", ext: ["webidl"]},
  240. {name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]},
  241. {name: "VBScript", mime: "text/vbscript", mode: "vbscript", ext: ["vbs"]},
  242. {name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]},
  243. {name: "Verilog", mime: "text/x-verilog", mode: "verilog", ext: ["v"]},
  244. {name: "VHDL", mime: "text/x-vhdl", mode: "vhdl", ext: ["vhd", "vhdl"]},
  245. {name: "Vue.js Component", mimes: ["script/x-vue", "text/x-vue"], mode: "vue", ext: ["vue"]},
  246. {
  247. name: "XML",
  248. mimes: ["application/xml", "text/xml"],
  249. mode: "xml",
  250. ext: ["xml", "xsl", "xsd", "svg"],
  251. alias: ["rss", "wsdl", "xsd"]
  252. },
  253. {name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]},
  254. {name: "Yacas", mime: "text/x-yacas", mode: "yacas", ext: ["ys"]},
  255. {name: "YAML", mimes: ["text/x-yaml", "text/yaml"], mode: "yaml", ext: ["yaml", "yml"], alias: ["yml"]},
  256. {name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]},
  257. {name: "mscgen", mime: "text/x-mscgen", mode: "mscgen", ext: ["mscgen", "mscin", "msc"]},
  258. {name: "xu", mime: "text/x-xu", mode: "mscgen", ext: ["xu"]},
  259. {name: "msgenny", mime: "text/x-msgenny", mode: "mscgen", ext: ["msgenny"]},
  260. {name: "WebAssembly", mime: "text/webassembly", mode: "wast", ext: ["wat", "wast"]},
  261. ];
  262. // Ensure all modes have a mime property for backwards compatibility
  263. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  264. var info = CodeMirror.modeInfo[i];
  265. if (info.mimes) info.mime = info.mimes[0];
  266. }
  267. CodeMirror.findModeByMIME = function (mime) {
  268. mime = mime.toLowerCase();
  269. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  270. var info = CodeMirror.modeInfo[i];
  271. if (info.mime == mime) return info;
  272. if (info.mimes) for (var j = 0; j < info.mimes.length; j++)
  273. if (info.mimes[j] == mime) return info;
  274. }
  275. if (/\+xml$/.test(mime)) return CodeMirror.findModeByMIME("application/xml")
  276. if (/\+json$/.test(mime)) return CodeMirror.findModeByMIME("application/json")
  277. };
  278. CodeMirror.findModeByExtension = function (ext) {
  279. ext = ext.toLowerCase();
  280. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  281. var info = CodeMirror.modeInfo[i];
  282. if (info.ext) for (var j = 0; j < info.ext.length; j++)
  283. if (info.ext[j] == ext) return info;
  284. }
  285. };
  286. CodeMirror.findModeByFileName = function (filename) {
  287. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  288. var info = CodeMirror.modeInfo[i];
  289. if (info.file && info.file.test(filename)) return info;
  290. }
  291. var dot = filename.lastIndexOf(".");
  292. var ext = dot > -1 && filename.substring(dot + 1, filename.length);
  293. if (ext) return CodeMirror.findModeByExtension(ext);
  294. };
  295. CodeMirror.findModeByName = function (name) {
  296. name = name.toLowerCase();
  297. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  298. var info = CodeMirror.modeInfo[i];
  299. if (info.name.toLowerCase() == name) return info;
  300. if (info.alias) for (var j = 0; j < info.alias.length; j++)
  301. if (info.alias[j].toLowerCase() == name) return info;
  302. }
  303. };
  304. });