corrade-nucleus-nucleons – Blame information for rev 20
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
20 | office | 1 | define("ace/mode/logiql_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { |
2 | "use strict"; |
||
3 | |||
4 | var oop = require("../lib/oop"); |
||
5 | var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
||
6 | |||
7 | var LogiQLHighlightRules = function() { |
||
8 | |||
9 | this.$rules = { start: |
||
10 | [ { token: 'comment.block', |
||
11 | regex: '/\\*', |
||
12 | push: |
||
13 | [ { token: 'comment.block', regex: '\\*/', next: 'pop' }, |
||
14 | { defaultToken: 'comment.block' } ] |
||
15 | }, |
||
16 | { token: 'comment.single', |
||
17 | regex: '//.*' |
||
18 | }, |
||
19 | { token: 'constant.numeric', |
||
20 | regex: '\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?[fd]?' |
||
21 | }, |
||
22 | { token: 'string', |
||
23 | regex: '"', |
||
24 | push: |
||
25 | [ { token: 'string', regex: '"', next: 'pop' }, |
||
26 | { defaultToken: 'string' } ] |
||
27 | }, |
||
28 | { token: 'constant.language', |
||
29 | regex: '\\b(true|false)\\b' |
||
30 | }, |
||
31 | { token: 'entity.name.type.logicblox', |
||
32 | regex: '`[a-zA-Z_:]+(\\d|\\a)*\\b' |
||
33 | }, |
||
34 | { token: 'keyword.start', regex: '->', comment: 'Constraint' }, |
||
35 | { token: 'keyword.start', regex: '-->', comment: 'Level 1 Constraint'}, |
||
36 | { token: 'keyword.start', regex: '<-', comment: 'Rule' }, |
||
37 | { token: 'keyword.start', regex: '<--', comment: 'Level 1 Rule' }, |
||
38 | { token: 'keyword.end', regex: '\\.', comment: 'Terminator' }, |
||
39 | { token: 'keyword.other', regex: '!', comment: 'Negation' }, |
||
40 | { token: 'keyword.other', regex: ',', comment: 'Conjunction' }, |
||
41 | { token: 'keyword.other', regex: ';', comment: 'Disjunction' }, |
||
42 | { token: 'keyword.operator', regex: '<=|>=|!=|<|>', comment: 'Equality'}, |
||
43 | { token: 'keyword.other', regex: '@', comment: 'Equality' }, |
||
44 | { token: 'keyword.operator', regex: '\\+|-|\\*|/', comment: 'Arithmetic operations'}, |
||
45 | { token: 'keyword', regex: '::', comment: 'Colon colon' }, |
||
46 | { token: 'support.function', |
||
47 | regex: '\\b(agg\\s*<<)', |
||
48 | push: |
||
49 | [ { include: '$self' }, |
||
50 | { token: 'support.function', |
||
51 | regex: '>>', |
||
52 | next: 'pop' } ] |
||
53 | }, |
||
54 | { token: 'storage.modifier', |
||
55 | regex: '\\b(lang:[\\w:]*)' |
||
56 | }, |
||
57 | { token: [ 'storage.type', 'text' ], |
||
58 | regex: '(export|sealed|clauses|block|alias|alias_all)(\\s*\\()(?=`)' |
||
59 | }, |
||
60 | { token: 'entity.name', |
||
61 | regex: '[a-zA-Z_][a-zA-Z_0-9:]*(@prev|@init|@final)?(?=(\\(|\\[))' |
||
62 | }, |
||
63 | { token: 'variable.parameter', |
||
64 | regex: '([a-zA-Z][a-zA-Z_0-9]*|_)\\s*(?=(,|\\.|<-|->|\\)|\\]|=))' |
||
65 | } ] } |
||
66 | |||
67 | this.normalizeRules(); |
||
68 | }; |
||
69 | |||
70 | oop.inherits(LogiQLHighlightRules, TextHighlightRules); |
||
71 | |||
72 | exports.LogiQLHighlightRules = LogiQLHighlightRules; |
||
73 | }); |
||
74 | |||
75 | define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) { |
||
76 | "use strict"; |
||
77 | |||
78 | var oop = require("../../lib/oop"); |
||
79 | var BaseFoldMode = require("./fold_mode").FoldMode; |
||
80 | var Range = require("../../range").Range; |
||
81 | |||
82 | var FoldMode = exports.FoldMode = function() {}; |
||
83 | oop.inherits(FoldMode, BaseFoldMode); |
||
84 | |||
85 | (function() { |
||
86 | |||
87 | this.getFoldWidgetRange = function(session, foldStyle, row) { |
||
88 | var range = this.indentationBlock(session, row); |
||
89 | if (range) |
||
90 | return range; |
||
91 | |||
92 | var re = /\S/; |
||
93 | var line = session.getLine(row); |
||
94 | var startLevel = line.search(re); |
||
95 | if (startLevel == -1 || line[startLevel] != "#") |
||
96 | return; |
||
97 | |||
98 | var startColumn = line.length; |
||
99 | var maxRow = session.getLength(); |
||
100 | var startRow = row; |
||
101 | var endRow = row; |
||
102 | |||
103 | while (++row < maxRow) { |
||
104 | line = session.getLine(row); |
||
105 | var level = line.search(re); |
||
106 | |||
107 | if (level == -1) |
||
108 | continue; |
||
109 | |||
110 | if (line[level] != "#") |
||
111 | break; |
||
112 | |||
113 | endRow = row; |
||
114 | } |
||
115 | |||
116 | if (endRow > startRow) { |
||
117 | var endColumn = session.getLine(endRow).length; |
||
118 | return new Range(startRow, startColumn, endRow, endColumn); |
||
119 | } |
||
120 | }; |
||
121 | this.getFoldWidget = function(session, foldStyle, row) { |
||
122 | var line = session.getLine(row); |
||
123 | var indent = line.search(/\S/); |
||
124 | var next = session.getLine(row + 1); |
||
125 | var prev = session.getLine(row - 1); |
||
126 | var prevIndent = prev.search(/\S/); |
||
127 | var nextIndent = next.search(/\S/); |
||
128 | |||
129 | if (indent == -1) { |
||
130 | session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : ""; |
||
131 | return ""; |
||
132 | } |
||
133 | if (prevIndent == -1) { |
||
134 | if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") { |
||
135 | session.foldWidgets[row - 1] = ""; |
||
136 | session.foldWidgets[row + 1] = ""; |
||
137 | return "start"; |
||
138 | } |
||
139 | } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") { |
||
140 | if (session.getLine(row - 2).search(/\S/) == -1) { |
||
141 | session.foldWidgets[row - 1] = "start"; |
||
142 | session.foldWidgets[row + 1] = ""; |
||
143 | return ""; |
||
144 | } |
||
145 | } |
||
146 | |||
147 | if (prevIndent!= -1 && prevIndent < indent) |
||
148 | session.foldWidgets[row - 1] = "start"; |
||
149 | else |
||
150 | session.foldWidgets[row - 1] = ""; |
||
151 | |||
152 | if (indent < nextIndent) |
||
153 | return "start"; |
||
154 | else |
||
155 | return ""; |
||
156 | }; |
||
157 | |||
158 | }).call(FoldMode.prototype); |
||
159 | |||
160 | }); |
||
161 | |||
162 | define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) { |
||
163 | "use strict"; |
||
164 | |||
165 | var Range = require("../range").Range; |
||
166 | |||
167 | var MatchingBraceOutdent = function() {}; |
||
168 | |||
169 | (function() { |
||
170 | |||
171 | this.checkOutdent = function(line, input) { |
||
172 | if (! /^\s+$/.test(line)) |
||
173 | return false; |
||
174 | |||
175 | return /^\s*\}/.test(input); |
||
176 | }; |
||
177 | |||
178 | this.autoOutdent = function(doc, row) { |
||
179 | var line = doc.getLine(row); |
||
180 | var match = line.match(/^(\s*\})/); |
||
181 | |||
182 | if (!match) return 0; |
||
183 | |||
184 | var column = match[1].length; |
||
185 | var openBracePos = doc.findMatchingBracket({row: row, column: column}); |
||
186 | |||
187 | if (!openBracePos || openBracePos.row == row) return 0; |
||
188 | |||
189 | var indent = this.$getIndent(doc.getLine(openBracePos.row)); |
||
190 | doc.replace(new Range(row, 0, row, column-1), indent); |
||
191 | }; |
||
192 | |||
193 | this.$getIndent = function(line) { |
||
194 | return line.match(/^\s*/)[0]; |
||
195 | }; |
||
196 | |||
197 | }).call(MatchingBraceOutdent.prototype); |
||
198 | |||
199 | exports.MatchingBraceOutdent = MatchingBraceOutdent; |
||
200 | }); |
||
201 | |||
202 | define("ace/mode/logiql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/logiql_highlight_rules","ace/mode/folding/coffee","ace/token_iterator","ace/range","ace/mode/behaviour/cstyle","ace/mode/matching_brace_outdent"], function(require, exports, module) { |
||
203 | "use strict"; |
||
204 | |||
205 | var oop = require("../lib/oop"); |
||
206 | var TextMode = require("./text").Mode; |
||
207 | var LogiQLHighlightRules = require("./logiql_highlight_rules").LogiQLHighlightRules; |
||
208 | var FoldMode = require("./folding/coffee").FoldMode; |
||
209 | var TokenIterator = require("../token_iterator").TokenIterator; |
||
210 | var Range = require("../range").Range; |
||
211 | var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; |
||
212 | var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; |
||
213 | |||
214 | var Mode = function() { |
||
215 | this.HighlightRules = LogiQLHighlightRules; |
||
216 | this.foldingRules = new FoldMode(); |
||
217 | this.$outdent = new MatchingBraceOutdent(); |
||
218 | this.$behaviour = new CstyleBehaviour(); |
||
219 | }; |
||
220 | oop.inherits(Mode, TextMode); |
||
221 | |||
222 | (function() { |
||
223 | this.lineCommentStart = "//"; |
||
224 | this.blockComment = {start: "/*", end: "*/"}; |
||
225 | |||
226 | this.getNextLineIndent = function(state, line, tab) { |
||
227 | var indent = this.$getIndent(line); |
||
228 | |||
229 | var tokenizedLine = this.getTokenizer().getLineTokens(line, state); |
||
230 | var tokens = tokenizedLine.tokens; |
||
231 | var endState = tokenizedLine.state; |
||
232 | if (/comment|string/.test(endState)) |
||
233 | return indent; |
||
234 | if (tokens.length && tokens[tokens.length - 1].type == "comment.single") |
||
235 | return indent; |
||
236 | |||
237 | var match = line.match(); |
||
238 | if (/(-->|<--|<-|->|{)\s*$/.test(line))-|->--|<-|-> |
||
239 | <--|<-|-><-|-> indent += tab;-|->--|<-|-> |
||
240 | <--|<-|-><-|-> return indent;-|->--|<-|-> |
||
241 | <--|<-|-><-|-> };-|->--|<-|-> |
||
242 | |||
243 | <--|<-|-><-|-> this.checkOutdent = function(state, line, input) {-|->--|<-|-> |
||
244 | <--|<-|-><-|-> if (this.$outdent.checkOutdent(line, input))-|->--|<-|-> |
||
245 | <--|<-|-><-|-> return true;-|->--|<-|-> |
||
246 | |||
247 | <--|<-|-><-|-> if (input !== "\n" && input !== "\r\n")-|->--|<-|-> |
||
248 | <--|<-|-><-|-> return false;-|->--|<-|-> |
||
249 | |||
250 | <--|<-|-><-|-> if (!/^\s+/.test(line))-|->--|<-|-> |
||
251 | <--|<-|-><-|-> return false;-|->--|<-|-> |
||
252 | |||
253 | <--|<-|-><-|-> return true;-|->--|<-|-> |
||
254 | <--|<-|-><-|-> };-|->--|<-|-> |
||
255 | |||
256 | <--|<-|-><-|-> this.autoOutdent = function(state, doc, row) {-|->--|<-|-> |
||
257 | <--|<-|-><-|-> if (this.$outdent.autoOutdent(doc, row))-|->--|<-|-> |
||
258 | <--|<-|-><-|-> return;-|->--|<-|-> |
||
259 | <--|<-|-><-|-> var prevLine = doc.getLine(row);-|->--|<-|-> |
||
260 | <--|<-|-><-|-> var match = prevLine.match(/^\s+/);-|->--|<-|-> |
||
261 | <--|<-|-><-|-> var column = prevLine.lastIndexOf(".") + 1;-|->--|<-|-> |
||
262 | <--|<-|-><-|-> if (!match || !row || !column) return 0;-|->--|<-|-> |
||
263 | |||
264 | <--|<-|-><-|-> var line = doc.getLine(row + 1);-|->--|<-|-> |
||
265 | <--|<-|-><-|-> var startRange = this.getMatching(doc, {row: row, column: column});-|->--|<-|-> |
||
266 | <--|<-|-><-|-> if (!startRange || startRange.start.row == row) return 0;-|->--|<-|-> |
||
267 | |||
268 | <--|<-|-><-|-> column = match[0].length;-|->--|<-|-> |
||
269 | <--|<-|-><-|-> var indent = this.$getIndent(doc.getLine(startRange.start.row));-|->--|<-|-> |
||
270 | <--|<-|-><-|-> doc.replace(new Range(row + 1, 0, row + 1, column), indent);-|->--|<-|-> |
||
271 | <--|<-|-><-|-> };-|->--|<-|-> |
||
272 | |||
273 | <--|<-|-><-|-> this.getMatching = function(session, row, column) {-|->--|<-|-> |
||
274 | <--|<-|-><-|-> if (row == undefined)-|->--|<-|-> |
||
275 | <--|<-|-><-|-> row = session.selection.lead-|->--|<-|-> |
||
276 | <--|<-|-><-|-> if (typeof row == "object") {-|->--|<-|-> |
||
277 | <--|<-|-><-|-> column = row.column;-|->--|<-|-> |
||
278 | <--|<-|-><-|-> row = row.row;-|->--|<-|-> |
||
279 | <--|<-|-><-|-> }-|->--|<-|-> |
||
280 | |||
281 | <--|<-|-><-|-> var startToken = session.getTokenAt(row, column);-|->--|<-|-> |
||
282 | <--|<-|-><-|-> var KW_START = "keyword.start", KW_END = "keyword.end";-|->--|<-|-> |
||
283 | <--|<-|-><-|-> var tok;-|->--|<-|-> |
||
284 | <--|<-|-><-|-> if (!startToken)-|->--|<-|-> |
||
285 | <--|<-|-><-|-> return;-|->--|<-|-> |
||
286 | <--|<-|-><-|-> if (startToken.type == KW_START) {-|->--|<-|-> |
||
287 | <--|<-|-><-|-> var it = new TokenIterator(session, row, column);-|->--|<-|-> |
||
288 | <--|<-|-><-|-> it.step = it.stepForward;-|->--|<-|-> |
||
289 | <--|<-|-><-|-> } else if (startToken.type == KW_END) {-|->--|<-|-> |
||
290 | <--|<-|-><-|-> var it = new TokenIterator(session, row, column);-|->--|<-|-> |
||
291 | <--|<-|-><-|-> it.step = it.stepBackward;-|->--|<-|-> |
||
292 | <--|<-|-><-|-> } else-|->--|<-|-> |
||
293 | <--|<-|-><-|-> return;-|->--|<-|-> |
||
294 | |||
295 | <--|<-|-><-|-> while (tok = it.step()) {-|->--|<-|-> |
||
296 | <--|<-|-><-|-> if (tok.type == KW_START || tok.type == KW_END)-|->--|<-|-> |
||
297 | <--|<-|-><-|-> break;-|->--|<-|-> |
||
298 | <--|<-|-><-|-> }-|->--|<-|-> |
||
299 | <--|<-|-><-|-> if (!tok || tok.type == startToken.type)-|->--|<-|-> |
||
300 | <--|<-|-><-|-> return;-|->--|<-|-> |
||
301 | |||
302 | <--|<-|-><-|-> var col = it.getCurrentTokenColumn();-|->--|<-|-> |
||
303 | <--|<-|-><-|-> var row = it.getCurrentTokenRow();-|->--|<-|-> |
||
304 | <--|<-|-><-|-> return new Range(row, col, row, col + tok.value.length);-|->--|<-|-> |
||
305 | <--|<-|-><-|-> };-|->--|<-|-> |
||
306 | <--|<-|-><-|-> this.$id = "ace/mode/logiql";-|->--|<-|-> |
||
307 | <--|<-|-><-|->}).call(Mode.prototype);-|->--|<-|-> |
||
308 | |||
309 | <--|<-|-><-|->exports.Mode = Mode;-|->--|<-|-> |
||
310 | <--|<-|-><-|->});-|->--|<-|-> |