PageRenderTime 25ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/bower/ace-builds/src-noconflict/ext-modelist.js

https://gitlab.com/itlboy/yii2-starter-installed
JavaScript | 205 lines | 197 code | 8 blank | 0 comment | 6 complexity | 127dc7b68ca885eb1ea1b48fb1130f8b MD5 | raw file
  1. ace.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. Assembly_x86:["asm|a"],
  41. AutoHotKey: ["ahk"],
  42. BatchFile: ["bat|cmd"],
  43. C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"],
  44. C9Search: ["c9search_results"],
  45. Cirru: ["cirru|cr"],
  46. Clojure: ["clj|cljs"],
  47. Cobol: ["CBL|COB"],
  48. coffee: ["coffee|cf|cson|^Cakefile"],
  49. ColdFusion: ["cfm"],
  50. CSharp: ["cs"],
  51. CSS: ["css"],
  52. Curly: ["curly"],
  53. D: ["d|di"],
  54. Dart: ["dart"],
  55. Diff: ["diff|patch"],
  56. Dockerfile: ["^Dockerfile"],
  57. Dot: ["dot"],
  58. Drools: ["drl"],
  59. Dummy: ["dummy"],
  60. DummySyntax: ["dummy"],
  61. Eiffel: ["e|ge"],
  62. EJS: ["ejs"],
  63. Elixir: ["ex|exs"],
  64. Elm: ["elm"],
  65. Erlang: ["erl|hrl"],
  66. Forth: ["frt|fs|ldr|fth|4th"],
  67. Fortran: ["f|f90"],
  68. FTL: ["ftl"],
  69. Gcode: ["gcode"],
  70. Gherkin: ["feature"],
  71. Gitignore: ["^.gitignore"],
  72. Glsl: ["glsl|frag|vert"],
  73. Gobstones: ["gbs"],
  74. golang: ["go"],
  75. Groovy: ["groovy"],
  76. HAML: ["haml"],
  77. Handlebars: ["hbs|handlebars|tpl|mustache"],
  78. Haskell: ["hs"],
  79. Haskell_Cabal: ["cabal"],
  80. haXe: ["hx"],
  81. HTML: ["html|htm|xhtml"],
  82. HTML_Elixir: ["eex|html.eex"],
  83. HTML_Ruby: ["erb|rhtml|html.erb"],
  84. INI: ["ini|conf|cfg|prefs"],
  85. Io: ["io"],
  86. Jack: ["jack"],
  87. Jade: ["jade"],
  88. Java: ["java"],
  89. JavaScript: ["js|jsm|jsx"],
  90. JSON: ["json"],
  91. JSONiq: ["jq"],
  92. JSP: ["jsp"],
  93. JSX: ["jsx"],
  94. Julia: ["jl"],
  95. Kotlin: ["kt|kts"],
  96. LaTeX: ["tex|latex|ltx|bib"],
  97. LESS: ["less"],
  98. Liquid: ["liquid"],
  99. Lisp: ["lisp"],
  100. LiveScript: ["ls"],
  101. LogiQL: ["logic|lql"],
  102. LSL: ["lsl"],
  103. Lua: ["lua"],
  104. LuaPage: ["lp"],
  105. Lucene: ["lucene"],
  106. Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
  107. Markdown: ["md|markdown"],
  108. Mask: ["mask"],
  109. MATLAB: ["matlab"],
  110. Maze: ["mz"],
  111. MEL: ["mel"],
  112. MUSHCode: ["mc|mush"],
  113. MySQL: ["mysql"],
  114. Nix: ["nix"],
  115. NSIS: ["nsi|nsh"],
  116. ObjectiveC: ["m|mm"],
  117. OCaml: ["ml|mli"],
  118. Pascal: ["pas|p"],
  119. Perl: ["pl|pm"],
  120. pgSQL: ["pgsql"],
  121. PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"],
  122. Powershell: ["ps1"],
  123. Praat: ["praat|praatscript|psc|proc"],
  124. Prolog: ["plg|prolog"],
  125. Properties: ["properties"],
  126. Protobuf: ["proto"],
  127. Python: ["py"],
  128. R: ["r"],
  129. Razor: ["cshtml|asp"],
  130. RDoc: ["Rd"],
  131. RHTML: ["Rhtml"],
  132. RST: ["rst"],
  133. Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
  134. Rust: ["rs"],
  135. SASS: ["sass"],
  136. SCAD: ["scad"],
  137. Scala: ["scala"],
  138. Scheme: ["scm|sm|rkt|oak|scheme"],
  139. SCSS: ["scss"],
  140. SH: ["sh|bash|^.bashrc"],
  141. SJS: ["sjs"],
  142. Smarty: ["smarty|tpl"],
  143. snippets: ["snippets"],
  144. Soy_Template:["soy"],
  145. Space: ["space"],
  146. SQL: ["sql"],
  147. SQLServer: ["sqlserver"],
  148. Stylus: ["styl|stylus"],
  149. SVG: ["svg"],
  150. Swift: ["swift"],
  151. Tcl: ["tcl"],
  152. Tex: ["tex"],
  153. Text: ["txt"],
  154. Textile: ["textile"],
  155. Toml: ["toml"],
  156. Twig: ["twig|swig"],
  157. Typescript: ["ts|typescript|str"],
  158. TSX: ["tsx"],
  159. Vala: ["vala"],
  160. VBScript: ["vbs|vb"],
  161. Velocity: ["vm"],
  162. Verilog: ["v|vh|sv|svh"],
  163. VHDL: ["vhd|vhdl"],
  164. Wollok: ["wlk|wpgm|wtest"],
  165. XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"],
  166. XQuery: ["xq"],
  167. YAML: ["yaml|yml"],
  168. Django: ["html"]
  169. };
  170. var nameOverrides = {
  171. ObjectiveC: "Objective-C",
  172. CSharp: "C#",
  173. golang: "Go",
  174. C_Cpp: "C and C++",
  175. coffee: "CoffeeScript",
  176. HTML_Ruby: "HTML (Ruby)",
  177. HTML_Elixir: "HTML (Elixir)",
  178. FTL: "FreeMarker"
  179. };
  180. var modesByName = {};
  181. for (var name in supportedModes) {
  182. var data = supportedModes[name];
  183. var displayName = (nameOverrides[name] || name).replace(/_/g, " ");
  184. var filename = name.toLowerCase();
  185. var mode = new Mode(filename, displayName, data[0]);
  186. modesByName[filename] = mode;
  187. modes.push(mode);
  188. }
  189. module.exports = {
  190. getModeForPath: getModeForPath,
  191. modes: modes,
  192. modesByName: modesByName
  193. };
  194. });
  195. (function() {
  196. ace.require(["ace/ext/modelist"], function() {});
  197. })();