ext-modelist.js 7.1 KB

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