mode-sass.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. define("ace/mode/css_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(ace_require, exports, module) {
  2. "use strict";
  3. var oop = ace_require("../lib/oop");
  4. var lang = ace_require("../lib/lang");
  5. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  6. var supportType = exports.supportType = "align-content|align-items|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|border|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|bottom|box-shadow|box-sizing|caption-side|clear|clip|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|cursor|direction|display|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|font|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|hanging-punctuation|height|justify-content|left|letter-spacing|line-height|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|max-height|max-width|max-zoom|min-height|min-width|min-zoom|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|order|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page-break-after|page-break-before|page-break-inside|perspective|perspective-origin|position|quotes|resize|right|tab-size|table-layout|text-align|text-align-last|text-decoration|text-decoration-color|text-decoration-line|text-decoration-style|text-indent|text-justify|text-overflow|text-shadow|text-transform|top|transform|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|user-zoom|vertical-align|visibility|white-space|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|zoom";
  9. var supportConstantColor = exports.supportConstantColor = "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen";
  10. var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|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. include : ["strings", "url", "comments"]
  25. }, {
  26. token: "paren.lparen",
  27. regex: "\\{",
  28. next: "ruleset"
  29. }, {
  30. token: "paren.rparen",
  31. regex: "\\}"
  32. }, {
  33. token: "string",
  34. regex: "@(?!viewport)",
  35. next: "media"
  36. }, {
  37. token: "keyword",
  38. regex: "#[a-z0-9-_]+"
  39. }, {
  40. token: "keyword",
  41. regex: "%"
  42. }, {
  43. token: "variable",
  44. regex: "\\.[a-z0-9-_]+"
  45. }, {
  46. token: "string",
  47. regex: ":[a-z0-9-_]+"
  48. }, {
  49. token : "constant.numeric",
  50. regex : numRe
  51. }, {
  52. token: "constant",
  53. regex: "[a-z0-9-_]+"
  54. }, {
  55. caseInsensitive: true
  56. }],
  57. "media": [{
  58. include : ["strings", "url", "comments"]
  59. }, {
  60. token: "paren.lparen",
  61. regex: "\\{",
  62. next: "start"
  63. }, {
  64. token: "paren.rparen",
  65. regex: "\\}",
  66. next: "start"
  67. }, {
  68. token: "string",
  69. regex: ";",
  70. next: "start"
  71. }, {
  72. token: "keyword",
  73. regex: "(?:media|supports|document|charset|import|namespace|media|supports|document"
  74. + "|page|font|keyframes|viewport|counter-style|font-feature-values"
  75. + "|swash|ornaments|annotation|stylistic|styleset|character-variant)"
  76. }],
  77. "comments" : [{
  78. token: "comment", // multi line comment
  79. regex: "\\/\\*",
  80. push: [{
  81. token : "comment",
  82. regex : "\\*\\/",
  83. next : "pop"
  84. }, {
  85. defaultToken : "comment"
  86. }]
  87. }],
  88. "ruleset" : [{
  89. regex : "-(webkit|ms|moz|o)-",
  90. token : "text"
  91. }, {
  92. token : "punctuation.operator",
  93. regex : "[:;]"
  94. }, {
  95. token : "paren.rparen",
  96. regex : "\\}",
  97. next : "start"
  98. }, {
  99. include : ["strings", "url", "comments"]
  100. }, {
  101. token : ["constant.numeric", "keyword"],
  102. regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)"
  103. }, {
  104. token : "constant.numeric",
  105. regex : numRe
  106. }, {
  107. token : "constant.numeric", // hex6 color
  108. regex : "#[a-f0-9]{6}"
  109. }, {
  110. token : "constant.numeric", // hex3 color
  111. regex : "#[a-f0-9]{3}"
  112. }, {
  113. token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
  114. regex : pseudoElements
  115. }, {
  116. token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
  117. regex : pseudoClasses
  118. }, {
  119. include: "url"
  120. }, {
  121. token : keywordMapper,
  122. regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
  123. }, {
  124. caseInsensitive: true
  125. }],
  126. url: [{
  127. token : "support.function",
  128. regex : "(?:url(:?-prefix)?|domain|regexp)\\(",
  129. push: [{
  130. token : "support.function",
  131. regex : "\\)",
  132. next : "pop"
  133. }, {
  134. defaultToken: "string"
  135. }]
  136. }],
  137. strings: [{
  138. token : "string.start",
  139. regex : "'",
  140. push : [{
  141. token : "string.end",
  142. regex : "'|$",
  143. next: "pop"
  144. }, {
  145. include : "escapes"
  146. }, {
  147. token : "constant.language.escape",
  148. regex : /\\$/,
  149. consumeLineEnd: true
  150. }, {
  151. defaultToken: "string"
  152. }]
  153. }, {
  154. token : "string.start",
  155. regex : '"',
  156. push : [{
  157. token : "string.end",
  158. regex : '"|$',
  159. next: "pop"
  160. }, {
  161. include : "escapes"
  162. }, {
  163. token : "constant.language.escape",
  164. regex : /\\$/,
  165. consumeLineEnd: true
  166. }, {
  167. defaultToken: "string"
  168. }]
  169. }],
  170. escapes: [{
  171. token : "constant.language.escape",
  172. regex : /\\([a-fA-F\d]{1,6}|[^a-fA-F\d])/
  173. }]
  174. };
  175. this.normalizeRules();
  176. };
  177. oop.inherits(CssHighlightRules, TextHighlightRules);
  178. exports.CssHighlightRules = CssHighlightRules;
  179. });
  180. define("ace/mode/scss_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/css_highlight_rules"], function(ace_require, exports, module) {
  181. "use strict";
  182. var oop = ace_require("../lib/oop");
  183. var lang = ace_require("../lib/lang");
  184. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  185. var CssHighlightRules = ace_require("./css_highlight_rules");
  186. var ScssHighlightRules = function() {
  187. var properties = lang.arrayToMap(CssHighlightRules.supportType.split("|"));
  188. var functions = lang.arrayToMap(
  189. ("hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|" +
  190. "alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|" +
  191. "floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|" +
  192. "nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|" +
  193. "scale_color|transparentize|type_of|unit|unitless|unquote").split("|")
  194. );
  195. var constants = lang.arrayToMap(CssHighlightRules.supportConstant.split("|"));
  196. var colors = lang.arrayToMap(CssHighlightRules.supportConstantColor.split("|"));
  197. var keywords = lang.arrayToMap(
  198. ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare").split("|")
  199. );
  200. var tags = lang.arrayToMap(
  201. ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
  202. "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
  203. "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
  204. "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
  205. "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
  206. "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
  207. "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
  208. "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
  209. "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
  210. );
  211. var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
  212. this.$rules = {
  213. "start" : [
  214. {
  215. token : "comment",
  216. regex : "\\/\\/.*$"
  217. },
  218. {
  219. token : "comment", // multi line comment
  220. regex : "\\/\\*",
  221. next : "comment"
  222. }, {
  223. token : "string", // single line
  224. regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
  225. }, {
  226. token : "string", // multi line string start
  227. regex : '["].*\\\\$',
  228. next : "qqstring"
  229. }, {
  230. token : "string", // single line
  231. regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
  232. }, {
  233. token : "string", // multi line string start
  234. regex : "['].*\\\\$",
  235. next : "qstring"
  236. }, {
  237. token : "constant.numeric",
  238. regex : numRe + "(?:ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vmax|vmin|vm|vw|%)"
  239. }, {
  240. token : "constant.numeric", // hex6 color
  241. regex : "#[a-f0-9]{6}"
  242. }, {
  243. token : "constant.numeric", // hex3 color
  244. regex : "#[a-f0-9]{3}"
  245. }, {
  246. token : "constant.numeric",
  247. regex : numRe
  248. }, {
  249. token : ["support.function", "string", "support.function"],
  250. regex : "(url\\()(.*)(\\))"
  251. }, {
  252. token : function(value) {
  253. if (properties.hasOwnProperty(value.toLowerCase()))
  254. return "support.type";
  255. if (keywords.hasOwnProperty(value))
  256. return "keyword";
  257. else if (constants.hasOwnProperty(value))
  258. return "constant.language";
  259. else if (functions.hasOwnProperty(value))
  260. return "support.function";
  261. else if (colors.hasOwnProperty(value.toLowerCase()))
  262. return "support.constant.color";
  263. else if (tags.hasOwnProperty(value.toLowerCase()))
  264. return "variable.language";
  265. else
  266. return "text";
  267. },
  268. regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
  269. }, {
  270. token : "variable",
  271. regex : "[a-z_\\-$][a-z0-9_\\-$]*\\b"
  272. }, {
  273. token: "variable.language",
  274. regex: "#[a-z0-9-_]+"
  275. }, {
  276. token: "variable.language",
  277. regex: "\\.[a-z0-9-_]+"
  278. }, {
  279. token: "variable.language",
  280. regex: ":[a-z0-9-_]+"
  281. }, {
  282. token: "constant",
  283. regex: "[a-z0-9-_]+"
  284. }, {
  285. token : "keyword.operator",
  286. regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
  287. }, {
  288. token : "paren.lparen",
  289. regex : "[[({]"
  290. }, {
  291. token : "paren.rparen",
  292. regex : "[\\])}]"
  293. }, {
  294. token : "text",
  295. regex : "\\s+"
  296. }, {
  297. caseInsensitive: true
  298. }
  299. ],
  300. "comment" : [
  301. {
  302. token : "comment", // closing comment
  303. regex : "\\*\\/",
  304. next : "start"
  305. }, {
  306. defaultToken : "comment"
  307. }
  308. ],
  309. "qqstring" : [
  310. {
  311. token : "string",
  312. regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
  313. next : "start"
  314. }, {
  315. token : "string",
  316. regex : '.+'
  317. }
  318. ],
  319. "qstring" : [
  320. {
  321. token : "string",
  322. regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
  323. next : "start"
  324. }, {
  325. token : "string",
  326. regex : '.+'
  327. }
  328. ]
  329. };
  330. };
  331. oop.inherits(ScssHighlightRules, TextHighlightRules);
  332. exports.ScssHighlightRules = ScssHighlightRules;
  333. });
  334. define("ace/mode/sass_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/scss_highlight_rules"], function(ace_require, exports, module) {
  335. "use strict";
  336. var oop = ace_require("../lib/oop");
  337. var lang = ace_require("../lib/lang");
  338. var ScssHighlightRules = ace_require("./scss_highlight_rules").ScssHighlightRules;
  339. var SassHighlightRules = function() {
  340. ScssHighlightRules.call(this);
  341. var start = this.$rules.start;
  342. if (start[1].token == "comment") {
  343. start.splice(1, 1, {
  344. onMatch: function(value, currentState, stack) {
  345. stack.unshift(this.next, -1, value.length - 2, currentState);
  346. return "comment";
  347. },
  348. regex: /^\s*\/\*/,
  349. next: "comment"
  350. }, {
  351. token: "error.invalid",
  352. regex: "/\\*|[{;}]"
  353. }, {
  354. token: "support.type",
  355. regex: /^\s*:[\w\-]+\s/
  356. });
  357. this.$rules.comment = [
  358. {regex: /^\s*/, onMatch: function(value, currentState, stack) {
  359. if (stack[1] === -1)
  360. stack[1] = Math.max(stack[2], value.length - 1);
  361. if (value.length <= stack[1]) {stack.shift();stack.shift();stack.shift();
  362. this.next = stack.shift();
  363. return "text";
  364. } else {
  365. this.next = "";
  366. return "comment";
  367. }
  368. }, next: "start"},
  369. {defaultToken: "comment"}
  370. ];
  371. }
  372. };
  373. oop.inherits(SassHighlightRules, ScssHighlightRules);
  374. exports.SassHighlightRules = SassHighlightRules;
  375. });
  376. define("ace/mode/folding/coffee",["ace_require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(ace_require, exports, module) {
  377. "use strict";
  378. var oop = ace_require("../../lib/oop");
  379. var BaseFoldMode = ace_require("./fold_mode").FoldMode;
  380. var Range = ace_require("../../range").Range;
  381. var FoldMode = exports.FoldMode = function() {};
  382. oop.inherits(FoldMode, BaseFoldMode);
  383. (function() {
  384. this.getFoldWidgetRange = function(session, foldStyle, row) {
  385. var range = this.indentationBlock(session, row);
  386. if (range)
  387. return range;
  388. var re = /\S/;
  389. var line = session.getLine(row);
  390. var startLevel = line.search(re);
  391. if (startLevel == -1 || line[startLevel] != "#")
  392. return;
  393. var startColumn = line.length;
  394. var maxRow = session.getLength();
  395. var startRow = row;
  396. var endRow = row;
  397. while (++row < maxRow) {
  398. line = session.getLine(row);
  399. var level = line.search(re);
  400. if (level == -1)
  401. continue;
  402. if (line[level] != "#")
  403. break;
  404. endRow = row;
  405. }
  406. if (endRow > startRow) {
  407. var endColumn = session.getLine(endRow).length;
  408. return new Range(startRow, startColumn, endRow, endColumn);
  409. }
  410. };
  411. this.getFoldWidget = function(session, foldStyle, row) {
  412. var line = session.getLine(row);
  413. var indent = line.search(/\S/);
  414. var next = session.getLine(row + 1);
  415. var prev = session.getLine(row - 1);
  416. var prevIndent = prev.search(/\S/);
  417. var nextIndent = next.search(/\S/);
  418. if (indent == -1) {
  419. session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
  420. return "";
  421. }
  422. if (prevIndent == -1) {
  423. if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
  424. session.foldWidgets[row - 1] = "";
  425. session.foldWidgets[row + 1] = "";
  426. return "start";
  427. }
  428. } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
  429. if (session.getLine(row - 2).search(/\S/) == -1) {
  430. session.foldWidgets[row - 1] = "start";
  431. session.foldWidgets[row + 1] = "";
  432. return "";
  433. }
  434. }
  435. if (prevIndent!= -1 && prevIndent < indent)
  436. session.foldWidgets[row - 1] = "start";
  437. else
  438. session.foldWidgets[row - 1] = "";
  439. if (indent < nextIndent)
  440. return "start";
  441. else
  442. return "";
  443. };
  444. }).call(FoldMode.prototype);
  445. });
  446. define("ace/mode/sass",["ace_require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sass_highlight_rules","ace/mode/folding/coffee"], function(ace_require, exports, module) {
  447. "use strict";
  448. var oop = ace_require("../lib/oop");
  449. var TextMode = ace_require("./text").Mode;
  450. var SassHighlightRules = ace_require("./sass_highlight_rules").SassHighlightRules;
  451. var FoldMode = ace_require("./folding/coffee").FoldMode;
  452. var Mode = function() {
  453. this.HighlightRules = SassHighlightRules;
  454. this.foldingRules = new FoldMode();
  455. this.$behaviour = this.$defaultBehaviour;
  456. };
  457. oop.inherits(Mode, TextMode);
  458. (function() {
  459. this.lineCommentStart = "//";
  460. this.$id = "ace/mode/sass";
  461. }).call(Mode.prototype);
  462. exports.Mode = Mode;
  463. }); (function() {
  464. window.ace_require(["ace/mode/sass"], function(m) {
  465. if (typeof module == "object" && typeof exports == "object" && module) {
  466. module.exports = m;
  467. }
  468. });
  469. })();