corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 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 | |||
4 | var oop = require("../lib/oop"); |
||
5 | var lang = require("../lib/lang"); |
||
6 | var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
||
7 | 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|min-height|min-width|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|vertical-align|visibility|white-space|width|word-break|word-spacing|word-wrap|z-index"; |
||
8 | var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters"; |
||
9 | 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"; |
||
10 | var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow"; |
||
11 | 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"; |
||
12 | |||
13 | var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))"; |
||
14 | var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b"; |
||
15 | 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"; |
||
16 | |||
17 | var CssHighlightRules = function() { |
||
18 | |||
19 | var keywordMapper = this.createKeywordMapper({ |
||
20 | "support.function": supportFunction, |
||
21 | "support.constant": supportConstant, |
||
22 | "support.type": supportType, |
||
23 | "support.constant.color": supportConstantColor, |
||
24 | "support.constant.fonts": supportConstantFonts |
||
25 | }, "text", true); |
||
26 | |||
27 | this.$rules = { |
||
28 | "start" : [{ |
||
29 | token : "comment", // multi line comment |
||
30 | regex : "\\/\\*", |
||
31 | push : "comment" |
||
32 | }, { |
||
33 | token: "paren.lparen", |
||
34 | regex: "\\{", |
||
35 | push: "ruleset" |
||
36 | }, { |
||
37 | token: "string", |
||
38 | regex: "@.*?{", |
||
39 | push: "media" |
||
40 | }, { |
||
41 | token: "keyword", |
||
42 | regex: "#[a-z0-9-_]+" |
||
43 | }, { |
||
44 | token: "variable", |
||
45 | regex: "\\.[a-z0-9-_]+" |
||
46 | }, { |
||
47 | token: "string", |
||
48 | regex: ":[a-z0-9-_]+" |
||
49 | }, { |
||
50 | token: "constant", |
||
51 | regex: "[a-z0-9-_]+" |
||
52 | }, { |
||
53 | caseInsensitive: true |
||
54 | }], |
||
55 | |||
56 | "media" : [{ |
||
57 | token : "comment", // multi line comment |
||
58 | regex : "\\/\\*", |
||
59 | push : "comment" |
||
60 | }, { |
||
61 | token: "paren.lparen", |
||
62 | regex: "\\{", |
||
63 | push: "ruleset" |
||
64 | }, { |
||
65 | token: "string", |
||
66 | regex: "\\}", |
||
67 | next: "pop" |
||
68 | }, { |
||
69 | token: "keyword", |
||
70 | regex: "#[a-z0-9-_]+" |
||
71 | }, { |
||
72 | token: "variable", |
||
73 | regex: "\\.[a-z0-9-_]+" |
||
74 | }, { |
||
75 | token: "string", |
||
76 | regex: ":[a-z0-9-_]+" |
||
77 | }, { |
||
78 | token: "constant", |
||
79 | regex: "[a-z0-9-_]+" |
||
80 | }, { |
||
81 | caseInsensitive: true |
||
82 | }], |
||
83 | |||
84 | "comment" : [{ |
||
85 | token : "comment", |
||
86 | regex : "\\*\\/", |
||
87 | next : "pop" |
||
88 | }, { |
||
89 | defaultToken : "comment" |
||
90 | }], |
||
91 | |||
92 | "ruleset" : [ |
||
93 | { |
||
94 | token : "paren.rparen", |
||
95 | regex : "\\}", |
||
96 | next: "pop" |
||
97 | }, { |
||
98 | token : "comment", // multi line comment |
||
99 | regex : "\\/\\*", |
||
100 | push : "comment" |
||
101 | }, { |
||
102 | token : "string", // single line |
||
103 | regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' |
||
104 | }, { |
||
105 | token : "string", // single line |
||
106 | regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']" |
||
107 | }, { |
||
108 | token : ["constant.numeric", "keyword"], |
||
109 | 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|%)" |
||
110 | }, { |
||
111 | token : "constant.numeric", |
||
112 | regex : numRe |
||
113 | }, { |
||
114 | token : "constant.numeric", // hex6 color |
||
115 | regex : "#[a-f0-9]{6}" |
||
116 | }, { |
||
117 | token : "constant.numeric", // hex3 color |
||
118 | regex : "#[a-f0-9]{3}" |
||
119 | }, { |
||
120 | token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"], |
||
121 | regex : pseudoElements |
||
122 | }, { |
||
123 | token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"], |
||
124 | regex : pseudoClasses |
||
125 | }, { |
||
126 | token : ["support.function", "string", "support.function"], |
||
127 | regex : "(url\\()(.*)(\\))" |
||
128 | }, { |
||
129 | token : keywordMapper, |
||
130 | regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*" |
||
131 | }, { |
||
132 | caseInsensitive: true |
||
133 | }] |
||
134 | }; |
||
135 | |||
136 | this.normalizeRules(); |
||
137 | }; |
||
138 | |||
139 | oop.inherits(CssHighlightRules, TextHighlightRules); |
||
140 | |||
141 | exports.CssHighlightRules = CssHighlightRules; |
||
142 | |||
143 | }); |
||
144 | |||
145 | ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { |
||
146 | "use strict"; |
||
147 | |||
148 | var Range = require("../range").Range; |
||
149 | |||
150 | var MatchingBraceOutdent = function() {}; |
||
151 | |||
152 | (function() { |
||
153 | |||
154 | this.checkOutdent = function(line, input) { |
||
155 | if (! /^\s+$/.test(line)) |
||
156 | return false; |
||
157 | |||
158 | return /^\s*\}/.test(input); |
||
159 | }; |
||
160 | |||
161 | this.autoOutdent = function(doc, row) { |
||
162 | var line = doc.getLine(row); |
||
163 | var match = line.match(/^(\s*\})/); |
||
164 | |||
165 | if (!match) return 0; |
||
166 | |||
167 | var column = match[1].length; |
||
168 | var openBracePos = doc.findMatchingBracket({row: row, column: column}); |
||
169 | |||
170 | if (!openBracePos || openBracePos.row == row) return 0; |
||
171 | |||
172 | var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
||
173 | doc.replace(new Range(row, 0, row, column-1), indent); |
||
174 | }; |
||
175 | |||
176 | this.$getIndent = function(line) { |
||
177 | return line.match(/^\s*/)[0]; |
||
178 | }; |
||
179 | |||
180 | }).call(MatchingBraceOutdent.prototype); |
||
181 | |||
182 | exports.MatchingBraceOutdent = MatchingBraceOutdent; |
||
183 | }); |
||
184 | |||
185 | ace.define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) { |
||
186 | "use strict"; |
||
187 | |||
188 | var propertyMap = { |
||
189 | "background": {"#$0": 1}, |
||
190 | "background-color": {"#$0": 1, "transparent": 1, "fixed": 1}, |
||
191 | "background-image": {"url('/$0')": 1}, |
||
192 | "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1}, |
||
193 | "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2}, |
||
194 | "background-attachment": {"scroll": 1, "fixed": 1}, |
||
195 | "background-size": {"cover": 1, "contain": 1}, |
||
196 | "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1}, |
||
197 | "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1}, |
||
198 | "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1}, |
||
199 | "border-color": {"#$0": 1}, |
||
200 | "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2}, |
||
201 | "border-collapse": {"collapse": 1, "separate": 1}, |
||
202 | "bottom": {"px": 1, "em": 1, "%": 1}, |
||
203 | "clear": {"left": 1, "right": 1, "both": 1, "none": 1}, |
||
204 | "color": {"#$0": 1, "rgb(#$00,0,0)": 1}, |
||
205 | "cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1}, |
||
206 | "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1}, |
||
207 | "empty-cells": {"show": 1, "hide": 1}, |
||
208 | "float": {"left": 1, "right": 1, "none": 1}, |
||
209 | "font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1}, |
||
210 | "font-size": {"px": 1, "em": 1, "%": 1}, |
||
211 | "font-weight": {"bold": 1, "normal": 1}, |
||
212 | "font-style": {"italic": 1, "normal": 1}, |
||
213 | "font-variant": {"normal": 1, "small-caps": 1}, |
||
214 | "height": {"px": 1, "em": 1, "%": 1}, |
||
215 | "left": {"px": 1, "em": 1, "%": 1}, |
||
216 | "letter-spacing": {"normal": 1}, |
||
217 | "line-height": {"normal": 1}, |
||
218 | "list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1}, |
||
219 | "margin": {"px": 1, "em": 1, "%": 1}, |
||
220 | "margin-right": {"px": 1, "em": 1, "%": 1}, |
||
221 | "margin-left": {"px": 1, "em": 1, "%": 1}, |
||
222 | "margin-top": {"px": 1, "em": 1, "%": 1}, |
||
223 | "margin-bottom": {"px": 1, "em": 1, "%": 1}, |
||
224 | "max-height": {"px": 1, "em": 1, "%": 1}, |
||
225 | "max-width": {"px": 1, "em": 1, "%": 1}, |
||
226 | "min-height": {"px": 1, "em": 1, "%": 1}, |
||
227 | "min-width": {"px": 1, "em": 1, "%": 1}, |
||
228 | "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1}, |
||
229 | "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1}, |
||
230 | "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1}, |
||
231 | "padding": {"px": 1, "em": 1, "%": 1}, |
||
232 | "padding-top": {"px": 1, "em": 1, "%": 1}, |
||
233 | "padding-right": {"px": 1, "em": 1, "%": 1}, |
||
234 | "padding-bottom": {"px": 1, "em": 1, "%": 1}, |
||
235 | "padding-left": {"px": 1, "em": 1, "%": 1}, |
||
236 | "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1}, |
||
237 | "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1}, |
||
238 | "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1}, |
||
239 | "right": {"px": 1, "em": 1, "%": 1}, |
||
240 | "table-layout": {"fixed": 1, "auto": 1}, |
||
241 | "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1}, |
||
242 | "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1}, |
||
243 | "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1}, |
||
244 | "top": {"px": 1, "em": 1, "%": 1}, |
||
245 | "vertical-align": {"top": 1, "bottom": 1}, |
||
246 | "visibility": {"hidden": 1, "visible": 1}, |
||
247 | "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1}, |
||
248 | "width": {"px": 1, "em": 1, "%": 1}, |
||
249 | "word-spacing": {"normal": 1}, |
||
250 | "filter": {"alpha(opacity=$0100)": 1}, |
||
251 | |||
252 | "text-shadow": {"$02px 2px 2px #777": 1}, |
||
253 | "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1}, |
||
254 | "-moz-border-radius": 1, |
||
255 | "-moz-border-radius-topright": 1, |
||
256 | "-moz-border-radius-bottomright": 1, |
||
257 | "-moz-border-radius-topleft": 1, |
||
258 | "-moz-border-radius-bottomleft": 1, |
||
259 | "-webkit-border-radius": 1, |
||
260 | "-webkit-border-top-right-radius": 1, |
||
261 | "-webkit-border-top-left-radius": 1, |
||
262 | "-webkit-border-bottom-right-radius": 1, |
||
263 | "-webkit-border-bottom-left-radius": 1, |
||
264 | "-moz-box-shadow": 1, |
||
265 | "-webkit-box-shadow": 1, |
||
266 | "transform": {"rotate($00deg)": 1, "skew($00deg)": 1}, |
||
267 | "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1}, |
||
268 | "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 } |
||
269 | }; |
||
270 | |||
271 | var CssCompletions = function() { |
||
272 | |||
273 | }; |
||
274 | |||
275 | (function() { |
||
276 | |||
277 | this.completionsDefined = false; |
||
278 | |||
279 | this.defineCompletions = function() { |
||
280 | if (document) { |
||
281 | var style = document.createElement('c').style; |
||
282 | |||
283 | for (var i in style) { |
||
284 | if (typeof style[i] !== 'string') |
||
285 | continue; |
||
286 | |||
287 | var name = i.replace(/[A-Z]/g, function(x) { |
||
288 | return '-' + x.toLowerCase(); |
||
289 | }); |
||
290 | |||
291 | if (!propertyMap.hasOwnProperty(name)) |
||
292 | propertyMap[name] = 1; |
||
293 | } |
||
294 | } |
||
295 | |||
296 | this.completionsDefined = true; |
||
297 | } |
||
298 | |||
299 | this.getCompletions = function(state, session, pos, prefix) { |
||
300 | if (!this.completionsDefined) { |
||
301 | this.defineCompletions(); |
||
302 | } |
||
303 | |||
304 | var token = session.getTokenAt(pos.row, pos.column); |
||
305 | |||
306 | if (!token) |
||
307 | return []; |
||
308 | if (state==='ruleset'){ |
||
309 | var line = session.getLine(pos.row).substr(0, pos.column); |
||
310 | if (/:[^;]+$/.test(line)) { |
||
311 | /([\w\-]+):[^:]*$/.test(line); |
||
312 | |||
313 | return this.getPropertyValueCompletions(state, session, pos, prefix); |
||
314 | } else { |
||
315 | return this.getPropertyCompletions(state, session, pos, prefix); |
||
316 | } |
||
317 | } |
||
318 | |||
319 | return []; |
||
320 | }; |
||
321 | |||
322 | this.getPropertyCompletions = function(state, session, pos, prefix) { |
||
323 | var properties = Object.keys(propertyMap); |
||
324 | return properties.map(function(property){ |
||
325 | return { |
||
326 | caption: property, |
||
327 | snippet: property + ': $0', |
||
328 | meta: "property", |
||
329 | score: Number.MAX_VALUE |
||
330 | }; |
||
331 | }); |
||
332 | }; |
||
333 | |||
334 | this.getPropertyValueCompletions = function(state, session, pos, prefix) { |
||
335 | var line = session.getLine(pos.row).substr(0, pos.column); |
||
336 | var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1]; |
||
337 | |||
338 | if (!property) |
||
339 | return []; |
||
340 | var values = []; |
||
341 | if (property in propertyMap && typeof propertyMap[property] === "object") { |
||
342 | values = Object.keys(propertyMap[property]); |
||
343 | } |
||
344 | return values.map(function(value){ |
||
345 | return { |
||
346 | caption: value, |
||
347 | snippet: value, |
||
348 | meta: "property value", |
||
349 | score: Number.MAX_VALUE |
||
350 | }; |
||
351 | }); |
||
352 | }; |
||
353 | |||
354 | }).call(CssCompletions.prototype); |
||
355 | |||
356 | exports.CssCompletions = CssCompletions; |
||
357 | }); |
||
358 | |||
359 | ace.define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"], function(require, exports, module) { |
||
360 | "use strict"; |
||
361 | |||
362 | var oop = require("../../lib/oop"); |
||
363 | var Behaviour = require("../behaviour").Behaviour; |
||
364 | var CstyleBehaviour = require("./cstyle").CstyleBehaviour; |
||
365 | var TokenIterator = require("../../token_iterator").TokenIterator; |
||
366 | |||
367 | var CssBehaviour = function () { |
||
368 | |||
369 | this.inherit(CstyleBehaviour); |
||
370 | |||
371 | this.add("colon", "insertion", function (state, action, editor, session, text) { |
||
372 | if (text === ':') { |
||
373 | var cursor = editor.getCursorPosition(); |
||
374 | var iterator = new TokenIterator(session, cursor.row, cursor.column); |
||
375 | var token = iterator.getCurrentToken(); |
||
376 | if (token && token.value.match(/\s+/)) { |
||
377 | token = iterator.stepBackward(); |
||
378 | } |
||
379 | if (token && token.type === 'support.type') { |
||
380 | var line = session.doc.getLine(cursor.row); |
||
381 | var rightChar = line.substring(cursor.column, cursor.column + 1); |
||
382 | if (rightChar === ':') { |
||
383 | return { |
||
384 | text: '', |
||
385 | selection: [1, 1] |
||
386 | } |
||
387 | } |
||
388 | if (!line.substring(cursor.column).match(/^\s*;/)) { |
||
389 | return { |
||
390 | text: ':;', |
||
391 | selection: [1, 1] |
||
392 | } |
||
393 | } |
||
394 | } |
||
395 | } |
||
396 | }); |
||
397 | |||
398 | this.add("colon", "deletion", function (state, action, editor, session, range) { |
||
399 | var selected = session.doc.getTextRange(range); |
||
400 | if (!range.isMultiLine() && selected === ':') { |
||
401 | var cursor = editor.getCursorPosition(); |
||
402 | var iterator = new TokenIterator(session, cursor.row, cursor.column); |
||
403 | var token = iterator.getCurrentToken(); |
||
404 | if (token && token.value.match(/\s+/)) { |
||
405 | token = iterator.stepBackward(); |
||
406 | } |
||
407 | if (token && token.type === 'support.type') { |
||
408 | var line = session.doc.getLine(range.start.row); |
||
409 | var rightChar = line.substring(range.end.column, range.end.column + 1); |
||
410 | if (rightChar === ';') { |
||
411 | range.end.column ++; |
||
412 | return range; |
||
413 | } |
||
414 | } |
||
415 | } |
||
416 | }); |
||
417 | |||
418 | this.add("semicolon", "insertion", function (state, action, editor, session, text) { |
||
419 | if (text === ';') { |
||
420 | var cursor = editor.getCursorPosition(); |
||
421 | var line = session.doc.getLine(cursor.row); |
||
422 | var rightChar = line.substring(cursor.column, cursor.column + 1); |
||
423 | if (rightChar === ';') { |
||
424 | return { |
||
425 | text: '', |
||
426 | selection: [1, 1] |
||
427 | } |
||
428 | } |
||
429 | } |
||
430 | }); |
||
431 | |||
432 | } |
||
433 | oop.inherits(CssBehaviour, CstyleBehaviour); |
||
434 | |||
435 | exports.CssBehaviour = CssBehaviour; |
||
436 | }); |
||
437 | |||
438 | ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) { |
||
439 | "use strict"; |
||
440 | |||
441 | var oop = require("../../lib/oop"); |
||
442 | var Range = require("../../range").Range; |
||
443 | var BaseFoldMode = require("./fold_mode").FoldMode; |
||
444 | |||
445 | var FoldMode = exports.FoldMode = function(commentRegex) { |
||
446 | if (commentRegex) { |
||
447 | this.foldingStartMarker = new RegExp( |
||
448 | this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start) |
||
449 | ); |
||
450 | this.foldingStopMarker = new RegExp( |
||
451 | this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end) |
||
452 | ); |
||
453 | } |
||
454 | }; |
||
455 | oop.inherits(FoldMode, BaseFoldMode); |
||
456 | |||
457 | (function() { |
||
458 | |||
459 | this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/; |
||
460 | this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/; |
||
461 | this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/; |
||
462 | this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
||
463 | this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
||
464 | this._getFoldWidgetBase = this.getFoldWidget; |
||
465 | this.getFoldWidget = function(session, foldStyle, row) { |
||
466 | var line = session.getLine(row); |
||
467 | |||
468 | if (this.singleLineBlockCommentRe.test(line)) { |
||
469 | if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
||
470 | return ""; |
||
471 | } |
||
472 | |||
473 | var fw = this._getFoldWidgetBase(session, foldStyle, row); |
||
474 | |||
475 | if (!fw && this.startRegionRe.test(line)) |
||
476 | return "start"; // lineCommentRegionStart |
||
477 | |||
478 | return fw; |
||
479 | }; |
||
480 | |||
481 | this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { |
||
482 | var line = session.getLine(row); |
||
483 | |||
484 | if (this.startRegionRe.test(line)) |
||
485 | return this.getCommentRegionBlock(session, line, row); |
||
486 | |||
487 | var match = line.match(this.foldingStartMarker); |
||
488 | if (match) { |
||
489 | var i = match.index; |
||
490 | |||
491 | if (match[1]) |
||
492 | return this.openingBracketBlock(session, match[1], row, i); |
||
493 | |||
494 | var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
||
495 | |||
496 | if (range && !range.isMultiLine()) { |
||
497 | if (forceMultiline) { |
||
498 | range = this.getSectionRange(session, row); |
||
499 | } else if (foldStyle != "all") |
||
500 | range = null; |
||
501 | } |
||
502 | |||
503 | return range; |
||
504 | } |
||
505 | |||
506 | if (foldStyle === "markbegin") |
||
507 | return; |
||
508 | |||
509 | var match = line.match(this.foldingStopMarker); |
||
510 | if (match) { |
||
511 | var i = match.index + match[0].length; |
||
512 | |||
513 | if (match[1]) |
||
514 | return this.closingBracketBlock(session, match[1], row, i); |
||
515 | |||
516 | return session.getCommentFoldRange(row, i, -1); |
||
517 | } |
||
518 | }; |
||
519 | |||
520 | this.getSectionRange = function(session, row) { |
||
521 | var line = session.getLine(row); |
||
522 | var startIndent = line.search(/\S/); |
||
523 | var startRow = row; |
||
524 | var startColumn = line.length; |
||
525 | row = row + 1; |
||
526 | var endRow = row; |
||
527 | var maxRow = session.getLength(); |
||
528 | while (++row < maxRow) { |
||
529 | line = session.getLine(row); |
||
530 | var indent = line.search(/\S/); |
||
531 | if (indent === -1) |
||
532 | continue; |
||
533 | if (startIndent > indent) |
||
534 | break; |
||
535 | var subRange = this.getFoldWidgetRange(session, "all", row); |
||
536 | |||
537 | if (subRange) { |
||
538 | if (subRange.start.row <= startRow) { |
||
539 | break; |
||
540 | } else if (subRange.isMultiLine()) { |
||
541 | row = subRange.end.row; |
||
542 | } else if (startIndent == indent) { |
||
543 | break; |
||
544 | } |
||
545 | } |
||
546 | endRow = row; |
||
547 | } |
||
548 | |||
549 | return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
||
550 | }; |
||
551 | this.getCommentRegionBlock = function(session, line, row) { |
||
552 | var startColumn = line.search(/\s*$/); |
||
553 | var maxRow = session.getLength(); |
||
554 | var startRow = row; |
||
555 | |||
556 | var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
||
557 | var depth = 1; |
||
558 | while (++row < maxRow) { |
||
559 | line = session.getLine(row); |
||
560 | var m = re.exec(line); |
||
561 | if (!m) continue; |
||
562 | if (m[1]) depth--; |
||
563 | else depth++; |
||
564 | |||
565 | if (!depth) break; |
||
566 | } |
||
567 | |||
568 | var endRow = row; |
||
569 | if (endRow > startRow) { |
||
570 | return new Range(startRow, startColumn, endRow, line.length); |
||
571 | } |
||
572 | }; |
||
573 | |||
574 | }).call(FoldMode.prototype); |
||
575 | |||
576 | }); |
||
577 | |||
578 | ace.define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) { |
||
579 | "use strict"; |
||
580 | |||
581 | var oop = require("../lib/oop"); |
||
582 | var TextMode = require("./text").Mode; |
||
583 | var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; |
||
584 | var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; |
||
585 | var WorkerClient = require("../worker/worker_client").WorkerClient; |
||
586 | var CssCompletions = require("./css_completions").CssCompletions; |
||
587 | var CssBehaviour = require("./behaviour/css").CssBehaviour; |
||
588 | var CStyleFoldMode = require("./folding/cstyle").FoldMode; |
||
589 | |||
590 | var Mode = function() { |
||
591 | this.HighlightRules = CssHighlightRules; |
||
592 | this.$outdent = new MatchingBraceOutdent(); |
||
593 | this.$behaviour = new CssBehaviour(); |
||
594 | this.$completer = new CssCompletions(); |
||
595 | this.foldingRules = new CStyleFoldMode(); |
||
596 | }; |
||
597 | oop.inherits(Mode, TextMode); |
||
598 | |||
599 | (function() { |
||
600 | |||
601 | this.foldingRules = "cStyle"; |
||
602 | this.blockComment = {start: "/*", end: "*/"}; |
||
603 | |||
604 | this.getNextLineIndent = function(state, line, tab) { |
||
605 | var indent = this.$getIndent(line); |
||
606 | var tokens = this.getTokenizer().getLineTokens(line, state).tokens; |
||
607 | if (tokens.length && tokens[tokens.length-1].type == "comment") { |
||
608 | return indent; |
||
609 | } |
||
610 | |||
611 | var match = line.match(/^.*\{\s*$/); |
||
612 | if (match) { |
||
613 | indent += tab; |
||
614 | } |
||
615 | |||
616 | return indent; |
||
617 | }; |
||
618 | |||
619 | this.checkOutdent = function(state, line, input) { |
||
620 | return this.$outdent.checkOutdent(line, input); |
||
621 | }; |
||
622 | |||
623 | this.autoOutdent = function(state, doc, row) { |
||
624 | this.$outdent.autoOutdent(doc, row); |
||
625 | }; |
||
626 | |||
627 | this.getCompletions = function(state, session, pos, prefix) { |
||
628 | return this.$completer.getCompletions(state, session, pos, prefix); |
||
629 | }; |
||
630 | |||
631 | this.createWorker = function(session) { |
||
632 | var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker"); |
||
633 | worker.attachToDocument(session.getDocument()); |
||
634 | |||
635 | worker.on("annotate", function(e) { |
||
636 | session.setAnnotations(e.data); |
||
637 | }); |
||
638 | |||
639 | worker.on("terminate", function() { |
||
640 | session.clearAnnotations(); |
||
641 | }); |
||
642 | |||
643 | return worker; |
||
644 | }; |
||
645 | |||
646 | this.$id = "ace/mode/css"; |
||
647 | }).call(Mode.prototype); |
||
648 | |||
649 | exports.Mode = Mode; |
||
650 | |||
651 | }); |