暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

mode-jsp.js 66KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584
  1. ace.define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var lang = require("../lib/lang");
  5. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  6. var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
  7. var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
  8. var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
  9. var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
  10. var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
  11. var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  12. var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
  13. var pseudoClasses = exports.pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
  14. var CssHighlightRules = function() {
  15. var keywordMapper = this.createKeywordMapper({
  16. "support.function": supportFunction,
  17. "support.constant": supportConstant,
  18. "support.type": supportType,
  19. "support.constant.color": supportConstantColor,
  20. "support.constant.fonts": supportConstantFonts
  21. }, "text", true);
  22. this.$rules = {
  23. "start" : [{
  24. token : "comment", // multi line comment
  25. regex : "\\/\\*",
  26. push : "comment"
  27. }, {
  28. token: "paren.lparen",
  29. regex: "\\{",
  30. push: "ruleset"
  31. }, {
  32. token: "string",
  33. regex: "@.*?{",
  34. push: "media"
  35. }, {
  36. token: "keyword",
  37. regex: "#[a-z0-9-_]+"
  38. }, {
  39. token: "variable",
  40. regex: "\\.[a-z0-9-_]+"
  41. }, {
  42. token: "string",
  43. regex: ":[a-z0-9-_]+"
  44. }, {
  45. token: "constant",
  46. regex: "[a-z0-9-_]+"
  47. }, {
  48. caseInsensitive: true
  49. }],
  50. "media" : [{
  51. token : "comment", // multi line comment
  52. regex : "\\/\\*",
  53. push : "comment"
  54. }, {
  55. token: "paren.lparen",
  56. regex: "\\{",
  57. push: "ruleset"
  58. }, {
  59. token: "string",
  60. regex: "\\}",
  61. next: "pop"
  62. }, {
  63. token: "keyword",
  64. regex: "#[a-z0-9-_]+"
  65. }, {
  66. token: "variable",
  67. regex: "\\.[a-z0-9-_]+"
  68. }, {
  69. token: "string",
  70. regex: ":[a-z0-9-_]+"
  71. }, {
  72. token: "constant",
  73. regex: "[a-z0-9-_]+"
  74. }, {
  75. caseInsensitive: true
  76. }],
  77. "comment" : [{
  78. token : "comment",
  79. regex : "\\*\\/",
  80. next : "pop"
  81. }, {
  82. defaultToken : "comment"
  83. }],
  84. "ruleset" : [
  85. {
  86. token : "paren.rparen",
  87. regex : "\\}",
  88. next: "pop"
  89. }, {
  90. token : "comment", // multi line comment
  91. regex : "\\/\\*",
  92. push : "comment"
  93. }, {
  94. token : "string", // single line
  95. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  96. }, {
  97. token : "string", // single line
  98. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  99. }, {
  100. token : ["constant.numeric", "keyword"],
  101. regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
  102. }, {
  103. token : "constant.numeric",
  104. regex : numRe
  105. }, {
  106. token : "constant.numeric", // hex6 color
  107. regex : "#[a-f0-9]{6}"
  108. }, {
  109. token : "constant.numeric", // hex3 color
  110. regex : "#[a-f0-9]{3}"
  111. }, {
  112. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  113. regex : pseudoElements
  114. }, {
  115. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  116. regex : pseudoClasses
  117. }, {
  118. token : ["support.function", "string", "support.function"],
  119. regex : "(url\\()(.*)(\\))"
  120. }, {
  121. token : keywordMapper,
  122. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  123. }, {
  124. caseInsensitive: true
  125. }]
  126. };
  127. this.normalizeRules();
  128. };
  129. oop.inherits(CssHighlightRules, TextHighlightRules);
  130. exports.CssHighlightRules = CssHighlightRules;
  131. });
  132. ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  133. "use strict";
  134. var oop = require("../lib/oop");
  135. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  136. var DocCommentHighlightRules = function() {
  137. this.$rules = {
  138. "start" : [ {
  139. token : "comment.doc.tag",
  140. regex : "@[\\w\\d_]+" // TODO: fix email addresses
  141. },
  142. DocCommentHighlightRules.getTagRule(),
  143. {
  144. defaultToken : "comment.doc",
  145. caseInsensitive: true
  146. }]
  147. };
  148. };
  149. oop.inherits(DocCommentHighlightRules, TextHighlightRules);
  150. DocCommentHighlightRules.getTagRule = function(start) {
  151. return {
  152. token : "comment.doc.tag.storage.type",
  153. regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
  154. };
  155. }
  156. DocCommentHighlightRules.getStartRule = function(start) {
  157. return {
  158. token : "comment.doc", // doc comment
  159. regex : "\\/\\*(?=\\*)",
  160. next : start
  161. };
  162. };
  163. DocCommentHighlightRules.getEndRule = function (start) {
  164. return {
  165. token : "comment.doc", // closing comment
  166. regex : "\\*\\/",
  167. next : start
  168. };
  169. };
  170. exports.DocCommentHighlightRules = DocCommentHighlightRules;
  171. });
  172. ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
  173. "use strict";
  174. var oop = require("../lib/oop");
  175. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  176. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  177. var JavaScriptHighlightRules = function(options) {
  178. var keywordMapper = this.createKeywordMapper({
  179. "variable.language":
  180. "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
  181. "Namespace|QName|XML|XMLList|" + // E4X
  182. "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
  183. "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
  184. "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
  185. "SyntaxError|TypeError|URIError|" +
  186. "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
  187. "isNaN|parseFloat|parseInt|" +
  188. "JSON|Math|" + // Other
  189. "this|arguments|prototype|window|document" , // Pseudo
  190. "keyword":
  191. "const|yield|import|get|set|" +
  192. "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
  193. "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
  194. "__parent__|__count__|escape|unescape|with|__proto__|" +
  195. "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
  196. "storage.type":
  197. "const|let|var|function",
  198. "constant.language":
  199. "null|Infinity|NaN|undefined",
  200. "support.function":
  201. "alert",
  202. "constant.language.boolean": "true|false"
  203. }, "identifier");
  204. var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
  205. var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
  206. var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
  207. "u[0-9a-fA-F]{4}|" + // unicode
  208. "[0-2][0-7]{0,2}|" + // oct
  209. "3[0-6][0-7]?|" + // oct
  210. "37[0-7]?|" + // oct
  211. "[4-7][0-7]?|" + //oct
  212. ".)";
  213. this.$rules = {
  214. "no_regex" : [
  215. {
  216. token : "comment",
  217. regex : "\\/\\/",
  218. next : "line_comment"
  219. },
  220. DocCommentHighlightRules.getStartRule("doc-start"),
  221. {
  222. token : "comment", // multi line comment
  223. regex : /\/\*/,
  224. next : "comment"
  225. }, {
  226. token : "string",
  227. regex : "'(?=.)",
  228. next : "qstring"
  229. }, {
  230. token : "string",
  231. regex : '"(?=.)',
  232. next : "qqstring"
  233. }, {
  234. token : "constant.numeric", // hex
  235. regex : /0[xX][0-9a-fA-F]+\b/
  236. }, {
  237. token : "constant.numeric", // float
  238. regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
  239. }, {
  240. token : [
  241. "storage.type", "punctuation.operator", "support.function",
  242. "punctuation.operator", "entity.name.function", "text","keyword.operator"
  243. ],
  244. regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
  245. next: "function_arguments"
  246. }, {
  247. token : [
  248. "storage.type", "punctuation.operator", "entity.name.function", "text",
  249. "keyword.operator", "text", "storage.type", "text", "paren.lparen"
  250. ],
  251. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  252. next: "function_arguments"
  253. }, {
  254. token : [
  255. "entity.name.function", "text", "keyword.operator", "text", "storage.type",
  256. "text", "paren.lparen"
  257. ],
  258. regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
  259. next: "function_arguments"
  260. }, {
  261. token : [
  262. "storage.type", "punctuation.operator", "entity.name.function", "text",
  263. "keyword.operator", "text",
  264. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  265. ],
  266. regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
  267. next: "function_arguments"
  268. }, {
  269. token : [
  270. "storage.type", "text", "entity.name.function", "text", "paren.lparen"
  271. ],
  272. regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
  273. next: "function_arguments"
  274. }, {
  275. token : [
  276. "entity.name.function", "text", "punctuation.operator",
  277. "text", "storage.type", "text", "paren.lparen"
  278. ],
  279. regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
  280. next: "function_arguments"
  281. }, {
  282. token : [
  283. "text", "text", "storage.type", "text", "paren.lparen"
  284. ],
  285. regex : "(:)(\\s*)(function)(\\s*)(\\()",
  286. next: "function_arguments"
  287. }, {
  288. token : "keyword",
  289. regex : "(?:" + kwBeforeRe + ")\\b",
  290. next : "start"
  291. }, {
  292. token : ["punctuation.operator", "support.function"],
  293. regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
  294. }, {
  295. token : ["punctuation.operator", "support.function.dom"],
  296. regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
  297. }, {
  298. token : ["punctuation.operator", "support.constant"],
  299. regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
  300. }, {
  301. token : ["support.constant"],
  302. regex : /that\b/
  303. }, {
  304. token : ["storage.type", "punctuation.operator", "support.function.firebug"],
  305. regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
  306. }, {
  307. token : keywordMapper,
  308. regex : identifierRe
  309. }, {
  310. token : "keyword.operator",
  311. regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
  312. next : "start"
  313. }, {
  314. token : "punctuation.operator",
  315. regex : /[?:,;.]/,
  316. next : "start"
  317. }, {
  318. token : "paren.lparen",
  319. regex : /[\[({]/,
  320. next : "start"
  321. }, {
  322. token : "paren.rparen",
  323. regex : /[\])}]/
  324. }, {
  325. token: "comment",
  326. regex: /^#!.*$/
  327. }
  328. ],
  329. "start": [
  330. DocCommentHighlightRules.getStartRule("doc-start"),
  331. {
  332. token : "comment", // multi line comment
  333. regex : "\\/\\*",
  334. next : "comment_regex_allowed"
  335. }, {
  336. token : "comment",
  337. regex : "\\/\\/",
  338. next : "line_comment_regex_allowed"
  339. }, {
  340. token: "string.regexp",
  341. regex: "\\/",
  342. next: "regex"
  343. }, {
  344. token : "text",
  345. regex : "\\s+|^$",
  346. next : "start"
  347. }, {
  348. token: "empty",
  349. regex: "",
  350. next: "no_regex"
  351. }
  352. ],
  353. "regex": [
  354. {
  355. token: "regexp.keyword.operator",
  356. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  357. }, {
  358. token: "string.regexp",
  359. regex: "/[sxngimy]*",
  360. next: "no_regex"
  361. }, {
  362. token : "invalid",
  363. regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
  364. }, {
  365. token : "constant.language.escape",
  366. regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
  367. }, {
  368. token : "constant.language.delimiter",
  369. regex: /\|/
  370. }, {
  371. token: "constant.language.escape",
  372. regex: /\[\^?/,
  373. next: "regex_character_class"
  374. }, {
  375. token: "empty",
  376. regex: "$",
  377. next: "no_regex"
  378. }, {
  379. defaultToken: "string.regexp"
  380. }
  381. ],
  382. "regex_character_class": [
  383. {
  384. token: "regexp.charclass.keyword.operator",
  385. regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
  386. }, {
  387. token: "constant.language.escape",
  388. regex: "]",
  389. next: "regex"
  390. }, {
  391. token: "constant.language.escape",
  392. regex: "-"
  393. }, {
  394. token: "empty",
  395. regex: "$",
  396. next: "no_regex"
  397. }, {
  398. defaultToken: "string.regexp.charachterclass"
  399. }
  400. ],
  401. "function_arguments": [
  402. {
  403. token: "variable.parameter",
  404. regex: identifierRe
  405. }, {
  406. token: "punctuation.operator",
  407. regex: "[, ]+"
  408. }, {
  409. token: "punctuation.operator",
  410. regex: "$"
  411. }, {
  412. token: "empty",
  413. regex: "",
  414. next: "no_regex"
  415. }
  416. ],
  417. "comment_regex_allowed" : [
  418. DocCommentHighlightRules.getTagRule(),
  419. {token : "comment", regex : "\\*\\/", next : "start"},
  420. {defaultToken : "comment", caseInsensitive: true}
  421. ],
  422. "comment" : [
  423. DocCommentHighlightRules.getTagRule(),
  424. {token : "comment", regex : "\\*\\/", next : "no_regex"},
  425. {defaultToken : "comment", caseInsensitive: true}
  426. ],
  427. "line_comment_regex_allowed" : [
  428. DocCommentHighlightRules.getTagRule(),
  429. {token : "comment", regex : "$|^", next : "start"},
  430. {defaultToken : "comment", caseInsensitive: true}
  431. ],
  432. "line_comment" : [
  433. DocCommentHighlightRules.getTagRule(),
  434. {token : "comment", regex : "$|^", next : "no_regex"},
  435. {defaultToken : "comment", caseInsensitive: true}
  436. ],
  437. "qqstring" : [
  438. {
  439. token : "constant.language.escape",
  440. regex : escapedRe
  441. }, {
  442. token : "string",
  443. regex : "\\\\$",
  444. next : "qqstring"
  445. }, {
  446. token : "string",
  447. regex : '"|$',
  448. next : "no_regex"
  449. }, {
  450. defaultToken: "string"
  451. }
  452. ],
  453. "qstring" : [
  454. {
  455. token : "constant.language.escape",
  456. regex : escapedRe
  457. }, {
  458. token : "string",
  459. regex : "\\\\$",
  460. next : "qstring"
  461. }, {
  462. token : "string",
  463. regex : "'|$",
  464. next : "no_regex"
  465. }, {
  466. defaultToken: "string"
  467. }
  468. ]
  469. };
  470. if (!options || !options.noES6) {
  471. this.$rules.no_regex.unshift({
  472. regex: "[{}]", onMatch: function(val, state, stack) {
  473. this.next = val == "{" ? this.nextState : "";
  474. if (val == "{" && stack.length) {
  475. stack.unshift("start", state);
  476. return "paren";
  477. }
  478. if (val == "}" && stack.length) {
  479. stack.shift();
  480. this.next = stack.shift();
  481. if (this.next.indexOf("string") != -1)
  482. return "paren.quasi.end";
  483. }
  484. return val == "{" ? "paren.lparen" : "paren.rparen";
  485. },
  486. nextState: "start"
  487. }, {
  488. token : "string.quasi.start",
  489. regex : /`/,
  490. push : [{
  491. token : "constant.language.escape",
  492. regex : escapedRe
  493. }, {
  494. token : "paren.quasi.start",
  495. regex : /\${/,
  496. push : "start"
  497. }, {
  498. token : "string.quasi.end",
  499. regex : /`/,
  500. next : "pop"
  501. }, {
  502. defaultToken: "string.quasi"
  503. }]
  504. });
  505. }
  506. this.embedRules(DocCommentHighlightRules, "doc-",
  507. [ DocCommentHighlightRules.getEndRule("no_regex") ]);
  508. this.normalizeRules();
  509. };
  510. oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
  511. exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
  512. });
  513. ace.define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  514. "use strict";
  515. var oop = require("../lib/oop");
  516. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  517. var XmlHighlightRules = function(normalize) {
  518. this.$rules = {
  519. start : [
  520. {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
  521. {
  522. token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"],
  523. regex : "(<\\?)(xml)(?=[\\s])", next : "xml_decl", caseInsensitive: true
  524. },
  525. {
  526. token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
  527. regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "processing_instruction",
  528. },
  529. {token : "comment.xml", regex : "<\\!--", next : "comment"},
  530. {
  531. token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
  532. regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
  533. },
  534. {include : "tag"},
  535. {token : "text.end-tag-open.xml", regex: "</"},
  536. {token : "text.tag-open.xml", regex: "<"},
  537. {include : "reference"},
  538. {defaultToken : "text.xml"}
  539. ],
  540. xml_decl : [{
  541. token : "entity.other.attribute-name.decl-attribute-name.xml",
  542. regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
  543. }, {
  544. token : "keyword.operator.decl-attribute-equals.xml",
  545. regex : "="
  546. }, {
  547. include: "whitespace"
  548. }, {
  549. include: "string"
  550. }, {
  551. token : "punctuation.xml-decl.xml",
  552. regex : "\\?>",
  553. next : "start"
  554. }],
  555. processing_instruction : [
  556. {token : "punctuation.instruction.xml", regex : "\\?>", next : "start"},
  557. {defaultToken : "instruction.xml"}
  558. ],
  559. doctype : [
  560. {include : "whitespace"},
  561. {include : "string"},
  562. {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
  563. {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
  564. {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
  565. ],
  566. int_subset : [{
  567. token : "text.xml",
  568. regex : "\\s+"
  569. }, {
  570. token: "punctuation.int-subset.xml",
  571. regex: "]",
  572. next: "pop"
  573. }, {
  574. token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
  575. regex : "(<\\!)([-_a-zA-Z0-9]+)",
  576. push : [{
  577. token : "text",
  578. regex : "\\s+"
  579. },
  580. {
  581. token : "punctuation.markup-decl.xml",
  582. regex : ">",
  583. next : "pop"
  584. },
  585. {include : "string"}]
  586. }],
  587. cdata : [
  588. {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
  589. {token : "text.xml", regex : "\\s+"},
  590. {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
  591. ],
  592. comment : [
  593. {token : "comment.xml", regex : "-->", next : "start"},
  594. {defaultToken : "comment.xml"}
  595. ],
  596. reference : [{
  597. token : "constant.language.escape.reference.xml",
  598. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  599. }],
  600. attr_reference : [{
  601. token : "constant.language.escape.reference.attribute-value.xml",
  602. regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
  603. }],
  604. tag : [{
  605. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
  606. regex : "(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
  607. next: [
  608. {include : "attributes"},
  609. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  610. ]
  611. }],
  612. tag_whitespace : [
  613. {token : "text.tag-whitespace.xml", regex : "\\s+"}
  614. ],
  615. whitespace : [
  616. {token : "text.whitespace.xml", regex : "\\s+"}
  617. ],
  618. string: [{
  619. token : "string.xml",
  620. regex : "'",
  621. push : [
  622. {token : "string.xml", regex: "'", next: "pop"},
  623. {defaultToken : "string.xml"}
  624. ]
  625. }, {
  626. token : "string.xml",
  627. regex : '"',
  628. push : [
  629. {token : "string.xml", regex: '"', next: "pop"},
  630. {defaultToken : "string.xml"}
  631. ]
  632. }],
  633. attributes: [{
  634. token : "entity.other.attribute-name.xml",
  635. regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
  636. }, {
  637. token : "keyword.operator.attribute-equals.xml",
  638. regex : "="
  639. }, {
  640. include: "tag_whitespace"
  641. }, {
  642. include: "attribute_value"
  643. }],
  644. attribute_value: [{
  645. token : "string.attribute-value.xml",
  646. regex : "'",
  647. push : [
  648. {token : "string.attribute-value.xml", regex: "'", next: "pop"},
  649. {include : "attr_reference"},
  650. {defaultToken : "string.attribute-value.xml"}
  651. ]
  652. }, {
  653. token : "string.attribute-value.xml",
  654. regex : '"',
  655. push : [
  656. {token : "string.attribute-value.xml", regex: '"', next: "pop"},
  657. {include : "attr_reference"},
  658. {defaultToken : "string.attribute-value.xml"}
  659. ]
  660. }]
  661. };
  662. if (this.constructor === XmlHighlightRules)
  663. this.normalizeRules();
  664. };
  665. (function() {
  666. this.embedTagRules = function(HighlightRules, prefix, tag){
  667. this.$rules.tag.unshift({
  668. token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  669. regex : "(<)(" + tag + "(?=\\s|>|$))",
  670. next: [
  671. {include : "attributes"},
  672. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
  673. ]
  674. });
  675. this.$rules[tag + "-end"] = [
  676. {include : "attributes"},
  677. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
  678. onMatch : function(value, currentState, stack) {
  679. stack.splice(0);
  680. return this.token;
  681. }}
  682. ]
  683. this.embedRules(HighlightRules, prefix, [{
  684. token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
  685. regex : "(</)(" + tag + "(?=\\s|>|$))",
  686. next: tag + "-end"
  687. }, {
  688. token: "string.cdata.xml",
  689. regex : "<\\!\\[CDATA\\["
  690. }, {
  691. token: "string.cdata.xml",
  692. regex : "\\]\\]>"
  693. }]);
  694. };
  695. }).call(TextHighlightRules.prototype);
  696. oop.inherits(XmlHighlightRules, TextHighlightRules);
  697. exports.XmlHighlightRules = XmlHighlightRules;
  698. });
  699. ace.define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module) {
  700. "use strict";
  701. var oop = require("../lib/oop");
  702. var lang = require("../lib/lang");
  703. var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
  704. var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
  705. var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
  706. var tagMap = lang.createMap({
  707. a : 'anchor',
  708. button : 'form',
  709. form : 'form',
  710. img : 'image',
  711. input : 'form',
  712. label : 'form',
  713. option : 'form',
  714. script : 'script',
  715. select : 'form',
  716. textarea : 'form',
  717. style : 'style',
  718. table : 'table',
  719. tbody : 'table',
  720. td : 'table',
  721. tfoot : 'table',
  722. th : 'table',
  723. tr : 'table'
  724. });
  725. var HtmlHighlightRules = function() {
  726. XmlHighlightRules.call(this);
  727. this.addRules({
  728. attributes: [{
  729. include : "tag_whitespace"
  730. }, {
  731. token : "entity.other.attribute-name.xml",
  732. regex : "[-_a-zA-Z0-9:]+"
  733. }, {
  734. token : "keyword.operator.attribute-equals.xml",
  735. regex : "=",
  736. push : [{
  737. include: "tag_whitespace"
  738. }, {
  739. token : "string.unquoted.attribute-value.html",
  740. regex : "[^<>='\"`\\s]+",
  741. next : "pop"
  742. }, {
  743. token : "empty",
  744. regex : "",
  745. next : "pop"
  746. }]
  747. }, {
  748. include : "attribute_value"
  749. }],
  750. tag: [{
  751. token : function(start, tag) {
  752. var group = tagMap[tag];
  753. return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
  754. "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
  755. },
  756. regex : "(</?)([-_a-zA-Z0-9:]+)",
  757. next: "tag_stuff"
  758. }],
  759. tag_stuff: [
  760. {include : "attributes"},
  761. {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
  762. ],
  763. });
  764. this.embedTagRules(CssHighlightRules, "css-", "style");
  765. this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
  766. if (this.constructor === HtmlHighlightRules)
  767. this.normalizeRules();
  768. };
  769. oop.inherits(HtmlHighlightRules, XmlHighlightRules);
  770. exports.HtmlHighlightRules = HtmlHighlightRules;
  771. });
  772. ace.define("ace/mode/java_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
  773. "use strict";
  774. var oop = require("../lib/oop");
  775. var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
  776. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  777. var JavaHighlightRules = function() {
  778. var keywords = (
  779. "abstract|continue|for|new|switch|" +
  780. "assert|default|goto|package|synchronized|" +
  781. "boolean|do|if|private|this|" +
  782. "break|double|implements|protected|throw|" +
  783. "byte|else|import|public|throws|" +
  784. "case|enum|instanceof|return|transient|" +
  785. "catch|extends|int|short|try|" +
  786. "char|final|interface|static|void|" +
  787. "class|finally|long|strictfp|volatile|" +
  788. "const|float|native|super|while"
  789. );
  790. var buildinConstants = ("null|Infinity|NaN|undefined");
  791. var langClasses = (
  792. "AbstractMethodError|AssertionError|ClassCircularityError|"+
  793. "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
  794. "ExceptionInInitializerError|IllegalAccessError|"+
  795. "IllegalThreadStateException|InstantiationError|InternalError|"+
  796. "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+
  797. "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+
  798. "SuppressWarnings|TypeNotPresentException|UnknownError|"+
  799. "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+
  800. "InstantiationException|IndexOutOfBoundsException|"+
  801. "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+
  802. "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+
  803. "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+
  804. "InterruptedException|NoSuchMethodException|IllegalAccessException|"+
  805. "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+
  806. "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+
  807. "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+
  808. "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+
  809. "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+
  810. "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+
  811. "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+
  812. "ArrayStoreException|ClassCastException|LinkageError|"+
  813. "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+
  814. "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
  815. "Cloneable|Class|CharSequence|Comparable|String|Object"
  816. );
  817. var keywordMapper = this.createKeywordMapper({
  818. "variable.language": "this",
  819. "keyword": keywords,
  820. "constant.language": buildinConstants,
  821. "support.function": langClasses
  822. }, "identifier");
  823. this.$rules = {
  824. "start" : [
  825. {
  826. token : "comment",
  827. regex : "\\/\\/.*$"
  828. },
  829. DocCommentHighlightRules.getStartRule("doc-start"),
  830. {
  831. token : "comment", // multi line comment
  832. regex : "\\/\\*",
  833. next : "comment"
  834. }, {
  835. token : "string", // single line
  836. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  837. }, {
  838. token : "string", // single line
  839. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  840. }, {
  841. token : "constant.numeric", // hex
  842. regex : "0[xX][0-9a-fA-F]+\\b"
  843. }, {
  844. token : "constant.numeric", // float
  845. regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  846. }, {
  847. token : "constant.language.boolean",
  848. regex : "(?:true|false)\\b"
  849. }, {
  850. token : keywordMapper,
  851. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  852. }, {
  853. token : "keyword.operator",
  854. regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
  855. }, {
  856. token : "lparen",
  857. regex : "[[({]"
  858. }, {
  859. token : "rparen",
  860. regex : "[\\])}]"
  861. }, {
  862. token : "text",
  863. regex : "\\s+"
  864. }
  865. ],
  866. "comment" : [
  867. {
  868. token : "comment", // closing comment
  869. regex : ".*?\\*\\/",
  870. next : "start"
  871. }, {
  872. token : "comment", // comment spanning whole line
  873. regex : ".+"
  874. }
  875. ]
  876. };
  877. this.embedRules(DocCommentHighlightRules, "doc-",
  878. [ DocCommentHighlightRules.getEndRule("start") ]);
  879. };
  880. oop.inherits(JavaHighlightRules, TextHighlightRules);
  881. exports.JavaHighlightRules = JavaHighlightRules;
  882. });
  883. ace.define("ace/mode/jsp_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/html_highlight_rules","ace/mode/java_highlight_rules"], function(require, exports, module) {
  884. "use strict";
  885. var oop = require("../lib/oop");
  886. var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
  887. var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules;
  888. var JspHighlightRules = function() {
  889. HtmlHighlightRules.call(this);
  890. var builtinVariables = 'request|response|out|session|' +
  891. 'application|config|pageContext|page|Exception';
  892. var keywords = 'page|include|taglib';
  893. var startRules = [
  894. {
  895. token : "comment",
  896. regex : "<%--",
  897. push : "jsp-dcomment"
  898. }, {
  899. token : "meta.tag", // jsp open tag
  900. regex : "<%@?|<%=?|<jsp:[^>]+>",
  901. push : "jsp-start"
  902. }
  903. ];
  904. var endRules = [
  905. {
  906. token : "meta.tag", // jsp close tag
  907. regex : "%>|<\\/jsp:[^>]+>",
  908. next : "pop"
  909. }, {
  910. token: "variable.language",
  911. regex : builtinVariables
  912. }, {
  913. token: "keyword",
  914. regex : keywords
  915. }
  916. ];
  917. for (var key in this.$rules)
  918. this.$rules[key].unshift.apply(this.$rules[key], startRules);
  919. this.embedRules(JavaHighlightRules, "jsp-", endRules, ["start"]);
  920. this.addRules({
  921. "jsp-dcomment" : [{
  922. token : "comment",
  923. regex : ".*?--%>",
  924. next : "pop"
  925. }]
  926. });
  927. this.normalizeRules();
  928. };
  929. oop.inherits(JspHighlightRules, HtmlHighlightRules);
  930. exports.JspHighlightRules = JspHighlightRules;
  931. });
  932. ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
  933. "use strict";
  934. var Range = require("../range").Range;
  935. var MatchingBraceOutdent = function() {};
  936. (function() {
  937. this.checkOutdent = function(line, input) {
  938. if (! /^\s+$/.test(line))
  939. return false;
  940. return /^\s*\}/.test(input);
  941. };
  942. this.autoOutdent = function(doc, row) {
  943. var line = doc.getLine(row);
  944. var match = line.match(/^(\s*\})/);
  945. if (!match) return 0;
  946. var column = match[1].length;
  947. var openBracePos = doc.findMatchingBracket({row: row, column: column});
  948. if (!openBracePos || openBracePos.row == row) return 0;
  949. var indent = this.$getIndent(doc.getLine(openBracePos.row));
  950. doc.replace(new Range(row, 0, row, column-1), indent);
  951. };
  952. this.$getIndent = function(line) {
  953. return line.match(/^\s*/)[0];
  954. };
  955. }).call(MatchingBraceOutdent.prototype);
  956. exports.MatchingBraceOutdent = MatchingBraceOutdent;
  957. });
  958. ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
  959. "use strict";
  960. var oop = require("../../lib/oop");
  961. var Behaviour = require("../behaviour").Behaviour;
  962. var TokenIterator = require("../../token_iterator").TokenIterator;
  963. var lang = require("../../lib/lang");
  964. var SAFE_INSERT_IN_TOKENS =
  965. ["text", "paren.rparen", "punctuation.operator"];
  966. var SAFE_INSERT_BEFORE_TOKENS =
  967. ["text", "paren.rparen", "punctuation.operator", "comment"];
  968. var context;
  969. var contextCache = {};
  970. var initContext = function(editor) {
  971. var id = -1;
  972. if (editor.multiSelect) {
  973. id = editor.selection.index;
  974. if (contextCache.rangeCount != editor.multiSelect.rangeCount)
  975. contextCache = {rangeCount: editor.multiSelect.rangeCount};
  976. }
  977. if (contextCache[id])
  978. return context = contextCache[id];
  979. context = contextCache[id] = {
  980. autoInsertedBrackets: 0,
  981. autoInsertedRow: -1,
  982. autoInsertedLineEnd: "",
  983. maybeInsertedBrackets: 0,
  984. maybeInsertedRow: -1,
  985. maybeInsertedLineStart: "",
  986. maybeInsertedLineEnd: ""
  987. };
  988. };
  989. var CstyleBehaviour = function() {
  990. this.add("braces", "insertion", function(state, action, editor, session, text) {
  991. var cursor = editor.getCursorPosition();
  992. var line = session.doc.getLine(cursor.row);
  993. if (text == '{') {
  994. initContext(editor);
  995. var selection = editor.getSelectionRange();
  996. var selected = session.doc.getTextRange(selection);
  997. if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
  998. return {
  999. text: '{' + selected + '}',
  1000. selection: false
  1001. };
  1002. } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
  1003. if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
  1004. CstyleBehaviour.recordAutoInsert(editor, session, "}");
  1005. return {
  1006. text: '{}',
  1007. selection: [1, 1]
  1008. };
  1009. } else {
  1010. CstyleBehaviour.recordMaybeInsert(editor, session, "{");
  1011. return {
  1012. text: '{',
  1013. selection: [1, 1]
  1014. };
  1015. }
  1016. }
  1017. } else if (text == '}') {
  1018. initContext(editor);
  1019. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1020. if (rightChar == '}') {
  1021. var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
  1022. if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
  1023. CstyleBehaviour.popAutoInsertedClosing();
  1024. return {
  1025. text: '',
  1026. selection: [1, 1]
  1027. };
  1028. }
  1029. }
  1030. } else if (text == "\n" || text == "\r\n") {
  1031. initContext(editor);
  1032. var closing = "";
  1033. if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
  1034. closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
  1035. CstyleBehaviour.clearMaybeInsertedClosing();
  1036. }
  1037. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1038. if (rightChar === '}') {
  1039. var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
  1040. if (!openBracePos)
  1041. return null;
  1042. var next_indent = this.$getIndent(session.getLine(openBracePos.row));
  1043. } else if (closing) {
  1044. var next_indent = this.$getIndent(line);
  1045. } else {
  1046. CstyleBehaviour.clearMaybeInsertedClosing();
  1047. return;
  1048. }
  1049. var indent = next_indent + session.getTabString();
  1050. return {
  1051. text: '\n' + indent + '\n' + next_indent + closing,
  1052. selection: [1, indent.length, 1, indent.length]
  1053. };
  1054. } else {
  1055. CstyleBehaviour.clearMaybeInsertedClosing();
  1056. }
  1057. });
  1058. this.add("braces", "deletion", function(state, action, editor, session, range) {
  1059. var selected = session.doc.getTextRange(range);
  1060. if (!range.isMultiLine() && selected == '{') {
  1061. initContext(editor);
  1062. var line = session.doc.getLine(range.start.row);
  1063. var rightChar = line.substring(range.end.column, range.end.column + 1);
  1064. if (rightChar == '}') {
  1065. range.end.column++;
  1066. return range;
  1067. } else {
  1068. context.maybeInsertedBrackets--;
  1069. }
  1070. }
  1071. });
  1072. this.add("parens", "insertion", function(state, action, editor, session, text) {
  1073. if (text == '(') {
  1074. initContext(editor);
  1075. var selection = editor.getSelectionRange();
  1076. var selected = session.doc.getTextRange(selection);
  1077. if (selected !== "" && editor.getWrapBehavioursEnabled()) {
  1078. return {
  1079. text: '(' + selected + ')',
  1080. selection: false
  1081. };
  1082. } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
  1083. CstyleBehaviour.recordAutoInsert(editor, session, ")");
  1084. return {
  1085. text: '()',
  1086. selection: [1, 1]
  1087. };
  1088. }
  1089. } else if (text == ')') {
  1090. initContext(editor);
  1091. var cursor = editor.getCursorPosition();
  1092. var line = session.doc.getLine(cursor.row);
  1093. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1094. if (rightChar == ')') {
  1095. var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
  1096. if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
  1097. CstyleBehaviour.popAutoInsertedClosing();
  1098. return {
  1099. text: '',
  1100. selection: [1, 1]
  1101. };
  1102. }
  1103. }
  1104. }
  1105. });
  1106. this.add("parens", "deletion", function(state, action, editor, session, range) {
  1107. var selected = session.doc.getTextRange(range);
  1108. if (!range.isMultiLine() && selected == '(') {
  1109. initContext(editor);
  1110. var line = session.doc.getLine(range.start.row);
  1111. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1112. if (rightChar == ')') {
  1113. range.end.column++;
  1114. return range;
  1115. }
  1116. }
  1117. });
  1118. this.add("brackets", "insertion", function(state, action, editor, session, text) {
  1119. if (text == '[') {
  1120. initContext(editor);
  1121. var selection = editor.getSelectionRange();
  1122. var selected = session.doc.getTextRange(selection);
  1123. if (selected !== "" && editor.getWrapBehavioursEnabled()) {
  1124. return {
  1125. text: '[' + selected + ']',
  1126. selection: false
  1127. };
  1128. } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
  1129. CstyleBehaviour.recordAutoInsert(editor, session, "]");
  1130. return {
  1131. text: '[]',
  1132. selection: [1, 1]
  1133. };
  1134. }
  1135. } else if (text == ']') {
  1136. initContext(editor);
  1137. var cursor = editor.getCursorPosition();
  1138. var line = session.doc.getLine(cursor.row);
  1139. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1140. if (rightChar == ']') {
  1141. var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
  1142. if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
  1143. CstyleBehaviour.popAutoInsertedClosing();
  1144. return {
  1145. text: '',
  1146. selection: [1, 1]
  1147. };
  1148. }
  1149. }
  1150. }
  1151. });
  1152. this.add("brackets", "deletion", function(state, action, editor, session, range) {
  1153. var selected = session.doc.getTextRange(range);
  1154. if (!range.isMultiLine() && selected == '[') {
  1155. initContext(editor);
  1156. var line = session.doc.getLine(range.start.row);
  1157. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1158. if (rightChar == ']') {
  1159. range.end.column++;
  1160. return range;
  1161. }
  1162. }
  1163. });
  1164. this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
  1165. if (text == '"' || text == "'") {
  1166. initContext(editor);
  1167. var quote = text;
  1168. var selection = editor.getSelectionRange();
  1169. var selected = session.doc.getTextRange(selection);
  1170. if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
  1171. return {
  1172. text: quote + selected + quote,
  1173. selection: false
  1174. };
  1175. } else {
  1176. var cursor = editor.getCursorPosition();
  1177. var line = session.doc.getLine(cursor.row);
  1178. var leftChar = line.substring(cursor.column-1, cursor.column);
  1179. var rightChar = line.substring(cursor.column, cursor.column + 1);
  1180. var token = session.getTokenAt(cursor.row, cursor.column);
  1181. var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
  1182. if (leftChar == "\\" && token && /escape/.test(token.type))
  1183. return null;
  1184. var stringBefore = token && /string/.test(token.type);
  1185. var stringAfter = !rightToken || /string/.test(rightToken.type);
  1186. var pair;
  1187. if (rightChar == quote) {
  1188. pair = stringBefore !== stringAfter;
  1189. } else {
  1190. if (stringBefore && !stringAfter)
  1191. return null; // wrap string with different quote
  1192. if (stringBefore && stringAfter)
  1193. return null; // do not pair quotes inside strings
  1194. var wordRe = session.$mode.tokenRe;
  1195. wordRe.lastIndex = 0;
  1196. var isWordBefore = wordRe.test(leftChar);
  1197. wordRe.lastIndex = 0;
  1198. var isWordAfter = wordRe.test(leftChar);
  1199. if (isWordBefore || isWordAfter)
  1200. return null; // before or after alphanumeric
  1201. if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
  1202. return null; // there is rightChar and it isn't closing
  1203. pair = true;
  1204. }
  1205. return {
  1206. text: pair ? quote + quote : "",
  1207. selection: [1,1]
  1208. };
  1209. }
  1210. }
  1211. });
  1212. this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
  1213. var selected = session.doc.getTextRange(range);
  1214. if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
  1215. initContext(editor);
  1216. var line = session.doc.getLine(range.start.row);
  1217. var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
  1218. if (rightChar == selected) {
  1219. range.end.column++;
  1220. return range;
  1221. }
  1222. }
  1223. });
  1224. };
  1225. CstyleBehaviour.isSaneInsertion = function(editor, session) {
  1226. var cursor = editor.getCursorPosition();
  1227. var iterator = new TokenIterator(session, cursor.row, cursor.column);
  1228. if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
  1229. var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
  1230. if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
  1231. return false;
  1232. }
  1233. iterator.stepForward();
  1234. return iterator.getCurrentTokenRow() !== cursor.row ||
  1235. this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
  1236. };
  1237. CstyleBehaviour.$matchTokenType = function(token, types) {
  1238. return types.indexOf(token.type || token) > -1;
  1239. };
  1240. CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
  1241. var cursor = editor.getCursorPosition();
  1242. var line = session.doc.getLine(cursor.row);
  1243. if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
  1244. context.autoInsertedBrackets = 0;
  1245. context.autoInsertedRow = cursor.row;
  1246. context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
  1247. context.autoInsertedBrackets++;
  1248. };
  1249. CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
  1250. var cursor = editor.getCursorPosition();
  1251. var line = session.doc.getLine(cursor.row);
  1252. if (!this.isMaybeInsertedClosing(cursor, line))
  1253. context.maybeInsertedBrackets = 0;
  1254. context.maybeInsertedRow = cursor.row;
  1255. context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
  1256. context.maybeInsertedLineEnd = line.substr(cursor.column);
  1257. context.maybeInsertedBrackets++;
  1258. };
  1259. CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
  1260. return context.autoInsertedBrackets > 0 &&
  1261. cursor.row === context.autoInsertedRow &&
  1262. bracket === context.autoInsertedLineEnd[0] &&
  1263. line.substr(cursor.column) === context.autoInsertedLineEnd;
  1264. };
  1265. CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
  1266. return context.maybeInsertedBrackets > 0 &&
  1267. cursor.row === context.maybeInsertedRow &&
  1268. line.substr(cursor.column) === context.maybeInsertedLineEnd &&
  1269. line.substr(0, cursor.column) == context.maybeInsertedLineStart;
  1270. };
  1271. CstyleBehaviour.popAutoInsertedClosing = function() {
  1272. context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
  1273. context.autoInsertedBrackets--;
  1274. };
  1275. CstyleBehaviour.clearMaybeInsertedClosing = function() {
  1276. if (context) {
  1277. context.maybeInsertedBrackets = 0;
  1278. context.maybeInsertedRow = -1;
  1279. }
  1280. };
  1281. oop.inherits(CstyleBehaviour, Behaviour);
  1282. exports.CstyleBehaviour = CstyleBehaviour;
  1283. });
  1284. ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
  1285. "use strict";
  1286. var oop = require("../../lib/oop");
  1287. var Range = require("../../range").Range;
  1288. var BaseFoldMode = require("./fold_mode").FoldMode;
  1289. var FoldMode = exports.FoldMode = function(commentRegex) {
  1290. if (commentRegex) {
  1291. this.foldingStartMarker = new RegExp(
  1292. this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
  1293. );
  1294. this.foldingStopMarker = new RegExp(
  1295. this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
  1296. );
  1297. }
  1298. };
  1299. oop.inherits(FoldMode, BaseFoldMode);
  1300. (function() {
  1301. this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
  1302. this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
  1303. this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
  1304. this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
  1305. this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
  1306. this._getFoldWidgetBase = this.getFoldWidget;
  1307. this.getFoldWidget = function(session, foldStyle, row) {
  1308. var line = session.getLine(row);
  1309. if (this.singleLineBlockCommentRe.test(line)) {
  1310. if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
  1311. return "";
  1312. }
  1313. var fw = this._getFoldWidgetBase(session, foldStyle, row);
  1314. if (!fw && this.startRegionRe.test(line))
  1315. return "start"; // lineCommentRegionStart
  1316. return fw;
  1317. };
  1318. this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
  1319. var line = session.getLine(row);
  1320. if (this.startRegionRe.test(line))
  1321. return this.getCommentRegionBlock(session, line, row);
  1322. var match = line.match(this.foldingStartMarker);
  1323. if (match) {
  1324. var i = match.index;
  1325. if (match[1])
  1326. return this.openingBracketBlock(session, match[1], row, i);
  1327. var range = session.getCommentFoldRange(row, i + match[0].length, 1);
  1328. if (range && !range.isMultiLine()) {
  1329. if (forceMultiline) {
  1330. range = this.getSectionRange(session, row);
  1331. } else if (foldStyle != "all")
  1332. range = null;
  1333. }
  1334. return range;
  1335. }
  1336. if (foldStyle === "markbegin")
  1337. return;
  1338. var match = line.match(this.foldingStopMarker);
  1339. if (match) {
  1340. var i = match.index + match[0].length;
  1341. if (match[1])
  1342. return this.closingBracketBlock(session, match[1], row, i);
  1343. return session.getCommentFoldRange(row, i, -1);
  1344. }
  1345. };
  1346. this.getSectionRange = function(session, row) {
  1347. var line = session.getLine(row);
  1348. var startIndent = line.search(/\S/);
  1349. var startRow = row;
  1350. var startColumn = line.length;
  1351. row = row + 1;
  1352. var endRow = row;
  1353. var maxRow = session.getLength();
  1354. while (++row < maxRow) {
  1355. line = session.getLine(row);
  1356. var indent = line.search(/\S/);
  1357. if (indent === -1)
  1358. continue;
  1359. if (startIndent > indent)
  1360. break;
  1361. var subRange = this.getFoldWidgetRange(session, "all", row);
  1362. if (subRange) {
  1363. if (subRange.start.row <= startRow) {
  1364. break;
  1365. } else if (subRange.isMultiLine()) {
  1366. row = subRange.end.row;
  1367. } else if (startIndent == indent) {
  1368. break;
  1369. }
  1370. }
  1371. endRow = row;
  1372. }
  1373. return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
  1374. };
  1375. this.getCommentRegionBlock = function(session, line, row) {
  1376. var startColumn = line.search(/\s*$/);
  1377. var maxRow = session.getLength();
  1378. var startRow = row;
  1379. var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
  1380. var depth = 1;
  1381. while (++row < maxRow) {
  1382. line = session.getLine(row);
  1383. var m = re.exec(line);
  1384. if (!m) continue;
  1385. if (m[1]) depth--;
  1386. else depth++;
  1387. if (!depth) break;
  1388. }
  1389. var endRow = row;
  1390. if (endRow > startRow) {
  1391. return new Range(startRow, startColumn, endRow, line.length);
  1392. }
  1393. };
  1394. }).call(FoldMode.prototype);
  1395. });
  1396. ace.define("ace/mode/jsp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/jsp_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
  1397. "use strict";
  1398. var oop = require("../lib/oop");
  1399. var TextMode = require("./text").Mode;
  1400. var JspHighlightRules = require("./jsp_highlight_rules").JspHighlightRules;
  1401. var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
  1402. var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
  1403. var CStyleFoldMode = require("./folding/cstyle").FoldMode;
  1404. var Mode = function() {
  1405. this.HighlightRules = JspHighlightRules;
  1406. this.$outdent = new MatchingBraceOutdent();
  1407. this.$behaviour = new CstyleBehaviour();
  1408. this.foldingRules = new CStyleFoldMode();
  1409. };
  1410. oop.inherits(Mode, TextMode);
  1411. (function() {
  1412. this.$id = "ace/mode/jsp";
  1413. }).call(Mode.prototype);
  1414. exports.Mode = Mode;
  1415. });