ext-modelist.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. define("ace/ext/modelist",["ace_require","exports","module"], function(ace_require, exports, module) {
  2. "use strict";
  3. var modes = [];
  4. function getModeForPath(path) {
  5. var mode = modesByName.text;
  6. var fileName = path.split(/[\/\\]/).pop();
  7. for (var i = 0; i < modes.length; i++) {
  8. if (modes[i].supportsFile(fileName)) {
  9. mode = modes[i];
  10. break;
  11. }
  12. }
  13. return mode;
  14. }
  15. var Mode = function(name, caption, extensions) {
  16. this.name = name;
  17. this.caption = caption;
  18. this.mode = "ace/mode/" + name;
  19. this.extensions = extensions;
  20. var re;
  21. if (/\^/.test(extensions)) {
  22. re = extensions.replace(/\|(\^)?/g, function(a, b){
  23. return "$|" + (b ? "^" : "^.*\\.");
  24. }) + "$";
  25. } else {
  26. re = "^.*\\.(" + extensions + ")$";
  27. }
  28. this.extRe = new RegExp(re, "gi");
  29. };
  30. Mode.prototype.supportsFile = function(filename) {
  31. return filename.match(this.extRe);
  32. };
  33. var supportedModes = {
  34. ABAP: ["abap"],
  35. ABC: ["abc"],
  36. ActionScript:["as"],
  37. ADA: ["ada|adb"],
  38. Alda: ["alda"],
  39. Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
  40. Apex: ["apex|cls|trigger|tgr"],
  41. AQL: ["aql"],
  42. AsciiDoc: ["asciidoc|adoc"],
  43. ASL: ["dsl|asl"],
  44. Assembly_x86:["asm|a"],
  45. AutoHotKey: ["ahk"],
  46. BatchFile: ["bat|cmd"],
  47. C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
  48. C9Search: ["c9search_results"],
  49. Cirru: ["cirru|cr"],
  50. Clojure: ["clj|cljs"],
  51. Cobol: ["CBL|COB"],
  52. coffee: ["coffee|cf|cson|^Cakefile"],
  53. ColdFusion: ["cfm"],
  54. Crystal: ["cr"],
  55. CSharp: ["cs"],
  56. Csound_Document: ["csd"],
  57. Csound_Orchestra: ["orc"],
  58. Csound_Score: ["sco"],
  59. CSS: ["css"],
  60. Curly: ["curly"],
  61. D: ["d|di"],
  62. Dart: ["dart"],
  63. Diff: ["diff|patch"],
  64. Dockerfile: ["^Dockerfile"],
  65. Dot: ["dot"],
  66. Drools: ["drl"],
  67. Edifact: ["edi"],
  68. Eiffel: ["e|ge"],
  69. EJS: ["ejs"],
  70. Elixir: ["ex|exs"],
  71. Elm: ["elm"],
  72. Erlang: ["erl|hrl"],
  73. Forth: ["frt|fs|ldr|fth|4th"],
  74. Fortran: ["f|f90"],
  75. FSharp: ["fsi|fs|ml|mli|fsx|fsscript"],
  76. FSL: ["fsl"],
  77. FTL: ["ftl"],
  78. Gcode: ["gcode"],
  79. Gherkin: ["feature"],
  80. Gitignore: ["^.gitignore"],
  81. Glsl: ["glsl|frag|vert"],
  82. Gobstones: ["gbs"],
  83. golang: ["go"],
  84. GraphQLSchema: ["gql"],
  85. Groovy: ["groovy"],
  86. HAML: ["haml"],
  87. Handlebars: ["hbs|handlebars|tpl|mustache"],
  88. Haskell: ["hs"],
  89. Haskell_Cabal: ["cabal"],
  90. haXe: ["hx"],
  91. Hjson: ["hjson"],
  92. HTML: ["html|htm|xhtml|vue|we|wpy"],
  93. HTML_Elixir: ["eex|html.eex"],
  94. HTML_Ruby: ["erb|rhtml|html.erb"],
  95. INI: ["ini|conf|cfg|prefs"],
  96. Io: ["io"],
  97. Jack: ["jack"],
  98. Jade: ["jade|pug"],
  99. Java: ["java"],
  100. JavaScript: ["js|jsm|jsx"],
  101. JSON: ["json"],
  102. JSON5: ["json5"],
  103. JSONiq: ["jq"],
  104. JSP: ["jsp"],
  105. JSSM: ["jssm|jssm_state"],
  106. JSX: ["jsx"],
  107. Julia: ["jl"],
  108. Kotlin: ["kt|kts"],
  109. LaTeX: ["tex|latex|ltx|bib"],
  110. LESS: ["less"],
  111. Liquid: ["liquid"],
  112. Lisp: ["lisp"],
  113. LiveScript: ["ls"],
  114. LogiQL: ["logic|lql"],
  115. LSL: ["lsl"],
  116. Lua: ["lua"],
  117. LuaPage: ["lp"],
  118. Lucene: ["lucene"],
  119. Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
  120. Markdown: ["md|markdown"],
  121. Mask: ["mask"],
  122. MATLAB: ["matlab"],
  123. Maze: ["mz"],
  124. MediaWiki: ["wiki|mediawiki"],
  125. MEL: ["mel"],
  126. MIXAL: ["mixal"],
  127. MUSHCode: ["mc|mush"],
  128. MySQL: ["mysql"],
  129. Nginx: ["nginx|conf"],
  130. Nim: ["nim"],
  131. Nix: ["nix"],
  132. NSIS: ["nsi|nsh"],
  133. Nunjucks: ["nunjucks|nunjs|nj|njk"],
  134. ObjectiveC: ["m|mm"],
  135. OCaml: ["ml|mli"],
  136. Pascal: ["pas|p"],
  137. Perl: ["pl|pm"],
  138. Perl6: ["p6|pl6|pm6"],
  139. pgSQL: ["pgsql"],
  140. PHP: ["php|inc|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
  141. PHP_Laravel_blade: ["blade.php"],
  142. Pig: ["pig"],
  143. Powershell: ["ps1"],
  144. Praat: ["praat|praatscript|psc|proc"],
  145. Prisma: ["prisma"],
  146. Prolog: ["plg|prolog"],
  147. Properties: ["properties"],
  148. Protobuf: ["proto"],
  149. Puppet: ["epp|pp"],
  150. Python: ["py"],
  151. QML: ["qml"],
  152. R: ["r"],
  153. Razor: ["cshtml|asp"],
  154. RDoc: ["Rd"],
  155. Red: ["red|reds"],
  156. RHTML: ["Rhtml"],
  157. RST: ["rst"],
  158. Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
  159. Rust: ["rs"],
  160. SASS: ["sass"],
  161. SCAD: ["scad"],
  162. Scala: ["scala|sbt"],
  163. Scheme: ["scm|sm|rkt|oak|scheme"],
  164. SCSS: ["scss"],
  165. SH: ["sh|bash|^.bashrc"],
  166. SJS: ["sjs"],
  167. Slim: ["slim|skim"],
  168. Smarty: ["smarty|tpl"],
  169. snippets: ["snippets"],
  170. Soy_Template:["soy"],
  171. Space: ["space"],
  172. SQL: ["sql"],
  173. SQLServer: ["sqlserver"],
  174. Stylus: ["styl|stylus"],
  175. SVG: ["svg"],
  176. Swift: ["swift"],
  177. Tcl: ["tcl"],
  178. Terraform: ["tf", "tfvars", "terragrunt"],
  179. Tex: ["tex"],
  180. Text: ["txt"],
  181. Textile: ["textile"],
  182. Toml: ["toml"],
  183. TSX: ["tsx"],
  184. Twig: ["latte|twig|swig"],
  185. Typescript: ["ts|typescript|str"],
  186. Vala: ["vala"],
  187. VBScript: ["vbs|vb"],
  188. Velocity: ["vm"],
  189. Verilog: ["v|vh|sv|svh"],
  190. VHDL: ["vhd|vhdl"],
  191. Visualforce: ["vfp|component|page"],
  192. Wollok: ["wlk|wpgm|wtest"],
  193. XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
  194. XQuery: ["xq"],
  195. YAML: ["yaml|yml"],
  196. Zeek: ["zeek|bro"],
  197. Django: ["html"]
  198. };
  199. var nameOverrides = {
  200. ObjectiveC: "Objective-C",
  201. CSharp: "C#",
  202. golang: "Go",
  203. C_Cpp: "C and C++",
  204. Csound_Document: "Csound Document",
  205. Csound_Orchestra: "Csound",
  206. Csound_Score: "Csound Score",
  207. coffee: "CoffeeScript",
  208. HTML_Ruby: "HTML (Ruby)",
  209. HTML_Elixir: "HTML (Elixir)",
  210. FTL: "FreeMarker",
  211. PHP_Laravel_blade: "PHP (Blade Template)",
  212. Perl6: "Perl 6",
  213. AutoHotKey: "AutoHotkey / AutoIt"
  214. };
  215. var modesByName = {};
  216. for (var name in supportedModes) {
  217. var data = supportedModes[name];
  218. var displayName = (nameOverrides[name] || name).replace(/_/g, " ");
  219. var filename = name.toLowerCase();
  220. var mode = new Mode(filename, displayName, data[0]);
  221. modesByName[filename] = mode;
  222. modes.push(mode);
  223. }
  224. module.exports = {
  225. getModeForPath: getModeForPath,
  226. modes: modes,
  227. modesByName: modesByName
  228. };
  229. }); (function() {
  230. window.ace_require(["ace/ext/modelist"], function(m) {
  231. if (typeof module == "object" && typeof exports == "object" && module) {
  232. module.exports = m;
  233. }
  234. });
  235. })();