crobi 10 gadus atpakaļ
vecāks
revīzija
bd4a41a9a0
100 mainītis faili ar 98746 papildinājumiem un 0 dzēšanām
  1. 2937
    0
      generator/js/ace.d.ts
  2. 18298
    0
      generator/lib/ace/ace.js
  3. 334
    0
      generator/lib/ace/ext-beautify.js
  4. 541
    0
      generator/lib/ace/ext-chromevox.js
  5. 275
    0
      generator/lib/ace/ext-elastic_tabstops_lite.js
  6. 1190
    0
      generator/lib/ace/ext-emmet.js
  7. 6
    0
      generator/lib/ace/ext-error_marker.js
  8. 170
    0
      generator/lib/ace/ext-keybinding_menu.js
  9. 1934
    0
      generator/lib/ace/ext-language_tools.js
  10. 52
    0
      generator/lib/ace/ext-linking.js
  11. 187
    0
      generator/lib/ace/ext-modelist.js
  12. 494
    0
      generator/lib/ace/ext-old_ie.js
  13. 409
    0
      generator/lib/ace/ext-searchbox.js
  14. 637
    0
      generator/lib/ace/ext-settings_menu.js
  15. 71
    0
      generator/lib/ace/ext-spellcheck.js
  16. 246
    0
      generator/lib/ace/ext-split.js
  17. 154
    0
      generator/lib/ace/ext-static_highlight.js
  18. 51
    0
      generator/lib/ace/ext-statusbar.js
  19. 632
    0
      generator/lib/ace/ext-textarea.js
  20. 58
    0
      generator/lib/ace/ext-themelist.js
  21. 181
    0
      generator/lib/ace/ext-whitespace.js
  22. 1182
    0
      generator/lib/ace/keybinding-emacs.js
  23. 5320
    0
      generator/lib/ace/keybinding-vim.js
  24. 230
    0
      generator/lib/ace/mode-abap.js
  25. 267
    0
      generator/lib/ace/mode-actionscript.js
  26. 87
    0
      generator/lib/ace/mode-ada.js
  27. 356
    0
      generator/lib/ace/mode-apache_conf.js
  28. 272
    0
      generator/lib/ace/mode-applescript.js
  29. 342
    0
      generator/lib/ace/mode-asciidoc.js
  30. 185
    0
      generator/lib/ace/mode-assembly_x86.js
  31. 235
    0
      generator/lib/ace/mode-autohotkey.js
  32. 223
    0
      generator/lib/ace/mode-batchfile.js
  33. 275
    0
      generator/lib/ace/mode-c9search.js
  34. 849
    0
      generator/lib/ace/mode-c_cpp.js
  35. 202
    0
      generator/lib/ace/mode-cirru.js
  36. 306
    0
      generator/lib/ace/mode-clojure.js
  37. 94
    0
      generator/lib/ace/mode-cobol.js
  38. 412
    0
      generator/lib/ace/mode-coffee.js
  39. 2477
    0
      generator/lib/ace/mode-coldfusion.js
  40. 847
    0
      generator/lib/ace/mode-csharp.js
  41. 828
    0
      generator/lib/ace/mode-css.js
  42. 2483
    0
      generator/lib/ace/mode-curly.js
  43. 513
    0
      generator/lib/ace/mode-d.js
  44. 1053
    0
      generator/lib/ace/mode-dart.js
  45. 139
    0
      generator/lib/ace/mode-diff.js
  46. 2517
    0
      generator/lib/ace/mode-django.js
  47. 803
    0
      generator/lib/ace/mode-dockerfile.js
  48. 413
    0
      generator/lib/ace/mode-dot.js
  49. 128
    0
      generator/lib/ace/mode-eiffel.js
  50. 2950
    0
      generator/lib/ace/mode-ejs.js
  51. 493
    0
      generator/lib/ace/mode-elixir.js
  52. 294
    0
      generator/lib/ace/mode-elm.js
  53. 1002
    0
      generator/lib/ace/mode-erlang.js
  54. 290
    0
      generator/lib/ace/mode-forth.js
  55. 1020
    0
      generator/lib/ace/mode-ftl.js
  56. 85
    0
      generator/lib/ace/mode-gcode.js
  57. 129
    0
      generator/lib/ace/mode-gherkin.js
  58. 51
    0
      generator/lib/ace/mode-gitignore.js
  59. 926
    0
      generator/lib/ace/mode-glsl.js
  60. 751
    0
      generator/lib/ace/mode-golang.js
  61. 1217
    0
      generator/lib/ace/mode-groovy.js
  62. 525
    0
      generator/lib/ace/mode-haml.js
  63. 2543
    0
      generator/lib/ace/mode-handlebars.js
  64. 372
    0
      generator/lib/ace/mode-haskell.js
  65. 737
    0
      generator/lib/ace/mode-haxe.js
  66. 2427
    0
      generator/lib/ace/mode-html.js
  67. 2955
    0
      generator/lib/ace/mode-html_ruby.js
  68. 154
    0
      generator/lib/ace/mode-ini.js
  69. 247
    0
      generator/lib/ace/mode-io.js
  70. 696
    0
      generator/lib/ace/mode-jack.js
  71. 2039
    0
      generator/lib/ace/mode-jade.js
  72. 1172
    0
      generator/lib/ace/mode-java.js
  73. 1025
    0
      generator/lib/ace/mode-javascript.js
  74. 668
    0
      generator/lib/ace/mode-json.js
  75. 2954
    0
      generator/lib/ace/mode-jsoniq.js
  76. 1584
    0
      generator/lib/ace/mode-jsp.js
  77. 762
    0
      generator/lib/ace/mode-jsx.js
  78. 296
    0
      generator/lib/ace/mode-julia.js
  79. 223
    0
      generator/lib/ace/mode-latex.js
  80. 897
    0
      generator/lib/ace/mode-less.js
  81. 1022
    0
      generator/lib/ace/mode-liquid.js
  82. 104
    0
      generator/lib/ace/mode-lisp.js
  83. 289
    0
      generator/lib/ace/mode-livescript.js
  84. 666
    0
      generator/lib/ace/mode-logiql.js
  85. 693
    0
      generator/lib/ace/mode-lsl.js
  86. 426
    0
      generator/lib/ace/mode-lua.js
  87. 2927
    0
      generator/lib/ace/mode-luapage.js
  88. 69
    0
      generator/lib/ace/mode-lucene.js
  89. 357
    0
      generator/lib/ace/mode-makefile.js
  90. 2795
    0
      generator/lib/ace/mode-markdown.js
  91. 1981
    0
      generator/lib/ace/mode-mask.js
  92. 256
    0
      generator/lib/ace/mode-matlab.js
  93. 613
    0
      generator/lib/ace/mode-mel.js
  94. 674
    0
      generator/lib/ace/mode-mushcode.js
  95. 160
    0
      generator/lib/ace/mode-mysql.js
  96. 993
    0
      generator/lib/ace/mode-nix.js
  97. 731
    0
      generator/lib/ace/mode-objectivec.js
  98. 414
    0
      generator/lib/ace/mode-ocaml.js
  99. 197
    0
      generator/lib/ace/mode-pascal.js
  100. 0
    0
      generator/lib/ace/mode-perl.js

+ 2937
- 0
generator/js/ace.d.ts
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 18298
- 0
generator/lib/ace/ace.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 334
- 0
generator/lib/ace/ext-beautify.js Parādīt failu

@@ -0,0 +1,334 @@
1
+ace.define("ace/ext/beautify/php_rules",["require","exports","module","ace/token_iterator"], function(require, exports, module) {
2
+"use strict";
3
+var TokenIterator = require("ace/token_iterator").TokenIterator;
4
+exports.newLines = [{
5
+    type: 'support.php_tag',
6
+    value: '<?php'
7
+}, {
8
+    type: 'support.php_tag',
9
+    value: '<?'
10
+}, {
11
+    type: 'support.php_tag',
12
+    value: '?>'
13
+}, {
14
+    type: 'paren.lparen',
15
+    value: '{',
16
+    indent: true
17
+}, {
18
+    type: 'paren.rparen',
19
+    breakBefore: true,
20
+    value: '}',
21
+    indent: false
22
+}, {
23
+    type: 'paren.rparen',
24
+    breakBefore: true,
25
+    value: '})',
26
+    indent: false,
27
+    dontBreak: true
28
+}, {
29
+    type: 'comment'
30
+}, {
31
+    type: 'text',
32
+    value: ';'
33
+}, {
34
+    type: 'text',
35
+    value: ':',
36
+    context: 'php'
37
+}, {
38
+    type: 'keyword',
39
+    value: 'case',
40
+    indent: true,
41
+    dontBreak: true
42
+}, {
43
+    type: 'keyword',
44
+    value: 'default',
45
+    indent: true,
46
+    dontBreak: true
47
+}, {
48
+    type: 'keyword',
49
+    value: 'break',
50
+    indent: false,
51
+    dontBreak: true
52
+}, {
53
+    type: 'punctuation.doctype.end',
54
+    value: '>'
55
+}, {
56
+    type: 'meta.tag.punctuation.end',
57
+    value: '>'
58
+}, {
59
+    type: 'meta.tag.punctuation.begin',
60
+    value: '<',
61
+    blockTag: true,
62
+    indent: true,
63
+    dontBreak: true
64
+}, {
65
+    type: 'meta.tag.punctuation.begin',
66
+    value: '</',
67
+    indent: false,
68
+    breakBefore: true,
69
+    dontBreak: true
70
+}, {
71
+    type: 'punctuation.operator',
72
+    value: ';'
73
+}];
74
+
75
+exports.spaces = [{
76
+    type: 'xml-pe',
77
+    prepend: true
78
+},{
79
+    type: 'entity.other.attribute-name',
80
+    prepend: true
81
+}, {
82
+    type: 'storage.type',
83
+    value: 'var',
84
+    append: true
85
+}, {
86
+    type: 'storage.type',
87
+    value: 'function',
88
+    append: true
89
+}, {
90
+    type: 'keyword.operator',
91
+    value: '='
92
+}, {
93
+    type: 'keyword',
94
+    value: 'as',
95
+    prepend: true,
96
+    append: true
97
+}, {
98
+    type: 'keyword',
99
+    value: 'function',
100
+    append: true
101
+}, {
102
+    type: 'support.function',
103
+    next: /[^\(]/,
104
+    append: true
105
+}, {
106
+    type: 'keyword',
107
+    value: 'or',
108
+    append: true,
109
+    prepend: true
110
+}, {
111
+    type: 'keyword',
112
+    value: 'and',
113
+    append: true,
114
+    prepend: true
115
+}, {
116
+    type: 'keyword',
117
+    value: 'case',
118
+    append: true
119
+}, {
120
+    type: 'keyword.operator',
121
+    value: '||',
122
+    append: true,
123
+    prepend: true
124
+}, {
125
+    type: 'keyword.operator',
126
+    value: '&&',
127
+    append: true,
128
+    prepend: true
129
+}];
130
+exports.singleTags = ['!doctype','area','base','br','hr','input','img','link','meta'];
131
+
132
+exports.transform = function(iterator, maxPos, context) {
133
+    var token = iterator.getCurrentToken();
134
+    
135
+    var newLines = exports.newLines;
136
+    var spaces = exports.spaces;
137
+    var singleTags = exports.singleTags;
138
+
139
+    var code = '';
140
+    
141
+    var indentation = 0;
142
+    var dontBreak = false;
143
+    var tag;
144
+    var lastTag;
145
+    var lastToken = {};
146
+    var nextTag;
147
+    var nextToken = {};
148
+    var breakAdded = false;
149
+    var value = '';
150
+
151
+    while (token!==null) {
152
+        console.log(token);
153
+
154
+        if( !token ){
155
+            token = iterator.stepForward();
156
+            continue;
157
+        }
158
+        if( token.type == 'support.php_tag' && token.value != '?>' ){
159
+            context = 'php';
160
+        }
161
+        else if( token.type == 'support.php_tag' && token.value == '?>' ){
162
+            context = 'html';
163
+        }
164
+        else if( token.type == 'meta.tag.name.style' && context != 'css' ){
165
+            context = 'css';
166
+        }
167
+        else if( token.type == 'meta.tag.name.style' && context == 'css' ){
168
+            context = 'html';
169
+        }
170
+        else if( token.type == 'meta.tag.name.script' && context != 'js' ){
171
+            context = 'js';
172
+        }
173
+        else if( token.type == 'meta.tag.name.script' && context == 'js' ){
174
+            context = 'html';
175
+        }
176
+
177
+        nextToken = iterator.stepForward();
178
+        if (nextToken && nextToken.type.indexOf('meta.tag.name') == 0) {
179
+            nextTag = nextToken.value;
180
+        }
181
+        if ( lastToken.type == 'support.php_tag' && lastToken.value == '<?=') {
182
+            dontBreak = true;
183
+        }
184
+        if (token.type == 'meta.tag.name') {
185
+            token.value = token.value.toLowerCase();
186
+        }
187
+        if (token.type == 'text') {
188
+            token.value = token.value.trim();
189
+        }
190
+        if (!token.value) {
191
+            token = nextToken;
192
+            continue;
193
+        }
194
+        value = token.value;
195
+        for (var i in spaces) {
196
+            if (
197
+                token.type == spaces[i].type &&
198
+                (!spaces[i].value || token.value == spaces[i].value) &&
199
+                (
200
+                    nextToken &&
201
+                    (!spaces[i].next || spaces[i].next.test(nextToken.value))
202
+                )
203
+            ) {
204
+                if (spaces[i].prepend) {
205
+                    value = ' ' + token.value;
206
+                }
207
+
208
+                if (spaces[i].append) {
209
+                    value += ' ';
210
+                }
211
+            }
212
+        }
213
+        if (token.type.indexOf('meta.tag.name') == 0) {
214
+            tag = token.value;
215
+        }
216
+        breakAdded = false;
217
+        for (i in newLines) {
218
+            if (
219
+                token.type == newLines[i].type &&
220
+                (
221
+                    !newLines[i].value ||
222
+                    token.value == newLines[i].value
223
+                ) &&
224
+                (
225
+                    !newLines[i].blockTag ||
226
+                    singleTags.indexOf(nextTag) === -1
227
+                ) &&
228
+                (
229
+                    !newLines[i].context ||
230
+                    newLines[i].context === context
231
+                )
232
+            ) {
233
+                if (newLines[i].indent === false) {
234
+                    indentation--;
235
+                }
236
+
237
+                if (
238
+                    newLines[i].breakBefore &&
239
+                    ( !newLines[i].prev || newLines[i].prev.test(lastToken.value) )
240
+                ) {
241
+                    code += "\n";
242
+                    breakAdded = true;
243
+                    for (i = 0; i < indentation; i++) {
244
+                        code += "\t";
245
+                    }
246
+                }
247
+
248
+                break;
249
+            }
250
+        }
251
+
252
+        if (dontBreak===false) {
253
+            for (i in newLines) {
254
+                if (
255
+                    lastToken.type == newLines[i].type &&
256
+                    (
257
+                        !newLines[i].value || lastToken.value == newLines[i].value
258
+                    ) &&
259
+                    (
260
+                        !newLines[i].blockTag ||
261
+                        singleTags.indexOf(tag) === -1
262
+                    ) &&
263
+                    (
264
+                        !newLines[i].context ||
265
+                        newLines[i].context === context
266
+                    )
267
+                ) {
268
+                    if (newLines[i].indent === true) {
269
+                        indentation++;
270
+                    }
271
+
272
+                    if (!newLines[i].dontBreak  && !breakAdded) {
273
+                        code += "\n";
274
+                        for (i = 0; i < indentation; i++) {
275
+                            code += "\t";
276
+                        }
277
+                    }
278
+
279
+                    break;
280
+                }
281
+            }
282
+        }
283
+
284
+        code += value;
285
+        if ( lastToken.type == 'support.php_tag' && lastToken.value == '?>' ) {
286
+            dontBreak = false;
287
+        }
288
+        lastTag = tag;
289
+
290
+        lastToken = token;
291
+
292
+        token = nextToken;
293
+
294
+        if (token===null) {
295
+            break;
296
+        }
297
+    }
298
+    
299
+    return code;
300
+};
301
+
302
+
303
+
304
+});
305
+
306
+ace.define("ace/ext/beautify",["require","exports","module","ace/token_iterator","ace/ext/beautify/php_rules"], function(require, exports, module) {
307
+"use strict";
308
+var TokenIterator = require("ace/token_iterator").TokenIterator;
309
+
310
+var phpTransform = require("./beautify/php_rules").transform;
311
+
312
+exports.beautify = function(session) {
313
+    var iterator = new TokenIterator(session, 0, 0);
314
+    var token = iterator.getCurrentToken();
315
+
316
+    var context = session.$modeId.split("/").pop();
317
+
318
+    var code = phpTransform(iterator, context);
319
+    session.doc.setValue(code);
320
+};
321
+
322
+exports.commands = [{
323
+    name: "beautify",
324
+    exec: function(editor) {
325
+        exports.beautify(editor.session);
326
+    },
327
+    bindKey: "Ctrl-Shift-B"
328
+}]
329
+
330
+});
331
+                (function() {
332
+                    ace.require(["ace/ext/beautify"], function() {});
333
+                })();
334
+            

+ 541
- 0
generator/lib/ace/ext-chromevox.js Parādīt failu

@@ -0,0 +1,541 @@
1
+ace.define("ace/ext/chromevox",["require","exports","module","ace/editor","ace/config"], function(require, exports, module) {
2
+var cvoxAce = {};
3
+cvoxAce.SpeechProperty;
4
+cvoxAce.Cursor;
5
+cvoxAce.Token;
6
+cvoxAce.Annotation;
7
+var CONSTANT_PROP = {
8
+  'rate': 0.8,
9
+  'pitch': 0.4,
10
+  'volume': 0.9
11
+};
12
+var DEFAULT_PROP = {
13
+  'rate': 1,
14
+  'pitch': 0.5,
15
+  'volume': 0.9
16
+};
17
+var ENTITY_PROP = {
18
+  'rate': 0.8,
19
+  'pitch': 0.8,
20
+  'volume': 0.9
21
+};
22
+var KEYWORD_PROP = {
23
+  'rate': 0.8,
24
+  'pitch': 0.3,
25
+  'volume': 0.9
26
+};
27
+var STORAGE_PROP = {
28
+  'rate': 0.8,
29
+  'pitch': 0.7,
30
+  'volume': 0.9
31
+};
32
+var VARIABLE_PROP = {
33
+  'rate': 0.8,
34
+  'pitch': 0.8,
35
+  'volume': 0.9
36
+};
37
+var DELETED_PROP = {
38
+  'punctuationEcho': 'none',
39
+  'relativePitch': -0.6
40
+};
41
+var ERROR_EARCON = 'ALERT_NONMODAL';
42
+var MODE_SWITCH_EARCON = 'ALERT_MODAL';
43
+var NO_MATCH_EARCON = 'INVALID_KEYPRESS';
44
+var INSERT_MODE_STATE = 'insertMode';
45
+var COMMAND_MODE_STATE = 'start';
46
+
47
+var REPLACE_LIST = [
48
+  {
49
+    substr: ';',
50
+    newSubstr: ' semicolon '
51
+  },
52
+  {
53
+    substr: ':',
54
+    newSubstr: ' colon '
55
+  }
56
+];
57
+var Command = {
58
+  SPEAK_ANNOT: 'annots',
59
+  SPEAK_ALL_ANNOTS: 'all_annots',
60
+  TOGGLE_LOCATION: 'toggle_location',
61
+  SPEAK_MODE: 'mode',
62
+  SPEAK_ROW_COL: 'row_col',
63
+  TOGGLE_DISPLACEMENT: 'toggle_displacement',
64
+  FOCUS_TEXT: 'focus_text'
65
+};
66
+var KEY_PREFIX = 'CONTROL + SHIFT ';
67
+cvoxAce.editor = null;
68
+var lastCursor = null;
69
+var annotTable = {};
70
+var shouldSpeakRowLocation = false;
71
+var shouldSpeakDisplacement = false;
72
+var changed = false;
73
+var vimState = null;
74
+var keyCodeToShortcutMap = {};
75
+var cmdToShortcutMap = {};
76
+var getKeyShortcutString = function(keyCode) {
77
+  return KEY_PREFIX + String.fromCharCode(keyCode);
78
+};
79
+var isVimMode = function() {
80
+  var keyboardHandler = cvoxAce.editor.keyBinding.getKeyboardHandler();
81
+  return keyboardHandler.$id === 'ace/keyboard/vim';
82
+};
83
+var getCurrentToken = function(cursor) {
84
+  return cvoxAce.editor.getSession().getTokenAt(cursor.row, cursor.column + 1);
85
+};
86
+var getCurrentLine = function(cursor) {
87
+  return cvoxAce.editor.getSession().getLine(cursor.row);
88
+};
89
+var onRowChange = function(currCursor) {
90
+  if (annotTable[currCursor.row]) {
91
+    cvox.Api.playEarcon(ERROR_EARCON);
92
+  }
93
+  if (shouldSpeakRowLocation) {
94
+    cvox.Api.stop();
95
+    speakChar(currCursor);
96
+    speakTokenQueue(getCurrentToken(currCursor));
97
+    speakLine(currCursor.row, 1);
98
+  } else {
99
+    speakLine(currCursor.row, 0);
100
+  }
101
+};
102
+var isWord = function(cursor) {
103
+  var line = getCurrentLine(cursor);
104
+  var lineSuffix = line.substr(cursor.column - 1);
105
+  if (cursor.column === 0) {
106
+    lineSuffix = ' ' + line;
107
+  }
108
+  var firstWordRegExp = /^\W(\w+)/;
109
+  var words = firstWordRegExp.exec(lineSuffix);
110
+  return words !== null;
111
+};
112
+var rules = {
113
+  'constant': {
114
+    prop: CONSTANT_PROP
115
+  },
116
+  'entity': {
117
+    prop: ENTITY_PROP
118
+  },
119
+  'keyword': {
120
+    prop: KEYWORD_PROP
121
+  },
122
+  'storage': {
123
+    prop: STORAGE_PROP
124
+  },
125
+  'variable': {
126
+    prop: VARIABLE_PROP
127
+  },
128
+  'meta': {
129
+    prop: DEFAULT_PROP,
130
+    replace: [
131
+      {
132
+        substr: '</',
133
+        newSubstr: ' closing tag '
134
+      },
135
+      {
136
+        substr: '/>',
137
+        newSubstr: ' close tag '
138
+      },
139
+      {
140
+        substr: '<',
141
+        newSubstr: ' tag start '
142
+      },
143
+      {
144
+        substr: '>',
145
+        newSubstr: ' tag end '
146
+      }
147
+    ]
148
+  }
149
+};
150
+var DEFAULT_RULE = {
151
+  prop: DEFAULT_RULE
152
+};
153
+var expand = function(value, replaceRules) {
154
+  var newValue = value;
155
+  for (var i = 0; i < replaceRules.length; i++) {
156
+    var replaceRule = replaceRules[i];
157
+    var regexp = new RegExp(replaceRule.substr, 'g');
158
+    newValue = newValue.replace(regexp, replaceRule.newSubstr);
159
+  }
160
+  return newValue;
161
+};
162
+var mergeTokens = function(tokens, start, end) {
163
+  var newToken = {};
164
+  newToken.value = '';
165
+  newToken.type = tokens[start].type;
166
+  for (var j = start; j < end; j++) {
167
+    newToken.value += tokens[j].value;
168
+  }
169
+  return newToken;
170
+};
171
+var mergeLikeTokens = function(tokens) {
172
+  if (tokens.length <= 1) {
173
+    return tokens;
174
+  }
175
+  var newTokens = [];
176
+  var lastLikeIndex = 0;
177
+  for (var i = 1; i < tokens.length; i++) {
178
+    var lastLikeToken = tokens[lastLikeIndex];
179
+    var currToken = tokens[i];
180
+    if (getTokenRule(lastLikeToken) !== getTokenRule(currToken)) {
181
+      newTokens.push(mergeTokens(tokens, lastLikeIndex, i));
182
+      lastLikeIndex = i;
183
+    }
184
+  }
185
+  newTokens.push(mergeTokens(tokens, lastLikeIndex, tokens.length));
186
+  return newTokens;
187
+};
188
+var isRowWhiteSpace = function(row) {
189
+  var line = cvoxAce.editor.getSession().getLine(row);
190
+  var whiteSpaceRegexp = /^\s*$/;
191
+  return whiteSpaceRegexp.exec(line) !== null;
192
+};
193
+var speakLine = function(row, queue) {
194
+  var tokens = cvoxAce.editor.getSession().getTokens(row);
195
+  if (tokens.length === 0 || isRowWhiteSpace(row)) {
196
+    cvox.Api.playEarcon('EDITABLE_TEXT');
197
+    return;
198
+  }
199
+  tokens = mergeLikeTokens(tokens);
200
+  var firstToken = tokens[0];
201
+  tokens = tokens.filter(function(token) {
202
+    return token !== firstToken;
203
+  });
204
+  speakToken_(firstToken, queue);
205
+  tokens.forEach(speakTokenQueue);
206
+};
207
+var speakTokenFlush = function(token) {
208
+  speakToken_(token, 0);
209
+};
210
+var speakTokenQueue = function(token) {
211
+  speakToken_(token, 1);
212
+};
213
+var getTokenRule = function(token) {
214
+  if (!token || !token.type) {
215
+    return;
216
+  }
217
+  var split = token.type.split('.');
218
+  if (split.length === 0) {
219
+    return;
220
+  }
221
+  var type = split[0];
222
+  var rule = rules[type];
223
+  if (!rule) {
224
+    return DEFAULT_RULE;
225
+  }
226
+  return rule;
227
+};
228
+var speakToken_ = function(token, queue) {
229
+  var rule = getTokenRule(token);
230
+  var value = expand(token.value, REPLACE_LIST);
231
+  if (rule.replace) {
232
+    value = expand(value, rule.replace);
233
+  }
234
+  cvox.Api.speak(value, queue, rule.prop);
235
+};
236
+var speakChar = function(cursor) {
237
+  var line = getCurrentLine(cursor);
238
+  cvox.Api.speak(line[cursor.column], 1);
239
+};
240
+var speakDisplacement = function(lastCursor, currCursor) {
241
+  var line = getCurrentLine(currCursor);
242
+  var displace = line.substring(lastCursor.column, currCursor.column);
243
+  displace = displace.replace(/ /g, ' space ');
244
+  cvox.Api.speak(displace);
245
+};
246
+var speakCharOrWordOrLine = function(lastCursor, currCursor) {
247
+  if (Math.abs(lastCursor.column - currCursor.column) !== 1) {
248
+    var currLineLength = getCurrentLine(currCursor).length;
249
+    if (currCursor.column === 0 || currCursor.column === currLineLength) {
250
+      speakLine(currCursor.row, 0);
251
+      return;
252
+    }
253
+    if (isWord(currCursor)) {
254
+      cvox.Api.stop();
255
+      speakTokenQueue(getCurrentToken(currCursor));
256
+      return;
257
+    }
258
+  }
259
+  speakChar(currCursor);
260
+};
261
+var onColumnChange = function(lastCursor, currCursor) {
262
+  if (!cvoxAce.editor.selection.isEmpty()) {
263
+    speakDisplacement(lastCursor, currCursor);
264
+    cvox.Api.speak('selected', 1);
265
+  }
266
+  else if (shouldSpeakDisplacement) {
267
+    speakDisplacement(lastCursor, currCursor);
268
+  } else {
269
+    speakCharOrWordOrLine(lastCursor, currCursor);
270
+  }
271
+};
272
+var onCursorChange = function(evt) {
273
+  if (changed) {
274
+    changed = false;
275
+    return;
276
+  }
277
+  var currCursor = cvoxAce.editor.selection.getCursor();
278
+  if (currCursor.row !== lastCursor.row) {
279
+    onRowChange(currCursor);
280
+  } else {
281
+    onColumnChange(lastCursor, currCursor);
282
+  }
283
+  lastCursor = currCursor;
284
+};
285
+var onSelectionChange = function(evt) {
286
+  if (cvoxAce.editor.selection.isEmpty()) {
287
+    cvox.Api.speak('unselected');
288
+  }
289
+};
290
+var onChange = function(evt) {
291
+  var data = evt.data;
292
+  switch (data.action) {
293
+  case 'removeText':
294
+    cvox.Api.speak(data.text, 0, DELETED_PROP);
295
+    changed = true;
296
+    break;
297
+  case 'insertText':
298
+    cvox.Api.speak(data.text, 0);
299
+    changed = true;
300
+    break;
301
+  }
302
+};
303
+var isNewAnnotation = function(annot) {
304
+  var row = annot.row;
305
+  var col = annot.column;
306
+  return !annotTable[row] || !annotTable[row][col];
307
+};
308
+var populateAnnotations = function(annotations) {
309
+  annotTable = {};
310
+  for (var i = 0; i < annotations.length; i++) {
311
+    var annotation = annotations[i];
312
+    var row = annotation.row;
313
+    var col = annotation.column;
314
+    if (!annotTable[row]) {
315
+      annotTable[row] = {};
316
+    }
317
+    annotTable[row][col] = annotation;
318
+  }
319
+};
320
+var onAnnotationChange = function(evt) {
321
+  var annotations = cvoxAce.editor.getSession().getAnnotations();
322
+  var newAnnotations = annotations.filter(isNewAnnotation);
323
+  if (newAnnotations.length > 0) {
324
+    cvox.Api.playEarcon(ERROR_EARCON);
325
+  }
326
+  populateAnnotations(annotations);
327
+};
328
+var speakAnnot = function(annot) {
329
+  var annotText = annot.type + ' ' + annot.text + ' on ' +
330
+      rowColToString(annot.row, annot.column);
331
+  annotText = annotText.replace(';', 'semicolon');
332
+  cvox.Api.speak(annotText, 1);
333
+};
334
+var speakAnnotsByRow = function(row) {
335
+  var annots = annotTable[row];
336
+  for (var col in annots) {
337
+    speakAnnot(annots[col]);
338
+  }
339
+};
340
+var rowColToString = function(row, col) {
341
+  return 'row ' + (row + 1) + ' column ' + (col + 1);
342
+};
343
+var speakCurrRowAndCol = function() {
344
+  cvox.Api.speak(rowColToString(lastCursor.row, lastCursor.column));
345
+};
346
+var speakAllAnnots = function() {
347
+  for (var row in annotTable) {
348
+    speakAnnotsByRow(row);
349
+  }
350
+};
351
+var speakMode = function() {
352
+  if (!isVimMode()) {
353
+    return;
354
+  }
355
+  switch (cvoxAce.editor.keyBinding.$data.state) {
356
+  case INSERT_MODE_STATE:
357
+    cvox.Api.speak('Insert mode');
358
+    break;
359
+  case COMMAND_MODE_STATE:
360
+    cvox.Api.speak('Command mode');
361
+    break;
362
+  }
363
+};
364
+var toggleSpeakRowLocation = function() {
365
+  shouldSpeakRowLocation = !shouldSpeakRowLocation;
366
+  if (shouldSpeakRowLocation) {
367
+    cvox.Api.speak('Speak location on row change enabled.');
368
+  } else {
369
+    cvox.Api.speak('Speak location on row change disabled.');
370
+  }
371
+};
372
+var toggleSpeakDisplacement = function() {
373
+  shouldSpeakDisplacement = !shouldSpeakDisplacement;
374
+  if (shouldSpeakDisplacement) {
375
+    cvox.Api.speak('Speak displacement on column changes.');
376
+  } else {
377
+    cvox.Api.speak('Speak current character or word on column changes.');
378
+  }
379
+};
380
+var onKeyDown = function(evt) {
381
+  if (evt.ctrlKey && evt.shiftKey) {
382
+    var shortcut = keyCodeToShortcutMap[evt.keyCode];
383
+    if (shortcut) {
384
+      shortcut.func();
385
+    }
386
+  }
387
+};
388
+var onChangeStatus = function(evt, editor) {
389
+  if (!isVimMode()) {
390
+    return;
391
+  }
392
+  var state = editor.keyBinding.$data.state;
393
+  if (state === vimState) {
394
+    return;
395
+  }
396
+  switch (state) {
397
+  case INSERT_MODE_STATE:
398
+    cvox.Api.playEarcon(MODE_SWITCH_EARCON);
399
+    cvox.Api.setKeyEcho(true);
400
+    break;
401
+  case COMMAND_MODE_STATE:
402
+    cvox.Api.playEarcon(MODE_SWITCH_EARCON);
403
+    cvox.Api.setKeyEcho(false);
404
+    break;
405
+  }
406
+  vimState = state;
407
+};
408
+var contextMenuHandler = function(evt) {
409
+  var cmd = evt.detail['customCommand'];
410
+  var shortcut = cmdToShortcutMap[cmd];
411
+  if (shortcut) {
412
+    shortcut.func();
413
+    cvoxAce.editor.focus();
414
+  }
415
+};
416
+var initContextMenu = function() {
417
+  var ACTIONS = SHORTCUTS.map(function(shortcut) {
418
+    return {
419
+      desc: shortcut.desc + getKeyShortcutString(shortcut.keyCode),
420
+      cmd: shortcut.cmd
421
+    };
422
+  });
423
+  var body = document.querySelector('body');
424
+  body.setAttribute('contextMenuActions', JSON.stringify(ACTIONS));
425
+  body.addEventListener('ATCustomEvent', contextMenuHandler, true);
426
+};
427
+var onFindSearchbox = function(evt) {
428
+  if (evt.match) {
429
+    speakLine(lastCursor.row, 0);
430
+  } else {
431
+    cvox.Api.playEarcon(NO_MATCH_EARCON);
432
+  }
433
+};
434
+var focus = function() {
435
+  cvoxAce.editor.focus();
436
+};
437
+var SHORTCUTS = [
438
+  {
439
+    keyCode: 49,
440
+    func: function() {
441
+      speakAnnotsByRow(lastCursor.row);
442
+    },
443
+    cmd: Command.SPEAK_ANNOT,
444
+    desc: 'Speak annotations on line'
445
+  },
446
+  {
447
+    keyCode: 50,
448
+    func: speakAllAnnots,
449
+    cmd: Command.SPEAK_ALL_ANNOTS,
450
+    desc: 'Speak all annotations'
451
+  },
452
+  {
453
+    keyCode: 51,
454
+    func: speakMode,
455
+    cmd: Command.SPEAK_MODE,
456
+    desc: 'Speak Vim mode'
457
+  },
458
+  {
459
+    keyCode: 52,
460
+    func: toggleSpeakRowLocation,
461
+    cmd: Command.TOGGLE_LOCATION,
462
+    desc: 'Toggle speak row location'
463
+  },
464
+  {
465
+    keyCode: 53,
466
+    func: speakCurrRowAndCol,
467
+    cmd: Command.SPEAK_ROW_COL,
468
+    desc: 'Speak row and column'
469
+  },
470
+  {
471
+    keyCode: 54,
472
+    func: toggleSpeakDisplacement,
473
+    cmd: Command.TOGGLE_DISPLACEMENT,
474
+    desc: 'Toggle speak displacement'
475
+  },
476
+  {
477
+    keyCode: 55,
478
+    func: focus,
479
+    cmd: Command.FOCUS_TEXT,
480
+    desc: 'Focus text'
481
+  }
482
+];
483
+var onFocus = function() {
484
+  cvoxAce.editor = editor;
485
+  editor.getSession().selection.on('changeCursor', onCursorChange);
486
+  editor.getSession().selection.on('changeSelection', onSelectionChange);
487
+  editor.getSession().on('change', onChange);
488
+  editor.getSession().on('changeAnnotation', onAnnotationChange);
489
+  editor.on('changeStatus', onChangeStatus);
490
+  editor.on('findSearchBox', onFindSearchbox);
491
+  editor.container.addEventListener('keydown', onKeyDown);
492
+
493
+  lastCursor = editor.selection.getCursor();
494
+};
495
+var init = function(editor) {
496
+  onFocus();
497
+  SHORTCUTS.forEach(function(shortcut) {
498
+    keyCodeToShortcutMap[shortcut.keyCode] = shortcut;
499
+    cmdToShortcutMap[shortcut.cmd] = shortcut;
500
+  });
501
+
502
+  editor.on('focus', onFocus);
503
+  if (isVimMode()) {
504
+    cvox.Api.setKeyEcho(false);
505
+  }
506
+  initContextMenu();
507
+};
508
+function cvoxApiExists() {
509
+  return (typeof(cvox) !== 'undefined') && cvox && cvox.Api;
510
+}
511
+var tries = 0;
512
+var MAX_TRIES = 15;
513
+function watchForCvoxLoad(editor) {
514
+  if (cvoxApiExists()) {
515
+    init(editor);
516
+  } else {
517
+    tries++;
518
+    if (tries >= MAX_TRIES) {
519
+      return;
520
+    }
521
+    window.setTimeout(watchForCvoxLoad, 500, editor);
522
+  }
523
+}
524
+
525
+var Editor = require('../editor').Editor;
526
+require('../config').defineOptions(Editor.prototype, 'editor', {
527
+  enableChromevoxEnhancements: {
528
+    set: function(val) {
529
+      if (val) {
530
+        watchForCvoxLoad(this);
531
+      }
532
+    },
533
+    value: true // turn it on by default or check for window.cvox
534
+  }
535
+});
536
+
537
+});
538
+                (function() {
539
+                    ace.require(["ace/ext/chromevox"], function() {});
540
+                })();
541
+            

+ 275
- 0
generator/lib/ace/ext-elastic_tabstops_lite.js Parādīt failu

@@ -0,0 +1,275 @@
1
+ace.define("ace/ext/elastic_tabstops_lite",["require","exports","module","ace/editor","ace/config"], function(require, exports, module) {
2
+"use strict";
3
+
4
+var ElasticTabstopsLite = function(editor) {
5
+    this.$editor = editor;
6
+    var self = this;
7
+    var changedRows = [];
8
+    var recordChanges = false;
9
+    this.onAfterExec = function() {
10
+        recordChanges = false;
11
+        self.processRows(changedRows);
12
+        changedRows = [];
13
+    };
14
+    this.onExec = function() {
15
+        recordChanges = true;
16
+    };
17
+    this.onChange = function(e) {
18
+        var range = e.data.range
19
+        if (recordChanges) {
20
+            if (changedRows.indexOf(range.start.row) == -1)
21
+                changedRows.push(range.start.row);
22
+            if (range.end.row != range.start.row)
23
+                changedRows.push(range.end.row);
24
+        }
25
+    };
26
+};
27
+
28
+(function() {
29
+    this.processRows = function(rows) {
30
+        this.$inChange = true;
31
+        var checkedRows = [];
32
+
33
+        for (var r = 0, rowCount = rows.length; r < rowCount; r++) {
34
+            var row = rows[r];
35
+
36
+            if (checkedRows.indexOf(row) > -1)
37
+                continue;
38
+
39
+            var cellWidthObj = this.$findCellWidthsForBlock(row);
40
+            var cellWidths = this.$setBlockCellWidthsToMax(cellWidthObj.cellWidths);
41
+            var rowIndex = cellWidthObj.firstRow;
42
+
43
+            for (var w = 0, l = cellWidths.length; w < l; w++) {
44
+                var widths = cellWidths[w];
45
+                checkedRows.push(rowIndex);
46
+                this.$adjustRow(rowIndex, widths);
47
+                rowIndex++;
48
+            }
49
+        }
50
+        this.$inChange = false;
51
+    };
52
+
53
+    this.$findCellWidthsForBlock = function(row) {
54
+        var cellWidths = [], widths;
55
+        var rowIter = row;
56
+        while (rowIter >= 0) {
57
+            widths = this.$cellWidthsForRow(rowIter);
58
+            if (widths.length == 0)
59
+                break;
60
+
61
+            cellWidths.unshift(widths);
62
+            rowIter--;
63
+        }
64
+        var firstRow = rowIter + 1;
65
+        rowIter = row;
66
+        var numRows = this.$editor.session.getLength();
67
+
68
+        while (rowIter < numRows - 1) {
69
+            rowIter++;
70
+
71
+            widths = this.$cellWidthsForRow(rowIter);
72
+            if (widths.length == 0)
73
+                break;
74
+
75
+            cellWidths.push(widths);
76
+        }
77
+
78
+        return { cellWidths: cellWidths, firstRow: firstRow };
79
+    };
80
+
81
+    this.$cellWidthsForRow = function(row) {
82
+        var selectionColumns = this.$selectionColumnsForRow(row);
83
+
84
+        var tabs = [-1].concat(this.$tabsForRow(row));
85
+        var widths = tabs.map(function(el) { return 0; } ).slice(1);
86
+        var line = this.$editor.session.getLine(row);
87
+
88
+        for (var i = 0, len = tabs.length - 1; i < len; i++) {
89
+            var leftEdge = tabs[i]+1;
90
+            var rightEdge = tabs[i+1];
91
+
92
+            var rightmostSelection = this.$rightmostSelectionInCell(selectionColumns, rightEdge);
93
+            var cell = line.substring(leftEdge, rightEdge);
94
+            widths[i] = Math.max(cell.replace(/\s+$/g,'').length, rightmostSelection - leftEdge);
95
+        }
96
+
97
+        return widths;
98
+    };
99
+
100
+    this.$selectionColumnsForRow = function(row) {
101
+        var selections = [], cursor = this.$editor.getCursorPosition();
102
+        if (this.$editor.session.getSelection().isEmpty()) {
103
+            if (row == cursor.row)
104
+                selections.push(cursor.column);
105
+        }
106
+
107
+        return selections;
108
+    };
109
+
110
+    this.$setBlockCellWidthsToMax = function(cellWidths) {
111
+        var startingNewBlock = true, blockStartRow, blockEndRow, maxWidth;
112
+        var columnInfo = this.$izip_longest(cellWidths);
113
+
114
+        for (var c = 0, l = columnInfo.length; c < l; c++) {
115
+            var column = columnInfo[c];
116
+            if (!column.push) {
117
+                console.error(column);
118
+                continue;
119
+            }
120
+            column.push(NaN);
121
+
122
+            for (var r = 0, s = column.length; r < s; r++) {
123
+                var width = column[r];
124
+                if (startingNewBlock) {
125
+                    blockStartRow = r;
126
+                    maxWidth = 0;
127
+                    startingNewBlock = false;
128
+                }
129
+                if (isNaN(width)) {
130
+                    blockEndRow = r;
131
+
132
+                    for (var j = blockStartRow; j < blockEndRow; j++) {
133
+                        cellWidths[j][c] = maxWidth;
134
+                    }
135
+                    startingNewBlock = true;
136
+                }
137
+
138
+                maxWidth = Math.max(maxWidth, width);
139
+            }
140
+        }
141
+
142
+        return cellWidths;
143
+    };
144
+
145
+    this.$rightmostSelectionInCell = function(selectionColumns, cellRightEdge) {
146
+        var rightmost = 0;
147
+
148
+        if (selectionColumns.length) {
149
+            var lengths = [];
150
+            for (var s = 0, length = selectionColumns.length; s < length; s++) {
151
+                if (selectionColumns[s] <= cellRightEdge)
152
+                    lengths.push(s);
153
+                else
154
+                    lengths.push(0);
155
+            }
156
+            rightmost = Math.max.apply(Math, lengths);
157
+        }
158
+
159
+        return rightmost;
160
+    };
161
+
162
+    this.$tabsForRow = function(row) {
163
+        var rowTabs = [], line = this.$editor.session.getLine(row),
164
+            re = /\t/g, match;
165
+
166
+        while ((match = re.exec(line)) != null) {
167
+            rowTabs.push(match.index);
168
+        }
169
+
170
+        return rowTabs;
171
+    };
172
+
173
+    this.$adjustRow = function(row, widths) {
174
+        var rowTabs = this.$tabsForRow(row);
175
+
176
+        if (rowTabs.length == 0)
177
+            return;
178
+
179
+        var bias = 0, location = -1;
180
+        var expandedSet = this.$izip(widths, rowTabs);
181
+
182
+        for (var i = 0, l = expandedSet.length; i < l; i++) {
183
+            var w = expandedSet[i][0], it = expandedSet[i][1];
184
+            location += 1 + w;
185
+            it += bias;
186
+            var difference = location - it;
187
+
188
+            if (difference == 0)
189
+                continue;
190
+
191
+            var partialLine = this.$editor.session.getLine(row).substr(0, it );
192
+            var strippedPartialLine = partialLine.replace(/\s*$/g, "");
193
+            var ispaces = partialLine.length - strippedPartialLine.length;
194
+
195
+            if (difference > 0) {
196
+                this.$editor.session.getDocument().insertInLine({row: row, column: it + 1}, Array(difference + 1).join(" ") + "\t");
197
+                this.$editor.session.getDocument().removeInLine(row, it, it + 1);
198
+
199
+                bias += difference;
200
+            }
201
+
202
+            if (difference < 0 && ispaces >= -difference) {
203
+                this.$editor.session.getDocument().removeInLine(row, it + difference, it);
204
+                bias += difference;
205
+            }
206
+        }
207
+    };
208
+    this.$izip_longest = function(iterables) {
209
+        if (!iterables[0])
210
+            return [];
211
+        var longest = iterables[0].length;
212
+        var iterablesLength = iterables.length;
213
+
214
+        for (var i = 1; i < iterablesLength; i++) {
215
+            var iLength = iterables[i].length;
216
+            if (iLength > longest)
217
+                longest = iLength;
218
+        }
219
+
220
+        var expandedSet = [];
221
+
222
+        for (var l = 0; l < longest; l++) {
223
+            var set = [];
224
+            for (var i = 0; i < iterablesLength; i++) {
225
+                if (iterables[i][l] === "")
226
+                    set.push(NaN);
227
+                else
228
+                    set.push(iterables[i][l]);
229
+            }
230
+
231
+            expandedSet.push(set);
232
+        }
233
+
234
+
235
+        return expandedSet;
236
+    };
237
+    this.$izip = function(widths, tabs) {
238
+        var size = widths.length >= tabs.length ? tabs.length : widths.length;
239
+
240
+        var expandedSet = [];
241
+        for (var i = 0; i < size; i++) {
242
+            var set = [ widths[i], tabs[i] ];
243
+            expandedSet.push(set);
244
+        }
245
+        return expandedSet;
246
+    };
247
+
248
+}).call(ElasticTabstopsLite.prototype);
249
+
250
+exports.ElasticTabstopsLite = ElasticTabstopsLite;
251
+
252
+var Editor = require("../editor").Editor;
253
+require("../config").defineOptions(Editor.prototype, "editor", {
254
+    useElasticTabstops: {
255
+        set: function(val) {
256
+            if (val) {
257
+                if (!this.elasticTabstops)
258
+                    this.elasticTabstops = new ElasticTabstopsLite(this);
259
+                this.commands.on("afterExec", this.elasticTabstops.onAfterExec);
260
+                this.commands.on("exec", this.elasticTabstops.onExec);
261
+                this.on("change", this.elasticTabstops.onChange);
262
+            } else if (this.elasticTabstops) {
263
+                this.commands.removeListener("afterExec", this.elasticTabstops.onAfterExec);
264
+                this.commands.removeListener("exec", this.elasticTabstops.onExec);
265
+                this.removeListener("change", this.elasticTabstops.onChange);
266
+            }
267
+        }
268
+    }
269
+});
270
+
271
+});
272
+                (function() {
273
+                    ace.require(["ace/ext/elastic_tabstops_lite"], function() {});
274
+                })();
275
+            

+ 1190
- 0
generator/lib/ace/ext-emmet.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 6
- 0
generator/lib/ace/ext-error_marker.js Parādīt failu

@@ -0,0 +1,6 @@
1
+
2
+;
3
+                (function() {
4
+                    ace.require(["ace/ext/error_marker"], function() {});
5
+                })();
6
+            

+ 170
- 0
generator/lib/ace/ext-keybinding_menu.js Parādīt failu

@@ -0,0 +1,170 @@
1
+ace.define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
2
+'use strict';
3
+var dom = require("../../lib/dom");
4
+var cssText = "#ace_settingsmenu, #kbshortcutmenu {\
5
+background-color: #F7F7F7;\
6
+color: black;\
7
+box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\
8
+padding: 1em 0.5em 2em 1em;\
9
+overflow: auto;\
10
+position: absolute;\
11
+margin: 0;\
12
+bottom: 0;\
13
+right: 0;\
14
+top: 0;\
15
+z-index: 9991;\
16
+cursor: default;\
17
+}\
18
+.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\
19
+box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\
20
+background-color: rgba(255, 255, 255, 0.6);\
21
+color: black;\
22
+}\
23
+.ace_optionsMenuEntry:hover {\
24
+background-color: rgba(100, 100, 100, 0.1);\
25
+-webkit-transition: all 0.5s;\
26
+transition: all 0.3s\
27
+}\
28
+.ace_closeButton {\
29
+background: rgba(245, 146, 146, 0.5);\
30
+border: 1px solid #F48A8A;\
31
+border-radius: 50%;\
32
+padding: 7px;\
33
+position: absolute;\
34
+right: -8px;\
35
+top: -8px;\
36
+z-index: 1000;\
37
+}\
38
+.ace_closeButton{\
39
+background: rgba(245, 146, 146, 0.9);\
40
+}\
41
+.ace_optionsMenuKey {\
42
+color: darkslateblue;\
43
+font-weight: bold;\
44
+}\
45
+.ace_optionsMenuCommand {\
46
+color: darkcyan;\
47
+font-weight: normal;\
48
+}";
49
+dom.importCssString(cssText);
50
+module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) {
51
+    top = top ? 'top: ' + top + ';' : '';
52
+    bottom = bottom ? 'bottom: ' + bottom + ';' : '';
53
+    right = right ? 'right: ' + right + ';' : '';
54
+    left = left ? 'left: ' + left + ';' : '';
55
+
56
+    var closer = document.createElement('div');
57
+    var contentContainer = document.createElement('div');
58
+
59
+    function documentEscListener(e) {
60
+        if (e.keyCode === 27) {
61
+            closer.click();
62
+        }
63
+    }
64
+
65
+    closer.style.cssText = 'margin: 0; padding: 0; ' +
66
+        'position: fixed; top:0; bottom:0; left:0; right:0;' +
67
+        'z-index: 9990; ' +
68
+        'background-color: rgba(0, 0, 0, 0.3);';
69
+    closer.addEventListener('click', function() {
70
+        document.removeEventListener('keydown', documentEscListener);
71
+        closer.parentNode.removeChild(closer);
72
+        editor.focus();
73
+        closer = null;
74
+    });
75
+    document.addEventListener('keydown', documentEscListener);
76
+
77
+    contentContainer.style.cssText = top + right + bottom + left;
78
+    contentContainer.addEventListener('click', function(e) {
79
+        e.stopPropagation();
80
+    });
81
+
82
+    var wrapper = dom.createElement("div");
83
+    wrapper.style.position = "relative";
84
+    
85
+    var closeButton = dom.createElement("div");
86
+    closeButton.className = "ace_closeButton";
87
+    closeButton.addEventListener('click', function() {
88
+        closer.click();
89
+    });
90
+    
91
+    wrapper.appendChild(closeButton);
92
+    contentContainer.appendChild(wrapper);
93
+    
94
+    contentContainer.appendChild(contentElement);
95
+    closer.appendChild(contentContainer);
96
+    document.body.appendChild(closer);
97
+    editor.blur();
98
+};
99
+
100
+});
101
+
102
+ace.define("ace/ext/menu_tools/get_editor_keyboard_shortcuts",["require","exports","module","ace/lib/keys"], function(require, exports, module) {
103
+"use strict";
104
+var keys = require("../../lib/keys");
105
+module.exports.getEditorKeybordShortcuts = function(editor) {
106
+    var KEY_MODS = keys.KEY_MODS;
107
+    var keybindings = [];
108
+    var commandMap = {};
109
+    editor.keyBinding.$handlers.forEach(function(handler) {
110
+        var ckb = handler.commandKeyBinding;
111
+        for (var i in ckb) {
112
+            var key = i.replace(/(^|-)\w/g, function(x) { return x.toUpperCase(); });
113
+            var commands = ckb[i];
114
+            if (!Array.isArray(commands))
115
+                commands = [commands];
116
+            commands.forEach(function(command) {
117
+                if (typeof command != "string")
118
+                    command  = command.name
119
+                if (commandMap[command]) {
120
+                    commandMap[command].key += "|" + key;
121
+                } else {
122
+                    commandMap[command] = {key: key, command: command};
123
+                    keybindings.push(commandMap[command]);
124
+                }         
125
+            });
126
+        }
127
+    });
128
+    return keybindings;
129
+};
130
+
131
+});
132
+
133
+ace.define("ace/ext/keybinding_menu",["require","exports","module","ace/editor","ace/ext/menu_tools/overlay_page","ace/ext/menu_tools/get_editor_keyboard_shortcuts"], function(require, exports, module) {
134
+    "use strict";
135
+    var Editor = require("ace/editor").Editor;
136
+    function showKeyboardShortcuts (editor) {
137
+        if(!document.getElementById('kbshortcutmenu')) {
138
+            var overlayPage = require('./menu_tools/overlay_page').overlayPage;
139
+            var getEditorKeybordShortcuts = require('./menu_tools/get_editor_keyboard_shortcuts').getEditorKeybordShortcuts;
140
+            var kb = getEditorKeybordShortcuts(editor);
141
+            var el = document.createElement('div');
142
+            var commands = kb.reduce(function(previous, current) {
143
+                return previous + '<div class="ace_optionsMenuEntry"><span class="ace_optionsMenuCommand">' 
144
+                    + current.command + '</span> : '
145
+                    + '<span class="ace_optionsMenuKey">' + current.key + '</span></div>';
146
+            }, '');
147
+
148
+            el.id = 'kbshortcutmenu';
149
+            el.innerHTML = '<h1>Keyboard Shortcuts</h1>' + commands + '</div>';
150
+            overlayPage(editor, el, '0', '0', '0', null);
151
+        }
152
+    };
153
+    module.exports.init = function(editor) {
154
+        Editor.prototype.showKeyboardShortcuts = function() {
155
+            showKeyboardShortcuts(this);
156
+        };
157
+        editor.commands.addCommands([{
158
+            name: "showKeyboardShortcuts",
159
+            bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
160
+            exec: function(editor, line) {
161
+                editor.showKeyboardShortcuts();
162
+            }
163
+        }]);
164
+    };
165
+
166
+});
167
+                (function() {
168
+                    ace.require(["ace/ext/keybinding_menu"], function() {});
169
+                })();
170
+            

+ 1934
- 0
generator/lib/ace/ext-language_tools.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 52
- 0
generator/lib/ace/ext-linking.js Parādīt failu

@@ -0,0 +1,52 @@
1
+ace.define("ace/ext/linking",["require","exports","module","ace/editor","ace/config"], function(require, exports, module) {
2
+
3
+var Editor = require("ace/editor").Editor;
4
+
5
+require("../config").defineOptions(Editor.prototype, "editor", {
6
+    enableLinking: {
7
+        set: function(val) {
8
+            if (val) {
9
+                this.on("click", onClick);
10
+                this.on("mousemove", onMouseMove);
11
+            } else {
12
+                this.off("click", onClick);
13
+                this.off("mousemove", onMouseMove);
14
+            }
15
+        },
16
+        value: false
17
+    }
18
+})
19
+
20
+function onMouseMove(e) {
21
+    var editor = e.editor;
22
+    var ctrl = e.getAccelKey();
23
+
24
+    if (ctrl) {
25
+        var editor = e.editor;
26
+        var docPos = e.getDocumentPosition();
27
+        var session = editor.session;
28
+        var token = session.getTokenAt(docPos.row, docPos.column);
29
+
30
+        editor._emit("linkHover", {position: docPos, token: token});
31
+    }
32
+}
33
+
34
+function onClick(e) {
35
+    var ctrl = e.getAccelKey();
36
+    var button = e.getButton();
37
+
38
+    if (button == 0 && ctrl) {
39
+        var editor = e.editor;
40
+        var docPos = e.getDocumentPosition();
41
+        var session = editor.session;
42
+        var token = session.getTokenAt(docPos.row, docPos.column);
43
+
44
+        editor._emit("linkClick", {position: docPos, token: token});
45
+    }
46
+}
47
+
48
+});
49
+                (function() {
50
+                    ace.require(["ace/ext/linking"], function() {});
51
+                })();
52
+            

+ 187
- 0
generator/lib/ace/ext-modelist.js Parādīt failu

@@ -0,0 +1,187 @@
1
+ace.define("ace/ext/modelist",["require","exports","module"], function(require, exports, module) {
2
+"use strict";
3
+
4
+var modes = [];
5
+function getModeForPath(path) {
6
+    var mode = modesByName.text;
7
+    var fileName = path.split(/[\/\\]/).pop();
8
+    for (var i = 0; i < modes.length; i++) {
9
+        if (modes[i].supportsFile(fileName)) {
10
+            mode = modes[i];
11
+            break;
12
+        }
13
+    }
14
+    return mode;
15
+}
16
+
17
+var Mode = function(name, caption, extensions) {
18
+    this.name = name;
19
+    this.caption = caption;
20
+    this.mode = "ace/mode/" + name;
21
+    this.extensions = extensions;
22
+    if (/\^/.test(extensions)) {
23
+        var re = extensions.replace(/\|(\^)?/g, function(a, b){
24
+            return "$|" + (b ? "^" : "^.*\\.");
25
+        }) + "$";
26
+    } else {
27
+        var re = "^.*\\.(" + extensions + ")$";
28
+    }
29
+
30
+    this.extRe = new RegExp(re, "gi");
31
+};
32
+
33
+Mode.prototype.supportsFile = function(filename) {
34
+    return filename.match(this.extRe);
35
+};
36
+var supportedModes = {
37
+    ABAP:        ["abap"],
38
+    ActionScript:["as"],
39
+    ADA:         ["ada|adb"],
40
+    Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
41
+    AsciiDoc:    ["asciidoc"],
42
+    Assembly_x86:["asm"],
43
+    AutoHotKey:  ["ahk"],
44
+    BatchFile:   ["bat|cmd"],
45
+    C9Search:    ["c9search_results"],
46
+    C_Cpp:       ["cpp|c|cc|cxx|h|hh|hpp"],
47
+    Cirru:       ["cirru|cr"],
48
+    Clojure:     ["clj|cljs"],
49
+    Cobol:       ["CBL|COB"],
50
+    coffee:      ["coffee|cf|cson|^Cakefile"],
51
+    ColdFusion:  ["cfm"],
52
+    CSharp:      ["cs"],
53
+    CSS:         ["css"],
54
+    Curly:       ["curly"],
55
+    D:           ["d|di"],
56
+    Dart:        ["dart"],
57
+    Diff:        ["diff|patch"],
58
+    Dockerfile:  ["^Dockerfile"],
59
+    Dot:         ["dot"],
60
+    Dummy:       ["dummy"],
61
+    DummySyntax: ["dummy"],
62
+    Eiffel:      ["e"],
63
+    EJS:         ["ejs"],
64
+    Elixir:      ["ex|exs"],
65
+    Elm:         ["elm"],
66
+    Erlang:      ["erl|hrl"],
67
+    Forth:       ["frt|fs|ldr"],
68
+    FTL:         ["ftl"],
69
+    Gcode:       ["gcode"],
70
+    Gherkin:     ["feature"],
71
+    Gitignore:   ["^.gitignore"],
72
+    Glsl:        ["glsl|frag|vert"],
73
+    golang:      ["go"],
74
+    Groovy:      ["groovy"],
75
+    HAML:        ["haml"],
76
+    Handlebars:  ["hbs|handlebars|tpl|mustache"],
77
+    Haskell:     ["hs"],
78
+    haXe:        ["hx"],
79
+    HTML:        ["html|htm|xhtml"],
80
+    HTML_Ruby:   ["erb|rhtml|html.erb"],
81
+    INI:         ["ini|conf|cfg|prefs"],
82
+    Io:          ["io"],
83
+    Jack:        ["jack"],
84
+    Jade:        ["jade"],
85
+    Java:        ["java"],
86
+    JavaScript:  ["js|jsm"],
87
+    JSON:        ["json"],
88
+    JSONiq:      ["jq"],
89
+    JSP:         ["jsp"],
90
+    JSX:         ["jsx"],
91
+    Julia:       ["jl"],
92
+    LaTeX:       ["tex|latex|ltx|bib"],
93
+    LESS:        ["less"],
94
+    Liquid:      ["liquid"],
95
+    Lisp:        ["lisp"],
96
+    LiveScript:  ["ls"],
97
+    LogiQL:      ["logic|lql"],
98
+    LSL:         ["lsl"],
99
+    Lua:         ["lua"],
100
+    LuaPage:     ["lp"],
101
+    Lucene:      ["lucene"],
102
+    Makefile:    ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
103
+    Markdown:    ["md|markdown"],
104
+    Mask:        ["mask"],
105
+    MATLAB:      ["matlab"],
106
+    MEL:         ["mel"],
107
+    MUSHCode:    ["mc|mush"],
108
+    MySQL:       ["mysql"],
109
+    Nix:         ["nix"],
110
+    ObjectiveC:  ["m|mm"],
111
+    OCaml:       ["ml|mli"],
112
+    Pascal:      ["pas|p"],
113
+    Perl:        ["pl|pm"],
114
+    pgSQL:       ["pgsql"],
115
+    PHP:         ["php|phtml"],
116
+    Powershell:  ["ps1"],
117
+    Praat:       ["praat|praatscript|psc|proc"],
118
+    Prolog:      ["plg|prolog"],
119
+    Properties:  ["properties"],
120
+    Protobuf:    ["proto"],
121
+    Python:      ["py"],
122
+    R:           ["r"],
123
+    RDoc:        ["Rd"],
124
+    RHTML:       ["Rhtml"],
125
+    Ruby:        ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
126
+    Rust:        ["rs"],
127
+    SASS:        ["sass"],
128
+    SCAD:        ["scad"],
129
+    Scala:       ["scala"],
130
+    Scheme:      ["scm|rkt"],
131
+    SCSS:        ["scss"],
132
+    SH:          ["sh|bash|^.bashrc"],
133
+    SJS:         ["sjs"],
134
+    Smarty:      ["smarty|tpl"],
135
+    snippets:    ["snippets"],
136
+    Soy_Template:["soy"],
137
+    Space:       ["space"],
138
+    SQL:         ["sql"],
139
+    Stylus:      ["styl|stylus"],
140
+    SVG:         ["svg"],
141
+    Tcl:         ["tcl"],
142
+    Tex:         ["tex"],
143
+    Text:        ["txt"],
144
+    Textile:     ["textile"],
145
+    Toml:        ["toml"],
146
+    Twig:        ["twig"],
147
+    Typescript:  ["ts|typescript|str"],
148
+    Vala:        ["vala"],
149
+    VBScript:    ["vbs|vb"],
150
+    Velocity:    ["vm"],
151
+    Verilog:     ["v|vh|sv|svh"],
152
+    VHDL:        ["vhd|vhdl"],
153
+    XML:         ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
154
+    XQuery:      ["xq"],
155
+    YAML:        ["yaml|yml"]
156
+};
157
+
158
+var nameOverrides = {
159
+    ObjectiveC: "Objective-C",
160
+    CSharp: "C#",
161
+    golang: "Go",
162
+    C_Cpp: "C and C++",
163
+    coffee: "CoffeeScript",
164
+    HTML_Ruby: "HTML (Ruby)",
165
+    FTL: "FreeMarker"
166
+};
167
+var modesByName = {};
168
+for (var name in supportedModes) {
169
+    var data = supportedModes[name];
170
+    var displayName = (nameOverrides[name] || name).replace(/_/g, " ");
171
+    var filename = name.toLowerCase();
172
+    var mode = new Mode(filename, displayName, data[0]);
173
+    modesByName[filename] = mode;
174
+    modes.push(mode);
175
+}
176
+
177
+module.exports = {
178
+    getModeForPath: getModeForPath,
179
+    modes: modes,
180
+    modesByName: modesByName
181
+};
182
+
183
+});
184
+                (function() {
185
+                    ace.require(["ace/ext/modelist"], function() {});
186
+                })();
187
+            

+ 494
- 0
generator/lib/ace/ext-old_ie.js Parādīt failu

@@ -0,0 +1,494 @@
1
+ace.define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"], function(require, exports, module) {
2
+"use strict";
3
+
4
+var dom = require("../lib/dom");
5
+var lang = require("../lib/lang");
6
+var event = require("../lib/event");
7
+var searchboxCss = "\
8
+.ace_search {\
9
+background-color: #ddd;\
10
+border: 1px solid #cbcbcb;\
11
+border-top: 0 none;\
12
+max-width: 325px;\
13
+overflow: hidden;\
14
+margin: 0;\
15
+padding: 4px;\
16
+padding-right: 6px;\
17
+padding-bottom: 0;\
18
+position: absolute;\
19
+top: 0px;\
20
+z-index: 99;\
21
+white-space: normal;\
22
+}\
23
+.ace_search.left {\
24
+border-left: 0 none;\
25
+border-radius: 0px 0px 5px 0px;\
26
+left: 0;\
27
+}\
28
+.ace_search.right {\
29
+border-radius: 0px 0px 0px 5px;\
30
+border-right: 0 none;\
31
+right: 0;\
32
+}\
33
+.ace_search_form, .ace_replace_form {\
34
+border-radius: 3px;\
35
+border: 1px solid #cbcbcb;\
36
+float: left;\
37
+margin-bottom: 4px;\
38
+overflow: hidden;\
39
+}\
40
+.ace_search_form.ace_nomatch {\
41
+outline: 1px solid red;\
42
+}\
43
+.ace_search_field {\
44
+background-color: white;\
45
+border-right: 1px solid #cbcbcb;\
46
+border: 0 none;\
47
+-webkit-box-sizing: border-box;\
48
+-moz-box-sizing: border-box;\
49
+box-sizing: border-box;\
50
+float: left;\
51
+height: 22px;\
52
+outline: 0;\
53
+padding: 0 7px;\
54
+width: 214px;\
55
+margin: 0;\
56
+}\
57
+.ace_searchbtn,\
58
+.ace_replacebtn {\
59
+background: #fff;\
60
+border: 0 none;\
61
+border-left: 1px solid #dcdcdc;\
62
+cursor: pointer;\
63
+float: left;\
64
+height: 22px;\
65
+margin: 0;\
66
+padding: 0;\
67
+position: relative;\
68
+}\
69
+.ace_searchbtn:last-child,\
70
+.ace_replacebtn:last-child {\
71
+border-top-right-radius: 3px;\
72
+border-bottom-right-radius: 3px;\
73
+}\
74
+.ace_searchbtn:disabled {\
75
+background: none;\
76
+cursor: default;\
77
+}\
78
+.ace_searchbtn {\
79
+background-position: 50% 50%;\
80
+background-repeat: no-repeat;\
81
+width: 27px;\
82
+}\
83
+.ace_searchbtn.prev {\
84
+background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=);    \
85
+}\
86
+.ace_searchbtn.next {\
87
+background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=);    \
88
+}\
89
+.ace_searchbtn_close {\
90
+background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\
91
+border-radius: 50%;\
92
+border: 0 none;\
93
+color: #656565;\
94
+cursor: pointer;\
95
+float: right;\
96
+font: 16px/16px Arial;\
97
+height: 14px;\
98
+margin: 5px 1px 9px 5px;\
99
+padding: 0;\
100
+text-align: center;\
101
+width: 14px;\
102
+}\
103
+.ace_searchbtn_close:hover {\
104
+background-color: #656565;\
105
+background-position: 50% 100%;\
106
+color: white;\
107
+}\
108
+.ace_replacebtn.prev {\
109
+width: 54px\
110
+}\
111
+.ace_replacebtn.next {\
112
+width: 27px\
113
+}\
114
+.ace_button {\
115
+margin-left: 2px;\
116
+cursor: pointer;\
117
+-webkit-user-select: none;\
118
+-moz-user-select: none;\
119
+-o-user-select: none;\
120
+-ms-user-select: none;\
121
+user-select: none;\
122
+overflow: hidden;\
123
+opacity: 0.7;\
124
+border: 1px solid rgba(100,100,100,0.23);\
125
+padding: 1px;\
126
+-moz-box-sizing: border-box;\
127
+box-sizing:    border-box;\
128
+color: black;\
129
+}\
130
+.ace_button:hover {\
131
+background-color: #eee;\
132
+opacity:1;\
133
+}\
134
+.ace_button:active {\
135
+background-color: #ddd;\
136
+}\
137
+.ace_button.checked {\
138
+border-color: #3399ff;\
139
+opacity:1;\
140
+}\
141
+.ace_search_options{\
142
+margin-bottom: 3px;\
143
+text-align: right;\
144
+-webkit-user-select: none;\
145
+-moz-user-select: none;\
146
+-o-user-select: none;\
147
+-ms-user-select: none;\
148
+user-select: none;\
149
+}";
150
+var HashHandler = require("../keyboard/hash_handler").HashHandler;
151
+var keyUtil = require("../lib/keys");
152
+
153
+dom.importCssString(searchboxCss, "ace_searchbox");
154
+
155
+var html = '<div class="ace_search right">\
156
+    <button type="button" action="hide" class="ace_searchbtn_close"></button>\
157
+    <div class="ace_search_form">\
158
+        <input class="ace_search_field" placeholder="Search for" spellcheck="false"></input>\
159
+        <button type="button" action="findNext" class="ace_searchbtn next"></button>\
160
+        <button type="button" action="findPrev" class="ace_searchbtn prev"></button>\
161
+        <button type="button" action="findAll" class="ace_searchbtn" title="Alt-Enter">All</button>\
162
+    </div>\
163
+    <div class="ace_replace_form">\
164
+        <input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>\
165
+        <button type="button" action="replaceAndFindNext" class="ace_replacebtn">Replace</button>\
166
+        <button type="button" action="replaceAll" class="ace_replacebtn">All</button>\
167
+    </div>\
168
+    <div class="ace_search_options">\
169
+        <span action="toggleRegexpMode" class="ace_button" title="RegExp Search">.*</span>\
170
+        <span action="toggleCaseSensitive" class="ace_button" title="CaseSensitive Search">Aa</span>\
171
+        <span action="toggleWholeWords" class="ace_button" title="Whole Word Search">\\b</span>\
172
+    </div>\
173
+</div>'.replace(/>\s+/g, ">");
174
+
175
+var SearchBox = function(editor, range, showReplaceForm) {
176
+    var div = dom.createElement("div");
177
+    div.innerHTML = html;
178
+    this.element = div.firstChild;
179
+
180
+    this.$init();
181
+    this.setEditor(editor);
182
+};
183
+
184
+(function() {
185
+    this.setEditor = function(editor) {
186
+        editor.searchBox = this;
187
+        editor.container.appendChild(this.element);
188
+        this.editor = editor;
189
+    };
190
+
191
+    this.$initElements = function(sb) {
192
+        this.searchBox = sb.querySelector(".ace_search_form");
193
+        this.replaceBox = sb.querySelector(".ace_replace_form");
194
+        this.searchOptions = sb.querySelector(".ace_search_options");
195
+        this.regExpOption = sb.querySelector("[action=toggleRegexpMode]");
196
+        this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]");
197
+        this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]");
198
+        this.searchInput = this.searchBox.querySelector(".ace_search_field");
199
+        this.replaceInput = this.replaceBox.querySelector(".ace_search_field");
200
+    };
201
+    
202
+    this.$init = function() {
203
+        var sb = this.element;
204
+        
205
+        this.$initElements(sb);
206
+        
207
+        var _this = this;
208
+        event.addListener(sb, "mousedown", function(e) {
209
+            setTimeout(function(){
210
+                _this.activeInput.focus();
211
+            }, 0);
212
+            event.stopPropagation(e);
213
+        });
214
+        event.addListener(sb, "click", function(e) {
215
+            var t = e.target || e.srcElement;
216
+            var action = t.getAttribute("action");
217
+            if (action && _this[action])
218
+                _this[action]();
219
+            else if (_this.$searchBarKb.commands[action])
220
+                _this.$searchBarKb.commands[action].exec(_this);
221
+            event.stopPropagation(e);
222
+        });
223
+
224
+        event.addCommandKeyListener(sb, function(e, hashId, keyCode) {
225
+            var keyString = keyUtil.keyCodeToString(keyCode);
226
+            var command = _this.$searchBarKb.findKeyCommand(hashId, keyString);
227
+            if (command && command.exec) {
228
+                command.exec(_this);
229
+                event.stopEvent(e);
230
+            }
231
+        });
232
+
233
+        this.$onChange = lang.delayedCall(function() {
234
+            _this.find(false, false);
235
+        });
236
+
237
+        event.addListener(this.searchInput, "input", function() {
238
+            _this.$onChange.schedule(20);
239
+        });
240
+        event.addListener(this.searchInput, "focus", function() {
241
+            _this.activeInput = _this.searchInput;
242
+            _this.searchInput.value && _this.highlight();
243
+        });
244
+        event.addListener(this.replaceInput, "focus", function() {
245
+            _this.activeInput = _this.replaceInput;
246
+            _this.searchInput.value && _this.highlight();
247
+        });
248
+    };
249
+    this.$closeSearchBarKb = new HashHandler([{
250
+        bindKey: "Esc",
251
+        name: "closeSearchBar",
252
+        exec: function(editor) {
253
+            editor.searchBox.hide();
254
+        }
255
+    }]);
256
+    this.$searchBarKb = new HashHandler();
257
+    this.$searchBarKb.bindKeys({
258
+        "Ctrl-f|Command-f|Ctrl-H|Command-Option-F": function(sb) {
259
+            var isReplace = sb.isReplace = !sb.isReplace;
260
+            sb.replaceBox.style.display = isReplace ? "" : "none";
261
+            sb[isReplace ? "replaceInput" : "searchInput"].focus();
262
+        },
263
+        "Ctrl-G|Command-G": function(sb) {
264
+            sb.findNext();
265
+        },
266
+        "Ctrl-Shift-G|Command-Shift-G": function(sb) {
267
+            sb.findPrev();
268
+        },
269
+        "esc": function(sb) {
270
+            setTimeout(function() { sb.hide();});
271
+        },
272
+        "Return": function(sb) {
273
+            if (sb.activeInput == sb.replaceInput)
274
+                sb.replace();
275
+            sb.findNext();
276
+        },
277
+        "Shift-Return": function(sb) {
278
+            if (sb.activeInput == sb.replaceInput)
279
+                sb.replace();
280
+            sb.findPrev();
281
+        },
282
+        "Alt-Return": function(sb) {
283
+            if (sb.activeInput == sb.replaceInput)
284
+                sb.replaceAll();
285
+            sb.findAll();
286
+        },
287
+        "Tab": function(sb) {
288
+            (sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
289
+        }
290
+    });
291
+
292
+    this.$searchBarKb.addCommands([{
293
+        name: "toggleRegexpMode",
294
+        bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"},
295
+        exec: function(sb) {
296
+            sb.regExpOption.checked = !sb.regExpOption.checked;
297
+            sb.$syncOptions();
298
+        }
299
+    }, {
300
+        name: "toggleCaseSensitive",
301
+        bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"},
302
+        exec: function(sb) {
303
+            sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked;
304
+            sb.$syncOptions();
305
+        }
306
+    }, {
307
+        name: "toggleWholeWords",
308
+        bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"},
309
+        exec: function(sb) {
310
+            sb.wholeWordOption.checked = !sb.wholeWordOption.checked;
311
+            sb.$syncOptions();
312
+        }
313
+    }]);
314
+
315
+    this.$syncOptions = function() {
316
+        dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
317
+        dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
318
+        dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
319
+        this.find(false, false);
320
+    };
321
+
322
+    this.highlight = function(re) {
323
+        this.editor.session.highlight(re || this.editor.$search.$options.re);
324
+        this.editor.renderer.updateBackMarkers()
325
+    };
326
+    this.find = function(skipCurrent, backwards) {
327
+        var range = this.editor.find(this.searchInput.value, {
328
+            skipCurrent: skipCurrent,
329
+            backwards: backwards,
330
+            wrap: true,
331
+            regExp: this.regExpOption.checked,
332
+            caseSensitive: this.caseSensitiveOption.checked,
333
+            wholeWord: this.wholeWordOption.checked
334
+        });
335
+        var noMatch = !range && this.searchInput.value;
336
+        dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
337
+        this.editor._emit("findSearchBox", { match: !noMatch });
338
+        this.highlight();
339
+    };
340
+    this.findNext = function() {
341
+        this.find(true, false);
342
+    };
343
+    this.findPrev = function() {
344
+        this.find(true, true);
345
+    };
346
+    this.findAll = function(){
347
+        var range = this.editor.findAll(this.searchInput.value, {            
348
+            regExp: this.regExpOption.checked,
349
+            caseSensitive: this.caseSensitiveOption.checked,
350
+            wholeWord: this.wholeWordOption.checked
351
+        });
352
+        var noMatch = !range && this.searchInput.value;
353
+        dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
354
+        this.editor._emit("findSearchBox", { match: !noMatch });
355
+        this.highlight();
356
+        this.hide();
357
+    };
358
+    this.replace = function() {
359
+        if (!this.editor.getReadOnly())
360
+            this.editor.replace(this.replaceInput.value);
361
+    };    
362
+    this.replaceAndFindNext = function() {
363
+        if (!this.editor.getReadOnly()) {
364
+            this.editor.replace(this.replaceInput.value);
365
+            this.findNext()
366
+        }
367
+    };
368
+    this.replaceAll = function() {
369
+        if (!this.editor.getReadOnly())
370
+            this.editor.replaceAll(this.replaceInput.value);
371
+    };
372
+
373
+    this.hide = function() {
374
+        this.element.style.display = "none";
375
+        this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
376
+        this.editor.focus();
377
+    };
378
+    this.show = function(value, isReplace) {
379
+        this.element.style.display = "";
380
+        this.replaceBox.style.display = isReplace ? "" : "none";
381
+
382
+        this.isReplace = isReplace;
383
+
384
+        if (value)
385
+            this.searchInput.value = value;
386
+        this.searchInput.focus();
387
+        this.searchInput.select();
388
+
389
+        this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
390
+    };
391
+
392
+    this.isFocused = function() {
393
+        var el = document.activeElement;
394
+        return el == this.searchInput || el == this.replaceInput;
395
+    }
396
+}).call(SearchBox.prototype);
397
+
398
+exports.SearchBox = SearchBox;
399
+
400
+exports.Search = function(editor, isReplace) {
401
+    var sb = editor.searchBox || new SearchBox(editor);
402
+    sb.show(editor.session.getTextRange(), isReplace);
403
+};
404
+
405
+});
406
+
407
+ace.define("ace/ext/old_ie",["require","exports","module","ace/lib/useragent","ace/tokenizer","ace/ext/searchbox","ace/mode/text"], function(require, exports, module) {
408
+"use strict";
409
+var MAX_TOKEN_COUNT = 1000;
410
+var useragent = require("../lib/useragent");
411
+var TokenizerModule = require("../tokenizer");
412
+
413
+function patch(obj, name, regexp, replacement) {
414
+    eval("obj['" + name + "']=" + obj[name].toString().replace(
415
+        regexp, replacement
416
+    ));
417
+}
418
+
419
+if (useragent.isIE && useragent.isIE < 10 && window.top.document.compatMode === "BackCompat")
420
+    useragent.isOldIE = true;
421
+
422
+if (typeof document != "undefined" && !document.documentElement.querySelector) {    
423
+    useragent.isOldIE = true;
424
+    var qs = function(el, selector) {
425
+        if (selector.charAt(0) == ".") {
426
+            var classNeme = selector.slice(1);
427
+        } else {
428
+            var m = selector.match(/(\w+)=(\w+)/);
429
+            var attr = m && m[1];
430
+            var attrVal = m && m[2];
431
+        }
432
+        for (var i = 0; i < el.all.length; i++) {
433
+            var ch = el.all[i];
434
+            if (classNeme) {
435
+                if (ch.className.indexOf(classNeme) != -1)
436
+                    return ch;
437
+            } else if (attr) {
438
+                if (ch.getAttribute(attr) == attrVal)
439
+                    return ch;
440
+            }
441
+        }
442
+    };
443
+    var sb = require("./searchbox").SearchBox.prototype;
444
+    patch(
445
+        sb, "$initElements",
446
+        /([^\s=]*).querySelector\((".*?")\)/g, 
447
+        "qs($1, $2)"
448
+    );
449
+}
450
+    
451
+var compliantExecNpcg = /()??/.exec("")[1] === undefined;
452
+if (compliantExecNpcg)
453
+    return;
454
+var proto = TokenizerModule.Tokenizer.prototype;
455
+TokenizerModule.Tokenizer_orig = TokenizerModule.Tokenizer;
456
+proto.getLineTokens_orig = proto.getLineTokens;
457
+
458
+patch(
459
+    TokenizerModule, "Tokenizer",
460
+    "ruleRegExps.push(adjustedregex);\n", 
461
+    function(m) {
462
+        return m + '\
463
+        if (state[i].next && RegExp(adjustedregex).test(""))\n\
464
+            rule._qre = RegExp(adjustedregex, "g");\n\
465
+        ';
466
+    }
467
+);
468
+TokenizerModule.Tokenizer.prototype = proto;
469
+patch(
470
+    proto, "getLineTokens",
471
+    /if \(match\[i \+ 1\] === undefined\)\s*continue;/, 
472
+    "if (!match[i + 1]) {\n\
473
+        if (value)continue;\n\
474
+        var qre = state[mapping[i]]._qre;\n\
475
+        if (!qre) continue;\n\
476
+        qre.lastIndex = lastIndex;\n\
477
+        if (!qre.exec(line) || qre.lastIndex != lastIndex)\n\
478
+            continue;\n\
479
+    }"
480
+);
481
+
482
+patch(
483
+    require("../mode/text").Mode.prototype, "getTokenizer",
484
+    /Tokenizer/,
485
+    "TokenizerModule.Tokenizer"
486
+);
487
+
488
+useragent.isOldIE = true;
489
+
490
+});
491
+                (function() {
492
+                    ace.require(["ace/ext/old_ie"], function() {});
493
+                })();
494
+            

+ 409
- 0
generator/lib/ace/ext-searchbox.js Parādīt failu

@@ -0,0 +1,409 @@
1
+ace.define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"], function(require, exports, module) {
2
+"use strict";
3
+
4
+var dom = require("../lib/dom");
5
+var lang = require("../lib/lang");
6
+var event = require("../lib/event");
7
+var searchboxCss = "\
8
+.ace_search {\
9
+background-color: #ddd;\
10
+border: 1px solid #cbcbcb;\
11
+border-top: 0 none;\
12
+max-width: 325px;\
13
+overflow: hidden;\
14
+margin: 0;\
15
+padding: 4px;\
16
+padding-right: 6px;\
17
+padding-bottom: 0;\
18
+position: absolute;\
19
+top: 0px;\
20
+z-index: 99;\
21
+white-space: normal;\
22
+}\
23
+.ace_search.left {\
24
+border-left: 0 none;\
25
+border-radius: 0px 0px 5px 0px;\
26
+left: 0;\
27
+}\
28
+.ace_search.right {\
29
+border-radius: 0px 0px 0px 5px;\
30
+border-right: 0 none;\
31
+right: 0;\
32
+}\
33
+.ace_search_form, .ace_replace_form {\
34
+border-radius: 3px;\
35
+border: 1px solid #cbcbcb;\
36
+float: left;\
37
+margin-bottom: 4px;\
38
+overflow: hidden;\
39
+}\
40
+.ace_search_form.ace_nomatch {\
41
+outline: 1px solid red;\
42
+}\
43
+.ace_search_field {\
44
+background-color: white;\
45
+border-right: 1px solid #cbcbcb;\
46
+border: 0 none;\
47
+-webkit-box-sizing: border-box;\
48
+-moz-box-sizing: border-box;\
49
+box-sizing: border-box;\
50
+float: left;\
51
+height: 22px;\
52
+outline: 0;\
53
+padding: 0 7px;\
54
+width: 214px;\
55
+margin: 0;\
56
+}\
57
+.ace_searchbtn,\
58
+.ace_replacebtn {\
59
+background: #fff;\
60
+border: 0 none;\
61
+border-left: 1px solid #dcdcdc;\
62
+cursor: pointer;\
63
+float: left;\
64
+height: 22px;\
65
+margin: 0;\
66
+padding: 0;\
67
+position: relative;\
68
+}\
69
+.ace_searchbtn:last-child,\
70
+.ace_replacebtn:last-child {\
71
+border-top-right-radius: 3px;\
72
+border-bottom-right-radius: 3px;\
73
+}\
74
+.ace_searchbtn:disabled {\
75
+background: none;\
76
+cursor: default;\
77
+}\
78
+.ace_searchbtn {\
79
+background-position: 50% 50%;\
80
+background-repeat: no-repeat;\
81
+width: 27px;\
82
+}\
83
+.ace_searchbtn.prev {\
84
+background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=);    \
85
+}\
86
+.ace_searchbtn.next {\
87
+background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=);    \
88
+}\
89
+.ace_searchbtn_close {\
90
+background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\
91
+border-radius: 50%;\
92
+border: 0 none;\
93
+color: #656565;\
94
+cursor: pointer;\
95
+float: right;\
96
+font: 16px/16px Arial;\
97
+height: 14px;\
98
+margin: 5px 1px 9px 5px;\
99
+padding: 0;\
100
+text-align: center;\
101
+width: 14px;\
102
+}\
103
+.ace_searchbtn_close:hover {\
104
+background-color: #656565;\
105
+background-position: 50% 100%;\
106
+color: white;\
107
+}\
108
+.ace_replacebtn.prev {\
109
+width: 54px\
110
+}\
111
+.ace_replacebtn.next {\
112
+width: 27px\
113
+}\
114
+.ace_button {\
115
+margin-left: 2px;\
116
+cursor: pointer;\
117
+-webkit-user-select: none;\
118
+-moz-user-select: none;\
119
+-o-user-select: none;\
120
+-ms-user-select: none;\
121
+user-select: none;\
122
+overflow: hidden;\
123
+opacity: 0.7;\
124
+border: 1px solid rgba(100,100,100,0.23);\
125
+padding: 1px;\
126
+-moz-box-sizing: border-box;\
127
+box-sizing:    border-box;\
128
+color: black;\
129
+}\
130
+.ace_button:hover {\
131
+background-color: #eee;\
132
+opacity:1;\
133
+}\
134
+.ace_button:active {\
135
+background-color: #ddd;\
136
+}\
137
+.ace_button.checked {\
138
+border-color: #3399ff;\
139
+opacity:1;\
140
+}\
141
+.ace_search_options{\
142
+margin-bottom: 3px;\
143
+text-align: right;\
144
+-webkit-user-select: none;\
145
+-moz-user-select: none;\
146
+-o-user-select: none;\
147
+-ms-user-select: none;\
148
+user-select: none;\
149
+}";
150
+var HashHandler = require("../keyboard/hash_handler").HashHandler;
151
+var keyUtil = require("../lib/keys");
152
+
153
+dom.importCssString(searchboxCss, "ace_searchbox");
154
+
155
+var html = '<div class="ace_search right">\
156
+    <button type="button" action="hide" class="ace_searchbtn_close"></button>\
157
+    <div class="ace_search_form">\
158
+        <input class="ace_search_field" placeholder="Search for" spellcheck="false"></input>\
159
+        <button type="button" action="findNext" class="ace_searchbtn next"></button>\
160
+        <button type="button" action="findPrev" class="ace_searchbtn prev"></button>\
161
+        <button type="button" action="findAll" class="ace_searchbtn" title="Alt-Enter">All</button>\
162
+    </div>\
163
+    <div class="ace_replace_form">\
164
+        <input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>\
165
+        <button type="button" action="replaceAndFindNext" class="ace_replacebtn">Replace</button>\
166
+        <button type="button" action="replaceAll" class="ace_replacebtn">All</button>\
167
+    </div>\
168
+    <div class="ace_search_options">\
169
+        <span action="toggleRegexpMode" class="ace_button" title="RegExp Search">.*</span>\
170
+        <span action="toggleCaseSensitive" class="ace_button" title="CaseSensitive Search">Aa</span>\
171
+        <span action="toggleWholeWords" class="ace_button" title="Whole Word Search">\\b</span>\
172
+    </div>\
173
+</div>'.replace(/>\s+/g, ">");
174
+
175
+var SearchBox = function(editor, range, showReplaceForm) {
176
+    var div = dom.createElement("div");
177
+    div.innerHTML = html;
178
+    this.element = div.firstChild;
179
+
180
+    this.$init();
181
+    this.setEditor(editor);
182
+};
183
+
184
+(function() {
185
+    this.setEditor = function(editor) {
186
+        editor.searchBox = this;
187
+        editor.container.appendChild(this.element);
188
+        this.editor = editor;
189
+    };
190
+
191
+    this.$initElements = function(sb) {
192
+        this.searchBox = sb.querySelector(".ace_search_form");
193
+        this.replaceBox = sb.querySelector(".ace_replace_form");
194
+        this.searchOptions = sb.querySelector(".ace_search_options");
195
+        this.regExpOption = sb.querySelector("[action=toggleRegexpMode]");
196
+        this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]");
197
+        this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]");
198
+        this.searchInput = this.searchBox.querySelector(".ace_search_field");
199
+        this.replaceInput = this.replaceBox.querySelector(".ace_search_field");
200
+    };
201
+    
202
+    this.$init = function() {
203
+        var sb = this.element;
204
+        
205
+        this.$initElements(sb);
206
+        
207
+        var _this = this;
208
+        event.addListener(sb, "mousedown", function(e) {
209
+            setTimeout(function(){
210
+                _this.activeInput.focus();
211
+            }, 0);
212
+            event.stopPropagation(e);
213
+        });
214
+        event.addListener(sb, "click", function(e) {
215
+            var t = e.target || e.srcElement;
216
+            var action = t.getAttribute("action");
217
+            if (action && _this[action])
218
+                _this[action]();
219
+            else if (_this.$searchBarKb.commands[action])
220
+                _this.$searchBarKb.commands[action].exec(_this);
221
+            event.stopPropagation(e);
222
+        });
223
+
224
+        event.addCommandKeyListener(sb, function(e, hashId, keyCode) {
225
+            var keyString = keyUtil.keyCodeToString(keyCode);
226
+            var command = _this.$searchBarKb.findKeyCommand(hashId, keyString);
227
+            if (command && command.exec) {
228
+                command.exec(_this);
229
+                event.stopEvent(e);
230
+            }
231
+        });
232
+
233
+        this.$onChange = lang.delayedCall(function() {
234
+            _this.find(false, false);
235
+        });
236
+
237
+        event.addListener(this.searchInput, "input", function() {
238
+            _this.$onChange.schedule(20);
239
+        });
240
+        event.addListener(this.searchInput, "focus", function() {
241
+            _this.activeInput = _this.searchInput;
242
+            _this.searchInput.value && _this.highlight();
243
+        });
244
+        event.addListener(this.replaceInput, "focus", function() {
245
+            _this.activeInput = _this.replaceInput;
246
+            _this.searchInput.value && _this.highlight();
247
+        });
248
+    };
249
+    this.$closeSearchBarKb = new HashHandler([{
250
+        bindKey: "Esc",
251
+        name: "closeSearchBar",
252
+        exec: function(editor) {
253
+            editor.searchBox.hide();
254
+        }
255
+    }]);
256
+    this.$searchBarKb = new HashHandler();
257
+    this.$searchBarKb.bindKeys({
258
+        "Ctrl-f|Command-f|Ctrl-H|Command-Option-F": function(sb) {
259
+            var isReplace = sb.isReplace = !sb.isReplace;
260
+            sb.replaceBox.style.display = isReplace ? "" : "none";
261
+            sb[isReplace ? "replaceInput" : "searchInput"].focus();
262
+        },
263
+        "Ctrl-G|Command-G": function(sb) {
264
+            sb.findNext();
265
+        },
266
+        "Ctrl-Shift-G|Command-Shift-G": function(sb) {
267
+            sb.findPrev();
268
+        },
269
+        "esc": function(sb) {
270
+            setTimeout(function() { sb.hide();});
271
+        },
272
+        "Return": function(sb) {
273
+            if (sb.activeInput == sb.replaceInput)
274
+                sb.replace();
275
+            sb.findNext();
276
+        },
277
+        "Shift-Return": function(sb) {
278
+            if (sb.activeInput == sb.replaceInput)
279
+                sb.replace();
280
+            sb.findPrev();
281
+        },
282
+        "Alt-Return": function(sb) {
283
+            if (sb.activeInput == sb.replaceInput)
284
+                sb.replaceAll();
285
+            sb.findAll();
286
+        },
287
+        "Tab": function(sb) {
288
+            (sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
289
+        }
290
+    });
291
+
292
+    this.$searchBarKb.addCommands([{
293
+        name: "toggleRegexpMode",
294
+        bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"},
295
+        exec: function(sb) {
296
+            sb.regExpOption.checked = !sb.regExpOption.checked;
297
+            sb.$syncOptions();
298
+        }
299
+    }, {
300
+        name: "toggleCaseSensitive",
301
+        bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"},
302
+        exec: function(sb) {
303
+            sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked;
304
+            sb.$syncOptions();
305
+        }
306
+    }, {
307
+        name: "toggleWholeWords",
308
+        bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"},
309
+        exec: function(sb) {
310
+            sb.wholeWordOption.checked = !sb.wholeWordOption.checked;
311
+            sb.$syncOptions();
312
+        }
313
+    }]);
314
+
315
+    this.$syncOptions = function() {
316
+        dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
317
+        dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
318
+        dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
319
+        this.find(false, false);
320
+    };
321
+
322
+    this.highlight = function(re) {
323
+        this.editor.session.highlight(re || this.editor.$search.$options.re);
324
+        this.editor.renderer.updateBackMarkers()
325
+    };
326
+    this.find = function(skipCurrent, backwards) {
327
+        var range = this.editor.find(this.searchInput.value, {
328
+            skipCurrent: skipCurrent,
329
+            backwards: backwards,
330
+            wrap: true,
331
+            regExp: this.regExpOption.checked,
332
+            caseSensitive: this.caseSensitiveOption.checked,
333
+            wholeWord: this.wholeWordOption.checked
334
+        });
335
+        var noMatch = !range && this.searchInput.value;
336
+        dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
337
+        this.editor._emit("findSearchBox", { match: !noMatch });
338
+        this.highlight();
339
+    };
340
+    this.findNext = function() {
341
+        this.find(true, false);
342
+    };
343
+    this.findPrev = function() {
344
+        this.find(true, true);
345
+    };
346
+    this.findAll = function(){
347
+        var range = this.editor.findAll(this.searchInput.value, {            
348
+            regExp: this.regExpOption.checked,
349
+            caseSensitive: this.caseSensitiveOption.checked,
350
+            wholeWord: this.wholeWordOption.checked
351
+        });
352
+        var noMatch = !range && this.searchInput.value;
353
+        dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
354
+        this.editor._emit("findSearchBox", { match: !noMatch });
355
+        this.highlight();
356
+        this.hide();
357
+    };
358
+    this.replace = function() {
359
+        if (!this.editor.getReadOnly())
360
+            this.editor.replace(this.replaceInput.value);
361
+    };    
362
+    this.replaceAndFindNext = function() {
363
+        if (!this.editor.getReadOnly()) {
364
+            this.editor.replace(this.replaceInput.value);
365
+            this.findNext()
366
+        }
367
+    };
368
+    this.replaceAll = function() {
369
+        if (!this.editor.getReadOnly())
370
+            this.editor.replaceAll(this.replaceInput.value);
371
+    };
372
+
373
+    this.hide = function() {
374
+        this.element.style.display = "none";
375
+        this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
376
+        this.editor.focus();
377
+    };
378
+    this.show = function(value, isReplace) {
379
+        this.element.style.display = "";
380
+        this.replaceBox.style.display = isReplace ? "" : "none";
381
+
382
+        this.isReplace = isReplace;
383
+
384
+        if (value)
385
+            this.searchInput.value = value;
386
+        this.searchInput.focus();
387
+        this.searchInput.select();
388
+
389
+        this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
390
+    };
391
+
392
+    this.isFocused = function() {
393
+        var el = document.activeElement;
394
+        return el == this.searchInput || el == this.replaceInput;
395
+    }
396
+}).call(SearchBox.prototype);
397
+
398
+exports.SearchBox = SearchBox;
399
+
400
+exports.Search = function(editor, isReplace) {
401
+    var sb = editor.searchBox || new SearchBox(editor);
402
+    sb.show(editor.session.getTextRange(), isReplace);
403
+};
404
+
405
+});
406
+                (function() {
407
+                    ace.require(["ace/ext/searchbox"], function() {});
408
+                })();
409
+            

+ 637
- 0
generator/lib/ace/ext-settings_menu.js Parādīt failu

@@ -0,0 +1,637 @@
1
+ace.define("ace/ext/menu_tools/element_generator",["require","exports","module"], function(require, exports, module) {
2
+'use strict';
3
+module.exports.createOption = function createOption (obj) {
4
+    var attribute;
5
+    var el = document.createElement('option');
6
+    for(attribute in obj) {
7
+        if(obj.hasOwnProperty(attribute)) {
8
+            if(attribute === 'selected') {
9
+                el.setAttribute(attribute, obj[attribute]);
10
+            } else {
11
+                el[attribute] = obj[attribute];
12
+            }
13
+        }
14
+    }
15
+    return el;
16
+};
17
+module.exports.createCheckbox = function createCheckbox (id, checked, clss) {
18
+    var el = document.createElement('input');
19
+    el.setAttribute('type', 'checkbox');
20
+    el.setAttribute('id', id);
21
+    el.setAttribute('name', id);
22
+    el.setAttribute('value', checked);
23
+    el.setAttribute('class', clss);
24
+    if(checked) {
25
+        el.setAttribute('checked', 'checked');
26
+    }
27
+    return el;
28
+};
29
+module.exports.createInput = function createInput (id, value, clss) {
30
+    var el = document.createElement('input');
31
+    el.setAttribute('type', 'text');
32
+    el.setAttribute('id', id);
33
+    el.setAttribute('name', id);
34
+    el.setAttribute('value', value);
35
+    el.setAttribute('class', clss);
36
+    return el;
37
+};
38
+module.exports.createLabel = function createLabel (text, labelFor) {
39
+    var el = document.createElement('label');
40
+    el.setAttribute('for', labelFor);
41
+    el.textContent = text;
42
+    return el;
43
+};
44
+module.exports.createSelection = function createSelection (id, values, clss) {
45
+    var el = document.createElement('select');
46
+    el.setAttribute('id', id);
47
+    el.setAttribute('name', id);
48
+    el.setAttribute('class', clss);
49
+    values.forEach(function(item) {
50
+        el.appendChild(module.exports.createOption(item));
51
+    });
52
+    return el;
53
+};
54
+
55
+});
56
+
57
+ace.define("ace/ext/modelist",["require","exports","module"], function(require, exports, module) {
58
+"use strict";
59
+
60
+var modes = [];
61
+function getModeForPath(path) {
62
+    var mode = modesByName.text;
63
+    var fileName = path.split(/[\/\\]/).pop();
64
+    for (var i = 0; i < modes.length; i++) {
65
+        if (modes[i].supportsFile(fileName)) {
66
+            mode = modes[i];
67
+            break;
68
+        }
69
+    }
70
+    return mode;
71
+}
72
+
73
+var Mode = function(name, caption, extensions) {
74
+    this.name = name;
75
+    this.caption = caption;
76
+    this.mode = "ace/mode/" + name;
77
+    this.extensions = extensions;
78
+    if (/\^/.test(extensions)) {
79
+        var re = extensions.replace(/\|(\^)?/g, function(a, b){
80
+            return "$|" + (b ? "^" : "^.*\\.");
81
+        }) + "$";
82
+    } else {
83
+        var re = "^.*\\.(" + extensions + ")$";
84
+    }
85
+
86
+    this.extRe = new RegExp(re, "gi");
87
+};
88
+
89
+Mode.prototype.supportsFile = function(filename) {
90
+    return filename.match(this.extRe);
91
+};
92
+var supportedModes = {
93
+    ABAP:        ["abap"],
94
+    ActionScript:["as"],
95
+    ADA:         ["ada|adb"],
96
+    Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"],
97
+    AsciiDoc:    ["asciidoc"],
98
+    Assembly_x86:["asm"],
99
+    AutoHotKey:  ["ahk"],
100
+    BatchFile:   ["bat|cmd"],
101
+    C9Search:    ["c9search_results"],
102
+    C_Cpp:       ["cpp|c|cc|cxx|h|hh|hpp"],
103
+    Cirru:       ["cirru|cr"],
104
+    Clojure:     ["clj|cljs"],
105
+    Cobol:       ["CBL|COB"],
106
+    coffee:      ["coffee|cf|cson|^Cakefile"],
107
+    ColdFusion:  ["cfm"],
108
+    CSharp:      ["cs"],
109
+    CSS:         ["css"],
110
+    Curly:       ["curly"],
111
+    D:           ["d|di"],
112
+    Dart:        ["dart"],
113
+    Diff:        ["diff|patch"],
114
+    Dockerfile:  ["^Dockerfile"],
115
+    Dot:         ["dot"],
116
+    Dummy:       ["dummy"],
117
+    DummySyntax: ["dummy"],
118
+    Eiffel:      ["e"],
119
+    EJS:         ["ejs"],
120
+    Elixir:      ["ex|exs"],
121
+    Elm:         ["elm"],
122
+    Erlang:      ["erl|hrl"],
123
+    Forth:       ["frt|fs|ldr"],
124
+    FTL:         ["ftl"],
125
+    Gcode:       ["gcode"],
126
+    Gherkin:     ["feature"],
127
+    Gitignore:   ["^.gitignore"],
128
+    Glsl:        ["glsl|frag|vert"],
129
+    golang:      ["go"],
130
+    Groovy:      ["groovy"],
131
+    HAML:        ["haml"],
132
+    Handlebars:  ["hbs|handlebars|tpl|mustache"],
133
+    Haskell:     ["hs"],
134
+    haXe:        ["hx"],
135
+    HTML:        ["html|htm|xhtml"],
136
+    HTML_Ruby:   ["erb|rhtml|html.erb"],
137
+    INI:         ["ini|conf|cfg|prefs"],
138
+    Io:          ["io"],
139
+    Jack:        ["jack"],
140
+    Jade:        ["jade"],
141
+    Java:        ["java"],
142
+    JavaScript:  ["js|jsm"],
143
+    JSON:        ["json"],
144
+    JSONiq:      ["jq"],
145
+    JSP:         ["jsp"],
146
+    JSX:         ["jsx"],
147
+    Julia:       ["jl"],
148
+    LaTeX:       ["tex|latex|ltx|bib"],
149
+    LESS:        ["less"],
150
+    Liquid:      ["liquid"],
151
+    Lisp:        ["lisp"],
152
+    LiveScript:  ["ls"],
153
+    LogiQL:      ["logic|lql"],
154
+    LSL:         ["lsl"],
155
+    Lua:         ["lua"],
156
+    LuaPage:     ["lp"],
157
+    Lucene:      ["lucene"],
158
+    Makefile:    ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
159
+    Markdown:    ["md|markdown"],
160
+    Mask:        ["mask"],
161
+    MATLAB:      ["matlab"],
162
+    MEL:         ["mel"],
163
+    MUSHCode:    ["mc|mush"],
164
+    MySQL:       ["mysql"],
165
+    Nix:         ["nix"],
166
+    ObjectiveC:  ["m|mm"],
167
+    OCaml:       ["ml|mli"],
168
+    Pascal:      ["pas|p"],
169
+    Perl:        ["pl|pm"],
170
+    pgSQL:       ["pgsql"],
171
+    PHP:         ["php|phtml"],
172
+    Powershell:  ["ps1"],
173
+    Praat:       ["praat|praatscript|psc|proc"],
174
+    Prolog:      ["plg|prolog"],
175
+    Properties:  ["properties"],
176
+    Protobuf:    ["proto"],
177
+    Python:      ["py"],
178
+    R:           ["r"],
179
+    RDoc:        ["Rd"],
180
+    RHTML:       ["Rhtml"],
181
+    Ruby:        ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
182
+    Rust:        ["rs"],
183
+    SASS:        ["sass"],
184
+    SCAD:        ["scad"],
185
+    Scala:       ["scala"],
186
+    Scheme:      ["scm|rkt"],
187
+    SCSS:        ["scss"],
188
+    SH:          ["sh|bash|^.bashrc"],
189
+    SJS:         ["sjs"],
190
+    Smarty:      ["smarty|tpl"],
191
+    snippets:    ["snippets"],
192
+    Soy_Template:["soy"],
193
+    Space:       ["space"],
194
+    SQL:         ["sql"],
195
+    Stylus:      ["styl|stylus"],
196
+    SVG:         ["svg"],
197
+    Tcl:         ["tcl"],
198
+    Tex:         ["tex"],
199
+    Text:        ["txt"],
200
+    Textile:     ["textile"],
201
+    Toml:        ["toml"],
202
+    Twig:        ["twig"],
203
+    Typescript:  ["ts|typescript|str"],
204
+    Vala:        ["vala"],
205
+    VBScript:    ["vbs|vb"],
206
+    Velocity:    ["vm"],
207
+    Verilog:     ["v|vh|sv|svh"],
208
+    VHDL:        ["vhd|vhdl"],
209
+    XML:         ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
210
+    XQuery:      ["xq"],
211
+    YAML:        ["yaml|yml"]
212
+};
213
+
214
+var nameOverrides = {
215
+    ObjectiveC: "Objective-C",
216
+    CSharp: "C#",
217
+    golang: "Go",
218
+    C_Cpp: "C and C++",
219
+    coffee: "CoffeeScript",
220
+    HTML_Ruby: "HTML (Ruby)",
221
+    FTL: "FreeMarker"
222
+};
223
+var modesByName = {};
224
+for (var name in supportedModes) {
225
+    var data = supportedModes[name];
226
+    var displayName = (nameOverrides[name] || name).replace(/_/g, " ");
227
+    var filename = name.toLowerCase();
228
+    var mode = new Mode(filename, displayName, data[0]);
229
+    modesByName[filename] = mode;
230
+    modes.push(mode);
231
+}
232
+
233
+module.exports = {
234
+    getModeForPath: getModeForPath,
235
+    modes: modes,
236
+    modesByName: modesByName
237
+};
238
+
239
+});
240
+
241
+ace.define("ace/ext/themelist",["require","exports","module","ace/lib/fixoldbrowsers"], function(require, exports, module) {
242
+"use strict";
243
+require("ace/lib/fixoldbrowsers");
244
+
245
+var themeData = [
246
+    ["Chrome"         ],
247
+    ["Clouds"         ],
248
+    ["Crimson Editor" ],
249
+    ["Dawn"           ],
250
+    ["Dreamweaver"    ],
251
+    ["Eclipse"        ],
252
+    ["GitHub"         ],
253
+    ["Solarized Light"],
254
+    ["TextMate"       ],
255
+    ["Tomorrow"       ],
256
+    ["XCode"          ],
257
+    ["Kuroir"],
258
+    ["KatzenMilch"],
259
+    ["Ambiance"             ,"ambiance"                ,  "dark"],
260
+    ["Chaos"                ,"chaos"                   ,  "dark"],
261
+    ["Clouds Midnight"      ,"clouds_midnight"         ,  "dark"],
262
+    ["Cobalt"               ,"cobalt"                  ,  "dark"],
263
+    ["idle Fingers"         ,"idle_fingers"            ,  "dark"],
264
+    ["krTheme"              ,"kr_theme"                ,  "dark"],
265
+    ["Merbivore"            ,"merbivore"               ,  "dark"],
266
+    ["Merbivore Soft"       ,"merbivore_soft"          ,  "dark"],
267
+    ["Mono Industrial"      ,"mono_industrial"         ,  "dark"],
268
+    ["Monokai"              ,"monokai"                 ,  "dark"],
269
+    ["Pastel on dark"       ,"pastel_on_dark"          ,  "dark"],
270
+    ["Solarized Dark"       ,"solarized_dark"          ,  "dark"],
271
+    ["Terminal"             ,"terminal"                ,  "dark"],
272
+    ["Tomorrow Night"       ,"tomorrow_night"          ,  "dark"],
273
+    ["Tomorrow Night Blue"  ,"tomorrow_night_blue"     ,  "dark"],
274
+    ["Tomorrow Night Bright","tomorrow_night_bright"   ,  "dark"],
275
+    ["Tomorrow Night 80s"   ,"tomorrow_night_eighties" ,  "dark"],
276
+    ["Twilight"             ,"twilight"                ,  "dark"],
277
+    ["Vibrant Ink"          ,"vibrant_ink"             ,  "dark"]
278
+];
279
+
280
+
281
+exports.themesByName = {};
282
+exports.themes = themeData.map(function(data) {
283
+    var name = data[1] || data[0].replace(/ /g, "_").toLowerCase();
284
+    var theme = {
285
+        caption: data[0],
286
+        theme: "ace/theme/" + name,
287
+        isDark: data[2] == "dark",
288
+        name: name
289
+    };
290
+    exports.themesByName[name] = theme;
291
+    return theme;
292
+});
293
+
294
+});
295
+
296
+ace.define("ace/ext/menu_tools/add_editor_menu_options",["require","exports","module","ace/ext/modelist","ace/ext/themelist"], function(require, exports, module) {
297
+'use strict';
298
+module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) {
299
+    var modelist = require('../modelist');
300
+    var themelist = require('../themelist');
301
+    editor.menuOptions = {
302
+        setNewLineMode: [{
303
+            textContent: "unix",
304
+            value: "unix"
305
+        }, {
306
+            textContent: "windows",
307
+            value: "windows"
308
+        }, {
309
+            textContent: "auto",
310
+            value: "auto"
311
+        }],
312
+        setTheme: [],
313
+        setMode: [],
314
+        setKeyboardHandler: [{
315
+            textContent: "ace",
316
+            value: ""
317
+        }, {
318
+            textContent: "vim",
319
+            value: "ace/keyboard/vim"
320
+        }, {
321
+            textContent: "emacs",
322
+            value: "ace/keyboard/emacs"
323
+        }, {
324
+            textContent: "textarea",
325
+            value: "ace/keyboard/textarea"
326
+        }, {
327
+            textContent: "sublime",
328
+            value: "ace/keyboard/sublime"
329
+        }]
330
+    };
331
+
332
+    editor.menuOptions.setTheme = themelist.themes.map(function(theme) {
333
+        return {
334
+            textContent: theme.caption,
335
+            value: theme.theme
336
+        };
337
+    });
338
+
339
+    editor.menuOptions.setMode = modelist.modes.map(function(mode) {
340
+        return {
341
+            textContent: mode.name,
342
+            value: mode.mode
343
+        };
344
+    });
345
+};
346
+
347
+
348
+});
349
+
350
+ace.define("ace/ext/menu_tools/get_set_functions",["require","exports","module"], function(require, exports, module) {
351
+'use strict';
352
+module.exports.getSetFunctions = function getSetFunctions (editor) {
353
+    var out = [];
354
+    var my = {
355
+        'editor' : editor,
356
+        'session' : editor.session,
357
+        'renderer' : editor.renderer
358
+    };
359
+    var opts = [];
360
+    var skip = [
361
+        'setOption',
362
+        'setUndoManager',
363
+        'setDocument',
364
+        'setValue',
365
+        'setBreakpoints',
366
+        'setScrollTop',
367
+        'setScrollLeft',
368
+        'setSelectionStyle',
369
+        'setWrapLimitRange'
370
+    ];
371
+    ['renderer', 'session', 'editor'].forEach(function(esra) {
372
+        var esr = my[esra];
373
+        var clss = esra;
374
+        for(var fn in esr) {
375
+            if(skip.indexOf(fn) === -1) {
376
+                if(/^set/.test(fn) && opts.indexOf(fn) === -1) {
377
+                    opts.push(fn);
378
+                    out.push({
379
+                        'functionName' : fn,
380
+                        'parentObj' : esr,
381
+                        'parentName' : clss
382
+                    });
383
+                }
384
+            }
385
+        }
386
+    });
387
+    return out;
388
+};
389
+
390
+});
391
+
392
+ace.define("ace/ext/menu_tools/generate_settings_menu",["require","exports","module","ace/ext/menu_tools/element_generator","ace/ext/menu_tools/add_editor_menu_options","ace/ext/menu_tools/get_set_functions"], function(require, exports, module) {
393
+'use strict';
394
+var egen = require('./element_generator');
395
+var addEditorMenuOptions = require('./add_editor_menu_options').addEditorMenuOptions;
396
+var getSetFunctions = require('./get_set_functions').getSetFunctions;
397
+module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
398
+    var elements = [];
399
+    function cleanupElementsList() {
400
+        elements.sort(function(a, b) {
401
+            var x = a.getAttribute('contains');
402
+            var y = b.getAttribute('contains');
403
+            return x.localeCompare(y);
404
+        });
405
+    }
406
+    function wrapElements() {
407
+        var topmenu = document.createElement('div');
408
+        topmenu.setAttribute('id', 'ace_settingsmenu');
409
+        elements.forEach(function(element) {
410
+            topmenu.appendChild(element);
411
+        });
412
+        
413
+        var el = topmenu.appendChild(document.createElement('div'));
414
+        var version = "1.1.8";
415
+        el.style.padding = "1em";
416
+        el.textContent = "Ace version " + version;
417
+        
418
+        return topmenu;
419
+    }
420
+    function createNewEntry(obj, clss, item, val) {
421
+        var el;
422
+        var div = document.createElement('div');
423
+        div.setAttribute('contains', item);
424
+        div.setAttribute('class', 'ace_optionsMenuEntry');
425
+        div.setAttribute('style', 'clear: both;');
426
+
427
+        div.appendChild(egen.createLabel(
428
+            item.replace(/^set/, '').replace(/([A-Z])/g, ' $1').trim(),
429
+            item
430
+        ));
431
+
432
+        if (Array.isArray(val)) {
433
+            el = egen.createSelection(item, val, clss);
434
+            el.addEventListener('change', function(e) {
435
+                try{
436
+                    editor.menuOptions[e.target.id].forEach(function(x) {
437
+                        if(x.textContent !== e.target.textContent) {
438
+                            delete x.selected;
439
+                        }
440
+                    });
441
+                    obj[e.target.id](e.target.value);
442
+                } catch (err) {
443
+                    throw new Error(err);
444
+                }
445
+            });
446
+        } else if(typeof val === 'boolean') {
447
+            el = egen.createCheckbox(item, val, clss);
448
+            el.addEventListener('change', function(e) {
449
+                try{
450
+                    obj[e.target.id](!!e.target.checked);
451
+                } catch (err) {
452
+                    throw new Error(err);
453
+                }
454
+            });
455
+        } else {
456
+            el = egen.createInput(item, val, clss);
457
+            el.addEventListener('change', function(e) {
458
+                try{
459
+                    if(e.target.value === 'true') {
460
+                        obj[e.target.id](true);
461
+                    } else if(e.target.value === 'false') {
462
+                        obj[e.target.id](false);
463
+                    } else {
464
+                        obj[e.target.id](e.target.value);
465
+                    }
466
+                } catch (err) {
467
+                    throw new Error(err);
468
+                }
469
+            });
470
+        }
471
+        el.style.cssText = 'float:right;';
472
+        div.appendChild(el);
473
+        return div;
474
+    }
475
+    function makeDropdown(item, esr, clss, fn) {
476
+        var val = editor.menuOptions[item];
477
+        var currentVal = esr[fn]();
478
+        if (typeof currentVal == 'object')
479
+            currentVal = currentVal.$id;
480
+        val.forEach(function(valuex) {
481
+            if (valuex.value === currentVal)
482
+                valuex.selected = 'selected';
483
+        });
484
+        return createNewEntry(esr, clss, item, val);
485
+    }
486
+    function handleSet(setObj) {
487
+        var item = setObj.functionName;
488
+        var esr = setObj.parentObj;
489
+        var clss = setObj.parentName;
490
+        var val;
491
+        var fn = item.replace(/^set/, 'get');
492
+        if(editor.menuOptions[item] !== undefined) {
493
+            elements.push(makeDropdown(item, esr, clss, fn));
494
+        } else if(typeof esr[fn] === 'function') {
495
+            try {
496
+                val = esr[fn]();
497
+                if(typeof val === 'object') {
498
+                    val = val.$id;
499
+                }
500
+                elements.push(
501
+                    createNewEntry(esr, clss, item, val)
502
+                );
503
+            } catch (e) {
504
+            }
505
+        }
506
+    }
507
+    addEditorMenuOptions(editor);
508
+    getSetFunctions(editor).forEach(function(setObj) {
509
+        handleSet(setObj);
510
+    });
511
+    cleanupElementsList();
512
+    return wrapElements();
513
+};
514
+
515
+});
516
+
517
+ace.define("ace/ext/menu_tools/overlay_page",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
518
+'use strict';
519
+var dom = require("../../lib/dom");
520
+var cssText = "#ace_settingsmenu, #kbshortcutmenu {\
521
+background-color: #F7F7F7;\
522
+color: black;\
523
+box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);\
524
+padding: 1em 0.5em 2em 1em;\
525
+overflow: auto;\
526
+position: absolute;\
527
+margin: 0;\
528
+bottom: 0;\
529
+right: 0;\
530
+top: 0;\
531
+z-index: 9991;\
532
+cursor: default;\
533
+}\
534
+.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {\
535
+box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);\
536
+background-color: rgba(255, 255, 255, 0.6);\
537
+color: black;\
538
+}\
539
+.ace_optionsMenuEntry:hover {\
540
+background-color: rgba(100, 100, 100, 0.1);\
541
+-webkit-transition: all 0.5s;\
542
+transition: all 0.3s\
543
+}\
544
+.ace_closeButton {\
545
+background: rgba(245, 146, 146, 0.5);\
546
+border: 1px solid #F48A8A;\
547
+border-radius: 50%;\
548
+padding: 7px;\
549
+position: absolute;\
550
+right: -8px;\
551
+top: -8px;\
552
+z-index: 1000;\
553
+}\
554
+.ace_closeButton{\
555
+background: rgba(245, 146, 146, 0.9);\
556
+}\
557
+.ace_optionsMenuKey {\
558
+color: darkslateblue;\
559
+font-weight: bold;\
560
+}\
561
+.ace_optionsMenuCommand {\
562
+color: darkcyan;\
563
+font-weight: normal;\
564
+}";
565
+dom.importCssString(cssText);
566
+module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) {
567
+    top = top ? 'top: ' + top + ';' : '';
568
+    bottom = bottom ? 'bottom: ' + bottom + ';' : '';
569
+    right = right ? 'right: ' + right + ';' : '';
570
+    left = left ? 'left: ' + left + ';' : '';
571
+
572
+    var closer = document.createElement('div');
573
+    var contentContainer = document.createElement('div');
574
+
575
+    function documentEscListener(e) {
576
+        if (e.keyCode === 27) {
577
+            closer.click();
578
+        }
579
+    }
580
+
581
+    closer.style.cssText = 'margin: 0; padding: 0; ' +
582
+        'position: fixed; top:0; bottom:0; left:0; right:0;' +
583
+        'z-index: 9990; ' +
584
+        'background-color: rgba(0, 0, 0, 0.3);';
585
+    closer.addEventListener('click', function() {
586
+        document.removeEventListener('keydown', documentEscListener);
587
+        closer.parentNode.removeChild(closer);
588
+        editor.focus();
589
+        closer = null;
590
+    });
591
+    document.addEventListener('keydown', documentEscListener);
592
+
593
+    contentContainer.style.cssText = top + right + bottom + left;
594
+    contentContainer.addEventListener('click', function(e) {
595
+        e.stopPropagation();
596
+    });
597
+
598
+    var wrapper = dom.createElement("div");
599
+    wrapper.style.position = "relative";
600
+    
601
+    var closeButton = dom.createElement("div");
602
+    closeButton.className = "ace_closeButton";
603
+    closeButton.addEventListener('click', function() {
604
+        closer.click();
605
+    });
606
+    
607
+    wrapper.appendChild(closeButton);
608
+    contentContainer.appendChild(wrapper);
609
+    
610
+    contentContainer.appendChild(contentElement);
611
+    closer.appendChild(contentContainer);
612
+    document.body.appendChild(closer);
613
+    editor.blur();
614
+};
615
+
616
+});
617
+
618
+ace.define("ace/ext/settings_menu",["require","exports","module","ace/ext/menu_tools/generate_settings_menu","ace/ext/menu_tools/overlay_page","ace/editor"], function(require, exports, module) {
619
+"use strict";
620
+var generateSettingsMenu = require('./menu_tools/generate_settings_menu').generateSettingsMenu;
621
+var overlayPage = require('./menu_tools/overlay_page').overlayPage;
622
+function showSettingsMenu(editor) {
623
+    var sm = document.getElementById('ace_settingsmenu');
624
+    if (!sm)    
625
+        overlayPage(editor, generateSettingsMenu(editor), '0', '0', '0');
626
+}
627
+module.exports.init = function(editor) {
628
+    var Editor = require("ace/editor").Editor;
629
+    Editor.prototype.showSettingsMenu = function() {
630
+        showSettingsMenu(this);
631
+    };
632
+};
633
+});
634
+                (function() {
635
+                    ace.require(["ace/ext/settings_menu"], function() {});
636
+                })();
637
+            

+ 71
- 0
generator/lib/ace/ext-spellcheck.js Parādīt failu

@@ -0,0 +1,71 @@
1
+ace.define("ace/ext/spellcheck",["require","exports","module","ace/lib/event","ace/editor","ace/config"], function(require, exports, module) {
2
+"use strict";
3
+var event = require("../lib/event");
4
+
5
+exports.contextMenuHandler = function(e){
6
+    var host = e.target;
7
+    var text = host.textInput.getElement();
8
+    if (!host.selection.isEmpty())
9
+        return;
10
+    var c = host.getCursorPosition();
11
+    var r = host.session.getWordRange(c.row, c.column);
12
+    var w = host.session.getTextRange(r);
13
+
14
+    host.session.tokenRe.lastIndex = 0;
15
+    if (!host.session.tokenRe.test(w))
16
+        return;
17
+    var PLACEHOLDER = "\x01\x01";
18
+    var value = w + " " + PLACEHOLDER;
19
+    text.value = value;
20
+    text.setSelectionRange(w.length, w.length + 1);
21
+    text.setSelectionRange(0, 0);
22
+    text.setSelectionRange(0, w.length);
23
+
24
+    var afterKeydown = false;
25
+    event.addListener(text, "keydown", function onKeydown() {
26
+        event.removeListener(text, "keydown", onKeydown);
27
+        afterKeydown = true;
28
+    });
29
+
30
+    host.textInput.setInputHandler(function(newVal) {
31
+        console.log(newVal , value, text.selectionStart, text.selectionEnd)
32
+        if (newVal == value)
33
+            return '';
34
+        if (newVal.lastIndexOf(value, 0) === 0)
35
+            return newVal.slice(value.length);
36
+        if (newVal.substr(text.selectionEnd) == value)
37
+            return newVal.slice(0, -value.length);
38
+        if (newVal.slice(-2) == PLACEHOLDER) {
39
+            var val = newVal.slice(0, -2);
40
+            if (val.slice(-1) == " ") {
41
+                if (afterKeydown)
42
+                    return val.substring(0, text.selectionEnd);
43
+                val = val.slice(0, -1);
44
+                host.session.replace(r, val);
45
+                return "";
46
+            }
47
+        }
48
+
49
+        return newVal;
50
+    });
51
+};
52
+var Editor = require("../editor").Editor;
53
+require("../config").defineOptions(Editor.prototype, "editor", {
54
+    spellcheck: {
55
+        set: function(val) {
56
+            var text = this.textInput.getElement();
57
+            text.spellcheck = !!val;
58
+            if (!val)
59
+                this.removeListener("nativecontextmenu", exports.contextMenuHandler);
60
+            else
61
+                this.on("nativecontextmenu", exports.contextMenuHandler);
62
+        },
63
+        value: true
64
+    }
65
+});
66
+
67
+});
68
+                (function() {
69
+                    ace.require(["ace/ext/spellcheck"], function() {});
70
+                })();
71
+            

+ 246
- 0
generator/lib/ace/ext-split.js Parādīt failu

@@ -0,0 +1,246 @@
1
+ace.define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"], function(require, exports, module) {
2
+"use strict";
3
+
4
+var oop = require("./lib/oop");
5
+var lang = require("./lib/lang");
6
+var EventEmitter = require("./lib/event_emitter").EventEmitter;
7
+
8
+var Editor = require("./editor").Editor;
9
+var Renderer = require("./virtual_renderer").VirtualRenderer;
10
+var EditSession = require("./edit_session").EditSession;
11
+
12
+
13
+var Split = function(container, theme, splits) {
14
+    this.BELOW = 1;
15
+    this.BESIDE = 0;
16
+
17
+    this.$container = container;
18
+    this.$theme = theme;
19
+    this.$splits = 0;
20
+    this.$editorCSS = "";
21
+    this.$editors = [];
22
+    this.$orientation = this.BESIDE;
23
+
24
+    this.setSplits(splits || 1);
25
+    this.$cEditor = this.$editors[0];
26
+
27
+
28
+    this.on("focus", function(editor) {
29
+        this.$cEditor = editor;
30
+    }.bind(this));
31
+};
32
+
33
+(function(){
34
+
35
+    oop.implement(this, EventEmitter);
36
+
37
+    this.$createEditor = function() {
38
+        var el = document.createElement("div");
39
+        el.className = this.$editorCSS;
40
+        el.style.cssText = "position: absolute; top:0px; bottom:0px";
41
+        this.$container.appendChild(el);
42
+        var editor = new Editor(new Renderer(el, this.$theme));
43
+
44
+        editor.on("focus", function() {
45
+            this._emit("focus", editor);
46
+        }.bind(this));
47
+
48
+        this.$editors.push(editor);
49
+        editor.setFontSize(this.$fontSize);
50
+        return editor;
51
+    };
52
+
53
+    this.setSplits = function(splits) {
54
+        var editor;
55
+        if (splits < 1) {
56
+            throw "The number of splits have to be > 0!";
57
+        }
58
+
59
+        if (splits == this.$splits) {
60
+            return;
61
+        } else if (splits > this.$splits) {
62
+            while (this.$splits < this.$editors.length && this.$splits < splits) {
63
+                editor = this.$editors[this.$splits];
64
+                this.$container.appendChild(editor.container);
65
+                editor.setFontSize(this.$fontSize);
66
+                this.$splits ++;
67
+            }
68
+            while (this.$splits < splits) {
69
+                this.$createEditor();
70
+                this.$splits ++;
71
+            }
72
+        } else {
73
+            while (this.$splits > splits) {
74
+                editor = this.$editors[this.$splits - 1];
75
+                this.$container.removeChild(editor.container);
76
+                this.$splits --;
77
+            }
78
+        }
79
+        this.resize();
80
+    };
81
+    this.getSplits = function() {
82
+        return this.$splits;
83
+    };
84
+    this.getEditor = function(idx) {
85
+        return this.$editors[idx];
86
+    };
87
+    this.getCurrentEditor = function() {
88
+        return this.$cEditor;
89
+    };
90
+    this.focus = function() {
91
+        this.$cEditor.focus();
92
+    };
93
+    this.blur = function() {
94
+        this.$cEditor.blur();
95
+    };
96
+    this.setTheme = function(theme) {
97
+        this.$editors.forEach(function(editor) {
98
+            editor.setTheme(theme);
99
+        });
100
+    };
101
+    this.setKeyboardHandler = function(keybinding) {
102
+        this.$editors.forEach(function(editor) {
103
+            editor.setKeyboardHandler(keybinding);
104
+        });
105
+    };
106
+    this.forEach = function(callback, scope) {
107
+        this.$editors.forEach(callback, scope);
108
+    };
109
+
110
+
111
+    this.$fontSize = "";
112
+    this.setFontSize = function(size) {
113
+        this.$fontSize = size;
114
+        this.forEach(function(editor) {
115
+           editor.setFontSize(size);
116
+        });
117
+    };
118
+
119
+    this.$cloneSession = function(session) {
120
+        var s = new EditSession(session.getDocument(), session.getMode());
121
+
122
+        var undoManager = session.getUndoManager();
123
+        if (undoManager) {
124
+            var undoManagerProxy = new UndoManagerProxy(undoManager, s);
125
+            s.setUndoManager(undoManagerProxy);
126
+        }
127
+        s.$informUndoManager = lang.delayedCall(function() { s.$deltas = []; });
128
+        s.setTabSize(session.getTabSize());
129
+        s.setUseSoftTabs(session.getUseSoftTabs());
130
+        s.setOverwrite(session.getOverwrite());
131
+        s.setBreakpoints(session.getBreakpoints());
132
+        s.setUseWrapMode(session.getUseWrapMode());
133
+        s.setUseWorker(session.getUseWorker());
134
+        s.setWrapLimitRange(session.$wrapLimitRange.min,
135
+                            session.$wrapLimitRange.max);
136
+        s.$foldData = session.$cloneFoldData();
137
+
138
+        return s;
139
+    };
140
+    this.setSession = function(session, idx) {
141
+        var editor;
142
+        if (idx == null) {
143
+            editor = this.$cEditor;
144
+        } else {
145
+            editor = this.$editors[idx];
146
+        }
147
+        var isUsed = this.$editors.some(function(editor) {
148
+           return editor.session === session;
149
+        });
150
+
151
+        if (isUsed) {
152
+            session = this.$cloneSession(session);
153
+        }
154
+        editor.setSession(session);
155
+        return session;
156
+    };
157
+    this.getOrientation = function() {
158
+        return this.$orientation;
159
+    };
160
+    this.setOrientation = function(orientation) {
161
+        if (this.$orientation == orientation) {
162
+            return;
163
+        }
164
+        this.$orientation = orientation;
165
+        this.resize();
166
+    };
167
+    this.resize = function() {
168
+        var width = this.$container.clientWidth;
169
+        var height = this.$container.clientHeight;
170
+        var editor;
171
+
172
+        if (this.$orientation == this.BESIDE) {
173
+            var editorWidth = width / this.$splits;
174
+            for (var i = 0; i < this.$splits; i++) {
175
+                editor = this.$editors[i];
176
+                editor.container.style.width = editorWidth + "px";
177
+                editor.container.style.top = "0px";
178
+                editor.container.style.left = i * editorWidth + "px";
179
+                editor.container.style.height = height + "px";
180
+                editor.resize();
181
+            }
182
+        } else {
183
+            var editorHeight = height / this.$splits;
184
+            for (var i = 0; i < this.$splits; i++) {
185
+                editor = this.$editors[i];
186
+                editor.container.style.width = width + "px";
187
+                editor.container.style.top = i * editorHeight + "px";
188
+                editor.container.style.left = "0px";
189
+                editor.container.style.height = editorHeight + "px";
190
+                editor.resize();
191
+            }
192
+        }
193
+    };
194
+
195
+}).call(Split.prototype);
196
+
197
+ 
198
+function UndoManagerProxy(undoManager, session) {
199
+    this.$u = undoManager;
200
+    this.$doc = session;
201
+}
202
+
203
+(function() {
204
+    this.execute = function(options) {
205
+        this.$u.execute(options);
206
+    };
207
+
208
+    this.undo = function() {
209
+        var selectionRange = this.$u.undo(true);
210
+        if (selectionRange) {
211
+            this.$doc.selection.setSelectionRange(selectionRange);
212
+        }
213
+    };
214
+
215
+    this.redo = function() {
216
+        var selectionRange = this.$u.redo(true);
217
+        if (selectionRange) {
218
+            this.$doc.selection.setSelectionRange(selectionRange);
219
+        }
220
+    };
221
+
222
+    this.reset = function() {
223
+        this.$u.reset();
224
+    };
225
+
226
+    this.hasUndo = function() {
227
+        return this.$u.hasUndo();
228
+    };
229
+
230
+    this.hasRedo = function() {
231
+        return this.$u.hasRedo();
232
+    };
233
+}).call(UndoManagerProxy.prototype);
234
+
235
+exports.Split = Split;
236
+});
237
+
238
+ace.define("ace/ext/split",["require","exports","module","ace/split"], function(require, exports, module) {
239
+"use strict";
240
+module.exports = require("../split");
241
+
242
+});
243
+                (function() {
244
+                    ace.require(["ace/ext/split"], function() {});
245
+                })();
246
+            

+ 154
- 0
generator/lib/ace/ext-static_highlight.js Parādīt failu

@@ -0,0 +1,154 @@
1
+ace.define("ace/ext/static_highlight",["require","exports","module","ace/edit_session","ace/layer/text","ace/config","ace/lib/dom"], function(require, exports, module) {
2
+"use strict";
3
+
4
+var EditSession = require("../edit_session").EditSession;
5
+var TextLayer = require("../layer/text").Text;
6
+var baseStyles = ".ace_static_highlight {\
7
+font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;\
8
+font-size: 12px;\
9
+}\
10
+.ace_static_highlight .ace_gutter {\
11
+width: 25px !important;\
12
+float: left;\
13
+text-align: right;\
14
+padding: 0 3px 0 0;\
15
+margin-right: 3px;\
16
+position: static !important;\
17
+}\
18
+.ace_static_highlight .ace_line { clear: both; }\
19
+.ace_static_highlight .ace_gutter-cell {\
20
+-moz-user-select: -moz-none;\
21
+-khtml-user-select: none;\
22
+-webkit-user-select: none;\
23
+user-select: none;\
24
+}\
25
+.ace_static_highlight .ace_gutter-cell:before {\
26
+content: counter(ace_line, decimal);\
27
+counter-increment: ace_line;\
28
+}\
29
+.ace_static_highlight {\
30
+counter-reset: ace_line;\
31
+}\
32
+";
33
+var config = require("../config");
34
+var dom = require("../lib/dom");
35
+
36
+
37
+var highlight = function(el, opts, callback) {
38
+    var m = el.className.match(/lang-(\w+)/);
39
+    var mode = opts.mode || m && ("ace/mode/" + m[1]);
40
+    if (!mode)
41
+        return false;
42
+    var theme = opts.theme || "ace/theme/textmate";
43
+    
44
+    var data = "";
45
+    var nodes = [];
46
+
47
+    if (el.firstElementChild) {
48
+        var textLen = 0;
49
+        for (var i = 0; i < el.childNodes.length; i++) {
50
+            var ch = el.childNodes[i];
51
+            if (ch.nodeType == 3) {
52
+                textLen += ch.data.length;
53
+                data += ch.data;
54
+            } else {
55
+                nodes.push(textLen, ch);
56
+            }
57
+        }
58
+    } else {
59
+        data = dom.getInnerText(el);
60
+        if (opts.trim)
61
+            data = data.trim();
62
+    }
63
+    
64
+    highlight.render(data, mode, theme, opts.firstLineNumber, !opts.showGutter, function (highlighted) {
65
+        dom.importCssString(highlighted.css, "ace_highlight");
66
+        el.innerHTML = highlighted.html;
67
+        var container = el.firstChild.firstChild;
68
+        for (var i = 0; i < nodes.length; i += 2) {
69
+            var pos = highlighted.session.doc.indexToPosition(nodes[i]);
70
+            var node = nodes[i + 1];
71
+            var lineEl = container.children[pos.row];
72
+            lineEl && lineEl.appendChild(node);
73
+        }
74
+        callback && callback();
75
+    });
76
+};
77
+highlight.render = function(input, mode, theme, lineStart, disableGutter, callback) {
78
+    var waiting = 1;
79
+    var modeCache = EditSession.prototype.$modes;
80
+    if (typeof theme == "string") {
81
+        waiting++;
82
+        config.loadModule(['theme', theme], function(m) {
83
+            theme = m;
84
+            --waiting || done();
85
+        });
86
+    }
87
+    var modeOptions;
88
+    if (mode && typeof mode === "object" && !mode.getTokenizer) {
89
+        modeOptions = mode;
90
+        mode = modeOptions.path;
91
+    }
92
+    if (typeof mode == "string") {
93
+        waiting++;
94
+        config.loadModule(['mode', mode], function(m) {
95
+            if (!modeCache[mode] || modeOptions)
96
+                modeCache[mode] = new m.Mode(modeOptions);
97
+            mode = modeCache[mode];
98
+            --waiting || done();
99
+        });
100
+    }
101
+    function done() {
102
+        var result = highlight.renderSync(input, mode, theme, lineStart, disableGutter);
103
+        return callback ? callback(result) : result;
104
+    }
105
+    return --waiting || done();
106
+};
107
+highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) {
108
+    lineStart = parseInt(lineStart || 1, 10);
109
+
110
+    var session = new EditSession("");
111
+    session.setUseWorker(false);
112
+    session.setMode(mode);
113
+
114
+    var textLayer = new TextLayer(document.createElement("div"));
115
+    textLayer.setSession(session);
116
+    textLayer.config = {
117
+        characterWidth: 10,
118
+        lineHeight: 20
119
+    };
120
+
121
+    session.setValue(input);
122
+
123
+    var stringBuilder = [];
124
+    var length =  session.getLength();
125
+
126
+    for(var ix = 0; ix < length; ix++) {
127
+        stringBuilder.push("<div class='ace_line'>");
128
+        if (!disableGutter)
129
+            stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + /*(ix + lineStart) + */ "</span>");
130
+        textLayer.$renderLine(stringBuilder, ix, true, false);
131
+        stringBuilder.push("\n</div>");
132
+    }
133
+    var html = "<div class='" + theme.cssClass + "'>" +
134
+        "<div class='ace_static_highlight' style='counter-reset:ace_line " + (lineStart - 1) + "'>" +
135
+            stringBuilder.join("") +
136
+        "</div>" +
137
+    "</div>";
138
+
139
+    textLayer.destroy();
140
+
141
+    return {
142
+        css: baseStyles + theme.cssText,
143
+        html: html,
144
+        session: session
145
+    };
146
+};
147
+
148
+module.exports = highlight;
149
+module.exports.highlight =highlight;
150
+});
151
+                (function() {
152
+                    ace.require(["ace/ext/static_highlight"], function() {});
153
+                })();
154
+            

+ 51
- 0
generator/lib/ace/ext-statusbar.js Parādīt failu

@@ -0,0 +1,51 @@
1
+ace.define("ace/ext/statusbar",["require","exports","module","ace/lib/dom","ace/lib/lang"], function(require, exports, module) {
2
+"use strict";
3
+var dom = require("ace/lib/dom");
4
+var lang = require("ace/lib/lang");
5
+
6
+var StatusBar = function(editor, parentNode) {
7
+    this.element = dom.createElement("div");
8
+    this.element.className = "ace_status-indicator";
9
+    this.element.style.cssText = "display: inline-block;";
10
+    parentNode.appendChild(this.element);
11
+
12
+    var statusUpdate = lang.delayedCall(function(){
13
+        this.updateStatus(editor)
14
+    }.bind(this));
15
+    editor.on("changeStatus", function() {
16
+        statusUpdate.schedule(100);
17
+    });
18
+    editor.on("changeSelection", function() {
19
+        statusUpdate.schedule(100);
20
+    });
21
+};
22
+
23
+(function(){
24
+    this.updateStatus = function(editor) {
25
+        var status = [];
26
+        function add(str, separator) {
27
+            str && status.push(str, separator || "|");
28
+        }
29
+
30
+        add(editor.keyBinding.getStatusText(editor));
31
+        if (editor.commands.recording)
32
+            add("REC");
33
+
34
+        var c = editor.selection.lead;
35
+        add(c.row + ":" + c.column, " ");
36
+        if (!editor.selection.isEmpty()) {
37
+            var r = editor.getSelectionRange();
38
+            add("(" + (r.end.row - r.start.row) + ":"  +(r.end.column - r.start.column) + ")");
39
+        }
40
+        status.pop();
41
+        this.element.textContent = status.join("");
42
+    };
43
+}).call(StatusBar.prototype);
44
+
45
+exports.StatusBar = StatusBar;
46
+
47
+});
48
+                (function() {
49
+                    ace.require(["ace/ext/statusbar"], function() {});
50
+                })();
51
+            

+ 632
- 0
generator/lib/ace/ext-textarea.js Parādīt failu

@@ -0,0 +1,632 @@
1
+ace.define("ace/theme/textmate",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
2
+"use strict";
3
+
4
+exports.isDark = false;
5
+exports.cssClass = "ace-tm";
6
+exports.cssText = ".ace-tm .ace_gutter {\
7
+background: #f0f0f0;\
8
+color: #333;\
9
+}\
10
+.ace-tm .ace_print-margin {\
11
+width: 1px;\
12
+background: #e8e8e8;\
13
+}\
14
+.ace-tm .ace_fold {\
15
+background-color: #6B72E6;\
16
+}\
17
+.ace-tm {\
18
+background-color: #FFFFFF;\
19
+color: black;\
20
+}\
21
+.ace-tm .ace_cursor {\
22
+color: black;\
23
+}\
24
+.ace-tm .ace_invisible {\
25
+color: rgb(191, 191, 191);\
26
+}\
27
+.ace-tm .ace_storage,\
28
+.ace-tm .ace_keyword {\
29
+color: blue;\
30
+}\
31
+.ace-tm .ace_constant {\
32
+color: rgb(197, 6, 11);\
33
+}\
34
+.ace-tm .ace_constant.ace_buildin {\
35
+color: rgb(88, 72, 246);\
36
+}\
37
+.ace-tm .ace_constant.ace_language {\
38
+color: rgb(88, 92, 246);\
39
+}\
40
+.ace-tm .ace_constant.ace_library {\
41
+color: rgb(6, 150, 14);\
42
+}\
43
+.ace-tm .ace_invalid {\
44
+background-color: rgba(255, 0, 0, 0.1);\
45
+color: red;\
46
+}\
47
+.ace-tm .ace_support.ace_function {\
48
+color: rgb(60, 76, 114);\
49
+}\
50
+.ace-tm .ace_support.ace_constant {\
51
+color: rgb(6, 150, 14);\
52
+}\
53
+.ace-tm .ace_support.ace_type,\
54
+.ace-tm .ace_support.ace_class {\
55
+color: rgb(109, 121, 222);\
56
+}\
57
+.ace-tm .ace_keyword.ace_operator {\
58
+color: rgb(104, 118, 135);\
59
+}\
60
+.ace-tm .ace_string {\
61
+color: rgb(3, 106, 7);\
62
+}\
63
+.ace-tm .ace_comment {\
64
+color: rgb(76, 136, 107);\
65
+}\
66
+.ace-tm .ace_comment.ace_doc {\
67
+color: rgb(0, 102, 255);\
68
+}\
69
+.ace-tm .ace_comment.ace_doc.ace_tag {\
70
+color: rgb(128, 159, 191);\
71
+}\
72
+.ace-tm .ace_constant.ace_numeric {\
73
+color: rgb(0, 0, 205);\
74
+}\
75
+.ace-tm .ace_variable {\
76
+color: rgb(49, 132, 149);\
77
+}\
78
+.ace-tm .ace_xml-pe {\
79
+color: rgb(104, 104, 91);\
80
+}\
81
+.ace-tm .ace_entity.ace_name.ace_function {\
82
+color: #0000A2;\
83
+}\
84
+.ace-tm .ace_heading {\
85
+color: rgb(12, 7, 255);\
86
+}\
87
+.ace-tm .ace_list {\
88
+color:rgb(185, 6, 144);\
89
+}\
90
+.ace-tm .ace_meta.ace_tag {\
91
+color:rgb(0, 22, 142);\
92
+}\
93
+.ace-tm .ace_string.ace_regex {\
94
+color: rgb(255, 0, 0)\
95
+}\
96
+.ace-tm .ace_marker-layer .ace_selection {\
97
+background: rgb(181, 213, 255);\
98
+}\
99
+.ace-tm.ace_multiselect .ace_selection.ace_start {\
100
+box-shadow: 0 0 3px 0px white;\
101
+border-radius: 2px;\
102
+}\
103
+.ace-tm .ace_marker-layer .ace_step {\
104
+background: rgb(252, 255, 0);\
105
+}\
106
+.ace-tm .ace_marker-layer .ace_stack {\
107
+background: rgb(164, 229, 101);\
108
+}\
109
+.ace-tm .ace_marker-layer .ace_bracket {\
110
+margin: -1px 0 0 -1px;\
111
+border: 1px solid rgb(192, 192, 192);\
112
+}\
113
+.ace-tm .ace_marker-layer .ace_active-line {\
114
+background: rgba(0, 0, 0, 0.07);\
115
+}\
116
+.ace-tm .ace_gutter-active-line {\
117
+background-color : #dcdcdc;\
118
+}\
119
+.ace-tm .ace_marker-layer .ace_selected-word {\
120
+background: rgb(250, 250, 255);\
121
+border: 1px solid rgb(200, 200, 250);\
122
+}\
123
+.ace-tm .ace_indent-guide {\
124
+background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;\
125
+}\
126
+";
127
+
128
+var dom = require("../lib/dom");
129
+dom.importCssString(exports.cssText, exports.cssClass);
130
+});
131
+
132
+ace.define("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config"], function(require, exports, module) {
133
+"use strict";
134
+
135
+require("./lib/fixoldbrowsers");
136
+
137
+var dom = require("./lib/dom");
138
+var event = require("./lib/event");
139
+
140
+var Editor = require("./editor").Editor;
141
+var EditSession = require("./edit_session").EditSession;
142
+var UndoManager = require("./undomanager").UndoManager;
143
+var Renderer = require("./virtual_renderer").VirtualRenderer;
144
+require("./worker/worker_client");
145
+require("./keyboard/hash_handler");
146
+require("./placeholder");
147
+require("./multi_select");
148
+require("./mode/folding/fold_mode");
149
+require("./theme/textmate");
150
+require("./ext/error_marker");
151
+
152
+exports.config = require("./config");
153
+exports.require = require;
154
+exports.edit = function(el) {
155
+    if (typeof(el) == "string") {
156
+        var _id = el;
157
+        el = document.getElementById(_id);
158
+        if (!el)
159
+            throw new Error("ace.edit can't find div #" + _id);
160
+    }
161
+
162
+    if (el && el.env && el.env.editor instanceof Editor)
163
+        return el.env.editor;
164
+
165
+    var value = "";
166
+    if (el && /input|textarea/i.test(el.tagName)) {
167
+        var oldNode = el;
168
+        value = oldNode.value;
169
+        el = dom.createElement("pre");
170
+        oldNode.parentNode.replaceChild(el, oldNode);
171
+    } else {
172
+        value = dom.getInnerText(el);
173
+        el.innerHTML = '';
174
+    }
175
+
176
+    var doc = exports.createEditSession(value);
177
+
178
+    var editor = new Editor(new Renderer(el));
179
+    editor.setSession(doc);
180
+
181
+    var env = {
182
+        document: doc,
183
+        editor: editor,
184
+        onResize: editor.resize.bind(editor, null)
185
+    };
186
+    if (oldNode) env.textarea = oldNode;
187
+    event.addListener(window, "resize", env.onResize);
188
+    editor.on("destroy", function() {
189
+        event.removeListener(window, "resize", env.onResize);
190
+        env.editor.container.env = null; // prevent memory leak on old ie
191
+    });
192
+    editor.container.env = editor.env = env;
193
+    return editor;
194
+};
195
+exports.createEditSession = function(text, mode) {
196
+    var doc = new EditSession(text, mode);
197
+    doc.setUndoManager(new UndoManager());
198
+    return doc;
199
+}
200
+exports.EditSession = EditSession;
201
+exports.UndoManager = UndoManager;
202
+});
203
+
204
+ace.define("ace/ext/textarea",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/net","ace/ace","ace/theme/textmate"], function(require, exports, module) {
205
+"use strict";
206
+
207
+var event = require("../lib/event");
208
+var UA = require("../lib/useragent");
209
+var net = require("../lib/net");
210
+var ace = require("../ace");
211
+
212
+require("../theme/textmate");
213
+
214
+module.exports = exports = ace;
215
+var getCSSProperty = function(element, container, property) {
216
+    var ret = element.style[property];
217
+
218
+    if (!ret) {
219
+        if (window.getComputedStyle) {
220
+            ret = window.getComputedStyle(element, '').getPropertyValue(property);
221
+        } else {
222
+            ret = element.currentStyle[property];
223
+        }
224
+    }
225
+
226
+    if (!ret || ret == 'auto' || ret == 'intrinsic') {
227
+        ret = container.style[property];
228
+    }
229
+    return ret;
230
+};
231
+
232
+function applyStyles(elm, styles) {
233
+    for (var style in styles) {
234
+        elm.style[style] = styles[style];
235
+    }
236
+}
237
+
238
+function setupContainer(element, getValue) {
239
+    if (element.type != 'textarea') {
240
+        throw new Error("Textarea required!");
241
+    }
242
+
243
+    var parentNode = element.parentNode;
244
+    var container = document.createElement('div');
245
+    var resizeEvent = function() {
246
+        var style = 'position:relative;';
247
+        [
248
+            'margin-top', 'margin-left', 'margin-right', 'margin-bottom'
249
+        ].forEach(function(item) {
250
+            style += item + ':' +
251
+                        getCSSProperty(element, container, item) + ';';
252
+        });
253
+        var width = getCSSProperty(element, container, 'width') || (element.clientWidth + "px");
254
+        var height = getCSSProperty(element, container, 'height')  || (element.clientHeight + "px");
255
+        style += 'height:' + height + ';width:' + width + ';';
256
+        style += 'display:inline-block;';
257
+        container.setAttribute('style', style);
258
+    };
259
+    event.addListener(window, 'resize', resizeEvent);
260
+    resizeEvent();
261
+    parentNode.insertBefore(container, element.nextSibling);
262
+    while (parentNode !== document) {
263
+        if (parentNode.tagName.toUpperCase() === 'FORM') {
264
+            var oldSumit = parentNode.onsubmit;
265
+            parentNode.onsubmit = function(evt) {
266
+                element.value = getValue();
267
+                if (oldSumit) {
268
+                    oldSumit.call(this, evt);
269
+                }
270
+            };
271
+            break;
272
+        }
273
+        parentNode = parentNode.parentNode;
274
+    }
275
+    return container;
276
+}
277
+
278
+exports.transformTextarea = function(element, options) {
279
+    var session;
280
+    var container = setupContainer(element, function() {
281
+        return session.getValue();
282
+    });
283
+    element.style.display = 'none';
284
+    container.style.background = 'white';
285
+    var editorDiv = document.createElement("div");
286
+    applyStyles(editorDiv, {
287
+        top: "0px",
288
+        left: "0px",
289
+        right: "0px",
290
+        bottom: "0px",
291
+        border: "1px solid gray",
292
+        position: "absolute"
293
+    });
294
+    container.appendChild(editorDiv);
295
+
296
+    var settingOpener = document.createElement("div");
297
+    applyStyles(settingOpener, {
298
+        position: "absolute",
299
+        right: "0px",
300
+        bottom: "0px",
301
+        background: "red",
302
+        cursor: "nw-resize",
303
+        borderStyle: "solid",
304
+        borderWidth: "9px 8px 10px 9px",
305
+        width: "2px",
306
+        borderColor: "lightblue gray gray lightblue",
307
+        zIndex: 101
308
+    });
309
+
310
+    var settingDiv = document.createElement("div");
311
+    var settingDivStyles = {
312
+        top: "0px",
313
+        left: "20%",
314
+        right: "0px",
315
+        bottom: "0px",
316
+        position: "absolute",
317
+        padding: "5px",
318
+        zIndex: 100,
319
+        color: "white",
320
+        display: "none",
321
+        overflow: "auto",
322
+        fontSize: "14px",
323
+        boxShadow: "-5px 2px 3px gray"
324
+    };
325
+    if (!UA.isOldIE) {
326
+        settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)";
327
+    } else {
328
+        settingDivStyles.backgroundColor = "#333";
329
+    }
330
+
331
+    applyStyles(settingDiv, settingDivStyles);
332
+    container.appendChild(settingDiv);
333
+
334
+    options = options || exports.defaultOptions;
335
+    var editor = ace.edit(editorDiv);
336
+    session = editor.getSession();
337
+
338
+    session.setValue(element.value || element.innerHTML);
339
+    editor.focus();
340
+    container.appendChild(settingOpener);
341
+    setupApi(editor, editorDiv, settingDiv, ace, options, load);
342
+    setupSettingPanel(settingDiv, settingOpener, editor);
343
+
344
+    var state = "";
345
+    event.addListener(settingOpener, "mousemove", function(e) {
346
+        var rect = this.getBoundingClientRect();
347
+        var x = e.clientX - rect.left, y = e.clientY - rect.top;
348
+        if (x + y < (rect.width + rect.height)/2) {
349
+            this.style.cursor = "pointer";
350
+            state = "toggle";
351
+        } else {
352
+            state = "resize";
353
+            this.style.cursor = "nw-resize";
354
+        }
355
+    });
356
+
357
+    event.addListener(settingOpener, "mousedown", function(e) {
358
+        if (state == "toggle") {
359
+            editor.setDisplaySettings();
360
+            return;
361
+        }
362
+        container.style.zIndex = 100000;
363
+        var rect = container.getBoundingClientRect();
364
+        var startX = rect.width  + rect.left - e.clientX;
365
+        var startY = rect.height  + rect.top - e.clientY;
366
+        event.capture(settingOpener, function(e) {
367
+            container.style.width = e.clientX - rect.left + startX + "px";
368
+            container.style.height = e.clientY - rect.top + startY + "px";
369
+            editor.resize();
370
+        }, function() {});
371
+    });
372
+
373
+    return editor;
374
+};
375
+
376
+function load(url, module, callback) {
377
+    net.loadScript(url, function() {
378
+        require([module], callback);
379
+    });
380
+}
381
+
382
+function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
383
+    var session = editor.getSession();
384
+    var renderer = editor.renderer;
385
+    loader = loader || load;
386
+
387
+    function toBool(value) {
388
+        return value === "true" || value == true;
389
+    }
390
+
391
+    editor.setDisplaySettings = function(display) {
392
+        if (display == null)
393
+            display = settingDiv.style.display == "none";
394
+        if (display) {
395
+            settingDiv.style.display = "block";
396
+            settingDiv.hideButton.focus();
397
+            editor.on("focus", function onFocus() {
398
+                editor.removeListener("focus", onFocus);
399
+                settingDiv.style.display = "none";
400
+            });
401
+        } else {
402
+            editor.focus();
403
+        }
404
+    };
405
+
406
+    editor.$setOption = editor.setOption;
407
+    editor.$getOption = editor.getOption;
408
+    editor.setOption = function(key, value) {
409
+        switch (key) {
410
+            case "mode":
411
+                editor.$setOption("mode", "ace/mode/" + value)
412
+            break;
413
+            case "theme":
414
+                editor.$setOption("theme", "ace/theme/" + value)
415
+            break;
416
+            case "keybindings":
417
+                switch (value) {
418
+                    case "vim":
419
+                        editor.setKeyboardHandler("ace/keyboard/vim");
420
+                        break;
421
+                    case "emacs":
422
+                        editor.setKeyboardHandler("ace/keyboard/emacs");
423
+                        break;
424
+                    default:
425
+                        editor.setKeyboardHandler(null);
426
+                }
427
+            break;
428
+
429
+            case "softWrap":
430
+            case "fontSize":
431
+                editor.$setOption(key, value);
432
+            break;
433
+            
434
+            default:
435
+                editor.$setOption(key, toBool(value));
436
+        }
437
+    };
438
+
439
+    editor.getOption = function(key) {
440
+        switch (key) {
441
+            case "mode":
442
+                return editor.$getOption("mode").substr("ace/mode/".length)
443
+            break;
444
+
445
+            case "theme":
446
+                return editor.$getOption("theme").substr("ace/theme/".length)
447
+            break;
448
+
449
+            case "keybindings":
450
+                var value = editor.getKeyboardHandler()
451
+                switch (value && value.$id) {
452
+                    case "ace/keyboard/vim":
453
+                        return "vim";
454
+                    case "ace/keyboard/emacs":
455
+                        return "emacs";
456
+                    default:
457
+                        return "ace";
458
+                }
459
+            break;
460
+
461
+            default:
462
+                return editor.$getOption(key);
463
+        }
464
+    };
465
+
466
+    editor.setOptions(options);
467
+    return editor;
468
+}
469
+
470
+function setupSettingPanel(settingDiv, settingOpener, editor) {
471
+    var BOOL = null;
472
+
473
+    var desc = {
474
+        mode:            "Mode:",
475
+        wrap:            "Soft Wrap:",
476
+        theme:           "Theme:",
477
+        fontSize:        "Font Size:",
478
+        showGutter:      "Display Gutter:",
479
+        keybindings:     "Keyboard",
480
+        showPrintMargin: "Show Print Margin:",
481
+        useSoftTabs:     "Use Soft Tabs:",
482
+        showInvisibles:  "Show Invisibles"
483
+    };
484
+
485
+    var optionValues = {
486
+        mode: {
487
+            text:       "Plain",
488
+            javascript: "JavaScript",
489
+            xml:        "XML",
490
+            html:       "HTML",
491
+            css:        "CSS",
492
+            scss:       "SCSS",
493
+            python:     "Python",
494
+            php:        "PHP",
495
+            java:       "Java",
496
+            ruby:       "Ruby",
497
+            c_cpp:      "C/C++",
498
+            coffee:     "CoffeeScript",
499
+            json:       "json",
500
+            perl:       "Perl",
501
+            clojure:    "Clojure",
502
+            ocaml:      "OCaml",
503
+            csharp:     "C#",
504
+            haxe:       "haXe",
505
+            svg:        "SVG",
506
+            textile:    "Textile",
507
+            groovy:     "Groovy",
508
+            liquid:     "Liquid",
509
+            Scala:      "Scala"
510
+        },
511
+        theme: {
512
+            clouds:           "Clouds",
513
+            clouds_midnight:  "Clouds Midnight",
514
+            cobalt:           "Cobalt",
515
+            crimson_editor:   "Crimson Editor",
516
+            dawn:             "Dawn",
517
+            eclipse:          "Eclipse",
518
+            idle_fingers:     "Idle Fingers",
519
+            kr_theme:         "Kr Theme",
520
+            merbivore:        "Merbivore",
521
+            merbivore_soft:   "Merbivore Soft",
522
+            mono_industrial:  "Mono Industrial",
523
+            monokai:          "Monokai",
524
+            pastel_on_dark:   "Pastel On Dark",
525
+            solarized_dark:   "Solarized Dark",
526
+            solarized_light:  "Solarized Light",
527
+            textmate:         "Textmate",
528
+            twilight:         "Twilight",
529
+            vibrant_ink:      "Vibrant Ink"
530
+        },
531
+        showGutter: BOOL,
532
+        fontSize: {
533
+            "10px": "10px",
534
+            "11px": "11px",
535
+            "12px": "12px",
536
+            "14px": "14px",
537
+            "16px": "16px"
538
+        },
539
+        wrap: {
540
+            off:    "Off",
541
+            40:     "40",
542
+            80:     "80",
543
+            free:   "Free"
544
+        },
545
+        keybindings: {
546
+            ace: "ace",
547
+            vim: "vim",
548
+            emacs: "emacs"
549
+        },
550
+        showPrintMargin:    BOOL,
551
+        useSoftTabs:        BOOL,
552
+        showInvisibles:     BOOL
553
+    };
554
+
555
+    var table = [];
556
+    table.push("<table><tr><th>Setting</th><th>Value</th></tr>");
557
+
558
+    function renderOption(builder, option, obj, cValue) {
559
+        if (!obj) {
560
+            builder.push(
561
+                "<input type='checkbox' title='", option, "' ",
562
+                    cValue + "" == "true" ? "checked='true'" : "",
563
+               "'></input>"
564
+            );
565
+            return;
566
+        }
567
+        builder.push("<select title='" + option + "'>");
568
+        for (var value in obj) {
569
+            builder.push("<option value='" + value + "' ");
570
+
571
+            if (cValue == value) {
572
+                builder.push(" selected ");
573
+            }
574
+
575
+            builder.push(">",
576
+                obj[value],
577
+                "</option>");
578
+        }
579
+        builder.push("</select>");
580
+    }
581
+
582
+    for (var option in exports.defaultOptions) {
583
+        table.push("<tr><td>", desc[option], "</td>");
584
+        table.push("<td>");
585
+        renderOption(table, option, optionValues[option], editor.getOption(option));
586
+        table.push("</td></tr>");
587
+    }
588
+    table.push("</table>");
589
+    settingDiv.innerHTML = table.join("");
590
+
591
+    var onChange = function(e) {
592
+        var select = e.currentTarget;
593
+        editor.setOption(select.title, select.value);
594
+    };
595
+    var onClick = function(e) {
596
+        var cb = e.currentTarget;
597
+        editor.setOption(cb.title, cb.checked);
598
+    };
599
+    var selects = settingDiv.getElementsByTagName("select");
600
+    for (var i = 0; i < selects.length; i++)
601
+        selects[i].onchange = onChange;
602
+    var cbs = settingDiv.getElementsByTagName("input");
603
+    for (var i = 0; i < cbs.length; i++)
604
+        cbs[i].onclick = onClick;
605
+
606
+
607
+    var button = document.createElement("input");
608
+    button.type = "button";
609
+    button.value = "Hide";
610
+    event.addListener(button, "click", function() {
611
+        editor.setDisplaySettings(false);
612
+    });
613
+    settingDiv.appendChild(button);
614
+    settingDiv.hideButton = button;
615
+}
616
+exports.defaultOptions = {
617
+    mode:               "javascript",
618
+    theme:              "textmate",
619
+    wrap:               "off",
620
+    fontSize:           "12px",
621
+    showGutter:         "false",
622
+    keybindings:        "ace",
623
+    showPrintMargin:    "false",
624
+    useSoftTabs:        "true",
625
+    showInvisibles:     "false"
626
+};
627
+
628
+});
629
+                (function() {
630
+                    ace.require(["ace/ext/textarea"], function() {});
631
+                })();
632
+            

+ 58
- 0
generator/lib/ace/ext-themelist.js Parādīt failu

@@ -0,0 +1,58 @@
1
+ace.define("ace/ext/themelist",["require","exports","module","ace/lib/fixoldbrowsers"], function(require, exports, module) {
2
+"use strict";
3
+require("ace/lib/fixoldbrowsers");
4
+
5
+var themeData = [
6
+    ["Chrome"         ],
7
+    ["Clouds"         ],
8
+    ["Crimson Editor" ],
9
+    ["Dawn"           ],
10
+    ["Dreamweaver"    ],
11
+    ["Eclipse"        ],
12
+    ["GitHub"         ],
13
+    ["Solarized Light"],
14
+    ["TextMate"       ],
15
+    ["Tomorrow"       ],
16
+    ["XCode"          ],
17
+    ["Kuroir"],
18
+    ["KatzenMilch"],
19
+    ["Ambiance"             ,"ambiance"                ,  "dark"],
20
+    ["Chaos"                ,"chaos"                   ,  "dark"],
21
+    ["Clouds Midnight"      ,"clouds_midnight"         ,  "dark"],
22
+    ["Cobalt"               ,"cobalt"                  ,  "dark"],
23
+    ["idle Fingers"         ,"idle_fingers"            ,  "dark"],
24
+    ["krTheme"              ,"kr_theme"                ,  "dark"],
25
+    ["Merbivore"            ,"merbivore"               ,  "dark"],
26
+    ["Merbivore Soft"       ,"merbivore_soft"          ,  "dark"],
27
+    ["Mono Industrial"      ,"mono_industrial"         ,  "dark"],
28
+    ["Monokai"              ,"monokai"                 ,  "dark"],
29
+    ["Pastel on dark"       ,"pastel_on_dark"          ,  "dark"],
30
+    ["Solarized Dark"       ,"solarized_dark"          ,  "dark"],
31
+    ["Terminal"             ,"terminal"                ,  "dark"],
32
+    ["Tomorrow Night"       ,"tomorrow_night"          ,  "dark"],
33
+    ["Tomorrow Night Blue"  ,"tomorrow_night_blue"     ,  "dark"],
34
+    ["Tomorrow Night Bright","tomorrow_night_bright"   ,  "dark"],
35
+    ["Tomorrow Night 80s"   ,"tomorrow_night_eighties" ,  "dark"],
36
+    ["Twilight"             ,"twilight"                ,  "dark"],
37
+    ["Vibrant Ink"          ,"vibrant_ink"             ,  "dark"]
38
+];
39
+
40
+
41
+exports.themesByName = {};
42
+exports.themes = themeData.map(function(data) {
43
+    var name = data[1] || data[0].replace(/ /g, "_").toLowerCase();
44
+    var theme = {
45
+        caption: data[0],
46
+        theme: "ace/theme/" + name,
47
+        isDark: data[2] == "dark",
48
+        name: name
49
+    };
50
+    exports.themesByName[name] = theme;
51
+    return theme;
52
+});
53
+
54
+});
55
+                (function() {
56
+                    ace.require(["ace/ext/themelist"], function() {});
57
+                })();
58
+            

+ 181
- 0
generator/lib/ace/ext-whitespace.js Parādīt failu

@@ -0,0 +1,181 @@
1
+ace.define("ace/ext/whitespace",["require","exports","module","ace/lib/lang"], function(require, exports, module) {
2
+"use strict";
3
+
4
+var lang = require("../lib/lang");
5
+exports.$detectIndentation = function(lines, fallback) {
6
+    var stats = [];
7
+    var changes = [];
8
+    var tabIndents = 0;
9
+    var prevSpaces = 0;
10
+    var max = Math.min(lines.length, 1000);
11
+    for (var i = 0; i < max; i++) {
12
+        var line = lines[i];
13
+        if (!/^\s*[^*+\-\s]/.test(line))
14
+            continue;
15
+
16
+        if (line[0] == "\t")
17
+            tabIndents++;
18
+
19
+        var spaces = line.match(/^ */)[0].length;
20
+        if (spaces && line[spaces] != "\t") {
21
+            var diff = spaces - prevSpaces;
22
+            if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff))
23
+                changes[diff] = (changes[diff] || 0) + 1;
24
+
25
+            stats[spaces] = (stats[spaces] || 0) + 1;
26
+        }
27
+        prevSpaces = spaces;
28
+        while (i < max && line[line.length - 1] == "\\")
29
+            line = lines[i++];
30
+    }
31
+    
32
+    function getScore(indent) {
33
+        var score = 0;
34
+        for (var i = indent; i < stats.length; i += indent)
35
+            score += stats[i] || 0;
36
+        return score;
37
+    }
38
+
39
+    var changesTotal = changes.reduce(function(a,b){return a+b}, 0);
40
+
41
+    var first = {score: 0, length: 0};
42
+    var spaceIndents = 0;
43
+    for (var i = 1; i < 12; i++) {
44
+        var score = getScore(i);
45
+        if (i == 1) {
46
+            spaceIndents = score;
47
+            score = stats[1] ? 0.9 : 0.8;
48
+            if (!stats.length)
49
+                score = 0
50
+        } else
51
+            score /= spaceIndents;
52
+
53
+        if (changes[i])
54
+            score += changes[i] / changesTotal;
55
+
56
+        if (score > first.score)
57
+            first = {score: score, length: i};
58
+    }
59
+
60
+    if (first.score && first.score > 1.4)
61
+        var tabLength = first.length;
62
+
63
+    if (tabIndents > spaceIndents + 1)
64
+        return {ch: "\t", length: tabLength};
65
+
66
+    if (spaceIndents > tabIndents + 1)
67
+        return {ch: " ", length: tabLength};
68
+};
69
+
70
+exports.detectIndentation = function(session) {
71
+    var lines = session.getLines(0, 1000);
72
+    var indent = exports.$detectIndentation(lines) || {};
73
+
74
+    if (indent.ch)
75
+        session.setUseSoftTabs(indent.ch == " ");
76
+
77
+    if (indent.length)
78
+        session.setTabSize(indent.length);
79
+    return indent;
80
+};
81
+
82
+exports.trimTrailingSpace = function(session, trimEmpty) {
83
+    var doc = session.getDocument();
84
+    var lines = doc.getAllLines();
85
+    
86
+    var min = trimEmpty ? -1 : 0;
87
+
88
+    for (var i = 0, l=lines.length; i < l; i++) {
89
+        var line = lines[i];
90
+        var index = line.search(/\s+$/);
91
+
92
+        if (index > min)
93
+            doc.removeInLine(i, index, line.length);
94
+    }
95
+};
96
+
97
+exports.convertIndentation = function(session, ch, len) {
98
+    var oldCh = session.getTabString()[0];
99
+    var oldLen = session.getTabSize();
100
+    if (!len) len = oldLen;
101
+    if (!ch) ch = oldCh;
102
+
103
+    var tab = ch == "\t" ? ch: lang.stringRepeat(ch, len);
104
+
105
+    var doc = session.doc;
106
+    var lines = doc.getAllLines();
107
+
108
+    var cache = {};
109
+    var spaceCache = {};
110
+    for (var i = 0, l=lines.length; i < l; i++) {
111
+        var line = lines[i];
112
+        var match = line.match(/^\s*/)[0];
113
+        if (match) {
114
+            var w = session.$getStringScreenWidth(match)[0];
115
+            var tabCount = Math.floor(w/oldLen);
116
+            var reminder = w%oldLen;
117
+            var toInsert = cache[tabCount] || (cache[tabCount] = lang.stringRepeat(tab, tabCount));
118
+            toInsert += spaceCache[reminder] || (spaceCache[reminder] = lang.stringRepeat(" ", reminder));
119
+
120
+            if (toInsert != match) {
121
+                doc.removeInLine(i, 0, match.length);
122
+                doc.insertInLine({row: i, column: 0}, toInsert);
123
+            }
124
+        }
125
+    }
126
+    session.setTabSize(len);
127
+    session.setUseSoftTabs(ch == " ");
128
+};
129
+
130
+exports.$parseStringArg = function(text) {
131
+    var indent = {};
132
+    if (/t/.test(text))
133
+        indent.ch = "\t";
134
+    else if (/s/.test(text))
135
+        indent.ch = " ";
136
+    var m = text.match(/\d+/);
137
+    if (m)
138
+        indent.length = parseInt(m[0], 10);
139
+    return indent;
140
+};
141
+
142
+exports.$parseArg = function(arg) {
143
+    if (!arg)
144
+        return {};
145
+    if (typeof arg == "string")
146
+        return exports.$parseStringArg(arg);
147
+    if (typeof arg.text == "string")
148
+        return exports.$parseStringArg(arg.text);
149
+    return arg;
150
+};
151
+
152
+exports.commands = [{
153
+    name: "detectIndentation",
154
+    exec: function(editor) {
155
+        exports.detectIndentation(editor.session);
156
+    }
157
+}, {
158
+    name: "trimTrailingSpace",
159
+    exec: function(editor) {
160
+        exports.trimTrailingSpace(editor.session);
161
+    }
162
+}, {
163
+    name: "convertIndentation",
164
+    exec: function(editor, arg) {
165
+        var indent = exports.$parseArg(arg);
166
+        exports.convertIndentation(editor.session, indent.ch, indent.length);
167
+    }
168
+}, {
169
+    name: "setIndentation",
170
+    exec: function(editor, arg) {
171
+        var indent = exports.$parseArg(arg);
172
+        indent.length && editor.session.setTabSize(indent.length);
173
+        indent.ch && editor.session.setUseSoftTabs(indent.ch == " ");
174
+    }
175
+}];
176
+
177
+});
178
+                (function() {
179
+                    ace.require(["ace/ext/whitespace"], function() {});
180
+                })();
181
+            

+ 1182
- 0
generator/lib/ace/keybinding-emacs.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 5320
- 0
generator/lib/ace/keybinding-vim.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 230
- 0
generator/lib/ace/mode-abap.js Parādīt failu

@@ -0,0 +1,230 @@
1
+ace.define("ace/mode/abap_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 AbapHighlightRules = function() {
8
+
9
+    var keywordMapper = this.createKeywordMapper({
10
+        "variable.language": "this",
11
+        "keyword": 
12
+            "ADD ALIAS ALIASES ASSERT ASSIGN ASSIGNING AT BACK" +
13
+            " CALL CASE CATCH CHECK CLASS CLEAR CLOSE CNT COLLECT COMMIT COMMUNICATION COMPUTE CONCATENATE CONDENSE CONSTANTS CONTINUE CONTROLS CONVERT CREATE CURRENCY" +
14
+            " DATA DEFINE DEFINITION DEFERRED DELETE DESCRIBE DETAIL DIVIDE DO" +
15
+            " ELSE ELSEIF ENDAT ENDCASE ENDCLASS ENDDO ENDEXEC ENDFORM ENDFUNCTION ENDIF ENDIFEND ENDINTERFACE ENDLOOP ENDMETHOD ENDMODULE ENDON ENDPROVIDE ENDSELECT ENDTRY ENDWHILE EVENT EVENTS EXEC EXIT EXPORT EXPORTING EXTRACT" +
16
+            " FETCH FIELDS FORM FORMAT FREE FROM FUNCTION" +
17
+            " GENERATE GET" +
18
+            " HIDE" +
19
+            " IF IMPORT IMPORTING INDEX INFOTYPES INITIALIZATION INTERFACE INTERFACES INPUT INSERT IMPLEMENTATION" +
20
+            " LEAVE LIKE LINE LOAD LOCAL LOOP" +
21
+            " MESSAGE METHOD METHODS MODIFY MODULE MOVE MULTIPLY" +
22
+            " ON OVERLAY OPTIONAL OTHERS" +
23
+            " PACK PARAMETERS PERFORM POSITION PROGRAM PROVIDE PUT" +
24
+            " RAISE RANGES READ RECEIVE RECEIVING REDEFINITION REFERENCE REFRESH REJECT REPLACE REPORT RESERVE RESTORE RETURNING ROLLBACK" +
25
+            " SCAN SCROLL SEARCH SELECT SET SHIFT SKIP SORT SORTED SPLIT STANDARD STATICS STEP STOP SUBMIT SUBTRACT SUM SUMMARY SUPPRESS" +
26
+            " TABLES TIMES TRANSFER TRANSLATE TRY TYPE TYPES" +
27
+            " UNASSIGN ULINE UNPACK UPDATE" +
28
+            " WHEN WHILE WINDOW WRITE" +
29
+            " OCCURS STRUCTURE OBJECT PROPERTY" +
30
+            " CASTING APPEND RAISING VALUE COLOR" +
31
+            " CHANGING EXCEPTION EXCEPTIONS DEFAULT CHECKBOX COMMENT" +
32
+            " ID NUMBER FOR TITLE OUTPUT" +
33
+            " WITH EXIT USING" +
34
+            " INTO WHERE GROUP BY HAVING ORDER BY SINGLE" +
35
+            " APPENDING CORRESPONDING FIELDS OF TABLE" +
36
+            " LEFT RIGHT OUTER INNER JOIN AS CLIENT SPECIFIED BYPASSING BUFFER UP TO ROWS CONNECTING" +
37
+            " EQ NE LT LE GT GE NOT AND OR XOR IN LIKE BETWEEN",
38
+        "constant.language": 
39
+            "TRUE FALSE NULL SPACE",
40
+        "support.type": 
41
+            "c n i p f d t x string xstring decfloat16 decfloat34",
42
+        "keyword.operator":
43
+            "abs sign ceil floor trunc frac acos asin atan cos sin tan" +
44
+            " abapOperator cosh sinh tanh exp log log10 sqrt" +
45
+            " strlen xstrlen charlen numofchar dbmaxlen lines" 
46
+    }, "text", true, " ");
47
+
48
+    var compoundKeywords = "WITH\\W+(?:HEADER\\W+LINE|FRAME|KEY)|NO\\W+STANDARD\\W+PAGE\\W+HEADING|"+
49
+        "EXIT\\W+FROM\\W+STEP\\W+LOOP|BEGIN\\W+OF\\W+(?:BLOCK|LINE)|BEGIN\\W+OF|"+
50
+        "END\\W+OF\\W+(?:BLOCK|LINE)|END\\W+OF|NO\\W+INTERVALS|"+
51
+        "RESPECTING\\W+BLANKS|SEPARATED\\W+BY|USING\\W+(?:EDIT\\W+MASK)|"+
52
+        "WHERE\\W+(?:LINE)|RADIOBUTTON\\W+GROUP|REF\\W+TO|"+
53
+        "(?:PUBLIC|PRIVATE|PROTECTED)(?:\\W+SECTION)?|DELETING\\W+(?:TRAILING|LEADING)"+
54
+        "(?:ALL\\W+OCCURRENCES)|(?:FIRST|LAST)\\W+OCCURRENCE|INHERITING\\W+FROM|"+
55
+        "LINE-COUNT|ADD-CORRESPONDING|AUTHORITY-CHECK|BREAK-POINT|CLASS-DATA|CLASS-METHODS|"+
56
+        "CLASS-METHOD|DIVIDE-CORRESPONDING|EDITOR-CALL|END-OF-DEFINITION|END-OF-PAGE|END-OF-SELECTION|"+
57
+        "FIELD-GROUPS|FIELD-SYMBOLS|FUNCTION-POOL|MOVE-CORRESPONDING|MULTIPLY-CORRESPONDING|NEW-LINE|"+
58
+        "NEW-PAGE|NEW-SECTION|PRINT-CONTROL|RP-PROVIDE-FROM-LAST|SELECT-OPTIONS|SELECTION-SCREEN|"+
59
+        "START-OF-SELECTION|SUBTRACT-CORRESPONDING|SYNTAX-CHECK|SYNTAX-TRACE|TOP-OF-PAGE|TYPE-POOL|"+
60
+        "TYPE-POOLS|LINE-SIZE|LINE-COUNT|MESSAGE-ID|DISPLAY-MODE|READ(?:-ONLY)?|"+
61
+        "IS\\W+(?:NOT\\W+)?(?:ASSIGNED|BOUND|INITIAL|SUPPLIED)";
62
+     
63
+    this.$rules = {
64
+        "start" : [
65
+            {token : "string", regex : "`", next  : "string"},
66
+            {token : "string", regex : "'", next  : "qstring"},
67
+            {token : "doc.comment", regex : /^\*.+/},
68
+            {token : "comment",  regex : /".+$/},
69
+            {token : "invalid", regex: "\\.{2,}"},
70
+            {token : "keyword.operator", regex: /\W[\-+\%=<>*]\W|\*\*|[~:,\.&$]|->*?|=>/},
71
+            {token : "paren.lparen", regex : "[\\[({]"},
72
+            {token : "paren.rparen", regex : "[\\])}]"},
73
+            {token : "constant.numeric", regex: "[+-]?\\d+\\b"},
74
+            {token : "variable.parameter", regex : /sy|pa?\d\d\d\d\|t\d\d\d\.|innnn/}, 
75
+            {token : "keyword", regex : compoundKeywords}, 
76
+            {token : "variable.parameter", regex : /\w+-\w+(?:-\w+)*/}, 
77
+            {token : keywordMapper, regex : "\\b\\w+\\b"},
78
+            {caseInsensitive: true}
79
+        ],
80
+        "qstring" : [
81
+            {token : "constant.language.escape",   regex : "''"},
82
+            {token : "string", regex : "'",     next  : "start"},
83
+            {defaultToken : "string"}
84
+        ],
85
+        "string" : [
86
+            {token : "constant.language.escape",   regex : "``"},
87
+            {token : "string", regex : "`",     next  : "start"},
88
+            {defaultToken : "string"}
89
+        ]
90
+    }
91
+};
92
+oop.inherits(AbapHighlightRules, TextHighlightRules);
93
+
94
+exports.AbapHighlightRules = AbapHighlightRules;
95
+});
96
+
97
+ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
98
+"use strict";
99
+
100
+var oop = require("../../lib/oop");
101
+var BaseFoldMode = require("./fold_mode").FoldMode;
102
+var Range = require("../../range").Range;
103
+
104
+var FoldMode = exports.FoldMode = function() {};
105
+oop.inherits(FoldMode, BaseFoldMode);
106
+
107
+(function() {
108
+
109
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
110
+        var range = this.indentationBlock(session, row);
111
+        if (range)
112
+            return range;
113
+
114
+        var re = /\S/;
115
+        var line = session.getLine(row);
116
+        var startLevel = line.search(re);
117
+        if (startLevel == -1 || line[startLevel] != "#")
118
+            return;
119
+
120
+        var startColumn = line.length;
121
+        var maxRow = session.getLength();
122
+        var startRow = row;
123
+        var endRow = row;
124
+
125
+        while (++row < maxRow) {
126
+            line = session.getLine(row);
127
+            var level = line.search(re);
128
+
129
+            if (level == -1)
130
+                continue;
131
+
132
+            if (line[level] != "#")
133
+                break;
134
+
135
+            endRow = row;
136
+        }
137
+
138
+        if (endRow > startRow) {
139
+            var endColumn = session.getLine(endRow).length;
140
+            return new Range(startRow, startColumn, endRow, endColumn);
141
+        }
142
+    };
143
+    this.getFoldWidget = function(session, foldStyle, row) {
144
+        var line = session.getLine(row);
145
+        var indent = line.search(/\S/);
146
+        var next = session.getLine(row + 1);
147
+        var prev = session.getLine(row - 1);
148
+        var prevIndent = prev.search(/\S/);
149
+        var nextIndent = next.search(/\S/);
150
+
151
+        if (indent == -1) {
152
+            session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
153
+            return "";
154
+        }
155
+        if (prevIndent == -1) {
156
+            if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
157
+                session.foldWidgets[row - 1] = "";
158
+                session.foldWidgets[row + 1] = "";
159
+                return "start";
160
+            }
161
+        } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
162
+            if (session.getLine(row - 2).search(/\S/) == -1) {
163
+                session.foldWidgets[row - 1] = "start";
164
+                session.foldWidgets[row + 1] = "";
165
+                return "";
166
+            }
167
+        }
168
+
169
+        if (prevIndent!= -1 && prevIndent < indent)
170
+            session.foldWidgets[row - 1] = "start";
171
+        else
172
+            session.foldWidgets[row - 1] = "";
173
+
174
+        if (indent < nextIndent)
175
+            return "start";
176
+        else
177
+            return "";
178
+    };
179
+
180
+}).call(FoldMode.prototype);
181
+
182
+});
183
+
184
+ace.define("ace/mode/abap",["require","exports","module","ace/mode/abap_highlight_rules","ace/mode/folding/coffee","ace/range","ace/mode/text","ace/lib/oop"], function(require, exports, module) {
185
+"use strict";
186
+
187
+var Rules = require("./abap_highlight_rules").AbapHighlightRules;
188
+var FoldMode = require("./folding/coffee").FoldMode;
189
+var Range = require("../range").Range;
190
+var TextMode = require("./text").Mode;
191
+var oop = require("../lib/oop");
192
+
193
+function Mode() {
194
+    this.HighlightRules = Rules;
195
+    this.foldingRules = new FoldMode();
196
+}
197
+
198
+oop.inherits(Mode, TextMode);
199
+
200
+(function() {
201
+    
202
+    this.getNextLineIndent = function(state, line, tab) {
203
+        var indent = this.$getIndent(line);
204
+        return indent;
205
+    };
206
+    
207
+    this.toggleCommentLines = function(state, doc, startRow, endRow){
208
+        var range = new Range(0, 0, 0, 0);
209
+        for (var i = startRow; i <= endRow; ++i) {
210
+            var line = doc.getLine(i);
211
+            if (hereComment.test(line))
212
+                continue;
213
+                
214
+            if (commentLine.test(line))
215
+                line = line.replace(commentLine, '$1');
216
+            else
217
+                line = line.replace(indentation, '$&#');
218
+    
219
+            range.end.row = range.start.row = i;
220
+            range.end.column = line.length + 1;
221
+            doc.replace(range, line);
222
+        }
223
+    };
224
+    
225
+    this.$id = "ace/mode/abap";
226
+}).call(Mode.prototype);
227
+
228
+exports.Mode = Mode;
229
+
230
+});

+ 267
- 0
generator/lib/ace/mode-actionscript.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 87
- 0
generator/lib/ace/mode-ada.js Parādīt failu

@@ -0,0 +1,87 @@
1
+ace.define("ace/mode/ada_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 AdaHighlightRules = function() {
8
+var keywords = "abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|" +
9
+"access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|" +
10
+"array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|" +
11
+"body|private|then|if|procedure|type|case|in|protected|constant|interface|until|" +
12
+"|is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor";
13
+
14
+    var builtinConstants = (
15
+        "true|false|null"
16
+    );
17
+
18
+    var builtinFunctions = (
19
+        "count|min|max|avg|sum|rank|now|coalesce|main"
20
+    );
21
+
22
+    var keywordMapper = this.createKeywordMapper({
23
+        "support.function": builtinFunctions,
24
+        "keyword": keywords,
25
+        "constant.language": builtinConstants
26
+    }, "identifier", true);
27
+
28
+    this.$rules = {
29
+        "start" : [ {
30
+            token : "comment",
31
+            regex : "--.*$"
32
+        }, {
33
+            token : "string",           // " string
34
+            regex : '".*?"'
35
+        }, {
36
+            token : "string",           // ' string
37
+            regex : "'.*?'"
38
+        }, {
39
+            token : "constant.numeric", // float
40
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
41
+        }, {
42
+            token : keywordMapper,
43
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
44
+        }, {
45
+            token : "keyword.operator",
46
+            regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
47
+        }, {
48
+            token : "paren.lparen",
49
+            regex : "[\\(]"
50
+        }, {
51
+            token : "paren.rparen",
52
+            regex : "[\\)]"
53
+        }, {
54
+            token : "text",
55
+            regex : "\\s+"
56
+        } ]
57
+    };
58
+};
59
+
60
+oop.inherits(AdaHighlightRules, TextHighlightRules);
61
+
62
+exports.AdaHighlightRules = AdaHighlightRules;
63
+});
64
+
65
+ace.define("ace/mode/ada",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ada_highlight_rules","ace/range"], function(require, exports, module) {
66
+"use strict";
67
+
68
+var oop = require("../lib/oop");
69
+var TextMode = require("./text").Mode;
70
+var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules;
71
+var Range = require("../range").Range;
72
+
73
+var Mode = function() {
74
+    this.HighlightRules = AdaHighlightRules;
75
+};
76
+oop.inherits(Mode, TextMode);
77
+
78
+(function() {
79
+
80
+    this.lineCommentStart = "--";
81
+
82
+    this.$id = "ace/mode/ada";
83
+}).call(Mode.prototype);
84
+
85
+exports.Mode = Mode;
86
+
87
+});

+ 356
- 0
generator/lib/ace/mode-apache_conf.js Parādīt failu

@@ -0,0 +1,356 @@
1
+ace.define("ace/mode/apache_conf_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 ApacheConfHighlightRules = function() {
8
+
9
+    this.$rules = { start: 
10
+       [ { token: 
11
+            [ 'punctuation.definition.comment.apacheconf',
12
+              'comment.line.hash.ini',
13
+              'comment.line.hash.ini' ],
14
+           regex: '^((?:\\s)*)(#)(.*$)' },
15
+         { token: 
16
+            [ 'punctuation.definition.tag.apacheconf',
17
+              'entity.tag.apacheconf',
18
+              'text',
19
+              'string.value.apacheconf',
20
+              'punctuation.definition.tag.apacheconf' ],
21
+           regex: '(<)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost)(?:(\\s)(.+?))?(>)' },
22
+         { token: 
23
+            [ 'punctuation.definition.tag.apacheconf',
24
+              'entity.tag.apacheconf',
25
+              'punctuation.definition.tag.apacheconf' ],
26
+           regex: '(</)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost)(>)' },
27
+         { token: 
28
+            [ 'keyword.alias.apacheconf', 'text',
29
+              'string.regexp.apacheconf', 'text',
30
+              'string.replacement.apacheconf', 'text' ],
31
+           regex: '(Rewrite(?:Rule|Cond))(\\s+)(.+?)(\\s+)(.+?)($|\\s)' },
32
+         { token: 
33
+            [ 'keyword.alias.apacheconf', 'text',
34
+              'entity.status.apacheconf', 'text',
35
+              'string.regexp.apacheconf', 'text',
36
+              'string.path.apacheconf', 'text' ],
37
+           regex: '(RedirectMatch)(?:(\\s+)(\\d\\d\\d|permanent|temp|seeother|gone))?(\\s+)(.+?)(\\s+)(?:(.+?)($|\\s))?' },
38
+         { token: 
39
+            [ 'keyword.alias.apacheconf', 'text', 
40
+              'entity.status.apacheconf', 'text',
41
+              'string.path.apacheconf', 'text',
42
+              'string.path.apacheconf', 'text' ],
43
+           regex: '(Redirect)(?:(\\s+)(\\d\\d\\d|permanent|temp|seeother|gone))?(\\s+)(.+?)(\\s+)(?:(.+?)($|\\s))?' },
44
+         { token: 
45
+            [ 'keyword.alias.apacheconf', 'text',
46
+              'string.regexp.apacheconf', 'text',
47
+              'string.path.apacheconf', 'text' ],
48
+           regex: '(ScriptAliasMatch|AliasMatch)(\\s+)(.+?)(\\s+)(?:(.+?)(\\s))?' },
49
+         { token: 
50
+            [ 'keyword.alias.apacheconf', 'text',
51
+              'string.path.apacheconf', 'text',
52
+              'string.path.apacheconf', 'text' ],
53
+           regex: '(RedirectPermanent|RedirectTemp|ScriptAlias|Alias)(\\s+)(.+?)(\\s+)(?:(.+?)($|\\s))?' },
54
+         { token: 'keyword.core.apacheconf',
55
+           regex: '\\b(?:AcceptPathInfo|AccessFileName|AddDefaultCharset|AddOutputFilterByType|AllowEncodedSlashes|AllowOverride|AuthName|AuthType|CGIMapExtension|ContentDigest|DefaultType|DocumentRoot|EnableMMAP|EnableSendfile|ErrorDocument|ErrorLog|FileETag|ForceType|HostnameLookups|IdentityCheck|Include|KeepAlive|KeepAliveTimeout|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine|LimitXMLRequestBody|LogLevel|MaxKeepAliveRequests|NameVirtualHost|Options|Require|RLimitCPU|RLimitMEM|RLimitNPROC|Satisfy|ScriptInterpreterSource|ServerAdmin|ServerAlias|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|SetHandler|SetInputFilter|SetOutputFilter|TimeOut|TraceEnable|UseCanonicalName)\\b' },
56
+         { token: 'keyword.mpm.apacheconf',
57
+           regex: '\\b(?:AcceptMutex|AssignUserID|BS2000Account|ChildPerUserID|CoreDumpDirectory|EnableExceptionHook|Group|Listen|ListenBacklog|LockFile|MaxClients|MaxMemFree|MaxRequestsPerChild|MaxRequestsPerThread|MaxSpareServers|MaxSpareThreads|MaxThreads|MaxThreadsPerChild|MinSpareServers|MinSpareThreads|NumServers|PidFile|ReceiveBufferSize|ScoreBoardFile|SendBufferSize|ServerLimit|StartServers|StartThreads|ThreadLimit|ThreadsPerChild|ThreadStackSize|User|Win32DisableAcceptEx)\\b' },
58
+         { token: 'keyword.access.apacheconf',
59
+           regex: '\\b(?:Allow|Deny|Order)\\b' },
60
+         { token: 'keyword.actions.apacheconf',
61
+           regex: '\\b(?:Action|Script)\\b' },
62
+         { token: 'keyword.alias.apacheconf',
63
+           regex: '\\b(?:Alias|AliasMatch|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ScriptAlias|ScriptAliasMatch)\\b' },
64
+         { token: 'keyword.auth.apacheconf',
65
+           regex: '\\b(?:AuthAuthoritative|AuthGroupFile|AuthUserFile)\\b' },
66
+         { token: 'keyword.auth_anon.apacheconf',
67
+           regex: '\\b(?:Anonymous|Anonymous_Authoritative|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID|Anonymous_VerifyEmail)\\b' },
68
+         { token: 'keyword.auth_dbm.apacheconf',
69
+           regex: '\\b(?:AuthDBMAuthoritative|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile)\\b' },
70
+         { token: 'keyword.auth_digest.apacheconf',
71
+           regex: '\\b(?:AuthDigestAlgorithm|AuthDigestDomain|AuthDigestFile|AuthDigestGroupFile|AuthDigestNcCheck|AuthDigestNonceFormat|AuthDigestNonceLifetime|AuthDigestQop|AuthDigestShmemSize)\\b' },
72
+         { token: 'keyword.auth_ldap.apacheconf',
73
+           regex: '\\b(?:AuthLDAPAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases|AuthLDAPEnabled|AuthLDAPFrontPageHack|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPRemoteUserIsDN|AuthLDAPUrl)\\b' },
74
+         { token: 'keyword.autoindex.apacheconf',
75
+           regex: '\\b(?:AddAlt|AddAltByEncoding|AddAltByType|AddDescription|AddIcon|AddIconByEncoding|AddIconByType|DefaultIcon|HeaderName|IndexIgnore|IndexOptions|IndexOrderDefault|ReadmeName)\\b' },
76
+         { token: 'keyword.cache.apacheconf',
77
+           regex: '\\b(?:CacheDefaultExpire|CacheDisable|CacheEnable|CacheForceCompletion|CacheIgnoreCacheControl|CacheIgnoreHeaders|CacheIgnoreNoLastMod|CacheLastModifiedFactor|CacheMaxExpire)\\b' },
78
+         { token: 'keyword.cern_meta.apacheconf',
79
+           regex: '\\b(?:MetaDir|MetaFiles|MetaSuffix)\\b' },
80
+         { token: 'keyword.cgi.apacheconf',
81
+           regex: '\\b(?:ScriptLog|ScriptLogBuffer|ScriptLogLength)\\b' },
82
+         { token: 'keyword.cgid.apacheconf',
83
+           regex: '\\b(?:ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock)\\b' },
84
+         { token: 'keyword.charset_lite.apacheconf',
85
+           regex: '\\b(?:CharsetDefault|CharsetOptions|CharsetSourceEnc)\\b' },
86
+         { token: 'keyword.dav.apacheconf',
87
+           regex: '\\b(?:Dav|DavDepthInfinity|DavMinTimeout|DavLockDB)\\b' },
88
+         { token: 'keyword.deflate.apacheconf',
89
+           regex: '\\b(?:DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateMemLevel|DeflateWindowSize)\\b' },
90
+         { token: 'keyword.dir.apacheconf',
91
+           regex: '\\b(?:DirectoryIndex|DirectorySlash)\\b' },
92
+         { token: 'keyword.disk_cache.apacheconf',
93
+           regex: '\\b(?:CacheDirLength|CacheDirLevels|CacheExpiryCheck|CacheGcClean|CacheGcDaily|CacheGcInterval|CacheGcMemUsage|CacheGcUnused|CacheMaxFileSize|CacheMinFileSize|CacheRoot|CacheSize|CacheTimeMargin)\\b' },
94
+         { token: 'keyword.dumpio.apacheconf',
95
+           regex: '\\b(?:DumpIOInput|DumpIOOutput)\\b' },
96
+         { token: 'keyword.env.apacheconf',
97
+           regex: '\\b(?:PassEnv|SetEnv|UnsetEnv)\\b' },
98
+         { token: 'keyword.expires.apacheconf',
99
+           regex: '\\b(?:ExpiresActive|ExpiresByType|ExpiresDefault)\\b' },
100
+         { token: 'keyword.ext_filter.apacheconf',
101
+           regex: '\\b(?:ExtFilterDefine|ExtFilterOptions)\\b' },
102
+         { token: 'keyword.file_cache.apacheconf',
103
+           regex: '\\b(?:CacheFile|MMapFile)\\b' },
104
+         { token: 'keyword.headers.apacheconf',
105
+           regex: '\\b(?:Header|RequestHeader)\\b' },
106
+         { token: 'keyword.imap.apacheconf',
107
+           regex: '\\b(?:ImapBase|ImapDefault|ImapMenu)\\b' },
108
+         { token: 'keyword.include.apacheconf',
109
+           regex: '\\b(?:SSIEndTag|SSIErrorMsg|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|XBitHack)\\b' },
110
+         { token: 'keyword.isapi.apacheconf',
111
+           regex: '\\b(?:ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer)\\b' },
112
+         { token: 'keyword.ldap.apacheconf',
113
+           regex: '\\b(?:LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionTimeout|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPSharedCacheFile|LDAPSharedCacheSize|LDAPTrustedCA|LDAPTrustedCAType)\\b' },
114
+         { token: 'keyword.log.apacheconf',
115
+           regex: '\\b(?:BufferedLogs|CookieLog|CustomLog|LogFormat|TransferLog|ForensicLog)\\b' },
116
+         { token: 'keyword.mem_cache.apacheconf',
117
+           regex: '\\b(?:MCacheMaxObjectCount|MCacheMaxObjectSize|MCacheMaxStreamingBuffer|MCacheMinObjectSize|MCacheRemovalAlgorithm|MCacheSize)\\b' },
118
+         { token: 'keyword.mime.apacheconf',
119
+           regex: '\\b(?:AddCharset|AddEncoding|AddHandler|AddInputFilter|AddLanguage|AddOutputFilter|AddType|DefaultLanguage|ModMimeUsePathInfo|MultiviewsMatch|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|TypesConfig)\\b' },
120
+         { token: 'keyword.misc.apacheconf',
121
+           regex: '\\b(?:ProtocolEcho|Example|AddModuleInfo|MimeMagicFile|CheckSpelling|ExtendedStatus|SuexecUserGroup|UserDir)\\b' },
122
+         { token: 'keyword.negotiation.apacheconf',
123
+           regex: '\\b(?:CacheNegotiatedDocs|ForceLanguagePriority|LanguagePriority)\\b' },
124
+         { token: 'keyword.nw_ssl.apacheconf',
125
+           regex: '\\b(?:NWSSLTrustedCerts|NWSSLUpgradeable|SecureListen)\\b' },
126
+         { token: 'keyword.proxy.apacheconf',
127
+           regex: '\\b(?:AllowCONNECT|NoProxy|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyFtpDirCharset|ProxyIOBufferSize|ProxyMaxForwards|ProxyPass|ProxyPassReverse|ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxyTimeout|ProxyVia)\\b' },
128
+         { token: 'keyword.rewrite.apacheconf',
129
+           regex: '\\b(?:RewriteBase|RewriteCond|RewriteEngine|RewriteLock|RewriteLog|RewriteLogLevel|RewriteMap|RewriteOptions|RewriteRule)\\b' },
130
+         { token: 'keyword.setenvif.apacheconf',
131
+           regex: '\\b(?:BrowserMatch|BrowserMatchNoCase|SetEnvIf|SetEnvIfNoCase)\\b' },
132
+         { token: 'keyword.so.apacheconf',
133
+           regex: '\\b(?:LoadFile|LoadModule)\\b' },
134
+         { token: 'keyword.ssl.apacheconf',
135
+           regex: '\\b(?:SSLCACertificateFile|SSLCACertificatePath|SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLEngine|SSLMutex|SSLOptions|SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCipherSuite|SSLProxyEngine|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRequire|SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLUserName|SSLVerifyClient|SSLVerifyDepth)\\b' },
136
+         { token: 'keyword.usertrack.apacheconf',
137
+           regex: '\\b(?:CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking)\\b' },
138
+         { token: 'keyword.vhost_alias.apacheconf',
139
+           regex: '\\b(?:VirtualDocumentRoot|VirtualDocumentRootIP|VirtualScriptAlias|VirtualScriptAliasIP)\\b' },
140
+         { token: 
141
+            [ 'keyword.php.apacheconf',
142
+              'text',
143
+              'entity.property.apacheconf',
144
+              'text',
145
+              'string.value.apacheconf',
146
+              'text' ],
147
+           regex: '\\b(php_value|php_flag)\\b(?:(\\s+)(.+?)(?:(\\s+)(.+?))?)?(\\s)' },
148
+         { token: 
149
+            [ 'punctuation.variable.apacheconf',
150
+              'variable.env.apacheconf',
151
+              'variable.misc.apacheconf',
152
+              'punctuation.variable.apacheconf' ],
153
+           regex: '(%\\{)(?:(HTTP_USER_AGENT|HTTP_REFERER|HTTP_COOKIE|HTTP_FORWARDED|HTTP_HOST|HTTP_PROXY_CONNECTION|HTTP_ACCEPT|REMOTE_ADDR|REMOTE_HOST|REMOTE_PORT|REMOTE_USER|REMOTE_IDENT|REQUEST_METHOD|SCRIPT_FILENAME|PATH_INFO|QUERY_STRING|AUTH_TYPE|DOCUMENT_ROOT|SERVER_ADMIN|SERVER_NAME|SERVER_ADDR|SERVER_PORT|SERVER_PROTOCOL|SERVER_SOFTWARE|TIME_YEAR|TIME_MON|TIME_DAY|TIME_HOUR|TIME_MIN|TIME_SEC|TIME_WDAY|TIME|API_VERSION|THE_REQUEST|REQUEST_URI|REQUEST_FILENAME|IS_SUBREQ|HTTPS)|(.*?))(\\})' },
154
+         { token: [ 'entity.mime-type.apacheconf', 'text' ],
155
+           regex: '\\b((?:text|image|application|video|audio)/.+?)(\\s)' },
156
+         { token: 'entity.helper.apacheconf',
157
+           regex: '\\b(?:from|unset|set|on|off)\\b',
158
+           caseInsensitive: true },
159
+         { token: 'constant.integer.apacheconf', regex: '\\b\\d+\\b' },
160
+         { token: 
161
+            [ 'text',
162
+              'punctuation.definition.flag.apacheconf',
163
+              'string.flag.apacheconf',
164
+              'punctuation.definition.flag.apacheconf',
165
+              'text' ],
166
+           regex: '(\\s)(\\[)(.*?)(\\])(\\s)' } ] }
167
+    
168
+    this.normalizeRules();
169
+};
170
+
171
+ApacheConfHighlightRules.metaData = { fileTypes: 
172
+       [ 'conf',
173
+         'CONF',
174
+         'htaccess',
175
+         'HTACCESS',
176
+         'htgroups',
177
+         'HTGROUPS',
178
+         'htpasswd',
179
+         'HTPASSWD',
180
+         '.htaccess',
181
+         '.HTACCESS',
182
+         '.htgroups',
183
+         '.HTGROUPS',
184
+         '.htpasswd',
185
+         '.HTPASSWD' ],
186
+      name: 'Apache Conf',
187
+      scopeName: 'source.apacheconf' }
188
+
189
+
190
+oop.inherits(ApacheConfHighlightRules, TextHighlightRules);
191
+
192
+exports.ApacheConfHighlightRules = ApacheConfHighlightRules;
193
+});
194
+
195
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
196
+"use strict";
197
+
198
+var oop = require("../../lib/oop");
199
+var Range = require("../../range").Range;
200
+var BaseFoldMode = require("./fold_mode").FoldMode;
201
+
202
+var FoldMode = exports.FoldMode = function(commentRegex) {
203
+    if (commentRegex) {
204
+        this.foldingStartMarker = new RegExp(
205
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
206
+        );
207
+        this.foldingStopMarker = new RegExp(
208
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
209
+        );
210
+    }
211
+};
212
+oop.inherits(FoldMode, BaseFoldMode);
213
+
214
+(function() {
215
+    
216
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
217
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
218
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
219
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
220
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
221
+    this._getFoldWidgetBase = this.getFoldWidget;
222
+    this.getFoldWidget = function(session, foldStyle, row) {
223
+        var line = session.getLine(row);
224
+    
225
+        if (this.singleLineBlockCommentRe.test(line)) {
226
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
227
+                return "";
228
+        }
229
+    
230
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
231
+    
232
+        if (!fw && this.startRegionRe.test(line))
233
+            return "start"; // lineCommentRegionStart
234
+    
235
+        return fw;
236
+    };
237
+
238
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
239
+        var line = session.getLine(row);
240
+        
241
+        if (this.startRegionRe.test(line))
242
+            return this.getCommentRegionBlock(session, line, row);
243
+        
244
+        var match = line.match(this.foldingStartMarker);
245
+        if (match) {
246
+            var i = match.index;
247
+
248
+            if (match[1])
249
+                return this.openingBracketBlock(session, match[1], row, i);
250
+                
251
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
252
+            
253
+            if (range && !range.isMultiLine()) {
254
+                if (forceMultiline) {
255
+                    range = this.getSectionRange(session, row);
256
+                } else if (foldStyle != "all")
257
+                    range = null;
258
+            }
259
+            
260
+            return range;
261
+        }
262
+
263
+        if (foldStyle === "markbegin")
264
+            return;
265
+
266
+        var match = line.match(this.foldingStopMarker);
267
+        if (match) {
268
+            var i = match.index + match[0].length;
269
+
270
+            if (match[1])
271
+                return this.closingBracketBlock(session, match[1], row, i);
272
+
273
+            return session.getCommentFoldRange(row, i, -1);
274
+        }
275
+    };
276
+    
277
+    this.getSectionRange = function(session, row) {
278
+        var line = session.getLine(row);
279
+        var startIndent = line.search(/\S/);
280
+        var startRow = row;
281
+        var startColumn = line.length;
282
+        row = row + 1;
283
+        var endRow = row;
284
+        var maxRow = session.getLength();
285
+        while (++row < maxRow) {
286
+            line = session.getLine(row);
287
+            var indent = line.search(/\S/);
288
+            if (indent === -1)
289
+                continue;
290
+            if  (startIndent > indent)
291
+                break;
292
+            var subRange = this.getFoldWidgetRange(session, "all", row);
293
+            
294
+            if (subRange) {
295
+                if (subRange.start.row <= startRow) {
296
+                    break;
297
+                } else if (subRange.isMultiLine()) {
298
+                    row = subRange.end.row;
299
+                } else if (startIndent == indent) {
300
+                    break;
301
+                }
302
+            }
303
+            endRow = row;
304
+        }
305
+        
306
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
307
+    };
308
+    
309
+    this.getCommentRegionBlock = function(session, line, row) {
310
+        var startColumn = line.search(/\s*$/);
311
+        var maxRow = session.getLength();
312
+        var startRow = row;
313
+        
314
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
315
+        var depth = 1;
316
+        while (++row < maxRow) {
317
+            line = session.getLine(row);
318
+            var m = re.exec(line);
319
+            if (!m) continue;
320
+            if (m[1]) depth--;
321
+            else depth++;
322
+
323
+            if (!depth) break;
324
+        }
325
+
326
+        var endRow = row;
327
+        if (endRow > startRow) {
328
+            return new Range(startRow, startColumn, endRow, line.length);
329
+        }
330
+    };
331
+
332
+}).call(FoldMode.prototype);
333
+
334
+});
335
+
336
+ace.define("ace/mode/apache_conf",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/apache_conf_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
337
+"use strict";
338
+
339
+var oop = require("../lib/oop");
340
+var TextMode = require("./text").Mode;
341
+var ApacheConfHighlightRules = require("./apache_conf_highlight_rules").ApacheConfHighlightRules;
342
+var FoldMode = require("./folding/cstyle").FoldMode;
343
+
344
+var Mode = function() {
345
+    this.HighlightRules = ApacheConfHighlightRules;
346
+    this.foldingRules = new FoldMode();
347
+};
348
+oop.inherits(Mode, TextMode);
349
+
350
+(function() {
351
+    this.lineCommentStart = "#";
352
+    this.$id = "ace/mode/apache_conf";
353
+}).call(Mode.prototype);
354
+
355
+exports.Mode = Mode;
356
+});

+ 272
- 0
generator/lib/ace/mode-applescript.js Parādīt failu

@@ -0,0 +1,272 @@
1
+ace.define("ace/mode/applescript_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 AppleScriptHighlightRules = function() {
8
+    var keywords = (
9
+        "about|above|after|against|and|around|as|at|back|before|beginning|" +
10
+        "behind|below|beneath|beside|between|but|by|considering|" +
11
+        "contain|contains|continue|copy|div|does|eighth|else|end|equal|" +
12
+        "equals|error|every|exit|fifth|first|for|fourth|from|front|" +
13
+        "get|given|global|if|ignoring|in|into|is|it|its|last|local|me|" +
14
+        "middle|mod|my|ninth|not|of|on|onto|or|over|prop|property|put|ref|" +
15
+        "reference|repeat|returning|script|second|set|seventh|since|" +
16
+        "sixth|some|tell|tenth|that|the|then|third|through|thru|" +
17
+        "timeout|times|to|transaction|try|until|where|while|whose|with|without"
18
+    );
19
+
20
+    var builtinConstants = (
21
+        "AppleScript|false|linefeed|return|pi|quote|result|space|tab|true"
22
+    );
23
+
24
+    var builtinFunctions = (
25
+        "activate|beep|count|delay|launch|log|offset|read|round|run|say|" +
26
+        "summarize|write"
27
+    );
28
+
29
+    var builtinTypes = (
30
+        "alias|application|boolean|class|constant|date|file|integer|list|" +
31
+        "number|real|record|string|text|character|characters|contents|day|" +
32
+        "frontmost|id|item|length|month|name|paragraph|paragraphs|rest|" +
33
+        "reverse|running|time|version|weekday|word|words|year"
34
+    );
35
+
36
+    var keywordMapper = this.createKeywordMapper({
37
+        "support.function": builtinFunctions,
38
+        "constant.language": builtinConstants,
39
+        "support.type": builtinTypes,
40
+        "keyword": keywords
41
+    }, "identifier");
42
+
43
+    this.$rules = {
44
+        "start": [
45
+            {
46
+                token: "comment",
47
+                regex: "--.*$"
48
+            },
49
+            {
50
+                token : "comment", // multi line comment
51
+                regex : "\\(\\*",
52
+                next : "comment"
53
+            },
54
+            {
55
+                token: "string",           // " string
56
+                regex: '".*?"'
57
+            },
58
+            {
59
+                token: "support.type",
60
+                regex: '\\b(POSIX file|POSIX path|(date|time) string|quoted form)\\b'
61
+            },
62
+            {
63
+                token: "support.function",
64
+                regex: '\\b(clipboard info|the clipboard|info for|list (disks|folder)|' +
65
+          'mount volume|path to|(close|open for) access|(get|set) eof|' +
66
+          'current date|do shell script|get volume settings|random number|' +
67
+          'set volume|system attribute|system info|time to GMT|' +
68
+          '(load|run|store) script|scripting components|' +
69
+          'ASCII (character|number)|localized string|' +
70
+          'choose (application|color|file|file name|' +
71
+          'folder|from list|remote application|URL)|' +
72
+          'display (alert|dialog))\\b|^\\s*return\\b'
73
+            },
74
+            {
75
+                token: "constant.language",
76
+                regex: '\\b(text item delimiters|current application|missing value)\\b'
77
+            },
78
+            {
79
+                token: "keyword",
80
+                regex: '\\b(apart from|aside from|instead of|out of|greater than|' +
81
+          "isn't|(doesn't|does not) (equal|come before|come after|contain)|" +
82
+          '(greater|less) than( or equal)?|(starts?|ends|begins?) with|' +
83
+          'contained by|comes (before|after)|a (ref|reference))\\b'
84
+            },
85
+            {
86
+                token: keywordMapper,
87
+                regex: "[a-zA-Z][a-zA-Z0-9_]*\\b"
88
+            }
89
+        ],
90
+        "comment": [
91
+            {
92
+                token: "comment", // closing comment
93
+                regex: "\\*\\)",
94
+                next: "start"
95
+            }, {
96
+                defaultToken: "comment"
97
+            }
98
+        ]
99
+    }
100
+
101
+    this.normalizeRules();
102
+};
103
+
104
+oop.inherits(AppleScriptHighlightRules, TextHighlightRules);
105
+
106
+exports.AppleScriptHighlightRules = AppleScriptHighlightRules;
107
+});
108
+
109
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
110
+"use strict";
111
+
112
+var oop = require("../../lib/oop");
113
+var Range = require("../../range").Range;
114
+var BaseFoldMode = require("./fold_mode").FoldMode;
115
+
116
+var FoldMode = exports.FoldMode = function(commentRegex) {
117
+    if (commentRegex) {
118
+        this.foldingStartMarker = new RegExp(
119
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
120
+        );
121
+        this.foldingStopMarker = new RegExp(
122
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
123
+        );
124
+    }
125
+};
126
+oop.inherits(FoldMode, BaseFoldMode);
127
+
128
+(function() {
129
+    
130
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
131
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
132
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
133
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
134
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
135
+    this._getFoldWidgetBase = this.getFoldWidget;
136
+    this.getFoldWidget = function(session, foldStyle, row) {
137
+        var line = session.getLine(row);
138
+    
139
+        if (this.singleLineBlockCommentRe.test(line)) {
140
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
141
+                return "";
142
+        }
143
+    
144
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
145
+    
146
+        if (!fw && this.startRegionRe.test(line))
147
+            return "start"; // lineCommentRegionStart
148
+    
149
+        return fw;
150
+    };
151
+
152
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
153
+        var line = session.getLine(row);
154
+        
155
+        if (this.startRegionRe.test(line))
156
+            return this.getCommentRegionBlock(session, line, row);
157
+        
158
+        var match = line.match(this.foldingStartMarker);
159
+        if (match) {
160
+            var i = match.index;
161
+
162
+            if (match[1])
163
+                return this.openingBracketBlock(session, match[1], row, i);
164
+                
165
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
166
+            
167
+            if (range && !range.isMultiLine()) {
168
+                if (forceMultiline) {
169
+                    range = this.getSectionRange(session, row);
170
+                } else if (foldStyle != "all")
171
+                    range = null;
172
+            }
173
+            
174
+            return range;
175
+        }
176
+
177
+        if (foldStyle === "markbegin")
178
+            return;
179
+
180
+        var match = line.match(this.foldingStopMarker);
181
+        if (match) {
182
+            var i = match.index + match[0].length;
183
+
184
+            if (match[1])
185
+                return this.closingBracketBlock(session, match[1], row, i);
186
+
187
+            return session.getCommentFoldRange(row, i, -1);
188
+        }
189
+    };
190
+    
191
+    this.getSectionRange = function(session, row) {
192
+        var line = session.getLine(row);
193
+        var startIndent = line.search(/\S/);
194
+        var startRow = row;
195
+        var startColumn = line.length;
196
+        row = row + 1;
197
+        var endRow = row;
198
+        var maxRow = session.getLength();
199
+        while (++row < maxRow) {
200
+            line = session.getLine(row);
201
+            var indent = line.search(/\S/);
202
+            if (indent === -1)
203
+                continue;
204
+            if  (startIndent > indent)
205
+                break;
206
+            var subRange = this.getFoldWidgetRange(session, "all", row);
207
+            
208
+            if (subRange) {
209
+                if (subRange.start.row <= startRow) {
210
+                    break;
211
+                } else if (subRange.isMultiLine()) {
212
+                    row = subRange.end.row;
213
+                } else if (startIndent == indent) {
214
+                    break;
215
+                }
216
+            }
217
+            endRow = row;
218
+        }
219
+        
220
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
221
+    };
222
+    
223
+    this.getCommentRegionBlock = function(session, line, row) {
224
+        var startColumn = line.search(/\s*$/);
225
+        var maxRow = session.getLength();
226
+        var startRow = row;
227
+        
228
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
229
+        var depth = 1;
230
+        while (++row < maxRow) {
231
+            line = session.getLine(row);
232
+            var m = re.exec(line);
233
+            if (!m) continue;
234
+            if (m[1]) depth--;
235
+            else depth++;
236
+
237
+            if (!depth) break;
238
+        }
239
+
240
+        var endRow = row;
241
+        if (endRow > startRow) {
242
+            return new Range(startRow, startColumn, endRow, line.length);
243
+        }
244
+    };
245
+
246
+}).call(FoldMode.prototype);
247
+
248
+});
249
+
250
+ace.define("ace/mode/applescript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/applescript_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
251
+"use strict";
252
+
253
+var oop = require("../lib/oop");
254
+var TextMode = require("./text").Mode;
255
+var Tokenizer = require("../tokenizer").Tokenizer;
256
+var AppleScriptHighlightRules = require("./applescript_highlight_rules").AppleScriptHighlightRules;
257
+var FoldMode = require("./folding/cstyle").FoldMode;
258
+
259
+var Mode = function() {
260
+    this.HighlightRules = AppleScriptHighlightRules;
261
+    this.foldingRules = new FoldMode();
262
+};
263
+oop.inherits(Mode, TextMode);
264
+
265
+(function() {
266
+    this.lineCommentStart = "--";
267
+    this.blockComment = {start: "(*", end: "*)"};
268
+    this.$id = "ace/mode/applescript";
269
+}).call(Mode.prototype);
270
+
271
+exports.Mode = Mode;
272
+});

+ 342
- 0
generator/lib/ace/mode-asciidoc.js Parādīt failu

@@ -0,0 +1,342 @@
1
+ace.define("ace/mode/asciidoc_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 AsciidocHighlightRules = function() {
8
+    var identifierRe = "[a-zA-Z\u00a1-\uffff]+\\b";
9
+
10
+    this.$rules = {
11
+        "start": [
12
+            {token: "empty",   regex: /$/},
13
+            {token: "literal", regex: /^\.{4,}\s*$/,  next: "listingBlock"},
14
+            {token: "literal", regex: /^-{4,}\s*$/,   next: "literalBlock"},
15
+            {token: "string",  regex: /^\+{4,}\s*$/,  next: "passthroughBlock"},
16
+            {token: "keyword", regex: /^={4,}\s*$/},
17
+            {token: "text",    regex: /^\s*$/},
18
+            {token: "empty", regex: "", next: "dissallowDelimitedBlock"}
19
+        ],
20
+
21
+        "dissallowDelimitedBlock": [
22
+            {include: "paragraphEnd"},
23
+            {token: "comment", regex: '^//.+$'},
24
+            {token: "keyword", regex: "^(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION):"},
25
+
26
+            {include: "listStart"},
27
+            {token: "literal", regex: /^\s+.+$/, next: "indentedBlock"},
28
+            {token: "empty",   regex: "", next: "text"}
29
+        ],
30
+
31
+        "paragraphEnd": [
32
+            {token: "doc.comment", regex: /^\/{4,}\s*$/,    next: "commentBlock"},
33
+            {token: "tableBlock",  regex: /^\s*[|!]=+\s*$/, next: "tableBlock"},
34
+            {token: "keyword",     regex: /^(?:--|''')\s*$/, next: "start"},
35
+            {token: "option",      regex: /^\[.*\]\s*$/,     next: "start"},
36
+            {token: "pageBreak",   regex: /^>{3,}$/,         next: "start"},
37
+            {token: "literal",     regex: /^\.{4,}\s*$/,     next: "listingBlock"},
38
+            {token: "titleUnderline",    regex: /^(?:={2,}|-{2,}|~{2,}|\^{2,}|\+{2,})\s*$/, next: "start"},
39
+            {token: "singleLineTitle",   regex: /^={1,5}\s+\S.*$/, next: "start"},
40
+
41
+            {token: "otherBlock",    regex: /^(?:\*{2,}|_{2,})\s*$/, next: "start"},
42
+            {token: "optionalTitle", regex: /^\.[^.\s].+$/,  next: "start"}
43
+        ],
44
+
45
+        "listStart": [
46
+            {token: "keyword",  regex: /^\s*(?:\d+\.|[a-zA-Z]\.|[ixvmIXVM]+\)|\*{1,5}|-|\.{1,5})\s/, next: "listText"},
47
+            {token: "meta.tag", regex: /^.+(?::{2,4}|;;)(?: |$)/, next: "listText"},
48
+            {token: "support.function.list.callout", regex: /^(?:<\d+>|\d+>|>) /, next: "text"},
49
+            {token: "keyword",  regex: /^\+\s*$/, next: "start"}
50
+        ],
51
+
52
+        "text": [
53
+            {token: ["link", "variable.language"], regex: /((?:https?:\/\/|ftp:\/\/|file:\/\/|mailto:|callto:)[^\s\[]+)(\[.*?\])/},
54
+            {token: "link", regex: /(?:https?:\/\/|ftp:\/\/|file:\/\/|mailto:|callto:)[^\s\[]+/},
55
+            {token: "link", regex: /\b[\w\.\/\-]+@[\w\.\/\-]+\b/},
56
+            {include: "macros"},
57
+            {include: "paragraphEnd"},
58
+            {token: "literal", regex:/\+{3,}/, next:"smallPassthrough"},
59
+            {token: "escape", regex: /\((?:C|TM|R)\)|\.{3}|->|<-|=>|<=|&#(?:\d+|x[a-fA-F\d]+);|(?: |^)--(?=\s+\S)/},
60
+            {token: "escape", regex: /\\[_*'`+#]|\\{2}[_*'`+#]{2}/},
61
+            {token: "keyword", regex: /\s\+$/},
62
+            {token: "text", regex: identifierRe},
63
+            {token: ["keyword", "string", "keyword"],
64
+                regex: /(<<[\w\d\-$]+,)(.*?)(>>|$)/},
65
+            {token: "keyword", regex: /<<[\w\d\-$]+,?|>>/},
66
+            {token: "constant.character", regex: /\({2,3}.*?\){2,3}/},
67
+            {token: "keyword", regex: /\[\[.+?\]\]/},
68
+            {token: "support", regex: /^\[{3}[\w\d =\-]+\]{3}/},
69
+
70
+            {include: "quotes"},
71
+            {token: "empty", regex: /^\s*$/, next: "start"}
72
+        ],
73
+
74
+        "listText": [
75
+            {include: "listStart"},
76
+            {include: "text"}
77
+        ],
78
+
79
+        "indentedBlock": [
80
+            {token: "literal", regex: /^[\s\w].+$/, next: "indentedBlock"},
81
+            {token: "literal", regex: "", next: "start"}
82
+        ],
83
+
84
+        "listingBlock": [
85
+            {token: "literal", regex: /^\.{4,}\s*$/, next: "dissallowDelimitedBlock"},
86
+            {token: "constant.numeric", regex: '<\\d+>'},
87
+            {token: "literal", regex: '[^<]+'},
88
+            {token: "literal", regex: '<'}
89
+        ],
90
+        "literalBlock": [
91
+            {token: "literal", regex: /^-{4,}\s*$/, next: "dissallowDelimitedBlock"},
92
+            {token: "constant.numeric", regex: '<\\d+>'},
93
+            {token: "literal", regex: '[^<]+'},
94
+            {token: "literal", regex: '<'}
95
+        ],
96
+        "passthroughBlock": [
97
+            {token: "literal", regex: /^\+{4,}\s*$/, next: "dissallowDelimitedBlock"},
98
+            {token: "literal", regex: identifierRe + "|\\d+"},
99
+            {include: "macros"},
100
+            {token: "literal", regex: "."}
101
+        ],
102
+
103
+        "smallPassthrough": [
104
+            {token: "literal", regex: /[+]{3,}/, next: "dissallowDelimitedBlock"},
105
+            {token: "literal", regex: /^\s*$/, next: "dissallowDelimitedBlock"},
106
+            {token: "literal", regex: identifierRe + "|\\d+"},
107
+            {include: "macros"}
108
+        ],
109
+
110
+        "commentBlock": [
111
+            {token: "doc.comment", regex: /^\/{4,}\s*$/, next: "dissallowDelimitedBlock"},
112
+            {token: "doc.comment", regex: '^.*$'}
113
+        ],
114
+        "tableBlock": [
115
+            {token: "tableBlock", regex: /^\s*\|={3,}\s*$/, next: "dissallowDelimitedBlock"},
116
+            {token: "tableBlock", regex: /^\s*!={3,}\s*$/, next: "innerTableBlock"},
117
+            {token: "tableBlock", regex: /\|/},
118
+            {include: "text", noEscape: true}
119
+        ],
120
+        "innerTableBlock": [
121
+            {token: "tableBlock", regex: /^\s*!={3,}\s*$/, next: "tableBlock"},
122
+            {token: "tableBlock", regex: /^\s*|={3,}\s*$/, next: "dissallowDelimitedBlock"},
123
+            {token: "tableBlock", regex: /\!/}
124
+        ],
125
+        "macros": [
126
+            {token: "macro", regex: /{[\w\-$]+}/},
127
+            {token: ["text", "string", "text", "constant.character", "text"], regex: /({)([\w\-$]+)(:)?(.+)?(})/},
128
+            {token: ["text", "markup.list.macro", "keyword", "string"], regex: /(\w+)(footnote(?:ref)?::?)([^\s\[]+)?(\[.*?\])?/},
129
+            {token: ["markup.list.macro", "keyword", "string"], regex: /([a-zA-Z\-][\w\.\/\-]*::?)([^\s\[]+)(\[.*?\])?/},
130
+            {token: ["markup.list.macro", "keyword"], regex: /([a-zA-Z\-][\w\.\/\-]+::?)(\[.*?\])/},
131
+            {token: "keyword",     regex: /^:.+?:(?= |$)/}
132
+        ],
133
+
134
+        "quotes": [
135
+            {token: "string.italic", regex: /__[^_\s].*?__/},
136
+            {token: "string.italic", regex: quoteRule("_")},
137
+            
138
+            {token: "keyword.bold", regex: /\*\*[^*\s].*?\*\*/},
139
+            {token: "keyword.bold", regex: quoteRule("\\*")},
140
+            
141
+            {token: "literal", regex: quoteRule("\\+")},
142
+            {token: "literal", regex: /\+\+[^+\s].*?\+\+/},
143
+            {token: "literal", regex: /\$\$.+?\$\$/},
144
+            {token: "literal", regex: quoteRule("`")},
145
+
146
+            {token: "keyword", regex: quoteRule("^")},
147
+            {token: "keyword", regex: quoteRule("~")},
148
+            {token: "keyword", regex: /##?/},
149
+            {token: "keyword", regex: /(?:\B|^)``|\b''/}
150
+        ]
151
+
152
+    };
153
+
154
+    function quoteRule(ch) {
155
+        var prefix = /\w/.test(ch) ? "\\b" : "(?:\\B|^)";
156
+        return prefix + ch + "[^" + ch + "].*?" + ch + "(?![\\w*])";
157
+    }
158
+
159
+    var tokenMap = {
160
+        macro: "constant.character",
161
+        tableBlock: "doc.comment",
162
+        titleUnderline: "markup.heading",
163
+        singleLineTitle: "markup.heading",
164
+        pageBreak: "string",
165
+        option: "string.regexp",
166
+        otherBlock: "markup.list",
167
+        literal: "support.function",
168
+        optionalTitle: "constant.numeric",
169
+        escape: "constant.language.escape",
170
+        link: "markup.underline.list"
171
+    };
172
+
173
+    for (var state in this.$rules) {
174
+        var stateRules = this.$rules[state];
175
+        for (var i = stateRules.length; i--; ) {
176
+            var rule = stateRules[i];
177
+            if (rule.include || typeof rule == "string") {
178
+                var args = [i, 1].concat(this.$rules[rule.include || rule]);
179
+                if (rule.noEscape) {
180
+                    args = args.filter(function(x) {
181
+                        return !x.next;
182
+                    });
183
+                }
184
+                stateRules.splice.apply(stateRules, args);
185
+            } else if (rule.token in tokenMap) {
186
+                rule.token = tokenMap[rule.token];
187
+            }
188
+        }
189
+    }
190
+};
191
+oop.inherits(AsciidocHighlightRules, TextHighlightRules);
192
+
193
+exports.AsciidocHighlightRules = AsciidocHighlightRules;
194
+});
195
+
196
+ace.define("ace/mode/folding/asciidoc",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
197
+"use strict";
198
+
199
+var oop = require("../../lib/oop");
200
+var BaseFoldMode = require("./fold_mode").FoldMode;
201
+var Range = require("../../range").Range;
202
+
203
+var FoldMode = exports.FoldMode = function() {};
204
+oop.inherits(FoldMode, BaseFoldMode);
205
+
206
+(function() {
207
+    this.foldingStartMarker = /^(?:\|={10,}|[\.\/=\-~^+]{4,}\s*$|={1,5} )/;
208
+    this.singleLineHeadingRe = /^={1,5}(?=\s+\S)/;
209
+
210
+    this.getFoldWidget = function(session, foldStyle, row) {
211
+        var line = session.getLine(row);
212
+        if (!this.foldingStartMarker.test(line))
213
+            return ""
214
+
215
+        if (line[0] == "=") {
216
+            if (this.singleLineHeadingRe.test(line))
217
+                return "start";
218
+            if (session.getLine(row - 1).length != session.getLine(row).length)
219
+                return "";
220
+            return "start";
221
+        }
222
+        if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock")
223
+            return "end";
224
+        return "start";
225
+    };
226
+
227
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
228
+        var line = session.getLine(row);
229
+        var startColumn = line.length;
230
+        var maxRow = session.getLength();
231
+        var startRow = row;
232
+        var endRow = row;
233
+        if (!line.match(this.foldingStartMarker))
234
+            return;
235
+
236
+        var token;
237
+        function getTokenType(row) {
238
+            token = session.getTokens(row)[0];
239
+            return token && token.type;
240
+        }
241
+
242
+        var levels = ["=","-","~","^","+"];
243
+        var heading = "markup.heading";
244
+        var singleLineHeadingRe = this.singleLineHeadingRe;
245
+        function getLevel() {
246
+            var match = token.value.match(singleLineHeadingRe);
247
+            if (match)
248
+                return match[0].length;
249
+            var level = levels.indexOf(token.value[0]) + 1;
250
+            if (level == 1) {
251
+                if (session.getLine(row - 1).length != session.getLine(row).length)
252
+                    return Infinity;
253
+            }
254
+            return level;
255
+        }
256
+
257
+        if (getTokenType(row) == heading) {
258
+            var startHeadingLevel = getLevel();
259
+            while (++row < maxRow) {
260
+                if (getTokenType(row) != heading)
261
+                    continue;
262
+                var level = getLevel();
263
+                if (level <= startHeadingLevel)
264
+                    break;
265
+            }
266
+
267
+            var isSingleLineHeading = token && token.value.match(this.singleLineHeadingRe);
268
+            endRow = isSingleLineHeading ? row - 1 : row - 2;
269
+
270
+            if (endRow > startRow) {
271
+                while (endRow > startRow && (!getTokenType(endRow) || token.value[0] == "["))
272
+                    endRow--;
273
+            }
274
+
275
+            if (endRow > startRow) {
276
+                var endColumn = session.getLine(endRow).length;
277
+                return new Range(startRow, startColumn, endRow, endColumn);
278
+            }
279
+        } else {
280
+            var state = session.bgTokenizer.getState(row);
281
+            if (state == "dissallowDelimitedBlock") {
282
+                while (row -- > 0) {
283
+                    if (session.bgTokenizer.getState(row).lastIndexOf("Block") == -1)
284
+                        break;
285
+                }
286
+                endRow = row + 1;
287
+                if (endRow < startRow) {
288
+                    var endColumn = session.getLine(row).length;
289
+                    return new Range(endRow, 5, startRow, startColumn - 5);
290
+                }
291
+            } else {
292
+                while (++row < maxRow) {
293
+                    if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock")
294
+                        break;
295
+                }
296
+                endRow = row;
297
+                if (endRow > startRow) {
298
+                    var endColumn = session.getLine(row).length;
299
+                    return new Range(startRow, 5, endRow, endColumn - 5);
300
+                }
301
+            }
302
+        }
303
+    };
304
+
305
+}).call(FoldMode.prototype);
306
+
307
+});
308
+
309
+ace.define("ace/mode/asciidoc",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/asciidoc_highlight_rules","ace/mode/folding/asciidoc"], function(require, exports, module) {
310
+"use strict";
311
+
312
+var oop = require("../lib/oop");
313
+var TextMode = require("./text").Mode;
314
+var AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighlightRules;
315
+var AsciidocFoldMode = require("./folding/asciidoc").FoldMode;
316
+
317
+var Mode = function() {
318
+    this.HighlightRules = AsciidocHighlightRules;
319
+    
320
+    this.foldingRules = new AsciidocFoldMode();    
321
+};
322
+oop.inherits(Mode, TextMode);
323
+
324
+(function() {
325
+    this.type = "text";
326
+    this.getNextLineIndent = function(state, line, tab) {
327
+        if (state == "listblock") {
328
+            var match = /^((?:.+)?)([-+*][ ]+)/.exec(line);
329
+            if (match) {
330
+                return new Array(match[1].length + 1).join(" ") + match[2];
331
+            } else {
332
+                return "";
333
+            }
334
+        } else {
335
+            return this.$getIndent(line);
336
+        }
337
+    };
338
+    this.$id = "ace/mode/asciidoc";
339
+}).call(Mode.prototype);
340
+
341
+exports.Mode = Mode;
342
+});

+ 185
- 0
generator/lib/ace/mode-assembly_x86.js Parādīt failu

@@ -0,0 +1,185 @@
1
+ace.define("ace/mode/assembly_x86_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 AssemblyX86HighlightRules = function() {
8
+
9
+    this.$rules = { start: 
10
+       [ { token: 'keyword.control.assembly',
11
+           regex: '\\b(?:aaa|aad|aam|aas|adc|add|addpd|addps|addsd|addss|addsubpd|addsubps|aesdec|aesdeclast|aesenc|aesenclast|aesimc|aeskeygenassist|and|andpd|andps|andnpd|andnps|arpl|blendpd|blendps|blendvpd|blendvps|bound|bsf|bsr|bswap|bt|btc|btr|bts|cbw|cwde|cdqe|clc|cld|cflush|clts|cmc|cmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|cmp|cmppd|cmpps|cmps|cnpsb|cmpsw|cmpsd|cmpsq|cmpss|cmpxchg|cmpxchg8b|cmpxchg16b|comisd|comiss|cpuid|crc32|cvtdq2pd|cvtdq2ps|cvtpd2dq|cvtpd2pi|cvtpd2ps|cvtpi2pd|cvtpi2ps|cvtps2dq|cvtps2pd|cvtps2pi|cvtsd2si|cvtsd2ss|cvts2sd|cvtsi2ss|cvtss2sd|cvtss2si|cvttpd2dq|cvtpd2pi|cvttps2dq|cvttps2pi|cvttps2dq|cvttps2pi|cvttsd2si|cvttss2si|cwd|cdq|cqo|daa|das|dec|div|divpd|divps|divsd|divss|dppd|dpps|emms|enter|extractps|f2xm1|fabs|fadd|faddp|fiadd|fbld|fbstp|fchs|fclex|fnclex|fcmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|fcom|fcmop|fcompp|fcomi|fcomip|fucomi|fucomip|fcos|fdecstp|fdiv|fdivp|fidiv|fdivr|fdivrp|fidivr|ffree|ficom|ficomp|fild|fincstp|finit|fnint|fist|fistp|fisttp|fld|fld1|fldl2t|fldl2e|fldpi|fldlg2|fldln2|fldz|fldcw|fldenv|fmul|fmulp|fimul|fnop|fpatan|fprem|fprem1|fptan|frndint|frstor|fsave|fnsave|fscale|fsin|fsincos|fsqrt|fst|fstp|fstcw|fnstcw|fstenv|fnstenv|fsts|fnstsw|fsub|fsubp|fisub|fsubr|fsubrp|fisubr|ftst|fucom|fucomp|fucompp|fxam|fxch|fxrstor|fxsave|fxtract|fyl2x|fyl2xp1|haddpd|haddps|husbpd|hsubps|idiv|imul|in|inc|ins|insb|insw|insd|insertps|int|into|invd|invplg|invpcid|iret|iretd|iretq|lahf|lar|lddqu|ldmxcsr|lds|les|lfs|lgs|lss|lea|leave|lfence|lgdt|lidt|llgdt|lmsw|lock|lods|lodsb|lodsw|lodsd|lodsq|lsl|ltr|maskmovdqu|maskmovq|maxpd|maxps|maxsd|maxss|mfence|minpd|minps|minsd|minss|monitor|mov|movapd|movaps|movbe|movd|movq|movddup|movdqa|movdqu|movq2q|movhlps|movhpd|movhps|movlhps|movlpd|movlps|movmskpd|movmskps|movntdqa|movntdq|movnti|movntpd|movntps|movntq|movq|movq2dq|movs|movsb|movsw|movsd|movsq|movsd|movshdup|movsldup|movss|movsx|movsxd|movupd|movups|movzx|mpsadbw|mul|mulpd|mulps|mulsd|mulss|mwait|neg|not|or|orpd|orps|out|outs|outsb|outsw|outsd|pabsb|pabsw|pabsd|packsswb|packssdw|packusdw|packuswbpaddb|paddw|paddd|paddq|paddsb|paddsw|paddusb|paddusw|palignr|pand|pandn|pause|pavgb|pavgw|pblendvb|pblendw|pclmulqdq|pcmpeqb|pcmpeqw|pcmpeqd|pcmpeqq|pcmpestri|pcmpestrm|pcmptb|pcmptgw|pcmpgtd|pcmpgtq|pcmpistri|pcmpisrm|pextrb|pextrd|pextrq|pextrw|phaddw|phaddd|phaddsw|phinposuw|phsubw|phsubd|phsubsw|pinsrb|pinsrd|pinsrq|pinsrw|pmaddubsw|pmadddwd|pmaxsb|pmaxsd|pmaxsw|pmaxsw|pmaxub|pmaxud|pmaxuw|pminsb|pminsd|pminsw|pminub|pminud|pminuw|pmovmskb|pmovsx|pmovzx|pmuldq|pmulhrsw|pmulhuw|pmulhw|pmulld|pmullw|pmuludw|pop|popa|popad|popcnt|popf|popfd|popfq|por|prefetch|psadbw|pshufb|pshufd|pshufhw|pshuflw|pshufw|psignb|psignw|psignd|pslldq|psllw|pslld|psllq|psraw|psrad|psrldq|psrlw|psrld|psrlq|psubb|psubw|psubd|psubq|psubsb|psubsw|psubusb|psubusw|test|ptest|punpckhbw|punpckhwd|punpckhdq|punpckhddq|punpcklbw|punpcklwd|punpckldq|punpckldqd|push|pusha|pushad|pushf|pushfd|pxor|prcl|rcr|rol|ror|rcpps|rcpss|rdfsbase|rdgsbase|rdmsr|rdpmc|rdrand|rdtsc|rdtscp|rep|repe|repz|repne|repnz|roundpd|roundps|roundsd|roundss|rsm|rsqrps|rsqrtss|sahf|sal|sar|shl|shr|sbb|scas|scasb|scasw|scasd|set(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|sfence|sgdt|shld|shrd|shufpd|shufps|sidt|sldt|smsw|sqrtpd|sqrtps|sqrtsd|sqrtss|stc|std|stmxcsr|stos|stosb|stosw|stosd|stosq|str|sub|subpd|subps|subsd|subss|swapgs|syscall|sysenter|sysexit|sysret|teset|ucomisd|ucomiss|ud2|unpckhpd|unpckhps|unpcklpd|unpcklps|vbroadcast|vcvtph2ps|vcvtp2sph|verr|verw|vextractf128|vinsertf128|vmaskmov|vpermilpd|vpermilps|vperm2f128|vtestpd|vtestps|vzeroall|vzeroupper|wait|fwait|wbinvd|wrfsbase|wrgsbase|wrmsr|xadd|xchg|xgetbv|xlat|xlatb|xor|xorpd|xorps|xrstor|xsave|xsaveopt|xsetbv|lzcnt|extrq|insertq|movntsd|movntss|vfmaddpd|vfmaddps|vfmaddsd|vfmaddss|vfmaddsubbpd|vfmaddsubps|vfmsubaddpd|vfmsubaddps|vfmsubpd|vfmsubps|vfmsubsd|vfnmaddpd|vfnmaddps|vfnmaddsd|vfnmaddss|vfnmsubpd|vfnmusbps|vfnmusbsd|vfnmusbss|cvt|xor|cli|sti|hlt|nop|lock|wait|enter|leave|ret|loop(?:n?e|n?z)?|call|j(?:mp|n?e|ge?|ae?|le?|be?|n?o|n?z))\\b',
12
+           caseInsensitive: true },
13
+         { token: 'variable.parameter.register.assembly',
14
+           regex: '\\b(?:CS|DS|ES|FS|GS|SS|RAX|EAX|RBX|EBX|RCX|ECX|RDX|EDX|RCX|RIP|EIP|IP|RSP|ESP|SP|RSI|ESI|SI|RDI|EDI|DI|RFLAGS|EFLAGS|FLAGS|R8-15|(?:Y|X)MM(?:[0-9]|10|11|12|13|14|15)|(?:A|B|C|D)(?:X|H|L)|CR(?:[0-4]|DR(?:[0-7]|TR6|TR7|EFER)))\\b',
15
+           caseInsensitive: true },
16
+         { token: 'constant.character.decimal.assembly',
17
+           regex: '\\b[0-9]+\\b' },
18
+         { token: 'constant.character.hexadecimal.assembly',
19
+           regex: '\\b0x[A-F0-9]+\\b',
20
+           caseInsensitive: true },
21
+         { token: 'constant.character.hexadecimal.assembly',
22
+           regex: '\\b[A-F0-9]+h\\b',
23
+           caseInsensitive: true },
24
+         { token: 'string.assembly', regex: /'([^\\']|\\.)*'/ },
25
+         { token: 'string.assembly', regex: /"([^\\"]|\\.)*"/ },
26
+         { token: 'support.function.directive.assembly',
27
+           regex: '^\\[',
28
+           push: 
29
+            [ { token: 'support.function.directive.assembly',
30
+                regex: '\\]$',
31
+                next: 'pop' },
32
+              { defaultToken: 'support.function.directive.assembly' } ] },
33
+         { token: 
34
+            [ 'support.function.directive.assembly',
35
+              'support.function.directive.assembly',
36
+              'entity.name.function.assembly' ],
37
+           regex: '(^struc)( )([_a-zA-Z][_a-zA-Z0-9]*)' },
38
+         { token: 'support.function.directive.assembly',
39
+           regex: '^endstruc\\b' },
40
+        { token: 
41
+            [ 'support.function.directive.assembly',
42
+              'entity.name.function.assembly',
43
+              'support.function.directive.assembly',
44
+              'constant.character.assembly' ],
45
+           regex: '^(%macro )([_a-zA-Z][_a-zA-Z0-9]*)( )([0-9]+)' },
46
+         { token: 'support.function.directive.assembly',
47
+           regex: '^%endmacro' },
48
+         { token: 
49
+            [ 'text',
50
+              'support.function.directive.assembly',
51
+              'text',
52
+              'entity.name.function.assembly' ],
53
+           regex: '(\\s*)(%define|%xdefine|%idefine|%undef|%assign|%defstr|%strcat|%strlen|%substr|%00|%0|%rotate|%rep|%endrep|%include|\\$\\$|\\$|%unmacro|%if|%elif|%else|%endif|%(?:el)?ifdef|%(?:el)?ifmacro|%(?:el)?ifctx|%(?:el)?ifidn|%(?:el)?ifidni|%(?:el)?ifid|%(?:el)?ifnum|%(?:el)?ifstr|%(?:el)?iftoken|%(?:el)?ifempty|%(?:el)?ifenv|%pathsearch|%depend|%use|%push|%pop|%repl|%arg|%stacksize|%local|%error|%warning|%fatal|%line|%!|%comment|%endcomment|__NASM_VERSION_ID__|__NASM_VER__|__FILE__|__LINE__|__BITS__|__OUTPUT_FORMAT__|__DATE__|__TIME__|__DATE_NUM__|_TIME__NUM__|__UTC_DATE__|__UTC_TIME__|__UTC_DATE_NUM__|__UTC_TIME_NUM__|__POSIX_TIME__|__PASS__|ISTRUC|AT|IEND|BITS 16|BITS 32|BITS 64|USE16|USE32|__SECT__|ABSOLUTE|EXTERN|GLOBAL|COMMON|CPU|FLOAT)\\b( ?)((?:[_a-zA-Z][_a-zA-Z0-9]*)?)',
54
+           caseInsensitive: true },
55
+          { token: 'support.function.directive.assembly',
56
+           regex: '\\b(?:d[bwdqtoy]|res[bwdqto]|equ|times|align|alignb|sectalign|section|ptr|byte|word|dword|qword|incbin)\\b',
57
+           caseInsensitive: true },
58
+         { token: 'entity.name.function.assembly', regex: '^\\s*%%[\\w.]+?:$' },
59
+         { token: 'entity.name.function.assembly', regex: '^\\s*%\\$[\\w.]+?:$' },
60
+         { token: 'entity.name.function.assembly', regex: '^[\\w.]+?:' },
61
+         { token: 'entity.name.function.assembly', regex: '^[\\w.]+?\\b' },
62
+         { token: 'comment.assembly', regex: ';.*$' } ] 
63
+    }
64
+    
65
+    this.normalizeRules();
66
+};
67
+
68
+AssemblyX86HighlightRules.metaData = { fileTypes: [ 'asm' ],
69
+      name: 'Assembly x86',
70
+      scopeName: 'source.assembly' }
71
+
72
+
73
+oop.inherits(AssemblyX86HighlightRules, TextHighlightRules);
74
+
75
+exports.AssemblyX86HighlightRules = AssemblyX86HighlightRules;
76
+});
77
+
78
+ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
79
+"use strict";
80
+
81
+var oop = require("../../lib/oop");
82
+var BaseFoldMode = require("./fold_mode").FoldMode;
83
+var Range = require("../../range").Range;
84
+
85
+var FoldMode = exports.FoldMode = function() {};
86
+oop.inherits(FoldMode, BaseFoldMode);
87
+
88
+(function() {
89
+
90
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
91
+        var range = this.indentationBlock(session, row);
92
+        if (range)
93
+            return range;
94
+
95
+        var re = /\S/;
96
+        var line = session.getLine(row);
97
+        var startLevel = line.search(re);
98
+        if (startLevel == -1 || line[startLevel] != "#")
99
+            return;
100
+
101
+        var startColumn = line.length;
102
+        var maxRow = session.getLength();
103
+        var startRow = row;
104
+        var endRow = row;
105
+
106
+        while (++row < maxRow) {
107
+            line = session.getLine(row);
108
+            var level = line.search(re);
109
+
110
+            if (level == -1)
111
+                continue;
112
+
113
+            if (line[level] != "#")
114
+                break;
115
+
116
+            endRow = row;
117
+        }
118
+
119
+        if (endRow > startRow) {
120
+            var endColumn = session.getLine(endRow).length;
121
+            return new Range(startRow, startColumn, endRow, endColumn);
122
+        }
123
+    };
124
+    this.getFoldWidget = function(session, foldStyle, row) {
125
+        var line = session.getLine(row);
126
+        var indent = line.search(/\S/);
127
+        var next = session.getLine(row + 1);
128
+        var prev = session.getLine(row - 1);
129
+        var prevIndent = prev.search(/\S/);
130
+        var nextIndent = next.search(/\S/);
131
+
132
+        if (indent == -1) {
133
+            session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
134
+            return "";
135
+        }
136
+        if (prevIndent == -1) {
137
+            if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
138
+                session.foldWidgets[row - 1] = "";
139
+                session.foldWidgets[row + 1] = "";
140
+                return "start";
141
+            }
142
+        } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
143
+            if (session.getLine(row - 2).search(/\S/) == -1) {
144
+                session.foldWidgets[row - 1] = "start";
145
+                session.foldWidgets[row + 1] = "";
146
+                return "";
147
+            }
148
+        }
149
+
150
+        if (prevIndent!= -1 && prevIndent < indent)
151
+            session.foldWidgets[row - 1] = "start";
152
+        else
153
+            session.foldWidgets[row - 1] = "";
154
+
155
+        if (indent < nextIndent)
156
+            return "start";
157
+        else
158
+            return "";
159
+    };
160
+
161
+}).call(FoldMode.prototype);
162
+
163
+});
164
+
165
+ace.define("ace/mode/assembly_x86",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/assembly_x86_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module) {
166
+"use strict";
167
+
168
+var oop = require("../lib/oop");
169
+var TextMode = require("./text").Mode;
170
+var AssemblyX86HighlightRules = require("./assembly_x86_highlight_rules").AssemblyX86HighlightRules;
171
+var FoldMode = require("./folding/coffee").FoldMode;
172
+
173
+var Mode = function() {
174
+    this.HighlightRules = AssemblyX86HighlightRules;
175
+    this.foldingRules = new FoldMode();
176
+};
177
+oop.inherits(Mode, TextMode);
178
+
179
+(function() {
180
+    this.lineCommentStart = ";";
181
+    this.$id = "ace/mode/assembly_x86";
182
+}).call(Mode.prototype);
183
+
184
+exports.Mode = Mode;
185
+});

+ 235
- 0
generator/lib/ace/mode-autohotkey.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 223
- 0
generator/lib/ace/mode-batchfile.js Parādīt failu

@@ -0,0 +1,223 @@
1
+ace.define("ace/mode/batchfile_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 BatchFileHighlightRules = function() {
8
+
9
+    this.$rules = { start: 
10
+       [ { token: 'keyword.command.dosbatch',
11
+           regex: '\\b(?:append|assoc|at|attrib|break|cacls|cd|chcp|chdir|chkdsk|chkntfs|cls|cmd|color|comp|compact|convert|copy|date|del|dir|diskcomp|diskcopy|doskey|echo|endlocal|erase|fc|find|findstr|format|ftype|graftabl|help|keyb|label|md|mkdir|mode|more|move|path|pause|popd|print|prompt|pushd|rd|recover|ren|rename|replace|restore|rmdir|set|setlocal|shift|sort|start|subst|time|title|tree|type|ver|verify|vol|xcopy)\\b',
12
+           caseInsensitive: true },
13
+         { token: 'keyword.control.statement.dosbatch',
14
+           regex: '\\b(?:goto|call|exit)\\b',
15
+           caseInsensitive: true },
16
+         { token: 'keyword.control.conditional.if.dosbatch',
17
+           regex: '\\bif\\s+not\\s+(?:exist|defined|errorlevel|cmdextversion)\\b',
18
+           caseInsensitive: true },
19
+         { token: 'keyword.control.conditional.dosbatch',
20
+           regex: '\\b(?:if|else)\\b',
21
+           caseInsensitive: true },
22
+         { token: 'keyword.control.repeat.dosbatch',
23
+           regex: '\\bfor\\b',
24
+           caseInsensitive: true },
25
+         { token: 'keyword.operator.dosbatch',
26
+           regex: '\\b(?:EQU|NEQ|LSS|LEQ|GTR|GEQ)\\b' },
27
+         { token: ['doc.comment', 'comment'],
28
+           regex: '(?:^|\\b)(rem)($|\\s.*$)',
29
+           caseInsensitive: true },
30
+         { token: 'comment.line.colons.dosbatch',
31
+           regex: '::.*$' },
32
+         { include: 'variable' },
33
+         { token: 'punctuation.definition.string.begin.shell',
34
+           regex: '"',
35
+           push: [ 
36
+              { token: 'punctuation.definition.string.end.shell', regex: '"', next: 'pop' },
37
+              { include: 'variable' },
38
+              { defaultToken: 'string.quoted.double.dosbatch' } ] },
39
+         { token: 'keyword.operator.pipe.dosbatch', regex: '[|]' },
40
+         { token: 'keyword.operator.redirect.shell',
41
+           regex: '&>|\\d*>&\\d*|\\d*(?:>>|>|<)|\\d*<&|\\d*<>' } ],
42
+        variable: [
43
+         { token: 'constant.numeric', regex: '%%\\w+|%[*\\d]|%\\w+%'},
44
+         { token: 'constant.numeric', regex: '%~\\d+'},
45
+         { token: ['markup.list', 'constant.other', 'markup.list'],
46
+            regex: '(%)(\\w+)(%?)' }]}
47
+    
48
+    this.normalizeRules();
49
+};
50
+
51
+BatchFileHighlightRules.metaData = { name: 'Batch File',
52
+      scopeName: 'source.dosbatch',
53
+      fileTypes: [ 'bat' ] }
54
+
55
+
56
+oop.inherits(BatchFileHighlightRules, TextHighlightRules);
57
+
58
+exports.BatchFileHighlightRules = BatchFileHighlightRules;
59
+});
60
+
61
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
62
+"use strict";
63
+
64
+var oop = require("../../lib/oop");
65
+var Range = require("../../range").Range;
66
+var BaseFoldMode = require("./fold_mode").FoldMode;
67
+
68
+var FoldMode = exports.FoldMode = function(commentRegex) {
69
+    if (commentRegex) {
70
+        this.foldingStartMarker = new RegExp(
71
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
72
+        );
73
+        this.foldingStopMarker = new RegExp(
74
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
75
+        );
76
+    }
77
+};
78
+oop.inherits(FoldMode, BaseFoldMode);
79
+
80
+(function() {
81
+    
82
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
83
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
84
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
85
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
86
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
87
+    this._getFoldWidgetBase = this.getFoldWidget;
88
+    this.getFoldWidget = function(session, foldStyle, row) {
89
+        var line = session.getLine(row);
90
+    
91
+        if (this.singleLineBlockCommentRe.test(line)) {
92
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
93
+                return "";
94
+        }
95
+    
96
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
97
+    
98
+        if (!fw && this.startRegionRe.test(line))
99
+            return "start"; // lineCommentRegionStart
100
+    
101
+        return fw;
102
+    };
103
+
104
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
105
+        var line = session.getLine(row);
106
+        
107
+        if (this.startRegionRe.test(line))
108
+            return this.getCommentRegionBlock(session, line, row);
109
+        
110
+        var match = line.match(this.foldingStartMarker);
111
+        if (match) {
112
+            var i = match.index;
113
+
114
+            if (match[1])
115
+                return this.openingBracketBlock(session, match[1], row, i);
116
+                
117
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
118
+            
119
+            if (range && !range.isMultiLine()) {
120
+                if (forceMultiline) {
121
+                    range = this.getSectionRange(session, row);
122
+                } else if (foldStyle != "all")
123
+                    range = null;
124
+            }
125
+            
126
+            return range;
127
+        }
128
+
129
+        if (foldStyle === "markbegin")
130
+            return;
131
+
132
+        var match = line.match(this.foldingStopMarker);
133
+        if (match) {
134
+            var i = match.index + match[0].length;
135
+
136
+            if (match[1])
137
+                return this.closingBracketBlock(session, match[1], row, i);
138
+
139
+            return session.getCommentFoldRange(row, i, -1);
140
+        }
141
+    };
142
+    
143
+    this.getSectionRange = function(session, row) {
144
+        var line = session.getLine(row);
145
+        var startIndent = line.search(/\S/);
146
+        var startRow = row;
147
+        var startColumn = line.length;
148
+        row = row + 1;
149
+        var endRow = row;
150
+        var maxRow = session.getLength();
151
+        while (++row < maxRow) {
152
+            line = session.getLine(row);
153
+            var indent = line.search(/\S/);
154
+            if (indent === -1)
155
+                continue;
156
+            if  (startIndent > indent)
157
+                break;
158
+            var subRange = this.getFoldWidgetRange(session, "all", row);
159
+            
160
+            if (subRange) {
161
+                if (subRange.start.row <= startRow) {
162
+                    break;
163
+                } else if (subRange.isMultiLine()) {
164
+                    row = subRange.end.row;
165
+                } else if (startIndent == indent) {
166
+                    break;
167
+                }
168
+            }
169
+            endRow = row;
170
+        }
171
+        
172
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
173
+    };
174
+    
175
+    this.getCommentRegionBlock = function(session, line, row) {
176
+        var startColumn = line.search(/\s*$/);
177
+        var maxRow = session.getLength();
178
+        var startRow = row;
179
+        
180
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
181
+        var depth = 1;
182
+        while (++row < maxRow) {
183
+            line = session.getLine(row);
184
+            var m = re.exec(line);
185
+            if (!m) continue;
186
+            if (m[1]) depth--;
187
+            else depth++;
188
+
189
+            if (!depth) break;
190
+        }
191
+
192
+        var endRow = row;
193
+        if (endRow > startRow) {
194
+            return new Range(startRow, startColumn, endRow, line.length);
195
+        }
196
+    };
197
+
198
+}).call(FoldMode.prototype);
199
+
200
+});
201
+
202
+ace.define("ace/mode/batchfile",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/batchfile_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
203
+"use strict";
204
+
205
+var oop = require("../lib/oop");
206
+var TextMode = require("./text").Mode;
207
+var BatchFileHighlightRules = require("./batchfile_highlight_rules").BatchFileHighlightRules;
208
+var FoldMode = require("./folding/cstyle").FoldMode;
209
+
210
+var Mode = function() {
211
+    this.HighlightRules = BatchFileHighlightRules;
212
+    this.foldingRules = new FoldMode();
213
+};
214
+oop.inherits(Mode, TextMode);
215
+
216
+(function() {
217
+    this.lineCommentStart = "::";
218
+    this.blockComment = "";
219
+    this.$id = "ace/mode/batchfile";
220
+}).call(Mode.prototype);
221
+
222
+exports.Mode = Mode;
223
+});

+ 275
- 0
generator/lib/ace/mode-c9search.js Parādīt failu

@@ -0,0 +1,275 @@
1
+ace.define("ace/mode/c9search_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
+
8
+function safeCreateRegexp(source, flag) {
9
+    try {
10
+        return new RegExp(source, flag);
11
+    } catch(e) {}
12
+}
13
+
14
+var C9SearchHighlightRules = function() {
15
+    this.$rules = {
16
+        "start" : [
17
+            {
18
+                tokenNames : ["c9searchresults.constant.numeric", "c9searchresults.text", "c9searchresults.text", "c9searchresults.keyword"],
19
+                regex : "(^\\s+[0-9]+)(:\\s)(.+)",
20
+                onMatch : function(val, state, stack) {
21
+                    var values = this.splitRegex.exec(val);
22
+                    var types = this.tokenNames;
23
+                    var tokens = [{
24
+                        type: types[0],
25
+                        value: values[1]
26
+                    },{
27
+                        type: types[1],
28
+                        value: values[2]
29
+                    }];
30
+                    
31
+                    var regex = stack[1];
32
+                    var str = values[3];
33
+                    
34
+                    var m;
35
+                    var last = 0;
36
+                    if (regex && regex.exec) {
37
+                        regex.lastIndex = 0;
38
+                        while (m = regex.exec(str)) {
39
+                            var skipped = str.substring(last, m.index);
40
+                            last = regex.lastIndex;
41
+                            if (skipped)
42
+                                tokens.push({type: types[2], value: skipped});
43
+                            if (m[0])
44
+                                tokens.push({type: types[3], value: m[0]});
45
+                            else if (!skipped)
46
+                                break;
47
+                        }
48
+                    }
49
+                    if (last < str.length)
50
+                        tokens.push({type: types[2], value: str.substr(last)});
51
+                    return tokens;
52
+                }
53
+            },
54
+            {
55
+                token : ["string", "text"], // single line
56
+                regex : "(\\S.*)(:$)"
57
+            },
58
+            {
59
+                regex : "Searching for .*$",
60
+                onMatch: function(val, state, stack) {
61
+                    var parts = val.split("\x01");
62
+                    if (parts.length < 3)
63
+                        return "text";
64
+
65
+                    var options, search, replace;
66
+                    
67
+                    var i = 0;
68
+                    var tokens = [{
69
+                        value: parts[i++] + "'",
70
+                        type: "text"
71
+                    }, {
72
+                        value: search = parts[i++],
73
+                        type: "text" // "c9searchresults.keyword"
74
+                    }, {
75
+                        value: "'" + parts[i++],
76
+                        type: "text"
77
+                    }];
78
+                    if (parts[2] !== " in") {
79
+                        replace = parts[i];
80
+                        tokens.push({
81
+                            value: "'" + parts[i++] + "'",
82
+                            type: "text"
83
+                        }, {
84
+                            value: parts[i++],
85
+                            type: "text"
86
+                        });
87
+                    }
88
+                    tokens.push({
89
+                        value: " " + parts[i++] + " ",
90
+                        type: "text"
91
+                    });
92
+                    if (parts[i+1]) {
93
+                        options = parts[i+1];
94
+                        tokens.push({
95
+                            value: "(" + parts[i+1] + ")",
96
+                            type: "text"
97
+                        });
98
+                        i += 1;
99
+                    } else {
100
+                        i -= 1;
101
+                    }
102
+                    while (i++ < parts.length) {
103
+                        parts[i] && tokens.push({
104
+                            value: parts[i],
105
+                            type: "text"
106
+                        });
107
+                    }
108
+                    
109
+                    if (replace) {
110
+                        search = replace;
111
+                        options = "";
112
+                    }
113
+                    
114
+                    if (search) {
115
+                        if (!/regex/.test(options))
116
+                            search = lang.escapeRegExp(search);
117
+                        if (/whole/.test(options))
118
+                            search = "\\b" + search + "\\b";
119
+                    }
120
+                    
121
+                    var regex = search && safeCreateRegexp(
122
+                        "(" + search + ")",
123
+                        / sensitive/.test(options) ? "g" : "ig"
124
+                    );
125
+                    if (regex) {
126
+                        stack[0] = state;
127
+                        stack[1] = regex;
128
+                    }
129
+                    
130
+                    return tokens;
131
+                }
132
+            },
133
+            {
134
+                regex : "\\d+",
135
+                token: "constant.numeric"
136
+            }
137
+        ]
138
+    };
139
+};
140
+
141
+oop.inherits(C9SearchHighlightRules, TextHighlightRules);
142
+
143
+exports.C9SearchHighlightRules = C9SearchHighlightRules;
144
+
145
+});
146
+
147
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
148
+"use strict";
149
+
150
+var Range = require("../range").Range;
151
+
152
+var MatchingBraceOutdent = function() {};
153
+
154
+(function() {
155
+
156
+    this.checkOutdent = function(line, input) {
157
+        if (! /^\s+$/.test(line))
158
+            return false;
159
+
160
+        return /^\s*\}/.test(input);
161
+    };
162
+
163
+    this.autoOutdent = function(doc, row) {
164
+        var line = doc.getLine(row);
165
+        var match = line.match(/^(\s*\})/);
166
+
167
+        if (!match) return 0;
168
+
169
+        var column = match[1].length;
170
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
171
+
172
+        if (!openBracePos || openBracePos.row == row) return 0;
173
+
174
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
175
+        doc.replace(new Range(row, 0, row, column-1), indent);
176
+    };
177
+
178
+    this.$getIndent = function(line) {
179
+        return line.match(/^\s*/)[0];
180
+    };
181
+
182
+}).call(MatchingBraceOutdent.prototype);
183
+
184
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
185
+});
186
+
187
+ace.define("ace/mode/folding/c9search",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
188
+"use strict";
189
+
190
+var oop = require("../../lib/oop");
191
+var Range = require("../../range").Range;
192
+var BaseFoldMode = require("./fold_mode").FoldMode;
193
+
194
+var FoldMode = exports.FoldMode = function() {};
195
+oop.inherits(FoldMode, BaseFoldMode);
196
+
197
+(function() {
198
+
199
+    this.foldingStartMarker = /^(\S.*\:|Searching for.*)$/;
200
+    this.foldingStopMarker = /^(\s+|Found.*)$/;
201
+    
202
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
203
+        var lines = session.doc.getAllLines(row);
204
+        var line = lines[row];
205
+        var level1 = /^(Found.*|Searching for.*)$/;
206
+        var level2 = /^(\S.*\:|\s*)$/;
207
+        var re = level1.test(line) ? level1 : level2;
208
+        
209
+        var startRow = row;
210
+        var endRow = row;
211
+
212
+        if (this.foldingStartMarker.test(line)) {            
213
+            for (var i = row + 1, l = session.getLength(); i < l; i++) {
214
+                if (re.test(lines[i]))
215
+                    break;
216
+            }
217
+            endRow = i;
218
+        }
219
+        else if (this.foldingStopMarker.test(line)) {
220
+            for (var i = row - 1; i >= 0; i--) {
221
+                line = lines[i];
222
+                if (re.test(line))
223
+                    break;
224
+            }
225
+            startRow = i;
226
+        }
227
+        if (startRow != endRow) {
228
+            var col = line.length;
229
+            if (re === level1)
230
+                col = line.search(/\(Found[^)]+\)$|$/);
231
+            return new Range(startRow, col, endRow, 0);
232
+        }
233
+    };
234
+    
235
+}).call(FoldMode.prototype);
236
+
237
+});
238
+
239
+ace.define("ace/mode/c9search",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/c9search_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/c9search"], function(require, exports, module) {
240
+"use strict";
241
+
242
+var oop = require("../lib/oop");
243
+var TextMode = require("./text").Mode;
244
+var C9SearchHighlightRules = require("./c9search_highlight_rules").C9SearchHighlightRules;
245
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
246
+var C9StyleFoldMode = require("./folding/c9search").FoldMode;
247
+
248
+var Mode = function() {
249
+    this.HighlightRules = C9SearchHighlightRules;
250
+    this.$outdent = new MatchingBraceOutdent();
251
+    this.foldingRules = new C9StyleFoldMode();
252
+};
253
+oop.inherits(Mode, TextMode);
254
+
255
+(function() {
256
+    
257
+    this.getNextLineIndent = function(state, line, tab) {
258
+        var indent = this.$getIndent(line);
259
+        return indent;
260
+    };
261
+
262
+    this.checkOutdent = function(state, line, input) {
263
+        return this.$outdent.checkOutdent(line, input);
264
+    };
265
+
266
+    this.autoOutdent = function(state, doc, row) {
267
+        this.$outdent.autoOutdent(doc, row);
268
+    };
269
+
270
+    this.$id = "ace/mode/c9search";
271
+}).call(Mode.prototype);
272
+
273
+exports.Mode = Mode;
274
+
275
+});

+ 849
- 0
generator/lib/ace/mode-c_cpp.js Parādīt failu

@@ -0,0 +1,849 @@
1
+ace.define("ace/mode/doc_comment_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 DocCommentHighlightRules = function() {
8
+    this.$rules = {
9
+        "start" : [ {
10
+            token : "comment.doc.tag",
11
+            regex : "@[\\w\\d_]+" // TODO: fix email addresses
12
+        }, 
13
+        DocCommentHighlightRules.getTagRule(),
14
+        {
15
+            defaultToken : "comment.doc",
16
+            caseInsensitive: true
17
+        }]
18
+    };
19
+};
20
+
21
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22
+
23
+DocCommentHighlightRules.getTagRule = function(start) {
24
+    return {
25
+        token : "comment.doc.tag.storage.type",
26
+        regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+    };
28
+}
29
+
30
+DocCommentHighlightRules.getStartRule = function(start) {
31
+    return {
32
+        token : "comment.doc", // doc comment
33
+        regex : "\\/\\*(?=\\*)",
34
+        next  : start
35
+    };
36
+};
37
+
38
+DocCommentHighlightRules.getEndRule = function (start) {
39
+    return {
40
+        token : "comment.doc", // closing comment
41
+        regex : "\\*\\/",
42
+        next  : start
43
+    };
44
+};
45
+
46
+
47
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
48
+
49
+});
50
+
51
+ace.define("ace/mode/c_cpp_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52
+"use strict";
53
+
54
+var oop = require("../lib/oop");
55
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57
+var cFunctions = exports.cFunctions = "\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\b"
58
+
59
+var c_cppHighlightRules = function() {
60
+
61
+    var keywordControls = (
62
+        "break|case|continue|default|do|else|for|goto|if|_Pragma|" +
63
+        "return|switch|while|catch|operator|try|throw|using"
64
+    );
65
+    
66
+    var storageType = (
67
+        "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" +
68
+        "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" +
69
+        "class|wchar_t|template"
70
+    );
71
+
72
+    var storageModifiers = (
73
+        "const|extern|register|restrict|static|volatile|inline|private|" +
74
+        "protected|public|friend|explicit|virtual|export|mutable|typename|" +
75
+        "constexpr|new|delete"
76
+    );
77
+
78
+    var keywordOperators = (
79
+        "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" +
80
+        "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace"
81
+    );
82
+
83
+    var builtinConstants = (
84
+        "NULL|true|false|TRUE|FALSE"
85
+    );
86
+
87
+    var keywordMapper = this.$keywords = this.createKeywordMapper({
88
+        "keyword.control" : keywordControls,
89
+        "storage.type" : storageType,
90
+        "storage.modifier" : storageModifiers,
91
+        "keyword.operator" : keywordOperators,
92
+        "variable.language": "this",
93
+        "constant.language": builtinConstants
94
+    }, "identifier");
95
+
96
+    var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
97
+
98
+    this.$rules = { 
99
+        "start" : [
100
+            {
101
+                token : "comment",
102
+                regex : "//",
103
+                next : "singleLineComment"
104
+            },
105
+            DocCommentHighlightRules.getStartRule("doc-start"),
106
+            {
107
+                token : "comment", // multi line comment
108
+                regex : "\\/\\*",
109
+                next : "comment"
110
+            }, {
111
+                token : "string", // single line
112
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
113
+            }, {
114
+                token : "string", // multi line string start
115
+                regex : '["].*\\\\$',
116
+                next : "qqstring"
117
+            }, {
118
+                token : "string", // single line
119
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
120
+            }, {
121
+                token : "string", // multi line string start
122
+                regex : "['].*\\\\$",
123
+                next : "qstring"
124
+            }, {
125
+                token : "constant.numeric", // hex
126
+                regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
127
+            }, {
128
+                token : "constant.numeric", // float
129
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
130
+            }, {
131
+                token : "keyword", // pre-compiler directives
132
+                regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b",
133
+                next  : "directive"
134
+            }, {
135
+                token : "keyword", // special case pre-compiler directive
136
+                regex : "(?:#\\s*endif)\\b"
137
+            }, {
138
+                token : "support.function.C99.c",
139
+                regex : cFunctions
140
+            }, {
141
+                token : keywordMapper,
142
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
143
+            }, {
144
+                token : "keyword.operator",
145
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
146
+            }, {
147
+              token : "punctuation.operator",
148
+              regex : "\\?|\\:|\\,|\\;|\\."
149
+            }, {
150
+                token : "paren.lparen",
151
+                regex : "[[({]"
152
+            }, {
153
+                token : "paren.rparen",
154
+                regex : "[\\])}]"
155
+            }, {
156
+                token : "text",
157
+                regex : "\\s+"
158
+            }
159
+        ],
160
+        "comment" : [
161
+            {
162
+                token : "comment", // closing comment
163
+                regex : ".*?\\*\\/",
164
+                next : "start"
165
+            }, {
166
+                token : "comment", // comment spanning whole line
167
+                regex : ".+"
168
+            }
169
+        ],
170
+        "singleLineComment" : [
171
+            {
172
+                token : "comment",
173
+                regex : /\\$/,
174
+                next : "singleLineComment"
175
+            }, {
176
+                token : "comment",
177
+                regex : /$/,
178
+                next : "start"
179
+            }, {
180
+                defaultToken: "comment"
181
+            }
182
+        ],
183
+        "qqstring" : [
184
+            {
185
+                token : "string",
186
+                regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
187
+                next : "start"
188
+            }, {
189
+                defaultToken : "string"
190
+            }
191
+        ],
192
+        "qstring" : [
193
+            {
194
+                token : "string",
195
+                regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
196
+                next : "start"
197
+            }, {
198
+                defaultToken : "string"
199
+            }
200
+        ],
201
+        "directive" : [
202
+            {
203
+                token : "constant.other.multiline",
204
+                regex : /\\/
205
+            },
206
+            {
207
+                token : "constant.other.multiline",
208
+                regex : /.*\\/
209
+            },
210
+            {
211
+                token : "constant.other",
212
+                regex : "\\s*<.+?>",
213
+                next : "start"
214
+            },
215
+            {
216
+                token : "constant.other", // single line
217
+                regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',
218
+                next : "start"
219
+            }, 
220
+            {
221
+                token : "constant.other", // single line
222
+                regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
223
+                next : "start"
224
+            },
225
+            {
226
+                token : "constant.other",
227
+                regex : /[^\\\/]+/,
228
+                next : "start"
229
+            }
230
+        ]
231
+    };
232
+
233
+    this.embedRules(DocCommentHighlightRules, "doc-",
234
+        [ DocCommentHighlightRules.getEndRule("start") ]);
235
+};
236
+
237
+oop.inherits(c_cppHighlightRules, TextHighlightRules);
238
+
239
+exports.c_cppHighlightRules = c_cppHighlightRules;
240
+});
241
+
242
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
243
+"use strict";
244
+
245
+var Range = require("../range").Range;
246
+
247
+var MatchingBraceOutdent = function() {};
248
+
249
+(function() {
250
+
251
+    this.checkOutdent = function(line, input) {
252
+        if (! /^\s+$/.test(line))
253
+            return false;
254
+
255
+        return /^\s*\}/.test(input);
256
+    };
257
+
258
+    this.autoOutdent = function(doc, row) {
259
+        var line = doc.getLine(row);
260
+        var match = line.match(/^(\s*\})/);
261
+
262
+        if (!match) return 0;
263
+
264
+        var column = match[1].length;
265
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
266
+
267
+        if (!openBracePos || openBracePos.row == row) return 0;
268
+
269
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
270
+        doc.replace(new Range(row, 0, row, column-1), indent);
271
+    };
272
+
273
+    this.$getIndent = function(line) {
274
+        return line.match(/^\s*/)[0];
275
+    };
276
+
277
+}).call(MatchingBraceOutdent.prototype);
278
+
279
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
280
+});
281
+
282
+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) {
283
+"use strict";
284
+
285
+var oop = require("../../lib/oop");
286
+var Behaviour = require("../behaviour").Behaviour;
287
+var TokenIterator = require("../../token_iterator").TokenIterator;
288
+var lang = require("../../lib/lang");
289
+
290
+var SAFE_INSERT_IN_TOKENS =
291
+    ["text", "paren.rparen", "punctuation.operator"];
292
+var SAFE_INSERT_BEFORE_TOKENS =
293
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
294
+
295
+var context;
296
+var contextCache = {};
297
+var initContext = function(editor) {
298
+    var id = -1;
299
+    if (editor.multiSelect) {
300
+        id = editor.selection.index;
301
+        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
302
+            contextCache = {rangeCount: editor.multiSelect.rangeCount};
303
+    }
304
+    if (contextCache[id])
305
+        return context = contextCache[id];
306
+    context = contextCache[id] = {
307
+        autoInsertedBrackets: 0,
308
+        autoInsertedRow: -1,
309
+        autoInsertedLineEnd: "",
310
+        maybeInsertedBrackets: 0,
311
+        maybeInsertedRow: -1,
312
+        maybeInsertedLineStart: "",
313
+        maybeInsertedLineEnd: ""
314
+    };
315
+};
316
+
317
+var CstyleBehaviour = function() {
318
+    this.add("braces", "insertion", function(state, action, editor, session, text) {
319
+        var cursor = editor.getCursorPosition();
320
+        var line = session.doc.getLine(cursor.row);
321
+        if (text == '{') {
322
+            initContext(editor);
323
+            var selection = editor.getSelectionRange();
324
+            var selected = session.doc.getTextRange(selection);
325
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
326
+                return {
327
+                    text: '{' + selected + '}',
328
+                    selection: false
329
+                };
330
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
331
+                if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
332
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
333
+                    return {
334
+                        text: '{}',
335
+                        selection: [1, 1]
336
+                    };
337
+                } else {
338
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
339
+                    return {
340
+                        text: '{',
341
+                        selection: [1, 1]
342
+                    };
343
+                }
344
+            }
345
+        } else if (text == '}') {
346
+            initContext(editor);
347
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
348
+            if (rightChar == '}') {
349
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
350
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
351
+                    CstyleBehaviour.popAutoInsertedClosing();
352
+                    return {
353
+                        text: '',
354
+                        selection: [1, 1]
355
+                    };
356
+                }
357
+            }
358
+        } else if (text == "\n" || text == "\r\n") {
359
+            initContext(editor);
360
+            var closing = "";
361
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
362
+                closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
363
+                CstyleBehaviour.clearMaybeInsertedClosing();
364
+            }
365
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
366
+            if (rightChar === '}') {
367
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
368
+                if (!openBracePos)
369
+                     return null;
370
+                var next_indent = this.$getIndent(session.getLine(openBracePos.row));
371
+            } else if (closing) {
372
+                var next_indent = this.$getIndent(line);
373
+            } else {
374
+                CstyleBehaviour.clearMaybeInsertedClosing();
375
+                return;
376
+            }
377
+            var indent = next_indent + session.getTabString();
378
+
379
+            return {
380
+                text: '\n' + indent + '\n' + next_indent + closing,
381
+                selection: [1, indent.length, 1, indent.length]
382
+            };
383
+        } else {
384
+            CstyleBehaviour.clearMaybeInsertedClosing();
385
+        }
386
+    });
387
+
388
+    this.add("braces", "deletion", function(state, action, editor, session, range) {
389
+        var selected = session.doc.getTextRange(range);
390
+        if (!range.isMultiLine() && selected == '{') {
391
+            initContext(editor);
392
+            var line = session.doc.getLine(range.start.row);
393
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
394
+            if (rightChar == '}') {
395
+                range.end.column++;
396
+                return range;
397
+            } else {
398
+                context.maybeInsertedBrackets--;
399
+            }
400
+        }
401
+    });
402
+
403
+    this.add("parens", "insertion", function(state, action, editor, session, text) {
404
+        if (text == '(') {
405
+            initContext(editor);
406
+            var selection = editor.getSelectionRange();
407
+            var selected = session.doc.getTextRange(selection);
408
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
409
+                return {
410
+                    text: '(' + selected + ')',
411
+                    selection: false
412
+                };
413
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
414
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
415
+                return {
416
+                    text: '()',
417
+                    selection: [1, 1]
418
+                };
419
+            }
420
+        } else if (text == ')') {
421
+            initContext(editor);
422
+            var cursor = editor.getCursorPosition();
423
+            var line = session.doc.getLine(cursor.row);
424
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
425
+            if (rightChar == ')') {
426
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
427
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
428
+                    CstyleBehaviour.popAutoInsertedClosing();
429
+                    return {
430
+                        text: '',
431
+                        selection: [1, 1]
432
+                    };
433
+                }
434
+            }
435
+        }
436
+    });
437
+
438
+    this.add("parens", "deletion", function(state, action, editor, session, range) {
439
+        var selected = session.doc.getTextRange(range);
440
+        if (!range.isMultiLine() && selected == '(') {
441
+            initContext(editor);
442
+            var line = session.doc.getLine(range.start.row);
443
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
444
+            if (rightChar == ')') {
445
+                range.end.column++;
446
+                return range;
447
+            }
448
+        }
449
+    });
450
+
451
+    this.add("brackets", "insertion", function(state, action, editor, session, text) {
452
+        if (text == '[') {
453
+            initContext(editor);
454
+            var selection = editor.getSelectionRange();
455
+            var selected = session.doc.getTextRange(selection);
456
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
457
+                return {
458
+                    text: '[' + selected + ']',
459
+                    selection: false
460
+                };
461
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
462
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
463
+                return {
464
+                    text: '[]',
465
+                    selection: [1, 1]
466
+                };
467
+            }
468
+        } else if (text == ']') {
469
+            initContext(editor);
470
+            var cursor = editor.getCursorPosition();
471
+            var line = session.doc.getLine(cursor.row);
472
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
473
+            if (rightChar == ']') {
474
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
475
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
476
+                    CstyleBehaviour.popAutoInsertedClosing();
477
+                    return {
478
+                        text: '',
479
+                        selection: [1, 1]
480
+                    };
481
+                }
482
+            }
483
+        }
484
+    });
485
+
486
+    this.add("brackets", "deletion", function(state, action, editor, session, range) {
487
+        var selected = session.doc.getTextRange(range);
488
+        if (!range.isMultiLine() && selected == '[') {
489
+            initContext(editor);
490
+            var line = session.doc.getLine(range.start.row);
491
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
492
+            if (rightChar == ']') {
493
+                range.end.column++;
494
+                return range;
495
+            }
496
+        }
497
+    });
498
+
499
+    this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
500
+        if (text == '"' || text == "'") {
501
+            initContext(editor);
502
+            var quote = text;
503
+            var selection = editor.getSelectionRange();
504
+            var selected = session.doc.getTextRange(selection);
505
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
506
+                return {
507
+                    text: quote + selected + quote,
508
+                    selection: false
509
+                };
510
+            } else {
511
+                var cursor = editor.getCursorPosition();
512
+                var line = session.doc.getLine(cursor.row);
513
+                var leftChar = line.substring(cursor.column-1, cursor.column);
514
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
515
+                
516
+                var token = session.getTokenAt(cursor.row, cursor.column);
517
+                var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
518
+                if (leftChar == "\\" && token && /escape/.test(token.type))
519
+                    return null;
520
+                
521
+                var stringBefore = token && /string/.test(token.type);
522
+                var stringAfter = !rightToken || /string/.test(rightToken.type);
523
+                
524
+                var pair;
525
+                if (rightChar == quote) {
526
+                    pair = stringBefore !== stringAfter;
527
+                } else {
528
+                    if (stringBefore && !stringAfter)
529
+                        return null; // wrap string with different quote
530
+                    if (stringBefore && stringAfter)
531
+                        return null; // do not pair quotes inside strings 
532
+                    var wordRe = session.$mode.tokenRe;
533
+                    wordRe.lastIndex = 0;
534
+                    var isWordBefore = wordRe.test(leftChar);
535
+                    wordRe.lastIndex = 0;
536
+                    var isWordAfter = wordRe.test(leftChar);
537
+                    if (isWordBefore || isWordAfter)
538
+                        return null; // before or after alphanumeric
539
+                    if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
540
+                        return null; // there is rightChar and it isn't closing
541
+                    pair = true;
542
+                }
543
+                return {
544
+                    text: pair ? quote + quote : "",
545
+                    selection: [1,1]
546
+                };
547
+            }
548
+        }
549
+    });
550
+
551
+    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
552
+        var selected = session.doc.getTextRange(range);
553
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
554
+            initContext(editor);
555
+            var line = session.doc.getLine(range.start.row);
556
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
557
+            if (rightChar == selected) {
558
+                range.end.column++;
559
+                return range;
560
+            }
561
+        }
562
+    });
563
+
564
+};
565
+
566
+    
567
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
568
+    var cursor = editor.getCursorPosition();
569
+    var iterator = new TokenIterator(session, cursor.row, cursor.column);
570
+    if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
571
+        var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
572
+        if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
573
+            return false;
574
+    }
575
+    iterator.stepForward();
576
+    return iterator.getCurrentTokenRow() !== cursor.row ||
577
+        this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
578
+};
579
+
580
+CstyleBehaviour.$matchTokenType = function(token, types) {
581
+    return types.indexOf(token.type || token) > -1;
582
+};
583
+
584
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
585
+    var cursor = editor.getCursorPosition();
586
+    var line = session.doc.getLine(cursor.row);
587
+    if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
588
+        context.autoInsertedBrackets = 0;
589
+    context.autoInsertedRow = cursor.row;
590
+    context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
591
+    context.autoInsertedBrackets++;
592
+};
593
+
594
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
595
+    var cursor = editor.getCursorPosition();
596
+    var line = session.doc.getLine(cursor.row);
597
+    if (!this.isMaybeInsertedClosing(cursor, line))
598
+        context.maybeInsertedBrackets = 0;
599
+    context.maybeInsertedRow = cursor.row;
600
+    context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
601
+    context.maybeInsertedLineEnd = line.substr(cursor.column);
602
+    context.maybeInsertedBrackets++;
603
+};
604
+
605
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
606
+    return context.autoInsertedBrackets > 0 &&
607
+        cursor.row === context.autoInsertedRow &&
608
+        bracket === context.autoInsertedLineEnd[0] &&
609
+        line.substr(cursor.column) === context.autoInsertedLineEnd;
610
+};
611
+
612
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
613
+    return context.maybeInsertedBrackets > 0 &&
614
+        cursor.row === context.maybeInsertedRow &&
615
+        line.substr(cursor.column) === context.maybeInsertedLineEnd &&
616
+        line.substr(0, cursor.column) == context.maybeInsertedLineStart;
617
+};
618
+
619
+CstyleBehaviour.popAutoInsertedClosing = function() {
620
+    context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
621
+    context.autoInsertedBrackets--;
622
+};
623
+
624
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
625
+    if (context) {
626
+        context.maybeInsertedBrackets = 0;
627
+        context.maybeInsertedRow = -1;
628
+    }
629
+};
630
+
631
+
632
+
633
+oop.inherits(CstyleBehaviour, Behaviour);
634
+
635
+exports.CstyleBehaviour = CstyleBehaviour;
636
+});
637
+
638
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
639
+"use strict";
640
+
641
+var oop = require("../../lib/oop");
642
+var Range = require("../../range").Range;
643
+var BaseFoldMode = require("./fold_mode").FoldMode;
644
+
645
+var FoldMode = exports.FoldMode = function(commentRegex) {
646
+    if (commentRegex) {
647
+        this.foldingStartMarker = new RegExp(
648
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
649
+        );
650
+        this.foldingStopMarker = new RegExp(
651
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
652
+        );
653
+    }
654
+};
655
+oop.inherits(FoldMode, BaseFoldMode);
656
+
657
+(function() {
658
+    
659
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
660
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
661
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
662
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
663
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
664
+    this._getFoldWidgetBase = this.getFoldWidget;
665
+    this.getFoldWidget = function(session, foldStyle, row) {
666
+        var line = session.getLine(row);
667
+    
668
+        if (this.singleLineBlockCommentRe.test(line)) {
669
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
670
+                return "";
671
+        }
672
+    
673
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
674
+    
675
+        if (!fw && this.startRegionRe.test(line))
676
+            return "start"; // lineCommentRegionStart
677
+    
678
+        return fw;
679
+    };
680
+
681
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
682
+        var line = session.getLine(row);
683
+        
684
+        if (this.startRegionRe.test(line))
685
+            return this.getCommentRegionBlock(session, line, row);
686
+        
687
+        var match = line.match(this.foldingStartMarker);
688
+        if (match) {
689
+            var i = match.index;
690
+
691
+            if (match[1])
692
+                return this.openingBracketBlock(session, match[1], row, i);
693
+                
694
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
695
+            
696
+            if (range && !range.isMultiLine()) {
697
+                if (forceMultiline) {
698
+                    range = this.getSectionRange(session, row);
699
+                } else if (foldStyle != "all")
700
+                    range = null;
701
+            }
702
+            
703
+            return range;
704
+        }
705
+
706
+        if (foldStyle === "markbegin")
707
+            return;
708
+
709
+        var match = line.match(this.foldingStopMarker);
710
+        if (match) {
711
+            var i = match.index + match[0].length;
712
+
713
+            if (match[1])
714
+                return this.closingBracketBlock(session, match[1], row, i);
715
+
716
+            return session.getCommentFoldRange(row, i, -1);
717
+        }
718
+    };
719
+    
720
+    this.getSectionRange = function(session, row) {
721
+        var line = session.getLine(row);
722
+        var startIndent = line.search(/\S/);
723
+        var startRow = row;
724
+        var startColumn = line.length;
725
+        row = row + 1;
726
+        var endRow = row;
727
+        var maxRow = session.getLength();
728
+        while (++row < maxRow) {
729
+            line = session.getLine(row);
730
+            var indent = line.search(/\S/);
731
+            if (indent === -1)
732
+                continue;
733
+            if  (startIndent > indent)
734
+                break;
735
+            var subRange = this.getFoldWidgetRange(session, "all", row);
736
+            
737
+            if (subRange) {
738
+                if (subRange.start.row <= startRow) {
739
+                    break;
740
+                } else if (subRange.isMultiLine()) {
741
+                    row = subRange.end.row;
742
+                } else if (startIndent == indent) {
743
+                    break;
744
+                }
745
+            }
746
+            endRow = row;
747
+        }
748
+        
749
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
750
+    };
751
+    
752
+    this.getCommentRegionBlock = function(session, line, row) {
753
+        var startColumn = line.search(/\s*$/);
754
+        var maxRow = session.getLength();
755
+        var startRow = row;
756
+        
757
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
758
+        var depth = 1;
759
+        while (++row < maxRow) {
760
+            line = session.getLine(row);
761
+            var m = re.exec(line);
762
+            if (!m) continue;
763
+            if (m[1]) depth--;
764
+            else depth++;
765
+
766
+            if (!depth) break;
767
+        }
768
+
769
+        var endRow = row;
770
+        if (endRow > startRow) {
771
+            return new Range(startRow, startColumn, endRow, line.length);
772
+        }
773
+    };
774
+
775
+}).call(FoldMode.prototype);
776
+
777
+});
778
+
779
+ace.define("ace/mode/c_cpp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/c_cpp_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
780
+"use strict";
781
+
782
+var oop = require("../lib/oop");
783
+var TextMode = require("./text").Mode;
784
+var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
785
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
786
+var Range = require("../range").Range;
787
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
788
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
789
+
790
+var Mode = function() {
791
+    this.HighlightRules = c_cppHighlightRules;
792
+
793
+    this.$outdent = new MatchingBraceOutdent();
794
+    this.$behaviour = new CstyleBehaviour();
795
+
796
+    this.foldingRules = new CStyleFoldMode();
797
+};
798
+oop.inherits(Mode, TextMode);
799
+
800
+(function() {
801
+
802
+    this.lineCommentStart = "//";
803
+    this.blockComment = {start: "/*", end: "*/"};
804
+
805
+    this.getNextLineIndent = function(state, line, tab) {
806
+        var indent = this.$getIndent(line);
807
+
808
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
809
+        var tokens = tokenizedLine.tokens;
810
+        var endState = tokenizedLine.state;
811
+
812
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
813
+            return indent;
814
+        }
815
+
816
+        if (state == "start") {
817
+            var match = line.match(/^.*[\{\(\[]\s*$/);
818
+            if (match) {
819
+                indent += tab;
820
+            }
821
+        } else if (state == "doc-start") {
822
+            if (endState == "start") {
823
+                return "";
824
+            }
825
+            var match = line.match(/^\s*(\/?)\*/);
826
+            if (match) {
827
+                if (match[1]) {
828
+                    indent += " ";
829
+                }
830
+                indent += "* ";
831
+            }
832
+        }
833
+
834
+        return indent;
835
+    };
836
+
837
+    this.checkOutdent = function(state, line, input) {
838
+        return this.$outdent.checkOutdent(line, input);
839
+    };
840
+
841
+    this.autoOutdent = function(state, doc, row) {
842
+        this.$outdent.autoOutdent(doc, row);
843
+    };
844
+
845
+    this.$id = "ace/mode/c_cpp";
846
+}).call(Mode.prototype);
847
+
848
+exports.Mode = Mode;
849
+});

+ 202
- 0
generator/lib/ace/mode-cirru.js Parādīt failu

@@ -0,0 +1,202 @@
1
+ace.define("ace/mode/cirru_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
+var CirruHighlightRules = function() {
7
+    this.$rules = {
8
+        start: [{
9
+            token: 'constant.numeric',
10
+            regex: /[\d\.]+/
11
+        }, {
12
+            token: 'comment.line.double-dash',
13
+            regex: /--/,
14
+            next: 'comment',
15
+        }, {
16
+            token: 'storage.modifier',
17
+            regex: /\(/,
18
+        }, {
19
+            token: 'storage.modifier',
20
+            regex: /\,/,
21
+            next: 'line',
22
+        }, {
23
+            token: 'support.function',
24
+            regex: /[^\(\)\"\s]+/,
25
+            next: 'line'
26
+        }, {
27
+            token: 'string.quoted.double',
28
+            regex: /"/,
29
+            next: 'string',
30
+        }, {
31
+            token: 'storage.modifier',
32
+            regex: /\)/,
33
+        }],
34
+        comment: [{
35
+            token: 'comment.line.double-dash',
36
+            regex: /\ +[^\n]+/,
37
+            next: 'start',
38
+        }],
39
+        string: [{
40
+            token: 'string.quoted.double',
41
+            regex: /"/,
42
+            next: 'line',
43
+        }, {
44
+            token: 'constant.character.escape',
45
+            regex: /\\/,
46
+            next: 'escape',
47
+        }, {
48
+            token: 'string.quoted.double',
49
+            regex: /[^\\\"]+/,
50
+        }],
51
+        escape: [{
52
+            token: 'constant.character.escape',
53
+            regex: /./,
54
+            next: 'string',
55
+        }],
56
+        line: [{
57
+            token: 'constant.numeric',
58
+            regex: /[\d\.]+/
59
+        }, {
60
+            token: 'markup.raw',
61
+            regex: /^\s*/,
62
+            next: 'start',
63
+        }, {
64
+            token: 'storage.modifier',
65
+            regex: /\$/,
66
+            next: 'start',
67
+        }, {
68
+            token: 'variable.parameter',
69
+            regex: /[^\(\)\"\s]+/
70
+        }, {
71
+            token: 'storage.modifier',
72
+            regex: /\(/,
73
+            next: 'start'
74
+        }, {
75
+            token: 'storage.modifier',
76
+            regex: /\)/,
77
+        }, {
78
+            token: 'markup.raw',
79
+            regex: /^\ */,
80
+            next: 'start',
81
+        }, {
82
+            token: 'string.quoted.double',
83
+            regex: /"/,
84
+            next: 'string',
85
+        }]
86
+    }
87
+
88
+};
89
+
90
+oop.inherits(CirruHighlightRules, TextHighlightRules);
91
+
92
+exports.CirruHighlightRules = CirruHighlightRules;
93
+});
94
+
95
+ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
96
+"use strict";
97
+
98
+var oop = require("../../lib/oop");
99
+var BaseFoldMode = require("./fold_mode").FoldMode;
100
+var Range = require("../../range").Range;
101
+
102
+var FoldMode = exports.FoldMode = function() {};
103
+oop.inherits(FoldMode, BaseFoldMode);
104
+
105
+(function() {
106
+
107
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
108
+        var range = this.indentationBlock(session, row);
109
+        if (range)
110
+            return range;
111
+
112
+        var re = /\S/;
113
+        var line = session.getLine(row);
114
+        var startLevel = line.search(re);
115
+        if (startLevel == -1 || line[startLevel] != "#")
116
+            return;
117
+
118
+        var startColumn = line.length;
119
+        var maxRow = session.getLength();
120
+        var startRow = row;
121
+        var endRow = row;
122
+
123
+        while (++row < maxRow) {
124
+            line = session.getLine(row);
125
+            var level = line.search(re);
126
+
127
+            if (level == -1)
128
+                continue;
129
+
130
+            if (line[level] != "#")
131
+                break;
132
+
133
+            endRow = row;
134
+        }
135
+
136
+        if (endRow > startRow) {
137
+            var endColumn = session.getLine(endRow).length;
138
+            return new Range(startRow, startColumn, endRow, endColumn);
139
+        }
140
+    };
141
+    this.getFoldWidget = function(session, foldStyle, row) {
142
+        var line = session.getLine(row);
143
+        var indent = line.search(/\S/);
144
+        var next = session.getLine(row + 1);
145
+        var prev = session.getLine(row - 1);
146
+        var prevIndent = prev.search(/\S/);
147
+        var nextIndent = next.search(/\S/);
148
+
149
+        if (indent == -1) {
150
+            session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
151
+            return "";
152
+        }
153
+        if (prevIndent == -1) {
154
+            if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
155
+                session.foldWidgets[row - 1] = "";
156
+                session.foldWidgets[row + 1] = "";
157
+                return "start";
158
+            }
159
+        } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
160
+            if (session.getLine(row - 2).search(/\S/) == -1) {
161
+                session.foldWidgets[row - 1] = "start";
162
+                session.foldWidgets[row + 1] = "";
163
+                return "";
164
+            }
165
+        }
166
+
167
+        if (prevIndent!= -1 && prevIndent < indent)
168
+            session.foldWidgets[row - 1] = "start";
169
+        else
170
+            session.foldWidgets[row - 1] = "";
171
+
172
+        if (indent < nextIndent)
173
+            return "start";
174
+        else
175
+            return "";
176
+    };
177
+
178
+}).call(FoldMode.prototype);
179
+
180
+});
181
+
182
+ace.define("ace/mode/cirru",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/cirru_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module) {
183
+"use strict";
184
+
185
+var oop = require("../lib/oop");
186
+var TextMode = require("./text").Mode;
187
+var CirruHighlightRules = require("./cirru_highlight_rules").CirruHighlightRules;
188
+var CoffeeFoldMode = require("./folding/coffee").FoldMode;
189
+
190
+var Mode = function() {
191
+    this.HighlightRules = CirruHighlightRules;
192
+    this.foldingRules = new CoffeeFoldMode();
193
+};
194
+oop.inherits(Mode, TextMode);
195
+
196
+(function() {
197
+    this.lineCommentStart = "--";
198
+    this.$id = "ace/mode/cirru";
199
+}).call(Mode.prototype);
200
+
201
+exports.Mode = Mode;
202
+});

+ 306
- 0
generator/lib/ace/mode-clojure.js Parādīt failu

@@ -0,0 +1,306 @@
1
+ace.define("ace/mode/clojure_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
+
8
+
9
+var ClojureHighlightRules = function() {
10
+
11
+    var builtinFunctions = (
12
+        '* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' +
13
+        '*command-line-args* *compile-files* *compile-path* *e *err* *file* ' +
14
+        '*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' +
15
+        '*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' +
16
+        '*read-eval* *source-path* *use-context-classloader* ' +
17
+        '*warn-on-reflection* + - -> ->> .. / < <= = ' +
18
+        '== > &gt; >= &gt;= accessor aclone ' +
19
+        'add-classpath add-watch agent agent-errors aget alength alias all-ns ' +
20
+        'alter alter-meta! alter-var-root amap ancestors and apply areduce ' +
21
+        'array-map aset aset-boolean aset-byte aset-char aset-double aset-float ' +
22
+        'aset-int aset-long aset-short assert assoc assoc! assoc-in associative? ' +
23
+        'atom await await-for await1 bases bean bigdec bigint binding bit-and ' +
24
+        'bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left ' +
25
+        'bit-shift-right bit-test bit-xor boolean boolean-array booleans ' +
26
+        'bound-fn bound-fn* butlast byte byte-array bytes cast char char-array ' +
27
+        'char-escape-string char-name-string char? chars chunk chunk-append ' +
28
+        'chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? ' +
29
+        'class class? clear-agent-errors clojure-version coll? comment commute ' +
30
+        'comp comparator compare compare-and-set! compile complement concat cond ' +
31
+        'condp conj conj! cons constantly construct-proxy contains? count ' +
32
+        'counted? create-ns create-struct cycle dec decimal? declare definline ' +
33
+        'defmacro defmethod defmulti defn defn- defonce defstruct delay delay? ' +
34
+        'deliver deref derive descendants destructure disj disj! dissoc dissoc! ' +
35
+        'distinct distinct? doall doc dorun doseq dosync dotimes doto double ' +
36
+        'double-array doubles drop drop-last drop-while empty empty? ensure ' +
37
+        'enumeration-seq eval even? every? false? ffirst file-seq filter find ' +
38
+        'find-doc find-ns find-var first float float-array float? floats flush ' +
39
+        'fn fn? fnext for force format future future-call future-cancel ' +
40
+        'future-cancelled? future-done? future? gen-class gen-interface gensym ' +
41
+        'get get-in get-method get-proxy-class get-thread-bindings get-validator ' +
42
+        'hash hash-map hash-set identical? identity if-let if-not ifn? import ' +
43
+        'in-ns inc init-proxy instance? int int-array integer? interleave intern ' +
44
+        'interpose into into-array ints io! isa? iterate iterator-seq juxt key ' +
45
+        'keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list ' +
46
+        'list* list? load load-file load-reader load-string loaded-libs locking ' +
47
+        'long long-array longs loop macroexpand macroexpand-1 make-array ' +
48
+        'make-hierarchy map map? mapcat max max-key memfn memoize merge ' +
49
+        'merge-with meta method-sig methods min min-key mod name namespace neg? ' +
50
+        'newline next nfirst nil? nnext not not-any? not-empty not-every? not= ' +
51
+        'ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ' +
52
+        'ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? ' +
53
+        'or parents partial partition pcalls peek persistent! pmap pop pop! ' +
54
+        'pop-thread-bindings pos? pr pr-str prefer-method prefers ' +
55
+        'primitives-classnames print print-ctor print-doc print-dup print-method ' +
56
+        'print-namespace-doc print-simple print-special-doc print-str printf ' +
57
+        'println println-str prn prn-str promise proxy proxy-call-with-super ' +
58
+        'proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot ' +
59
+        'rand rand-int range ratio? rational? rationalize re-find re-groups ' +
60
+        're-matcher re-matches re-pattern re-seq read read-line read-string ' +
61
+        'reduce ref ref-history-count ref-max-history ref-min-history ref-set ' +
62
+        'refer refer-clojure release-pending-sends rem remove remove-method ' +
63
+        'remove-ns remove-watch repeat repeatedly replace replicate require ' +
64
+        'reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq ' +
65
+        'rsubseq second select-keys send send-off seq seq? seque sequence ' +
66
+        'sequential? set set-validator! set? short short-array shorts ' +
67
+        'shutdown-agents slurp some sort sort-by sorted-map sorted-map-by ' +
68
+        'sorted-set sorted-set-by sorted? special-form-anchor special-symbol? ' +
69
+        'split-at split-with str stream? string? struct struct-map subs subseq ' +
70
+        'subvec supers swap! symbol symbol? sync syntax-symbol-anchor take ' +
71
+        'take-last take-nth take-while test the-ns time to-array to-array-2d ' +
72
+        'trampoline transient tree-seq true? type unchecked-add unchecked-dec ' +
73
+        'unchecked-divide unchecked-inc unchecked-multiply unchecked-negate ' +
74
+        'unchecked-remainder unchecked-subtract underive unquote ' +
75
+        'unquote-splicing update-in update-proxy use val vals var-get var-set ' +
76
+        'var? vary-meta vec vector vector? when when-first when-let when-not ' +
77
+        'while with-bindings with-bindings* with-in-str with-loading-context ' +
78
+        'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' +
79
+        'zero? zipmap'
80
+    );
81
+
82
+    var keywords = ('throw try var ' +
83
+        'def do fn if let loop monitor-enter monitor-exit new quote recur set!'
84
+    );
85
+
86
+    var buildinConstants = ("true false nil");
87
+
88
+    var keywordMapper = this.createKeywordMapper({
89
+        "keyword": keywords,
90
+        "constant.language": buildinConstants,
91
+        "support.function": builtinFunctions
92
+    }, "identifier", false, " ");
93
+
94
+    this.$rules = {
95
+        "start" : [
96
+            {
97
+                token : "comment",
98
+                regex : ";.*$"
99
+            }, {
100
+                token : "keyword", //parens
101
+                regex : "[\\(|\\)]"
102
+            }, {
103
+                token : "keyword", //lists
104
+                regex : "[\\'\\(]"
105
+            }, {
106
+                token : "keyword", //vectors
107
+                regex : "[\\[|\\]]"
108
+            }, {
109
+                token : "keyword", //sets and maps
110
+                regex : "[\\{|\\}|\\#\\{|\\#\\}]"
111
+            }, {
112
+                    token : "keyword", // ampersands
113
+                    regex : '[\\&]'
114
+            }, {
115
+                    token : "keyword", // metadata
116
+                    regex : '[\\#\\^\\{]'
117
+            }, {
118
+                    token : "keyword", // anonymous fn syntactic sugar
119
+                    regex : '[\\%]'
120
+            }, {
121
+                    token : "keyword", // deref reader macro
122
+                    regex : '[@]'
123
+            }, {
124
+                token : "constant.numeric", // hex
125
+                regex : "0[xX][0-9a-fA-F]+\\b"
126
+            }, {
127
+                token : "constant.numeric", // float
128
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
129
+            }, {
130
+                token : "constant.language",
131
+                regex : '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]'
132
+            }, {
133
+                token : keywordMapper,
134
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b"
135
+            }, {
136
+                token : "string", // single line
137
+                regex : '"',
138
+                next: "string"
139
+            }, {
140
+                token : "constant", // symbol
141
+                regex : /:[^()\[\]{}'"\^%`,;\s]+/
142
+            }, {
143
+                token : "string.regexp", //Regular Expressions
144
+                regex : '/#"(?:\\.|(?:\\\")|[^\""\n])*"/g'
145
+            }
146
+
147
+        ],
148
+        "string" : [
149
+            {
150
+                token : "constant.language.escape",                
151
+                regex : "\\\\.|\\\\$"
152
+            }, {
153
+                token : "string",                
154
+                regex : '[^"\\\\]+'
155
+            }, {
156
+                token : "string",
157
+                regex : '"',
158
+                next : "start"
159
+            }
160
+        ]
161
+    };
162
+};
163
+
164
+oop.inherits(ClojureHighlightRules, TextHighlightRules);
165
+
166
+exports.ClojureHighlightRules = ClojureHighlightRules;
167
+});
168
+
169
+ace.define("ace/mode/matching_parens_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
170
+"use strict";
171
+
172
+var Range = require("../range").Range;
173
+
174
+var MatchingParensOutdent = function() {};
175
+
176
+(function() {
177
+
178
+    this.checkOutdent = function(line, input) {
179
+        if (! /^\s+$/.test(line))
180
+            return false;
181
+
182
+        return /^\s*\)/.test(input);
183
+    };
184
+
185
+    this.autoOutdent = function(doc, row) {
186
+        var line = doc.getLine(row);
187
+        var match = line.match(/^(\s*\))/);
188
+
189
+        if (!match) return 0;
190
+
191
+        var column = match[1].length;
192
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
193
+
194
+        if (!openBracePos || openBracePos.row == row) return 0;
195
+
196
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
197
+        doc.replace(new Range(row, 0, row, column-1), indent);
198
+    };
199
+
200
+    this.$getIndent = function(line) {
201
+        var match = line.match(/^(\s+)/);
202
+        if (match) {
203
+            return match[1];
204
+        }
205
+
206
+        return "";
207
+    };
208
+
209
+}).call(MatchingParensOutdent.prototype);
210
+
211
+exports.MatchingParensOutdent = MatchingParensOutdent;
212
+});
213
+
214
+ace.define("ace/mode/clojure",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/clojure_highlight_rules","ace/mode/matching_parens_outdent"], function(require, exports, module) {
215
+"use strict";
216
+
217
+var oop = require("../lib/oop");
218
+var TextMode = require("./text").Mode;
219
+var ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules;
220
+var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent;
221
+
222
+var Mode = function() {
223
+    this.HighlightRules = ClojureHighlightRules;
224
+    this.$outdent = new MatchingParensOutdent();
225
+};
226
+oop.inherits(Mode, TextMode);
227
+
228
+(function() {
229
+
230
+    this.lineCommentStart = ";";
231
+    this.minorIndentFunctions = ["defn", "defn-", "defmacro", "def", "deftest", "testing"];
232
+
233
+    this.$toIndent = function(str) {
234
+        return str.split('').map(function(ch) {
235
+            if (/\s/.exec(ch)) {
236
+                return ch;
237
+            } else {
238
+                return ' ';
239
+            }
240
+        }).join('');
241
+    };
242
+
243
+    this.$calculateIndent = function(line, tab) {
244
+        var baseIndent = this.$getIndent(line);
245
+        var delta = 0;
246
+        var isParen, ch;
247
+        for (var i = line.length - 1; i >= 0; i--) {
248
+            ch = line[i];
249
+            if (ch === '(') {
250
+                delta--;
251
+                isParen = true;
252
+            } else if (ch === '(' || ch === '[' || ch === '{') {
253
+                delta--;
254
+                isParen = false;
255
+            } else if (ch === ')' || ch === ']' || ch === '}') {
256
+                delta++;
257
+            }
258
+            if (delta < 0) {
259
+                break;
260
+            }
261
+        }
262
+        if (delta < 0 && isParen) {
263
+            i += 1;
264
+            var iBefore = i;
265
+            var fn = '';
266
+            while (true) {
267
+                ch = line[i];
268
+                if (ch === ' ' || ch === '\t') {
269
+                    if(this.minorIndentFunctions.indexOf(fn) !== -1) {
270
+                        return this.$toIndent(line.substring(0, iBefore - 1) + tab);
271
+                    } else {
272
+                        return this.$toIndent(line.substring(0, i + 1));
273
+                    }
274
+                } else if (ch === undefined) {
275
+                    return this.$toIndent(line.substring(0, iBefore - 1) + tab);
276
+                }
277
+                fn += line[i];
278
+                i++;
279
+            }
280
+        } else if(delta < 0 && !isParen) {
281
+            return this.$toIndent(line.substring(0, i+1));
282
+        } else if(delta > 0) {
283
+            baseIndent = baseIndent.substring(0, baseIndent.length - tab.length);
284
+            return baseIndent;
285
+        } else {
286
+            return baseIndent;
287
+        }
288
+    };
289
+
290
+    this.getNextLineIndent = function(state, line, tab) {
291
+        return this.$calculateIndent(line, tab);
292
+    };
293
+
294
+    this.checkOutdent = function(state, line, input) {
295
+        return this.$outdent.checkOutdent(line, input);
296
+    };
297
+
298
+    this.autoOutdent = function(state, doc, row) {
299
+        this.$outdent.autoOutdent(doc, row);
300
+    };
301
+
302
+    this.$id = "ace/mode/clojure";
303
+}).call(Mode.prototype);
304
+
305
+exports.Mode = Mode;
306
+});

+ 94
- 0
generator/lib/ace/mode-cobol.js Parādīt failu

@@ -0,0 +1,94 @@
1
+ace.define("ace/mode/cobol_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 CobolHighlightRules = function() {
8
+var keywords = "ACCEPT|MERGE|SUM|ADD||MESSAGE|TABLE|ADVANCING|MODE|TAPE|" +
9
+"AFTER|MULTIPLY|TEST|ALL|NEGATIVE|TEXT|ALPHABET|NEXT|THAN|" +
10
+"ALSO|NO|THEN|ALTERNATE|NOT|THROUGH|AND|NUMBER|THRU|ANY|OCCURS|" +
11
+"TIME|ARE|OF|TO|AREA|OFF|TOP||ASCENDING|OMITTED|TRUE|ASSIGN|ON|TYPE|AT|OPEN|" +
12
+"UNIT|AUTHOR|OR|UNTIL|BEFORE|OTHER|UP|BLANK|OUTPUT|USE|BLOCK|PAGE|USING|BOTTOM|" +
13
+"PERFORM|VALUE|BY|PIC|VALUES|CALL|PICTURE|WHEN|CANCEL|PLUS|WITH|CD|POINTER|WRITE|" +
14
+"CHARACTER|POSITION||ZERO|CLOSE|POSITIVE|ZEROS|COLUMN|PROCEDURE|ZEROES|COMMA|PROGRAM|" +
15
+"COMMON|PROGRAM-ID|COMMUNICATION|QUOTE|COMP|RANDOM|COMPUTE|READ|CONTAINS|RECEIVE|CONFIGURATION|" +
16
+"RECORD|CONTINUE|REDEFINES|CONTROL|REFERENCE|COPY|REMAINDER|COUNT|REPLACE|DATA|REPORT|DATE|RESERVE|" +
17
+"DAY|RESET|DELETE|RETURN|DESTINATION|REWIND|DISABLE|REWRITE|DISPLAY|RIGHT|DIVIDE|RUN|DOWN|SAME|" +
18
+"ELSE|SEARCH|ENABLE|SECTION|END|SELECT|ENVIRONMENT|SENTENCE|EQUAL|SET|ERROR|SIGN|EXIT|SEQUENTIAL|" +
19
+"EXTERNAL|SIZE|FLASE|SORT|FILE|SOURCE|LENGTH|SPACE|LESS|STANDARD|LIMIT|START|LINE|STOP|LOCK|STRING|LOW-VALUE|SUBTRACT";
20
+
21
+    var builtinConstants = (
22
+        "true|false|null"
23
+    );
24
+
25
+    var builtinFunctions = (
26
+        "count|min|max|avg|sum|rank|now|coalesce|main"
27
+    );
28
+
29
+    var keywordMapper = this.createKeywordMapper({
30
+        "support.function": builtinFunctions,
31
+        "keyword": keywords,
32
+        "constant.language": builtinConstants
33
+    }, "identifier", true);
34
+
35
+    this.$rules = {
36
+        "start" : [ {
37
+            token : "comment",
38
+            regex : "\\*.*$"
39
+        }, {
40
+            token : "string",           // " string
41
+            regex : '".*?"'
42
+        }, {
43
+            token : "string",           // ' string
44
+            regex : "'.*?'"
45
+        }, {
46
+            token : "constant.numeric", // float
47
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
48
+        }, {
49
+            token : keywordMapper,
50
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
51
+        }, {
52
+            token : "keyword.operator",
53
+            regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
54
+        }, {
55
+            token : "paren.lparen",
56
+            regex : "[\\(]"
57
+        }, {
58
+            token : "paren.rparen",
59
+            regex : "[\\)]"
60
+        }, {
61
+            token : "text",
62
+            regex : "\\s+"
63
+        } ]
64
+    };
65
+};
66
+
67
+oop.inherits(CobolHighlightRules, TextHighlightRules);
68
+
69
+exports.CobolHighlightRules = CobolHighlightRules;
70
+});
71
+
72
+ace.define("ace/mode/cobol",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/cobol_highlight_rules","ace/range"], function(require, exports, module) {
73
+"use strict";
74
+
75
+var oop = require("../lib/oop");
76
+var TextMode = require("./text").Mode;
77
+var CobolHighlightRules = require("./cobol_highlight_rules").CobolHighlightRules;
78
+var Range = require("../range").Range;
79
+
80
+var Mode = function() {
81
+    this.HighlightRules = CobolHighlightRules;
82
+};
83
+oop.inherits(Mode, TextMode);
84
+
85
+(function() {
86
+
87
+    this.lineCommentStart = "*";
88
+
89
+    this.$id = "ace/mode/cobol";
90
+}).call(Mode.prototype);
91
+
92
+exports.Mode = Mode;
93
+
94
+});

+ 412
- 0
generator/lib/ace/mode-coffee.js Parādīt failu

@@ -0,0 +1,412 @@
1
+ace.define("ace/mode/coffee_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
+    oop.inherits(CoffeeHighlightRules, TextHighlightRules);
8
+
9
+    function CoffeeHighlightRules() {
10
+        var identifier = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*";
11
+
12
+        var keywords = (
13
+            "this|throw|then|try|typeof|super|switch|return|break|by|continue|" +
14
+            "catch|class|in|instanceof|is|isnt|if|else|extends|for|own|" +
15
+            "finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
16
+            "or|on|unless|until|and|yes"
17
+        );
18
+
19
+        var langConstant = (
20
+            "true|false|null|undefined|NaN|Infinity"
21
+        );
22
+
23
+        var illegal = (
24
+            "case|const|default|function|var|void|with|enum|export|implements|" +
25
+            "interface|let|package|private|protected|public|static|yield|" +
26
+            "__hasProp|slice|bind|indexOf"
27
+        );
28
+
29
+        var supportClass = (
30
+            "Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|" +
31
+            "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
32
+            "SyntaxError|TypeError|URIError|"  +
33
+            "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
34
+            "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray"
35
+        );
36
+
37
+        var supportFunction = (
38
+            "Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" +
39
+            "encodeURIComponent|decodeURI|decodeURIComponent|String|"
40
+        );
41
+
42
+        var variableLanguage = (
43
+            "window|arguments|prototype|document"
44
+        );
45
+
46
+        var keywordMapper = this.createKeywordMapper({
47
+            "keyword": keywords,
48
+            "constant.language": langConstant,
49
+            "invalid.illegal": illegal,
50
+            "language.support.class": supportClass,
51
+            "language.support.function": supportFunction,
52
+            "variable.language": variableLanguage
53
+        }, "identifier");
54
+
55
+        var functionRule = {
56
+            token: ["paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"],
57
+            regex: /(?:(\()((?:"[^")]*?"|'[^')]*?'|\/[^\/)]*?\/|[^()\"'\/])*?)(\))(\s*))?([\-=]>)/.source
58
+        };
59
+
60
+        var stringEscape = /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)/;
61
+
62
+        this.$rules = {
63
+            start : [
64
+                {
65
+                    token : "constant.numeric",
66
+                    regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"
67
+                }, {
68
+                    stateName: "qdoc",
69
+                    token : "string", regex : "'''", next : [
70
+                        {token : "string", regex : "'''", next : "start"},
71
+                        {token : "constant.language.escape", regex : stringEscape},
72
+                        {defaultToken: "string"}
73
+                    ]
74
+                }, {
75
+                    stateName: "qqdoc",
76
+                    token : "string",
77
+                    regex : '"""',
78
+                    next : [
79
+                        {token : "string", regex : '"""', next : "start"},
80
+                        {token : "paren.string", regex : '#{', push : "start"},
81
+                        {token : "constant.language.escape", regex : stringEscape},
82
+                        {defaultToken: "string"}
83
+                    ]
84
+                }, {
85
+                    stateName: "qstring",
86
+                    token : "string", regex : "'", next : [
87
+                        {token : "string", regex : "'", next : "start"},
88
+                        {token : "constant.language.escape", regex : stringEscape},
89
+                        {defaultToken: "string"}
90
+                    ]
91
+                }, {
92
+                    stateName: "qqstring",
93
+                    token : "string.start", regex : '"', next : [
94
+                        {token : "string.end", regex : '"', next : "start"},
95
+                        {token : "paren.string", regex : '#{', push : "start"},
96
+                        {token : "constant.language.escape", regex : stringEscape},
97
+                        {defaultToken: "string"}
98
+                    ]
99
+                }, {
100
+                    stateName: "js",
101
+                    token : "string", regex : "`", next : [
102
+                        {token : "string", regex : "`", next : "start"},
103
+                        {token : "constant.language.escape", regex : stringEscape},
104
+                        {defaultToken: "string"}
105
+                    ]
106
+                }, {
107
+                    regex: "[{}]", onMatch: function(val, state, stack) {
108
+                        this.next = "";
109
+                        if (val == "{" && stack.length) {
110
+                            stack.unshift("start", state);
111
+                            return "paren";
112
+                        }
113
+                        if (val == "}" && stack.length) {
114
+                            stack.shift();
115
+                            this.next = stack.shift() || "";
116
+                            if (this.next.indexOf("string") != -1)
117
+                                return "paren.string";
118
+                        }
119
+                        return "paren";
120
+                    }
121
+                }, {
122
+                    token : "string.regex",
123
+                    regex : "///",
124
+                    next : "heregex"
125
+                }, {
126
+                    token : "string.regex",
127
+                    regex : /(?:\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)(?:[imgy]{0,4})(?!\w)/
128
+                }, {
129
+                    token : "comment",
130
+                    regex : "###(?!#)",
131
+                    next : "comment"
132
+                }, {
133
+                    token : "comment",
134
+                    regex : "#.*"
135
+                }, {
136
+                    token : ["punctuation.operator", "text", "identifier"],
137
+                    regex : "(\\.)(\\s*)(" + illegal + ")"
138
+                }, {
139
+                    token : "punctuation.operator",
140
+                    regex : "\\."
141
+                }, {
142
+                    token : ["keyword", "text", "language.support.class",
143
+                     "text", "keyword", "text", "language.support.class"],
144
+                    regex : "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?"
145
+                }, {
146
+                    token : ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token),
147
+                    regex : "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex
148
+                }, 
149
+                functionRule, 
150
+                {
151
+                    token : "variable",
152
+                    regex : "@(?:" + identifier + ")?"
153
+                }, {
154
+                    token: keywordMapper,
155
+                    regex : identifier
156
+                }, {
157
+                    token : "punctuation.operator",
158
+                    regex : "\\,|\\."
159
+                }, {
160
+                    token : "storage.type",
161
+                    regex : "[\\-=]>"
162
+                }, {
163
+                    token : "keyword.operator",
164
+                    regex : "(?:[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
165
+                }, {
166
+                    token : "paren.lparen",
167
+                    regex : "[({[]"
168
+                }, {
169
+                    token : "paren.rparen",
170
+                    regex : "[\\]})]"
171
+                }, {
172
+                    token : "text",
173
+                    regex : "\\s+"
174
+                }],
175
+
176
+
177
+            heregex : [{
178
+                token : "string.regex",
179
+                regex : '.*?///[imgy]{0,4}',
180
+                next : "start"
181
+            }, {
182
+                token : "comment.regex",
183
+                regex : "\\s+(?:#.*)?"
184
+            }, {
185
+                token : "string.regex",
186
+                regex : "\\S+"
187
+            }],
188
+
189
+            comment : [{
190
+                token : "comment",
191
+                regex : '###',
192
+                next : "start"
193
+            }, {
194
+                defaultToken : "comment"
195
+            }]
196
+        };
197
+        this.normalizeRules();
198
+    }
199
+
200
+    exports.CoffeeHighlightRules = CoffeeHighlightRules;
201
+});
202
+
203
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
204
+"use strict";
205
+
206
+var Range = require("../range").Range;
207
+
208
+var MatchingBraceOutdent = function() {};
209
+
210
+(function() {
211
+
212
+    this.checkOutdent = function(line, input) {
213
+        if (! /^\s+$/.test(line))
214
+            return false;
215
+
216
+        return /^\s*\}/.test(input);
217
+    };
218
+
219
+    this.autoOutdent = function(doc, row) {
220
+        var line = doc.getLine(row);
221
+        var match = line.match(/^(\s*\})/);
222
+
223
+        if (!match) return 0;
224
+
225
+        var column = match[1].length;
226
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
227
+
228
+        if (!openBracePos || openBracePos.row == row) return 0;
229
+
230
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
231
+        doc.replace(new Range(row, 0, row, column-1), indent);
232
+    };
233
+
234
+    this.$getIndent = function(line) {
235
+        return line.match(/^\s*/)[0];
236
+    };
237
+
238
+}).call(MatchingBraceOutdent.prototype);
239
+
240
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
241
+});
242
+
243
+ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
244
+"use strict";
245
+
246
+var oop = require("../../lib/oop");
247
+var BaseFoldMode = require("./fold_mode").FoldMode;
248
+var Range = require("../../range").Range;
249
+
250
+var FoldMode = exports.FoldMode = function() {};
251
+oop.inherits(FoldMode, BaseFoldMode);
252
+
253
+(function() {
254
+
255
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
256
+        var range = this.indentationBlock(session, row);
257
+        if (range)
258
+            return range;
259
+
260
+        var re = /\S/;
261
+        var line = session.getLine(row);
262
+        var startLevel = line.search(re);
263
+        if (startLevel == -1 || line[startLevel] != "#")
264
+            return;
265
+
266
+        var startColumn = line.length;
267
+        var maxRow = session.getLength();
268
+        var startRow = row;
269
+        var endRow = row;
270
+
271
+        while (++row < maxRow) {
272
+            line = session.getLine(row);
273
+            var level = line.search(re);
274
+
275
+            if (level == -1)
276
+                continue;
277
+
278
+            if (line[level] != "#")
279
+                break;
280
+
281
+            endRow = row;
282
+        }
283
+
284
+        if (endRow > startRow) {
285
+            var endColumn = session.getLine(endRow).length;
286
+            return new Range(startRow, startColumn, endRow, endColumn);
287
+        }
288
+    };
289
+    this.getFoldWidget = function(session, foldStyle, row) {
290
+        var line = session.getLine(row);
291
+        var indent = line.search(/\S/);
292
+        var next = session.getLine(row + 1);
293
+        var prev = session.getLine(row - 1);
294
+        var prevIndent = prev.search(/\S/);
295
+        var nextIndent = next.search(/\S/);
296
+
297
+        if (indent == -1) {
298
+            session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
299
+            return "";
300
+        }
301
+        if (prevIndent == -1) {
302
+            if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
303
+                session.foldWidgets[row - 1] = "";
304
+                session.foldWidgets[row + 1] = "";
305
+                return "start";
306
+            }
307
+        } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
308
+            if (session.getLine(row - 2).search(/\S/) == -1) {
309
+                session.foldWidgets[row - 1] = "start";
310
+                session.foldWidgets[row + 1] = "";
311
+                return "";
312
+            }
313
+        }
314
+
315
+        if (prevIndent!= -1 && prevIndent < indent)
316
+            session.foldWidgets[row - 1] = "start";
317
+        else
318
+            session.foldWidgets[row - 1] = "";
319
+
320
+        if (indent < nextIndent)
321
+            return "start";
322
+        else
323
+            return "";
324
+    };
325
+
326
+}).call(FoldMode.prototype);
327
+
328
+});
329
+
330
+ace.define("ace/mode/coffee",["require","exports","module","ace/mode/coffee_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/coffee","ace/range","ace/mode/text","ace/worker/worker_client","ace/lib/oop"], function(require, exports, module) {
331
+"use strict";
332
+
333
+var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules;
334
+var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
335
+var FoldMode = require("./folding/coffee").FoldMode;
336
+var Range = require("../range").Range;
337
+var TextMode = require("./text").Mode;
338
+var WorkerClient = require("../worker/worker_client").WorkerClient;
339
+var oop = require("../lib/oop");
340
+
341
+function Mode() {
342
+    this.HighlightRules = Rules;
343
+    this.$outdent = new Outdent();
344
+    this.foldingRules = new FoldMode();
345
+}
346
+
347
+oop.inherits(Mode, TextMode);
348
+
349
+(function() {
350
+    var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|(?:swi|ca)tch(?:\s+[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$|^\s*(else\b\s*)?(?:if|for|while|loop)\b(?!.*\bthen\b)/;
351
+    var commentLine = /^(\s*)#/;
352
+    var hereComment = /^\s*###(?!#)/;
353
+    var indentation = /^\s*/;
354
+    
355
+    this.getNextLineIndent = function(state, line, tab) {
356
+        var indent = this.$getIndent(line);
357
+        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
358
+    
359
+        if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
360
+            state === 'start' && indenter.test(line))
361
+            indent += tab;
362
+        return indent;
363
+    };
364
+    
365
+    this.toggleCommentLines = function(state, doc, startRow, endRow){
366
+        console.log("toggle");
367
+        var range = new Range(0, 0, 0, 0);
368
+        for (var i = startRow; i <= endRow; ++i) {
369
+            var line = doc.getLine(i);
370
+            if (hereComment.test(line))
371
+                continue;
372
+                
373
+            if (commentLine.test(line))
374
+                line = line.replace(commentLine, '$1');
375
+            else
376
+                line = line.replace(indentation, '$&#');
377
+    
378
+            range.end.row = range.start.row = i;
379
+            range.end.column = line.length + 1;
380
+            doc.replace(range, line);
381
+        }
382
+    };
383
+    
384
+    this.checkOutdent = function(state, line, input) {
385
+        return this.$outdent.checkOutdent(line, input);
386
+    };
387
+    
388
+    this.autoOutdent = function(state, doc, row) {
389
+        this.$outdent.autoOutdent(doc, row);
390
+    };
391
+    
392
+    this.createWorker = function(session) {
393
+        var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker");
394
+        worker.attachToDocument(session.getDocument());
395
+        
396
+        worker.on("error", function(e) {
397
+            session.setAnnotations([e.data]);
398
+        });
399
+        
400
+        worker.on("ok", function(e) {
401
+            session.clearAnnotations();
402
+        });
403
+        
404
+        return worker;
405
+    };
406
+
407
+    this.$id = "ace/mode/coffee";
408
+}).call(Mode.prototype);
409
+
410
+exports.Mode = Mode;
411
+
412
+});

+ 2477
- 0
generator/lib/ace/mode-coldfusion.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 847
- 0
generator/lib/ace/mode-csharp.js Parādīt failu

@@ -0,0 +1,847 @@
1
+ace.define("ace/mode/doc_comment_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 DocCommentHighlightRules = function() {
8
+    this.$rules = {
9
+        "start" : [ {
10
+            token : "comment.doc.tag",
11
+            regex : "@[\\w\\d_]+" // TODO: fix email addresses
12
+        }, 
13
+        DocCommentHighlightRules.getTagRule(),
14
+        {
15
+            defaultToken : "comment.doc",
16
+            caseInsensitive: true
17
+        }]
18
+    };
19
+};
20
+
21
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22
+
23
+DocCommentHighlightRules.getTagRule = function(start) {
24
+    return {
25
+        token : "comment.doc.tag.storage.type",
26
+        regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+    };
28
+}
29
+
30
+DocCommentHighlightRules.getStartRule = function(start) {
31
+    return {
32
+        token : "comment.doc", // doc comment
33
+        regex : "\\/\\*(?=\\*)",
34
+        next  : start
35
+    };
36
+};
37
+
38
+DocCommentHighlightRules.getEndRule = function (start) {
39
+    return {
40
+        token : "comment.doc", // closing comment
41
+        regex : "\\*\\/",
42
+        next  : start
43
+    };
44
+};
45
+
46
+
47
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
48
+
49
+});
50
+
51
+ace.define("ace/mode/csharp_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52
+"use strict";
53
+
54
+var oop = require("../lib/oop");
55
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57
+
58
+var CSharpHighlightRules = function() {
59
+    var keywordMapper = this.createKeywordMapper({
60
+        "variable.language": "this",
61
+        "keyword": "abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic",
62
+        "constant.language": "null|true|false"
63
+    }, "identifier");
64
+
65
+    this.$rules = {
66
+        "start" : [
67
+            {
68
+                token : "comment",
69
+                regex : "\\/\\/.*$"
70
+            },
71
+            DocCommentHighlightRules.getStartRule("doc-start"),
72
+            {
73
+                token : "comment", // multi line comment
74
+                regex : "\\/\\*",
75
+                next : "comment"
76
+            }, {
77
+                token : "string", // character
78
+                regex : /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))'/
79
+            }, {
80
+                token : "string", start : '"', end : '"|$', next: [
81
+                    {token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/},
82
+                    {token: "invalid", regex: /\\./}
83
+                ]
84
+            }, {
85
+                token : "string", start : '@"', end : '"', next:[
86
+                    {token: "constant.language.escape", regex: '""'}
87
+                ]
88
+            }, {
89
+                token : "constant.numeric", // hex
90
+                regex : "0[xX][0-9a-fA-F]+\\b"
91
+            }, {
92
+                token : "constant.numeric", // float
93
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
94
+            }, {
95
+                token : "constant.language.boolean",
96
+                regex : "(?:true|false)\\b"
97
+            }, {
98
+                token : keywordMapper,
99
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
100
+            }, {
101
+                token : "keyword.operator",
102
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
103
+            }, {
104
+                token : "keyword",
105
+                regex : "^\\s*#(if|else|elif|endif|define|undef|warning|error|line|region|endregion|pragma)"
106
+            }, {
107
+                token : "punctuation.operator",
108
+                regex : "\\?|\\:|\\,|\\;|\\."
109
+            }, {
110
+                token : "paren.lparen",
111
+                regex : "[[({]"
112
+            }, {
113
+                token : "paren.rparen",
114
+                regex : "[\\])}]"
115
+            }, {
116
+                token : "text",
117
+                regex : "\\s+"
118
+            }
119
+        ],
120
+        "comment" : [
121
+            {
122
+                token : "comment", // closing comment
123
+                regex : ".*?\\*\\/",
124
+                next : "start"
125
+            }, {
126
+                token : "comment", // comment spanning whole line
127
+                regex : ".+"
128
+            }
129
+        ]
130
+    };
131
+
132
+    this.embedRules(DocCommentHighlightRules, "doc-",
133
+        [ DocCommentHighlightRules.getEndRule("start") ]);
134
+    this.normalizeRules();
135
+};
136
+
137
+oop.inherits(CSharpHighlightRules, TextHighlightRules);
138
+
139
+exports.CSharpHighlightRules = CSharpHighlightRules;
140
+});
141
+
142
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
143
+"use strict";
144
+
145
+var Range = require("../range").Range;
146
+
147
+var MatchingBraceOutdent = function() {};
148
+
149
+(function() {
150
+
151
+    this.checkOutdent = function(line, input) {
152
+        if (! /^\s+$/.test(line))
153
+            return false;
154
+
155
+        return /^\s*\}/.test(input);
156
+    };
157
+
158
+    this.autoOutdent = function(doc, row) {
159
+        var line = doc.getLine(row);
160
+        var match = line.match(/^(\s*\})/);
161
+
162
+        if (!match) return 0;
163
+
164
+        var column = match[1].length;
165
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
166
+
167
+        if (!openBracePos || openBracePos.row == row) return 0;
168
+
169
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
170
+        doc.replace(new Range(row, 0, row, column-1), indent);
171
+    };
172
+
173
+    this.$getIndent = function(line) {
174
+        return line.match(/^\s*/)[0];
175
+    };
176
+
177
+}).call(MatchingBraceOutdent.prototype);
178
+
179
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
180
+});
181
+
182
+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) {
183
+"use strict";
184
+
185
+var oop = require("../../lib/oop");
186
+var Behaviour = require("../behaviour").Behaviour;
187
+var TokenIterator = require("../../token_iterator").TokenIterator;
188
+var lang = require("../../lib/lang");
189
+
190
+var SAFE_INSERT_IN_TOKENS =
191
+    ["text", "paren.rparen", "punctuation.operator"];
192
+var SAFE_INSERT_BEFORE_TOKENS =
193
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
194
+
195
+var context;
196
+var contextCache = {};
197
+var initContext = function(editor) {
198
+    var id = -1;
199
+    if (editor.multiSelect) {
200
+        id = editor.selection.index;
201
+        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
202
+            contextCache = {rangeCount: editor.multiSelect.rangeCount};
203
+    }
204
+    if (contextCache[id])
205
+        return context = contextCache[id];
206
+    context = contextCache[id] = {
207
+        autoInsertedBrackets: 0,
208
+        autoInsertedRow: -1,
209
+        autoInsertedLineEnd: "",
210
+        maybeInsertedBrackets: 0,
211
+        maybeInsertedRow: -1,
212
+        maybeInsertedLineStart: "",
213
+        maybeInsertedLineEnd: ""
214
+    };
215
+};
216
+
217
+var CstyleBehaviour = function() {
218
+    this.add("braces", "insertion", function(state, action, editor, session, text) {
219
+        var cursor = editor.getCursorPosition();
220
+        var line = session.doc.getLine(cursor.row);
221
+        if (text == '{') {
222
+            initContext(editor);
223
+            var selection = editor.getSelectionRange();
224
+            var selected = session.doc.getTextRange(selection);
225
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
226
+                return {
227
+                    text: '{' + selected + '}',
228
+                    selection: false
229
+                };
230
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
231
+                if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
232
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
233
+                    return {
234
+                        text: '{}',
235
+                        selection: [1, 1]
236
+                    };
237
+                } else {
238
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
239
+                    return {
240
+                        text: '{',
241
+                        selection: [1, 1]
242
+                    };
243
+                }
244
+            }
245
+        } else if (text == '}') {
246
+            initContext(editor);
247
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
248
+            if (rightChar == '}') {
249
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
250
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
251
+                    CstyleBehaviour.popAutoInsertedClosing();
252
+                    return {
253
+                        text: '',
254
+                        selection: [1, 1]
255
+                    };
256
+                }
257
+            }
258
+        } else if (text == "\n" || text == "\r\n") {
259
+            initContext(editor);
260
+            var closing = "";
261
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
262
+                closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
263
+                CstyleBehaviour.clearMaybeInsertedClosing();
264
+            }
265
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
266
+            if (rightChar === '}') {
267
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
268
+                if (!openBracePos)
269
+                     return null;
270
+                var next_indent = this.$getIndent(session.getLine(openBracePos.row));
271
+            } else if (closing) {
272
+                var next_indent = this.$getIndent(line);
273
+            } else {
274
+                CstyleBehaviour.clearMaybeInsertedClosing();
275
+                return;
276
+            }
277
+            var indent = next_indent + session.getTabString();
278
+
279
+            return {
280
+                text: '\n' + indent + '\n' + next_indent + closing,
281
+                selection: [1, indent.length, 1, indent.length]
282
+            };
283
+        } else {
284
+            CstyleBehaviour.clearMaybeInsertedClosing();
285
+        }
286
+    });
287
+
288
+    this.add("braces", "deletion", function(state, action, editor, session, range) {
289
+        var selected = session.doc.getTextRange(range);
290
+        if (!range.isMultiLine() && selected == '{') {
291
+            initContext(editor);
292
+            var line = session.doc.getLine(range.start.row);
293
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
294
+            if (rightChar == '}') {
295
+                range.end.column++;
296
+                return range;
297
+            } else {
298
+                context.maybeInsertedBrackets--;
299
+            }
300
+        }
301
+    });
302
+
303
+    this.add("parens", "insertion", function(state, action, editor, session, text) {
304
+        if (text == '(') {
305
+            initContext(editor);
306
+            var selection = editor.getSelectionRange();
307
+            var selected = session.doc.getTextRange(selection);
308
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
309
+                return {
310
+                    text: '(' + selected + ')',
311
+                    selection: false
312
+                };
313
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
314
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
315
+                return {
316
+                    text: '()',
317
+                    selection: [1, 1]
318
+                };
319
+            }
320
+        } else if (text == ')') {
321
+            initContext(editor);
322
+            var cursor = editor.getCursorPosition();
323
+            var line = session.doc.getLine(cursor.row);
324
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
325
+            if (rightChar == ')') {
326
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
327
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
328
+                    CstyleBehaviour.popAutoInsertedClosing();
329
+                    return {
330
+                        text: '',
331
+                        selection: [1, 1]
332
+                    };
333
+                }
334
+            }
335
+        }
336
+    });
337
+
338
+    this.add("parens", "deletion", function(state, action, editor, session, range) {
339
+        var selected = session.doc.getTextRange(range);
340
+        if (!range.isMultiLine() && selected == '(') {
341
+            initContext(editor);
342
+            var line = session.doc.getLine(range.start.row);
343
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
344
+            if (rightChar == ')') {
345
+                range.end.column++;
346
+                return range;
347
+            }
348
+        }
349
+    });
350
+
351
+    this.add("brackets", "insertion", function(state, action, editor, session, text) {
352
+        if (text == '[') {
353
+            initContext(editor);
354
+            var selection = editor.getSelectionRange();
355
+            var selected = session.doc.getTextRange(selection);
356
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
357
+                return {
358
+                    text: '[' + selected + ']',
359
+                    selection: false
360
+                };
361
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
362
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
363
+                return {
364
+                    text: '[]',
365
+                    selection: [1, 1]
366
+                };
367
+            }
368
+        } else if (text == ']') {
369
+            initContext(editor);
370
+            var cursor = editor.getCursorPosition();
371
+            var line = session.doc.getLine(cursor.row);
372
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
373
+            if (rightChar == ']') {
374
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
375
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
376
+                    CstyleBehaviour.popAutoInsertedClosing();
377
+                    return {
378
+                        text: '',
379
+                        selection: [1, 1]
380
+                    };
381
+                }
382
+            }
383
+        }
384
+    });
385
+
386
+    this.add("brackets", "deletion", function(state, action, editor, session, range) {
387
+        var selected = session.doc.getTextRange(range);
388
+        if (!range.isMultiLine() && selected == '[') {
389
+            initContext(editor);
390
+            var line = session.doc.getLine(range.start.row);
391
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
392
+            if (rightChar == ']') {
393
+                range.end.column++;
394
+                return range;
395
+            }
396
+        }
397
+    });
398
+
399
+    this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
400
+        if (text == '"' || text == "'") {
401
+            initContext(editor);
402
+            var quote = text;
403
+            var selection = editor.getSelectionRange();
404
+            var selected = session.doc.getTextRange(selection);
405
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
406
+                return {
407
+                    text: quote + selected + quote,
408
+                    selection: false
409
+                };
410
+            } else {
411
+                var cursor = editor.getCursorPosition();
412
+                var line = session.doc.getLine(cursor.row);
413
+                var leftChar = line.substring(cursor.column-1, cursor.column);
414
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
415
+                
416
+                var token = session.getTokenAt(cursor.row, cursor.column);
417
+                var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
418
+                if (leftChar == "\\" && token && /escape/.test(token.type))
419
+                    return null;
420
+                
421
+                var stringBefore = token && /string/.test(token.type);
422
+                var stringAfter = !rightToken || /string/.test(rightToken.type);
423
+                
424
+                var pair;
425
+                if (rightChar == quote) {
426
+                    pair = stringBefore !== stringAfter;
427
+                } else {
428
+                    if (stringBefore && !stringAfter)
429
+                        return null; // wrap string with different quote
430
+                    if (stringBefore && stringAfter)
431
+                        return null; // do not pair quotes inside strings 
432
+                    var wordRe = session.$mode.tokenRe;
433
+                    wordRe.lastIndex = 0;
434
+                    var isWordBefore = wordRe.test(leftChar);
435
+                    wordRe.lastIndex = 0;
436
+                    var isWordAfter = wordRe.test(leftChar);
437
+                    if (isWordBefore || isWordAfter)
438
+                        return null; // before or after alphanumeric
439
+                    if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
440
+                        return null; // there is rightChar and it isn't closing
441
+                    pair = true;
442
+                }
443
+                return {
444
+                    text: pair ? quote + quote : "",
445
+                    selection: [1,1]
446
+                };
447
+            }
448
+        }
449
+    });
450
+
451
+    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
452
+        var selected = session.doc.getTextRange(range);
453
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
454
+            initContext(editor);
455
+            var line = session.doc.getLine(range.start.row);
456
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
457
+            if (rightChar == selected) {
458
+                range.end.column++;
459
+                return range;
460
+            }
461
+        }
462
+    });
463
+
464
+};
465
+
466
+    
467
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
468
+    var cursor = editor.getCursorPosition();
469
+    var iterator = new TokenIterator(session, cursor.row, cursor.column);
470
+    if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
471
+        var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
472
+        if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
473
+            return false;
474
+    }
475
+    iterator.stepForward();
476
+    return iterator.getCurrentTokenRow() !== cursor.row ||
477
+        this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
478
+};
479
+
480
+CstyleBehaviour.$matchTokenType = function(token, types) {
481
+    return types.indexOf(token.type || token) > -1;
482
+};
483
+
484
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
485
+    var cursor = editor.getCursorPosition();
486
+    var line = session.doc.getLine(cursor.row);
487
+    if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
488
+        context.autoInsertedBrackets = 0;
489
+    context.autoInsertedRow = cursor.row;
490
+    context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
491
+    context.autoInsertedBrackets++;
492
+};
493
+
494
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
495
+    var cursor = editor.getCursorPosition();
496
+    var line = session.doc.getLine(cursor.row);
497
+    if (!this.isMaybeInsertedClosing(cursor, line))
498
+        context.maybeInsertedBrackets = 0;
499
+    context.maybeInsertedRow = cursor.row;
500
+    context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
501
+    context.maybeInsertedLineEnd = line.substr(cursor.column);
502
+    context.maybeInsertedBrackets++;
503
+};
504
+
505
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
506
+    return context.autoInsertedBrackets > 0 &&
507
+        cursor.row === context.autoInsertedRow &&
508
+        bracket === context.autoInsertedLineEnd[0] &&
509
+        line.substr(cursor.column) === context.autoInsertedLineEnd;
510
+};
511
+
512
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
513
+    return context.maybeInsertedBrackets > 0 &&
514
+        cursor.row === context.maybeInsertedRow &&
515
+        line.substr(cursor.column) === context.maybeInsertedLineEnd &&
516
+        line.substr(0, cursor.column) == context.maybeInsertedLineStart;
517
+};
518
+
519
+CstyleBehaviour.popAutoInsertedClosing = function() {
520
+    context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
521
+    context.autoInsertedBrackets--;
522
+};
523
+
524
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
525
+    if (context) {
526
+        context.maybeInsertedBrackets = 0;
527
+        context.maybeInsertedRow = -1;
528
+    }
529
+};
530
+
531
+
532
+
533
+oop.inherits(CstyleBehaviour, Behaviour);
534
+
535
+exports.CstyleBehaviour = CstyleBehaviour;
536
+});
537
+
538
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
539
+"use strict";
540
+
541
+var oop = require("../../lib/oop");
542
+var Range = require("../../range").Range;
543
+var BaseFoldMode = require("./fold_mode").FoldMode;
544
+
545
+var FoldMode = exports.FoldMode = function(commentRegex) {
546
+    if (commentRegex) {
547
+        this.foldingStartMarker = new RegExp(
548
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
549
+        );
550
+        this.foldingStopMarker = new RegExp(
551
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
552
+        );
553
+    }
554
+};
555
+oop.inherits(FoldMode, BaseFoldMode);
556
+
557
+(function() {
558
+    
559
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
560
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
561
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
562
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
563
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
564
+    this._getFoldWidgetBase = this.getFoldWidget;
565
+    this.getFoldWidget = function(session, foldStyle, row) {
566
+        var line = session.getLine(row);
567
+    
568
+        if (this.singleLineBlockCommentRe.test(line)) {
569
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
570
+                return "";
571
+        }
572
+    
573
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
574
+    
575
+        if (!fw && this.startRegionRe.test(line))
576
+            return "start"; // lineCommentRegionStart
577
+    
578
+        return fw;
579
+    };
580
+
581
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
582
+        var line = session.getLine(row);
583
+        
584
+        if (this.startRegionRe.test(line))
585
+            return this.getCommentRegionBlock(session, line, row);
586
+        
587
+        var match = line.match(this.foldingStartMarker);
588
+        if (match) {
589
+            var i = match.index;
590
+
591
+            if (match[1])
592
+                return this.openingBracketBlock(session, match[1], row, i);
593
+                
594
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
595
+            
596
+            if (range && !range.isMultiLine()) {
597
+                if (forceMultiline) {
598
+                    range = this.getSectionRange(session, row);
599
+                } else if (foldStyle != "all")
600
+                    range = null;
601
+            }
602
+            
603
+            return range;
604
+        }
605
+
606
+        if (foldStyle === "markbegin")
607
+            return;
608
+
609
+        var match = line.match(this.foldingStopMarker);
610
+        if (match) {
611
+            var i = match.index + match[0].length;
612
+
613
+            if (match[1])
614
+                return this.closingBracketBlock(session, match[1], row, i);
615
+
616
+            return session.getCommentFoldRange(row, i, -1);
617
+        }
618
+    };
619
+    
620
+    this.getSectionRange = function(session, row) {
621
+        var line = session.getLine(row);
622
+        var startIndent = line.search(/\S/);
623
+        var startRow = row;
624
+        var startColumn = line.length;
625
+        row = row + 1;
626
+        var endRow = row;
627
+        var maxRow = session.getLength();
628
+        while (++row < maxRow) {
629
+            line = session.getLine(row);
630
+            var indent = line.search(/\S/);
631
+            if (indent === -1)
632
+                continue;
633
+            if  (startIndent > indent)
634
+                break;
635
+            var subRange = this.getFoldWidgetRange(session, "all", row);
636
+            
637
+            if (subRange) {
638
+                if (subRange.start.row <= startRow) {
639
+                    break;
640
+                } else if (subRange.isMultiLine()) {
641
+                    row = subRange.end.row;
642
+                } else if (startIndent == indent) {
643
+                    break;
644
+                }
645
+            }
646
+            endRow = row;
647
+        }
648
+        
649
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
650
+    };
651
+    
652
+    this.getCommentRegionBlock = function(session, line, row) {
653
+        var startColumn = line.search(/\s*$/);
654
+        var maxRow = session.getLength();
655
+        var startRow = row;
656
+        
657
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
658
+        var depth = 1;
659
+        while (++row < maxRow) {
660
+            line = session.getLine(row);
661
+            var m = re.exec(line);
662
+            if (!m) continue;
663
+            if (m[1]) depth--;
664
+            else depth++;
665
+
666
+            if (!depth) break;
667
+        }
668
+
669
+        var endRow = row;
670
+        if (endRow > startRow) {
671
+            return new Range(startRow, startColumn, endRow, line.length);
672
+        }
673
+    };
674
+
675
+}).call(FoldMode.prototype);
676
+
677
+});
678
+
679
+ace.define("ace/mode/folding/csharp",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/cstyle"], function(require, exports, module) {
680
+"use strict";
681
+
682
+var oop = require("../../lib/oop");
683
+var Range = require("../../range").Range;
684
+var CFoldMode = require("./cstyle").FoldMode;
685
+
686
+var FoldMode = exports.FoldMode = function(commentRegex) {
687
+    if (commentRegex) {
688
+        this.foldingStartMarker = new RegExp(
689
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
690
+        );
691
+        this.foldingStopMarker = new RegExp(
692
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
693
+        );
694
+    }
695
+};
696
+oop.inherits(FoldMode, CFoldMode);
697
+
698
+(function() {
699
+    this.usingRe = /^\s*using \S/;
700
+
701
+    this.getFoldWidgetRangeBase = this.getFoldWidgetRange;
702
+    this.getFoldWidgetBase = this.getFoldWidget;
703
+    
704
+    this.getFoldWidget = function(session, foldStyle, row) {
705
+        var fw = this.getFoldWidgetBase(session, foldStyle, row);
706
+        if (!fw) {
707
+            var line = session.getLine(row);
708
+            if (/^\s*#region\b/.test(line)) 
709
+                return "start";
710
+            var usingRe = this.usingRe;
711
+            if (usingRe.test(line)) {
712
+                var prev = session.getLine(row - 1);
713
+                var next = session.getLine(row + 1);
714
+                if (!usingRe.test(prev) && usingRe.test(next))
715
+                    return "start"
716
+            }
717
+        }
718
+        return fw;
719
+    };
720
+    
721
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
722
+        var range = this.getFoldWidgetRangeBase(session, foldStyle, row);
723
+        if (range)
724
+            return range;
725
+
726
+        var line = session.getLine(row);
727
+        if (this.usingRe.test(line))
728
+            return this.getUsingStatementBlock(session, line, row);
729
+            
730
+        if (/^\s*#region\b/.test(line))
731
+            return this.getRegionBlock(session, line, row);
732
+    };
733
+    
734
+    this.getUsingStatementBlock = function(session, line, row) {
735
+        var startColumn = line.match(this.usingRe)[0].length - 1;
736
+        var maxRow = session.getLength();
737
+        var startRow = row;
738
+        var endRow = row;
739
+
740
+        while (++row < maxRow) {
741
+            line = session.getLine(row);
742
+            if (/^\s*$/.test(line))
743
+                continue;
744
+            if (!this.usingRe.test(line))
745
+                break;
746
+
747
+            endRow = row;
748
+        }
749
+
750
+        if (endRow > startRow) {
751
+            var endColumn = session.getLine(endRow).length;
752
+            return new Range(startRow, startColumn, endRow, endColumn);
753
+        }
754
+    };
755
+    
756
+    this.getRegionBlock = function(session, line, row) {
757
+        var startColumn = line.search(/\s*$/);
758
+        var maxRow = session.getLength();
759
+        var startRow = row;
760
+        
761
+        var re = /^\s*#(end)?region\b/;
762
+        var depth = 1;
763
+        while (++row < maxRow) {
764
+            line = session.getLine(row);
765
+            var m = re.exec(line);
766
+            if (!m)
767
+                continue;
768
+            if (m[1])
769
+                depth--;
770
+            else
771
+                depth++;
772
+
773
+            if (!depth)
774
+                break;
775
+        }
776
+
777
+        var endRow = row;
778
+        if (endRow > startRow) {
779
+            return new Range(startRow, startColumn, endRow, line.length);
780
+        }
781
+    };
782
+
783
+}).call(FoldMode.prototype);
784
+
785
+});
786
+
787
+ace.define("ace/mode/csharp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/csharp_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/csharp"], function(require, exports, module) {
788
+"use strict";
789
+
790
+var oop = require("../lib/oop");
791
+var TextMode = require("./text").Mode;
792
+var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules;
793
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
794
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
795
+var CStyleFoldMode = require("./folding/csharp").FoldMode;
796
+
797
+var Mode = function() {
798
+    this.HighlightRules = CSharpHighlightRules;
799
+    this.$outdent = new MatchingBraceOutdent();
800
+    this.$behaviour = new CstyleBehaviour();
801
+    this.foldingRules = new CStyleFoldMode();
802
+};
803
+oop.inherits(Mode, TextMode);
804
+
805
+(function() {
806
+    
807
+    this.lineCommentStart = "//";
808
+    this.blockComment = {start: "/*", end: "*/"};
809
+    
810
+    this.getNextLineIndent = function(state, line, tab) {
811
+        var indent = this.$getIndent(line);
812
+  
813
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
814
+        var tokens = tokenizedLine.tokens;
815
+  
816
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
817
+            return indent;
818
+        }
819
+    
820
+        if (state == "start") {
821
+            var match = line.match(/^.*[\{\(\[]\s*$/);
822
+            if (match) {
823
+                indent += tab;
824
+            }
825
+        }
826
+  
827
+        return indent;
828
+    };
829
+
830
+    this.checkOutdent = function(state, line, input) {
831
+        return this.$outdent.checkOutdent(line, input);
832
+    };
833
+  
834
+    this.autoOutdent = function(state, doc, row) {
835
+        this.$outdent.autoOutdent(doc, row);
836
+    };
837
+
838
+
839
+    this.createWorker = function(session) {
840
+        return null;
841
+    };
842
+
843
+    this.$id = "ace/mode/csharp";
844
+}).call(Mode.prototype);
845
+
846
+exports.Mode = Mode;
847
+});

+ 828
- 0
generator/lib/ace/mode-css.js Parādīt failu

@@ -0,0 +1,828 @@
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 = "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";
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|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/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
186
+"use strict";
187
+
188
+var oop = require("../../lib/oop");
189
+var Behaviour = require("../behaviour").Behaviour;
190
+var TokenIterator = require("../../token_iterator").TokenIterator;
191
+var lang = require("../../lib/lang");
192
+
193
+var SAFE_INSERT_IN_TOKENS =
194
+    ["text", "paren.rparen", "punctuation.operator"];
195
+var SAFE_INSERT_BEFORE_TOKENS =
196
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
197
+
198
+var context;
199
+var contextCache = {};
200
+var initContext = function(editor) {
201
+    var id = -1;
202
+    if (editor.multiSelect) {
203
+        id = editor.selection.index;
204
+        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
205
+            contextCache = {rangeCount: editor.multiSelect.rangeCount};
206
+    }
207
+    if (contextCache[id])
208
+        return context = contextCache[id];
209
+    context = contextCache[id] = {
210
+        autoInsertedBrackets: 0,
211
+        autoInsertedRow: -1,
212
+        autoInsertedLineEnd: "",
213
+        maybeInsertedBrackets: 0,
214
+        maybeInsertedRow: -1,
215
+        maybeInsertedLineStart: "",
216
+        maybeInsertedLineEnd: ""
217
+    };
218
+};
219
+
220
+var CstyleBehaviour = function() {
221
+    this.add("braces", "insertion", function(state, action, editor, session, text) {
222
+        var cursor = editor.getCursorPosition();
223
+        var line = session.doc.getLine(cursor.row);
224
+        if (text == '{') {
225
+            initContext(editor);
226
+            var selection = editor.getSelectionRange();
227
+            var selected = session.doc.getTextRange(selection);
228
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
229
+                return {
230
+                    text: '{' + selected + '}',
231
+                    selection: false
232
+                };
233
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
234
+                if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
235
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
236
+                    return {
237
+                        text: '{}',
238
+                        selection: [1, 1]
239
+                    };
240
+                } else {
241
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
242
+                    return {
243
+                        text: '{',
244
+                        selection: [1, 1]
245
+                    };
246
+                }
247
+            }
248
+        } else if (text == '}') {
249
+            initContext(editor);
250
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
251
+            if (rightChar == '}') {
252
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
253
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
254
+                    CstyleBehaviour.popAutoInsertedClosing();
255
+                    return {
256
+                        text: '',
257
+                        selection: [1, 1]
258
+                    };
259
+                }
260
+            }
261
+        } else if (text == "\n" || text == "\r\n") {
262
+            initContext(editor);
263
+            var closing = "";
264
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
265
+                closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
266
+                CstyleBehaviour.clearMaybeInsertedClosing();
267
+            }
268
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
269
+            if (rightChar === '}') {
270
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
271
+                if (!openBracePos)
272
+                     return null;
273
+                var next_indent = this.$getIndent(session.getLine(openBracePos.row));
274
+            } else if (closing) {
275
+                var next_indent = this.$getIndent(line);
276
+            } else {
277
+                CstyleBehaviour.clearMaybeInsertedClosing();
278
+                return;
279
+            }
280
+            var indent = next_indent + session.getTabString();
281
+
282
+            return {
283
+                text: '\n' + indent + '\n' + next_indent + closing,
284
+                selection: [1, indent.length, 1, indent.length]
285
+            };
286
+        } else {
287
+            CstyleBehaviour.clearMaybeInsertedClosing();
288
+        }
289
+    });
290
+
291
+    this.add("braces", "deletion", function(state, action, editor, session, range) {
292
+        var selected = session.doc.getTextRange(range);
293
+        if (!range.isMultiLine() && selected == '{') {
294
+            initContext(editor);
295
+            var line = session.doc.getLine(range.start.row);
296
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
297
+            if (rightChar == '}') {
298
+                range.end.column++;
299
+                return range;
300
+            } else {
301
+                context.maybeInsertedBrackets--;
302
+            }
303
+        }
304
+    });
305
+
306
+    this.add("parens", "insertion", function(state, action, editor, session, text) {
307
+        if (text == '(') {
308
+            initContext(editor);
309
+            var selection = editor.getSelectionRange();
310
+            var selected = session.doc.getTextRange(selection);
311
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
312
+                return {
313
+                    text: '(' + selected + ')',
314
+                    selection: false
315
+                };
316
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
317
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
318
+                return {
319
+                    text: '()',
320
+                    selection: [1, 1]
321
+                };
322
+            }
323
+        } else if (text == ')') {
324
+            initContext(editor);
325
+            var cursor = editor.getCursorPosition();
326
+            var line = session.doc.getLine(cursor.row);
327
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
328
+            if (rightChar == ')') {
329
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
330
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
331
+                    CstyleBehaviour.popAutoInsertedClosing();
332
+                    return {
333
+                        text: '',
334
+                        selection: [1, 1]
335
+                    };
336
+                }
337
+            }
338
+        }
339
+    });
340
+
341
+    this.add("parens", "deletion", function(state, action, editor, session, range) {
342
+        var selected = session.doc.getTextRange(range);
343
+        if (!range.isMultiLine() && selected == '(') {
344
+            initContext(editor);
345
+            var line = session.doc.getLine(range.start.row);
346
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
347
+            if (rightChar == ')') {
348
+                range.end.column++;
349
+                return range;
350
+            }
351
+        }
352
+    });
353
+
354
+    this.add("brackets", "insertion", function(state, action, editor, session, text) {
355
+        if (text == '[') {
356
+            initContext(editor);
357
+            var selection = editor.getSelectionRange();
358
+            var selected = session.doc.getTextRange(selection);
359
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
360
+                return {
361
+                    text: '[' + selected + ']',
362
+                    selection: false
363
+                };
364
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
365
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
366
+                return {
367
+                    text: '[]',
368
+                    selection: [1, 1]
369
+                };
370
+            }
371
+        } else if (text == ']') {
372
+            initContext(editor);
373
+            var cursor = editor.getCursorPosition();
374
+            var line = session.doc.getLine(cursor.row);
375
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
376
+            if (rightChar == ']') {
377
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
378
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
379
+                    CstyleBehaviour.popAutoInsertedClosing();
380
+                    return {
381
+                        text: '',
382
+                        selection: [1, 1]
383
+                    };
384
+                }
385
+            }
386
+        }
387
+    });
388
+
389
+    this.add("brackets", "deletion", function(state, action, editor, session, range) {
390
+        var selected = session.doc.getTextRange(range);
391
+        if (!range.isMultiLine() && selected == '[') {
392
+            initContext(editor);
393
+            var line = session.doc.getLine(range.start.row);
394
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
395
+            if (rightChar == ']') {
396
+                range.end.column++;
397
+                return range;
398
+            }
399
+        }
400
+    });
401
+
402
+    this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
403
+        if (text == '"' || text == "'") {
404
+            initContext(editor);
405
+            var quote = text;
406
+            var selection = editor.getSelectionRange();
407
+            var selected = session.doc.getTextRange(selection);
408
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
409
+                return {
410
+                    text: quote + selected + quote,
411
+                    selection: false
412
+                };
413
+            } else {
414
+                var cursor = editor.getCursorPosition();
415
+                var line = session.doc.getLine(cursor.row);
416
+                var leftChar = line.substring(cursor.column-1, cursor.column);
417
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
418
+                
419
+                var token = session.getTokenAt(cursor.row, cursor.column);
420
+                var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
421
+                if (leftChar == "\\" && token && /escape/.test(token.type))
422
+                    return null;
423
+                
424
+                var stringBefore = token && /string/.test(token.type);
425
+                var stringAfter = !rightToken || /string/.test(rightToken.type);
426
+                
427
+                var pair;
428
+                if (rightChar == quote) {
429
+                    pair = stringBefore !== stringAfter;
430
+                } else {
431
+                    if (stringBefore && !stringAfter)
432
+                        return null; // wrap string with different quote
433
+                    if (stringBefore && stringAfter)
434
+                        return null; // do not pair quotes inside strings 
435
+                    var wordRe = session.$mode.tokenRe;
436
+                    wordRe.lastIndex = 0;
437
+                    var isWordBefore = wordRe.test(leftChar);
438
+                    wordRe.lastIndex = 0;
439
+                    var isWordAfter = wordRe.test(leftChar);
440
+                    if (isWordBefore || isWordAfter)
441
+                        return null; // before or after alphanumeric
442
+                    if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
443
+                        return null; // there is rightChar and it isn't closing
444
+                    pair = true;
445
+                }
446
+                return {
447
+                    text: pair ? quote + quote : "",
448
+                    selection: [1,1]
449
+                };
450
+            }
451
+        }
452
+    });
453
+
454
+    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
455
+        var selected = session.doc.getTextRange(range);
456
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
457
+            initContext(editor);
458
+            var line = session.doc.getLine(range.start.row);
459
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
460
+            if (rightChar == selected) {
461
+                range.end.column++;
462
+                return range;
463
+            }
464
+        }
465
+    });
466
+
467
+};
468
+
469
+    
470
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
471
+    var cursor = editor.getCursorPosition();
472
+    var iterator = new TokenIterator(session, cursor.row, cursor.column);
473
+    if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
474
+        var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
475
+        if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
476
+            return false;
477
+    }
478
+    iterator.stepForward();
479
+    return iterator.getCurrentTokenRow() !== cursor.row ||
480
+        this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
481
+};
482
+
483
+CstyleBehaviour.$matchTokenType = function(token, types) {
484
+    return types.indexOf(token.type || token) > -1;
485
+};
486
+
487
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
488
+    var cursor = editor.getCursorPosition();
489
+    var line = session.doc.getLine(cursor.row);
490
+    if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
491
+        context.autoInsertedBrackets = 0;
492
+    context.autoInsertedRow = cursor.row;
493
+    context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
494
+    context.autoInsertedBrackets++;
495
+};
496
+
497
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
498
+    var cursor = editor.getCursorPosition();
499
+    var line = session.doc.getLine(cursor.row);
500
+    if (!this.isMaybeInsertedClosing(cursor, line))
501
+        context.maybeInsertedBrackets = 0;
502
+    context.maybeInsertedRow = cursor.row;
503
+    context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
504
+    context.maybeInsertedLineEnd = line.substr(cursor.column);
505
+    context.maybeInsertedBrackets++;
506
+};
507
+
508
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
509
+    return context.autoInsertedBrackets > 0 &&
510
+        cursor.row === context.autoInsertedRow &&
511
+        bracket === context.autoInsertedLineEnd[0] &&
512
+        line.substr(cursor.column) === context.autoInsertedLineEnd;
513
+};
514
+
515
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
516
+    return context.maybeInsertedBrackets > 0 &&
517
+        cursor.row === context.maybeInsertedRow &&
518
+        line.substr(cursor.column) === context.maybeInsertedLineEnd &&
519
+        line.substr(0, cursor.column) == context.maybeInsertedLineStart;
520
+};
521
+
522
+CstyleBehaviour.popAutoInsertedClosing = function() {
523
+    context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
524
+    context.autoInsertedBrackets--;
525
+};
526
+
527
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
528
+    if (context) {
529
+        context.maybeInsertedBrackets = 0;
530
+        context.maybeInsertedRow = -1;
531
+    }
532
+};
533
+
534
+
535
+
536
+oop.inherits(CstyleBehaviour, Behaviour);
537
+
538
+exports.CstyleBehaviour = CstyleBehaviour;
539
+});
540
+
541
+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) {
542
+"use strict";
543
+
544
+var oop = require("../../lib/oop");
545
+var Behaviour = require("../behaviour").Behaviour;
546
+var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
547
+var TokenIterator = require("../../token_iterator").TokenIterator;
548
+
549
+var CssBehaviour = function () {
550
+
551
+    this.inherit(CstyleBehaviour);
552
+
553
+    this.add("colon", "insertion", function (state, action, editor, session, text) {
554
+        if (text === ':') {
555
+            var cursor = editor.getCursorPosition();
556
+            var iterator = new TokenIterator(session, cursor.row, cursor.column);
557
+            var token = iterator.getCurrentToken();
558
+            if (token && token.value.match(/\s+/)) {
559
+                token = iterator.stepBackward();
560
+            }
561
+            if (token && token.type === 'support.type') {
562
+                var line = session.doc.getLine(cursor.row);
563
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
564
+                if (rightChar === ':') {
565
+                    return {
566
+                       text: '',
567
+                       selection: [1, 1]
568
+                    }
569
+                }
570
+                if (!line.substring(cursor.column).match(/^\s*;/)) {
571
+                    return {
572
+                       text: ':;',
573
+                       selection: [1, 1]
574
+                    }
575
+                }
576
+            }
577
+        }
578
+    });
579
+
580
+    this.add("colon", "deletion", function (state, action, editor, session, range) {
581
+        var selected = session.doc.getTextRange(range);
582
+        if (!range.isMultiLine() && selected === ':') {
583
+            var cursor = editor.getCursorPosition();
584
+            var iterator = new TokenIterator(session, cursor.row, cursor.column);
585
+            var token = iterator.getCurrentToken();
586
+            if (token && token.value.match(/\s+/)) {
587
+                token = iterator.stepBackward();
588
+            }
589
+            if (token && token.type === 'support.type') {
590
+                var line = session.doc.getLine(range.start.row);
591
+                var rightChar = line.substring(range.end.column, range.end.column + 1);
592
+                if (rightChar === ';') {
593
+                    range.end.column ++;
594
+                    return range;
595
+                }
596
+            }
597
+        }
598
+    });
599
+
600
+    this.add("semicolon", "insertion", function (state, action, editor, session, text) {
601
+        if (text === ';') {
602
+            var cursor = editor.getCursorPosition();
603
+            var line = session.doc.getLine(cursor.row);
604
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
605
+            if (rightChar === ';') {
606
+                return {
607
+                   text: '',
608
+                   selection: [1, 1]
609
+                }
610
+            }
611
+        }
612
+    });
613
+
614
+}
615
+oop.inherits(CssBehaviour, CstyleBehaviour);
616
+
617
+exports.CssBehaviour = CssBehaviour;
618
+});
619
+
620
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
621
+"use strict";
622
+
623
+var oop = require("../../lib/oop");
624
+var Range = require("../../range").Range;
625
+var BaseFoldMode = require("./fold_mode").FoldMode;
626
+
627
+var FoldMode = exports.FoldMode = function(commentRegex) {
628
+    if (commentRegex) {
629
+        this.foldingStartMarker = new RegExp(
630
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
631
+        );
632
+        this.foldingStopMarker = new RegExp(
633
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
634
+        );
635
+    }
636
+};
637
+oop.inherits(FoldMode, BaseFoldMode);
638
+
639
+(function() {
640
+    
641
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
642
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
643
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
644
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
645
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
646
+    this._getFoldWidgetBase = this.getFoldWidget;
647
+    this.getFoldWidget = function(session, foldStyle, row) {
648
+        var line = session.getLine(row);
649
+    
650
+        if (this.singleLineBlockCommentRe.test(line)) {
651
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
652
+                return "";
653
+        }
654
+    
655
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
656
+    
657
+        if (!fw && this.startRegionRe.test(line))
658
+            return "start"; // lineCommentRegionStart
659
+    
660
+        return fw;
661
+    };
662
+
663
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
664
+        var line = session.getLine(row);
665
+        
666
+        if (this.startRegionRe.test(line))
667
+            return this.getCommentRegionBlock(session, line, row);
668
+        
669
+        var match = line.match(this.foldingStartMarker);
670
+        if (match) {
671
+            var i = match.index;
672
+
673
+            if (match[1])
674
+                return this.openingBracketBlock(session, match[1], row, i);
675
+                
676
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
677
+            
678
+            if (range && !range.isMultiLine()) {
679
+                if (forceMultiline) {
680
+                    range = this.getSectionRange(session, row);
681
+                } else if (foldStyle != "all")
682
+                    range = null;
683
+            }
684
+            
685
+            return range;
686
+        }
687
+
688
+        if (foldStyle === "markbegin")
689
+            return;
690
+
691
+        var match = line.match(this.foldingStopMarker);
692
+        if (match) {
693
+            var i = match.index + match[0].length;
694
+
695
+            if (match[1])
696
+                return this.closingBracketBlock(session, match[1], row, i);
697
+
698
+            return session.getCommentFoldRange(row, i, -1);
699
+        }
700
+    };
701
+    
702
+    this.getSectionRange = function(session, row) {
703
+        var line = session.getLine(row);
704
+        var startIndent = line.search(/\S/);
705
+        var startRow = row;
706
+        var startColumn = line.length;
707
+        row = row + 1;
708
+        var endRow = row;
709
+        var maxRow = session.getLength();
710
+        while (++row < maxRow) {
711
+            line = session.getLine(row);
712
+            var indent = line.search(/\S/);
713
+            if (indent === -1)
714
+                continue;
715
+            if  (startIndent > indent)
716
+                break;
717
+            var subRange = this.getFoldWidgetRange(session, "all", row);
718
+            
719
+            if (subRange) {
720
+                if (subRange.start.row <= startRow) {
721
+                    break;
722
+                } else if (subRange.isMultiLine()) {
723
+                    row = subRange.end.row;
724
+                } else if (startIndent == indent) {
725
+                    break;
726
+                }
727
+            }
728
+            endRow = row;
729
+        }
730
+        
731
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
732
+    };
733
+    
734
+    this.getCommentRegionBlock = function(session, line, row) {
735
+        var startColumn = line.search(/\s*$/);
736
+        var maxRow = session.getLength();
737
+        var startRow = row;
738
+        
739
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
740
+        var depth = 1;
741
+        while (++row < maxRow) {
742
+            line = session.getLine(row);
743
+            var m = re.exec(line);
744
+            if (!m) continue;
745
+            if (m[1]) depth--;
746
+            else depth++;
747
+
748
+            if (!depth) break;
749
+        }
750
+
751
+        var endRow = row;
752
+        if (endRow > startRow) {
753
+            return new Range(startRow, startColumn, endRow, line.length);
754
+        }
755
+    };
756
+
757
+}).call(FoldMode.prototype);
758
+
759
+});
760
+
761
+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/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
762
+"use strict";
763
+
764
+var oop = require("../lib/oop");
765
+var TextMode = require("./text").Mode;
766
+var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
767
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
768
+var WorkerClient = require("../worker/worker_client").WorkerClient;
769
+var CssBehaviour = require("./behaviour/css").CssBehaviour;
770
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
771
+
772
+var Mode = function() {
773
+    this.HighlightRules = CssHighlightRules;
774
+    this.$outdent = new MatchingBraceOutdent();
775
+    this.$behaviour = new CssBehaviour();
776
+    this.foldingRules = new CStyleFoldMode();
777
+};
778
+oop.inherits(Mode, TextMode);
779
+
780
+(function() {
781
+
782
+    this.foldingRules = "cStyle";
783
+    this.blockComment = {start: "/*", end: "*/"};
784
+
785
+    this.getNextLineIndent = function(state, line, tab) {
786
+        var indent = this.$getIndent(line);
787
+        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
788
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
789
+            return indent;
790
+        }
791
+
792
+        var match = line.match(/^.*\{\s*$/);
793
+        if (match) {
794
+            indent += tab;
795
+        }
796
+
797
+        return indent;
798
+    };
799
+
800
+    this.checkOutdent = function(state, line, input) {
801
+        return this.$outdent.checkOutdent(line, input);
802
+    };
803
+
804
+    this.autoOutdent = function(state, doc, row) {
805
+        this.$outdent.autoOutdent(doc, row);
806
+    };
807
+
808
+    this.createWorker = function(session) {
809
+        var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
810
+        worker.attachToDocument(session.getDocument());
811
+
812
+        worker.on("csslint", function(e) {
813
+            session.setAnnotations(e.data);
814
+        });
815
+
816
+        worker.on("terminate", function() {
817
+            session.clearAnnotations();
818
+        });
819
+
820
+        return worker;
821
+    };
822
+
823
+    this.$id = "ace/mode/css";
824
+}).call(Mode.prototype);
825
+
826
+exports.Mode = Mode;
827
+
828
+});

+ 2483
- 0
generator/lib/ace/mode-curly.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 513
- 0
generator/lib/ace/mode-d.js Parādīt failu

@@ -0,0 +1,513 @@
1
+ace.define("ace/mode/doc_comment_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 DocCommentHighlightRules = function() {
8
+    this.$rules = {
9
+        "start" : [ {
10
+            token : "comment.doc.tag",
11
+            regex : "@[\\w\\d_]+" // TODO: fix email addresses
12
+        }, 
13
+        DocCommentHighlightRules.getTagRule(),
14
+        {
15
+            defaultToken : "comment.doc",
16
+            caseInsensitive: true
17
+        }]
18
+    };
19
+};
20
+
21
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22
+
23
+DocCommentHighlightRules.getTagRule = function(start) {
24
+    return {
25
+        token : "comment.doc.tag.storage.type",
26
+        regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+    };
28
+}
29
+
30
+DocCommentHighlightRules.getStartRule = function(start) {
31
+    return {
32
+        token : "comment.doc", // doc comment
33
+        regex : "\\/\\*(?=\\*)",
34
+        next  : start
35
+    };
36
+};
37
+
38
+DocCommentHighlightRules.getEndRule = function (start) {
39
+    return {
40
+        token : "comment.doc", // closing comment
41
+        regex : "\\*\\/",
42
+        next  : start
43
+    };
44
+};
45
+
46
+
47
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
48
+
49
+});
50
+
51
+ace.define("ace/mode/d_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52
+"use strict";
53
+
54
+var oop = require("../lib/oop");
55
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57
+
58
+var DHighlightRules = function() {
59
+
60
+    var keywords = (
61
+        "this|super|import|module|body|mixin|__traits|invariant|alias|asm|delete|"+
62
+        "typeof|typeid|sizeof|cast|new|in|is|typedef|__vector|__parameters"
63
+    );
64
+
65
+    var keywordControls = (
66
+        "break|case|continue|default|do|else|for|foreach|foreach_reverse|goto|if|" +
67
+        "return|switch|while|catch|try|throw|finally|version|assert|unittest|with"
68
+    );
69
+    
70
+    var types = (
71
+        "auto|bool|char|dchar|wchar|byte|ubyte|float|double|real|" +
72
+        "cfloat|creal|cdouble|cent|ifloat|ireal|idouble|" +
73
+        "int|long|short|void|uint|ulong|ushort|ucent|" +
74
+        "function|delegate|string|wstring|dstring|size_t|ptrdiff_t|hash_t|Object"
75
+    );
76
+
77
+    var modifiers = (
78
+        "abstract|align|debug|deprecated|export|extern|const|final|in|inout|out|" +
79
+        "ref|immutable|lazy|nothrow|override|package|pragma|private|protected|" +
80
+        "public|pure|scope|shared|__gshared|synchronized|static|volatile"
81
+    );
82
+    
83
+    var storages = (
84
+        "class|struct|union|template|interface|enum|macro"
85
+    );
86
+    
87
+    var stringEscapesSeq =  {
88
+        token: "constant.language.escape",
89
+        regex: "\\\\(?:(?:x[0-9A-F]{2})|(?:[0-7]{1,3})|(?:['\"\\?0abfnrtv\\\\])|" +
90
+            "(?:u[0-9a-fA-F]{4})|(?:U[0-9a-fA-F]{8}))"
91
+    };
92
+
93
+    var builtinConstants = (
94
+        "null|true|false|"+
95
+        "__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__|"+
96
+        "__FILE__|__MODULE__|__LINE__|__FUNCTION__|__PRETTY_FUNCTION__"
97
+    );
98
+    
99
+    var operators = (
100
+        "/|/\\=|&|&\\=|&&|\\|\\|\\=|\\|\\||\\-|\\-\\=|\\-\\-|\\+|" +
101
+        "\\+\\=|\\+\\+|\\<|\\<\\=|\\<\\<|\\<\\<\\=|\\<\\>|\\<\\>\\=|\\>|\\>\\=|\\>\\>\\=|" +
102
+        "\\>\\>\\>\\=|\\>\\>|\\>\\>\\>|\\!|\\!\\=|\\!\\<\\>|\\!\\<\\>\\=|\\!\\<|\\!\\<\\=|" +
103
+        "\\!\\>|\\!\\>\\=|\\?|\\$|\\=|\\=\\=|\\*|\\*\\=|%|%\\=|" +
104
+        "\\^|\\^\\=|\\^\\^|\\^\\^\\=|~|~\\=|\\=\\>|#"
105
+    );
106
+
107
+    var keywordMapper = this.$keywords = this.createKeywordMapper({
108
+        "keyword.modifier" : modifiers,
109
+        "keyword.control" :  keywordControls,
110
+        "keyword.type" :     types,
111
+        "keyword":           keywords,
112
+        "keyword.storage":   storages,
113
+        "punctation": "\\.|\\,|;|\\.\\.|\\.\\.\\.",
114
+        "keyword.operator" : operators,
115
+        "constant.language": builtinConstants
116
+    }, "identifier");
117
+    
118
+    var identifierRe = "[a-zA-Z_\u00a1-\uffff][a-zA-Z\\d_\u00a1-\uffff]*\\b";
119
+
120
+    this.$rules = {
121
+        "start" : [
122
+            {     //-------------------------------------------------------- COMMENTS
123
+                token : "comment",
124
+                regex : "\\/\\/.*$"
125
+            },
126
+            DocCommentHighlightRules.getStartRule("doc-start"),
127
+            {
128
+                token : "comment", // multi line comment
129
+                regex : "\\/\\*",
130
+                next : "star-comment"
131
+            }, {
132
+                token: "comment.shebang",
133
+                regex: "^\s*#!.*"
134
+            }, {
135
+                token : "comment",
136
+                regex : "\\/\\+",
137
+                next: "plus-comment"
138
+            }, {  //-------------------------------------------------------- STRINGS
139
+                onMatch: function(value, currentState, state) {
140
+                    state.unshift(this.next, value.substr(2));
141
+                    return "string";
142
+                },
143
+                regex: 'q"(?:[\\[\\(\\{\\<]+)',
144
+                next: 'operator-heredoc-string'
145
+            }, {
146
+                onMatch: function(value, currentState, state) {
147
+                    state.unshift(this.next, value.substr(2));
148
+                    return "string";
149
+                },
150
+                regex: 'q"(?:[a-zA-Z_]+)$',
151
+                next: 'identifier-heredoc-string'
152
+            }, {
153
+                token : "string", // multi line string start
154
+                regex : '[xr]?"',
155
+                next : "quote-string"
156
+            }, {
157
+                token : "string", // multi line string start
158
+                regex : '[xr]?`',
159
+                next : "backtick-string"
160
+            }, {
161
+                token : "string", // single line
162
+                regex : "[xr]?['](?:(?:\\\\.)|(?:[^'\\\\]))*?['][cdw]?"
163
+            }, {  //-------------------------------------------------------- RULES
164
+                token: ["keyword", "text", "paren.lparen"],
165
+                regex: /(asm)(\s*)({)/,
166
+                next: "d-asm"
167
+            }, {
168
+                token: ["keyword", "text", "paren.lparen", "constant.language"],
169
+                regex: "(__traits)(\\s*)(\\()("+identifierRe+")"
170
+            }, { // import|module abc
171
+                token: ["keyword", "text", "variable.module"],
172
+                regex: "(import|module)(\\s+)((?:"+identifierRe+"\\.?)*)"
173
+            }, { // storage Name
174
+                token: ["keyword.storage", "text", "entity.name.type"],
175
+                regex: "("+storages+")(\\s*)("+identifierRe+")"
176
+            }, { // alias|typedef foo bar;
177
+                token: ["keyword", "text", "variable.storage", "text"],
178
+                regex: "(alias|typedef)(\\s*)("+identifierRe+")(\\s*)"
179
+            }, {  //-------------------------------------------------------- OTHERS
180
+                token : "constant.numeric", // hex
181
+                regex : "0[xX][0-9a-fA-F_]+(l|ul|u|f|F|L|U|UL)?\\b"
182
+            }, {
183
+                token : "constant.numeric", // float
184
+                regex : "[+-]?\\d[\\d_]*(?:(?:\\.[\\d_]*)?(?:[eE][+-]?[\\d_]+)?)?(l|ul|u|f|F|L|U|UL)?\\b"
185
+            }, {
186
+                token: "entity.other.attribute-name",
187
+                regex: "@"+identifierRe
188
+            }, {
189
+                token : keywordMapper,
190
+                regex : "[a-zA-Z_][a-zA-Z0-9_]*\\b"
191
+            }, {
192
+                token : "keyword.operator",
193
+                regex : operators
194
+            }, {
195
+                token : "punctuation.operator",
196
+                regex : "\\?|\\:|\\,|\\;|\\.|\\:"
197
+            }, {
198
+                token : "paren.lparen",
199
+                regex : "[[({]"
200
+            }, {
201
+                token : "paren.rparen",
202
+                regex : "[\\])}]"
203
+            }, {
204
+                token : "text",
205
+                regex : "\\s+"
206
+            }
207
+        ],
208
+        "star-comment" : [
209
+            {
210
+                token : "comment", // closing comment
211
+                regex : "\\*\\/",
212
+                next : "start"
213
+            }, {
214
+                defaultToken: 'comment'
215
+            }
216
+        ],
217
+        "plus-comment" : [
218
+            {
219
+                token : "comment", // closing comment
220
+                regex : "\\+\\/",
221
+                next : "start"
222
+            }, {
223
+                defaultToken: 'comment'
224
+            }
225
+        ],
226
+        
227
+        "quote-string" : [
228
+           stringEscapesSeq,
229
+           {
230
+                token : "string",
231
+                regex : '"[cdw]?',
232
+                next : "start"
233
+            }, {
234
+                defaultToken: 'string'
235
+            }
236
+        ],
237
+        
238
+        "backtick-string" : [
239
+           stringEscapesSeq,
240
+           {
241
+                token : "string",
242
+                regex : '`[cdw]?',
243
+                next : "start"
244
+            }, {
245
+                defaultToken: 'string'
246
+            }
247
+        ],
248
+        
249
+        "operator-heredoc-string": [
250
+            {
251
+                onMatch: function(value, currentState, state) {
252
+                    value = value.substring(value.length-2, value.length-1);
253
+                    var map = {'>':'<',']':'[',')':'(','}':'{'};
254
+                    if(Object.keys(map).indexOf(value) != -1)
255
+                        value = map[value];
256
+                    if(value != state[1]) return "string";
257
+                    state.shift();
258
+                    state.shift();
259
+                    
260
+                    return "string";
261
+                },
262
+                regex: '(?:[\\]\\)}>]+)"',
263
+                next: 'start'
264
+            }, {
265
+                token: 'string',
266
+                regex: '[^\\]\\)}>]+'
267
+            }
268
+        ],
269
+        
270
+        "identifier-heredoc-string": [
271
+            {
272
+                onMatch: function(value, currentState, state) {
273
+                    value = value.substring(0, value.length-1);
274
+                    if(value != state[1]) return "string";
275
+                    state.shift();
276
+                    state.shift();
277
+                    
278
+                    return "string";
279
+                },
280
+                regex: '^(?:[A-Za-z_][a-zA-Z0-9]+)"',
281
+                next: 'start'
282
+            }, {
283
+                token: 'string',
284
+                regex: '[^\\]\\)}>]+'
285
+            }
286
+        ],
287
+        
288
+        "d-asm": [
289
+            {
290
+                token: "paren.rparen",
291
+                regex: "\\}",
292
+                next: "start"
293
+            }, {
294
+                token: 'keyword.instruction',
295
+                regex: '[a-zA-Z]+',
296
+                next: 'd-asm-instruction' 
297
+            }, {
298
+                token: "text",
299
+                regex: "\\s+"
300
+            }
301
+        ],
302
+        'd-asm-instruction': [
303
+            {
304
+                token: 'constant.language',
305
+                regex: /AL|AH|AX|EAX|BL|BH|BX|EBX|CL|CH|CX|ECX|DL|DH|DX|EDX|BP|EBP|SP|ESP|DI|EDI|SI|ESI/i
306
+            }, {
307
+                token: 'identifier',
308
+                regex: '[a-zA-Z]+'
309
+            }, {
310
+                token: 'string',
311
+                regex: '".*"'
312
+            }, {
313
+                token: 'comment',
314
+                regex: '//.*$'
315
+            }, {
316
+                token: 'constant.numeric',
317
+                regex: '[0-9.xA-F]+'
318
+            }, {
319
+                token: 'punctuation.operator',
320
+                regex: '\\,'
321
+            }, {
322
+                token: 'punctuation.operator',
323
+                regex: ';',
324
+                next: 'd-asm'
325
+            }, {
326
+                token: 'text',
327
+                regex: '\\s+'
328
+            }
329
+        ]
330
+    };
331
+
332
+    this.embedRules(DocCommentHighlightRules, "doc-",
333
+        [ DocCommentHighlightRules.getEndRule("start") ]);
334
+};
335
+
336
+DHighlightRules.metaData = {
337
+      comment: 'D language',
338
+      fileTypes: [ 'd', 'di' ],
339
+      firstLineMatch: '^#!.*\\b[glr]?dmd\\b.',
340
+      foldingStartMarker: '(?x)/\\*\\*(?!\\*)|^(?![^{]*?//|[^{]*?/\\*(?!.*?\\*/.*?\\{)).*?\\{\\s*($|//|/\\*(?!.*?\\*/.*\\S))',
341
+      foldingStopMarker: '(?<!\\*)\\*\\*/|^\\s*\\}',
342
+      keyEquivalent: '^~D',
343
+      name: 'D',
344
+      scopeName: 'source.d'
345
+};
346
+oop.inherits(DHighlightRules, TextHighlightRules);
347
+
348
+exports.DHighlightRules = DHighlightRules;
349
+});
350
+
351
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
352
+"use strict";
353
+
354
+var oop = require("../../lib/oop");
355
+var Range = require("../../range").Range;
356
+var BaseFoldMode = require("./fold_mode").FoldMode;
357
+
358
+var FoldMode = exports.FoldMode = function(commentRegex) {
359
+    if (commentRegex) {
360
+        this.foldingStartMarker = new RegExp(
361
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
362
+        );
363
+        this.foldingStopMarker = new RegExp(
364
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
365
+        );
366
+    }
367
+};
368
+oop.inherits(FoldMode, BaseFoldMode);
369
+
370
+(function() {
371
+    
372
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
373
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
374
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
375
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
376
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
377
+    this._getFoldWidgetBase = this.getFoldWidget;
378
+    this.getFoldWidget = function(session, foldStyle, row) {
379
+        var line = session.getLine(row);
380
+    
381
+        if (this.singleLineBlockCommentRe.test(line)) {
382
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
383
+                return "";
384
+        }
385
+    
386
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
387
+    
388
+        if (!fw && this.startRegionRe.test(line))
389
+            return "start"; // lineCommentRegionStart
390
+    
391
+        return fw;
392
+    };
393
+
394
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
395
+        var line = session.getLine(row);
396
+        
397
+        if (this.startRegionRe.test(line))
398
+            return this.getCommentRegionBlock(session, line, row);
399
+        
400
+        var match = line.match(this.foldingStartMarker);
401
+        if (match) {
402
+            var i = match.index;
403
+
404
+            if (match[1])
405
+                return this.openingBracketBlock(session, match[1], row, i);
406
+                
407
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
408
+            
409
+            if (range && !range.isMultiLine()) {
410
+                if (forceMultiline) {
411
+                    range = this.getSectionRange(session, row);
412
+                } else if (foldStyle != "all")
413
+                    range = null;
414
+            }
415
+            
416
+            return range;
417
+        }
418
+
419
+        if (foldStyle === "markbegin")
420
+            return;
421
+
422
+        var match = line.match(this.foldingStopMarker);
423
+        if (match) {
424
+            var i = match.index + match[0].length;
425
+
426
+            if (match[1])
427
+                return this.closingBracketBlock(session, match[1], row, i);
428
+
429
+            return session.getCommentFoldRange(row, i, -1);
430
+        }
431
+    };
432
+    
433
+    this.getSectionRange = function(session, row) {
434
+        var line = session.getLine(row);
435
+        var startIndent = line.search(/\S/);
436
+        var startRow = row;
437
+        var startColumn = line.length;
438
+        row = row + 1;
439
+        var endRow = row;
440
+        var maxRow = session.getLength();
441
+        while (++row < maxRow) {
442
+            line = session.getLine(row);
443
+            var indent = line.search(/\S/);
444
+            if (indent === -1)
445
+                continue;
446
+            if  (startIndent > indent)
447
+                break;
448
+            var subRange = this.getFoldWidgetRange(session, "all", row);
449
+            
450
+            if (subRange) {
451
+                if (subRange.start.row <= startRow) {
452
+                    break;
453
+                } else if (subRange.isMultiLine()) {
454
+                    row = subRange.end.row;
455
+                } else if (startIndent == indent) {
456
+                    break;
457
+                }
458
+            }
459
+            endRow = row;
460
+        }
461
+        
462
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
463
+    };
464
+    
465
+    this.getCommentRegionBlock = function(session, line, row) {
466
+        var startColumn = line.search(/\s*$/);
467
+        var maxRow = session.getLength();
468
+        var startRow = row;
469
+        
470
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
471
+        var depth = 1;
472
+        while (++row < maxRow) {
473
+            line = session.getLine(row);
474
+            var m = re.exec(line);
475
+            if (!m) continue;
476
+            if (m[1]) depth--;
477
+            else depth++;
478
+
479
+            if (!depth) break;
480
+        }
481
+
482
+        var endRow = row;
483
+        if (endRow > startRow) {
484
+            return new Range(startRow, startColumn, endRow, line.length);
485
+        }
486
+    };
487
+
488
+}).call(FoldMode.prototype);
489
+
490
+});
491
+
492
+ace.define("ace/mode/d",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/d_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
493
+"use strict";
494
+
495
+var oop = require("../lib/oop");
496
+var TextMode = require("./text").Mode;
497
+var DHighlightRules = require("./d_highlight_rules").DHighlightRules;
498
+var FoldMode = require("./folding/cstyle").FoldMode;
499
+
500
+var Mode = function() {
501
+    this.HighlightRules = DHighlightRules;
502
+    this.foldingRules = new FoldMode();
503
+};
504
+oop.inherits(Mode, TextMode);
505
+
506
+(function() {
507
+    this.lineCommentStart = "//";
508
+    this.blockComment = {start: "/*", end: "*/"};
509
+    this.$id = "ace/mode/d";
510
+}).call(Mode.prototype);
511
+
512
+exports.Mode = Mode;
513
+});

+ 1053
- 0
generator/lib/ace/mode-dart.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 139
- 0
generator/lib/ace/mode-diff.js Parādīt failu

@@ -0,0 +1,139 @@
1
+ace.define("ace/mode/diff_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 DiffHighlightRules = function() {


8
+
9
+    this.$rules = {
10
+        "start" : [{
11
+                regex: "^(?:\\*{15}|={67}|-{3}|\\+{3})$",
12
+                token: "punctuation.definition.separator.diff",
13
+                "name": "keyword"
14
+            }, { //diff.range.unified
15
+                regex: "^(@@)(\\s*.+?\\s*)(@@)(.*)$",
16
+                token: [
17
+                    "constant",
18
+                    "constant.numeric",
19
+                    "constant",
20
+                    "comment.doc.tag"
21
+                ]
22
+            }, { //diff.range.normal
23
+                regex: "^(\\d+)([,\\d]+)(a|d|c)(\\d+)([,\\d]+)(.*)$",
24
+                token: [
25
+                    "constant.numeric",
26
+                    "punctuation.definition.range.diff",
27
+                    "constant.function",
28
+                    "constant.numeric",
29
+                    "punctuation.definition.range.diff",
30
+                    "invalid"
31
+                ],
32
+                "name": "meta."
33
+            }, {
34
+                regex: "^(\\-{3}|\\+{3}|\\*{3})( .+)$",
35
+                token: [
36
+                    "constant.numeric",
37
+                    "meta.tag"
38
+                ]
39
+            }, { // added
40
+                regex: "^([!+>])(.*?)(\\s*)$",
41
+                token: [
42
+                    "support.constant",
43
+                    "text",
44
+                    "invalid"
45
+                ]
46
+            }, { // removed
47
+                regex: "^([<\\-])(.*?)(\\s*)$",
48
+                token: [
49
+                    "support.function",
50
+                    "string",
51
+                    "invalid"
52
+                ]
53
+            }, {
54
+                regex: "^(diff)(\\s+--\\w+)?(.+?)( .+)?$",
55
+                token: ["variable", "variable", "keyword", "variable"]
56
+            }, {
57
+                regex: "^Index.+$",
58
+                token: "variable"
59
+            }, {
60
+                regex: "^\\s+$",
61
+                token: "text"
62
+            }, {
63
+                regex: "\\s*$",
64
+                token: "invalid"
65
+            }, {
66
+                defaultToken: "invisible",
67
+                caseInsensitive: true
68
+            }
69
+        ]
70
+    };
71
+};
72
+
73
+oop.inherits(DiffHighlightRules, TextHighlightRules);
74
+
75
+exports.DiffHighlightRules = DiffHighlightRules;
76
+});
77
+
78
+ace.define("ace/mode/folding/diff",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
79
+"use strict";
80
+
81
+var oop = require("../../lib/oop");
82
+var BaseFoldMode = require("./fold_mode").FoldMode;
83
+var Range = require("../../range").Range;
84
+
85
+var FoldMode = exports.FoldMode = function(levels, flag) {
86
+	this.regExpList = levels;
87
+	this.flag = flag;
88
+	this.foldingStartMarker = RegExp("^(" + levels.join("|") + ")", this.flag);
89
+};
90
+oop.inherits(FoldMode, BaseFoldMode);
91
+
92
+(function() {
93
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
94
+        var line = session.getLine(row);
95
+        var start = {row: row, column: line.length};
96
+
97
+        var regList = this.regExpList;
98
+        for (var i = 1; i <= regList.length; i++) {
99
+            var re = RegExp("^(" + regList.slice(0, i).join("|") + ")", this.flag);
100
+            if (re.test(line))
101
+                break;
102
+        }
103
+
104
+        for (var l = session.getLength(); ++row < l; ) {
105
+            line = session.getLine(row);
106
+            if (re.test(line))
107
+                break;
108
+        }
109
+        if (row == start.row + 1)
110
+            return;
111
+        return  Range.fromPoints(start, {row: row - 1, column: line.length});
112
+    };
113
+
114
+}).call(FoldMode.prototype);
115
+
116
+});
117
+
118
+ace.define("ace/mode/diff",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/diff_highlight_rules","ace/mode/folding/diff"], function(require, exports, module) {
119
+"use strict";
120
+
121
+var oop = require("../lib/oop");
122
+var TextMode = require("./text").Mode;
123
+var HighlightRules = require("./diff_highlight_rules").DiffHighlightRules;
124
+var FoldMode = require("./folding/diff").FoldMode;
125
+
126
+var Mode = function() {
127
+    this.HighlightRules = HighlightRules;
128
+    this.foldingRules = new FoldMode(["diff", "index", "\\+{3}", "@@|\\*{5}"], "i");
129
+};
130
+oop.inherits(Mode, TextMode);
131
+
132
+(function() {
133
+
134
+    this.$id = "ace/mode/diff";
135
+}).call(Mode.prototype);
136
+
137
+exports.Mode = Mode;
138
+
139
+});

+ 2517
- 0
generator/lib/ace/mode-django.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 803
- 0
generator/lib/ace/mode-dockerfile.js Parādīt failu

@@ -0,0 +1,803 @@
1
+ace.define("ace/mode/sh_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 reservedKeywords = exports.reservedKeywords = (
8
+        '!|{|}|case|do|done|elif|else|'+
9
+        'esac|fi|for|if|in|then|until|while|'+
10
+        '&|;|export|local|read|typeset|unset|'+
11
+        'elif|select|set'
12
+    );
13
+
14
+var languageConstructs = exports.languageConstructs = (
15
+    '[|]|alias|bg|bind|break|builtin|'+
16
+     'cd|command|compgen|complete|continue|'+
17
+     'dirs|disown|echo|enable|eval|exec|'+
18
+     'exit|fc|fg|getopts|hash|help|history|'+
19
+     'jobs|kill|let|logout|popd|printf|pushd|'+
20
+     'pwd|return|set|shift|shopt|source|'+
21
+     'suspend|test|times|trap|type|ulimit|'+
22
+     'umask|unalias|wait'
23
+);
24
+
25
+var ShHighlightRules = function() {
26
+    var keywordMapper = this.createKeywordMapper({
27
+        "keyword": reservedKeywords,
28
+        "support.function.builtin": languageConstructs,
29
+        "invalid.deprecated": "debugger"
30
+    }, "identifier");
31
+
32
+    var integer = "(?:(?:[1-9]\\d*)|(?:0))";
33
+
34
+    var fraction = "(?:\\.\\d+)";
35
+    var intPart = "(?:\\d+)";
36
+    var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
37
+    var exponentFloat = "(?:(?:" + pointFloat + "|" +  intPart + ")" + ")";
38
+    var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
39
+    var fileDescriptor = "(?:&" + intPart + ")";
40
+
41
+    var variableName = "[a-zA-Z_][a-zA-Z0-9_]*";
42
+    var variable = "(?:(?:\\$" + variableName + ")|(?:" + variableName + "=))";
43
+
44
+    var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
45
+
46
+    var func = "(?:" + variableName + "\\s*\\(\\))";
47
+
48
+    this.$rules = {
49
+        "start" : [{
50
+            token : "constant",
51
+            regex : /\\./
52
+        }, {
53
+            token : ["text", "comment"],
54
+            regex : /(^|\s)(#.*)$/
55
+        }, {
56
+            token : "string",
57
+            regex : '"',
58
+            push : [{
59
+                token : "constant.language.escape",
60
+                regex : /\\(?:[$abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/
61
+            }, {
62
+                token : "constant",
63
+                regex : /\$\w+/
64
+            }, {
65
+                token : "string",
66
+                regex : '"',
67
+                next: "pop"
68
+            }, {
69
+                defaultToken: "string"
70
+            }]
71
+        }, {
72
+            regex : "<<<",
73
+            token : "keyword.operator"
74
+        }, {
75
+            stateName: "heredoc",
76
+            regex : "(<<)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
77
+            onMatch : function(value, currentState, stack) {
78
+                var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
79
+                var tokens = value.split(this.splitRegex);
80
+                stack.push(next, tokens[4]);
81
+                return [
82
+                    {type:"constant", value: tokens[1]},
83
+                    {type:"text", value: tokens[2]},
84
+                    {type:"string", value: tokens[3]},
85
+                    {type:"support.class", value: tokens[4]},
86
+                    {type:"string", value: tokens[5]}
87
+                ];
88
+            },
89
+            rules: {
90
+                heredoc: [{
91
+                    onMatch:  function(value, currentState, stack) {
92
+                        if (value === stack[1]) {
93
+                            stack.shift();
94
+                            stack.shift();
95
+                            this.next = stack[0] || "start";
96
+                            return "support.class";
97
+                        }
98
+                        this.next = "";
99
+                        return "string";
100
+                    },
101
+                    regex: ".*$",
102
+                    next: "start"
103
+                }],
104
+                indentedHeredoc: [{
105
+                    token: "string",
106
+                    regex: "^\t+"
107
+                }, {
108
+                    onMatch:  function(value, currentState, stack) {
109
+                        if (value === stack[1]) {
110
+                            stack.shift();
111
+                            stack.shift();
112
+                            this.next = stack[0] || "start";
113
+                            return "support.class";
114
+                        }
115
+                        this.next = "";
116
+                        return "string";
117
+                    },
118
+                    regex: ".*$",
119
+                    next: "start"
120
+                }]
121
+            }
122
+        }, {
123
+            regex : "$",
124
+            token : "empty",
125
+            next : function(currentState, stack) {
126
+                if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
127
+                    return stack[0];
128
+                return currentState;
129
+            }
130
+        }, {
131
+            token : "variable.language",
132
+            regex : builtinVariable
133
+        }, {
134
+            token : "variable",
135
+            regex : variable
136
+        }, {
137
+            token : "support.function",
138
+            regex : func
139
+        }, {
140
+            token : "support.function",
141
+            regex : fileDescriptor
142
+        }, {
143
+            token : "string",           // ' string
144
+            start : "'", end : "'"
145
+        }, {
146
+            token : "constant.numeric", // float
147
+            regex : floatNumber
148
+        }, {
149
+            token : "constant.numeric", // integer
150
+            regex : integer + "\\b"
151
+        }, {
152
+            token : keywordMapper,
153
+            regex : "[a-zA-Z_][a-zA-Z0-9_]*\\b"
154
+        }, {
155
+            token : "keyword.operator",
156
+            regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!="
157
+        }, {
158
+            token : "paren.lparen",
159
+            regex : "[\\[\\(\\{]"
160
+        }, {
161
+            token : "paren.rparen",
162
+            regex : "[\\]\\)\\}]"
163
+        } ]
164
+    };
165
+    
166
+    this.normalizeRules();
167
+};
168
+
169
+oop.inherits(ShHighlightRules, TextHighlightRules);
170
+
171
+exports.ShHighlightRules = ShHighlightRules;
172
+});
173
+
174
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
175
+"use strict";
176
+
177
+var oop = require("../../lib/oop");
178
+var Range = require("../../range").Range;
179
+var BaseFoldMode = require("./fold_mode").FoldMode;
180
+
181
+var FoldMode = exports.FoldMode = function(commentRegex) {
182
+    if (commentRegex) {
183
+        this.foldingStartMarker = new RegExp(
184
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
185
+        );
186
+        this.foldingStopMarker = new RegExp(
187
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
188
+        );
189
+    }
190
+};
191
+oop.inherits(FoldMode, BaseFoldMode);
192
+
193
+(function() {
194
+    
195
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
196
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
197
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
198
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
199
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
200
+    this._getFoldWidgetBase = this.getFoldWidget;
201
+    this.getFoldWidget = function(session, foldStyle, row) {
202
+        var line = session.getLine(row);
203
+    
204
+        if (this.singleLineBlockCommentRe.test(line)) {
205
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
206
+                return "";
207
+        }
208
+    
209
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
210
+    
211
+        if (!fw && this.startRegionRe.test(line))
212
+            return "start"; // lineCommentRegionStart
213
+    
214
+        return fw;
215
+    };
216
+
217
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
218
+        var line = session.getLine(row);
219
+        
220
+        if (this.startRegionRe.test(line))
221
+            return this.getCommentRegionBlock(session, line, row);
222
+        
223
+        var match = line.match(this.foldingStartMarker);
224
+        if (match) {
225
+            var i = match.index;
226
+
227
+            if (match[1])
228
+                return this.openingBracketBlock(session, match[1], row, i);
229
+                
230
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
231
+            
232
+            if (range && !range.isMultiLine()) {
233
+                if (forceMultiline) {
234
+                    range = this.getSectionRange(session, row);
235
+                } else if (foldStyle != "all")
236
+                    range = null;
237
+            }
238
+            
239
+            return range;
240
+        }
241
+
242
+        if (foldStyle === "markbegin")
243
+            return;
244
+
245
+        var match = line.match(this.foldingStopMarker);
246
+        if (match) {
247
+            var i = match.index + match[0].length;
248
+
249
+            if (match[1])
250
+                return this.closingBracketBlock(session, match[1], row, i);
251
+
252
+            return session.getCommentFoldRange(row, i, -1);
253
+        }
254
+    };
255
+    
256
+    this.getSectionRange = function(session, row) {
257
+        var line = session.getLine(row);
258
+        var startIndent = line.search(/\S/);
259
+        var startRow = row;
260
+        var startColumn = line.length;
261
+        row = row + 1;
262
+        var endRow = row;
263
+        var maxRow = session.getLength();
264
+        while (++row < maxRow) {
265
+            line = session.getLine(row);
266
+            var indent = line.search(/\S/);
267
+            if (indent === -1)
268
+                continue;
269
+            if  (startIndent > indent)
270
+                break;
271
+            var subRange = this.getFoldWidgetRange(session, "all", row);
272
+            
273
+            if (subRange) {
274
+                if (subRange.start.row <= startRow) {
275
+                    break;
276
+                } else if (subRange.isMultiLine()) {
277
+                    row = subRange.end.row;
278
+                } else if (startIndent == indent) {
279
+                    break;
280
+                }
281
+            }
282
+            endRow = row;
283
+        }
284
+        
285
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
286
+    };
287
+    
288
+    this.getCommentRegionBlock = function(session, line, row) {
289
+        var startColumn = line.search(/\s*$/);
290
+        var maxRow = session.getLength();
291
+        var startRow = row;
292
+        
293
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
294
+        var depth = 1;
295
+        while (++row < maxRow) {
296
+            line = session.getLine(row);
297
+            var m = re.exec(line);
298
+            if (!m) continue;
299
+            if (m[1]) depth--;
300
+            else depth++;
301
+
302
+            if (!depth) break;
303
+        }
304
+
305
+        var endRow = row;
306
+        if (endRow > startRow) {
307
+            return new Range(startRow, startColumn, endRow, line.length);
308
+        }
309
+    };
310
+
311
+}).call(FoldMode.prototype);
312
+
313
+});
314
+
315
+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) {
316
+"use strict";
317
+
318
+var oop = require("../../lib/oop");
319
+var Behaviour = require("../behaviour").Behaviour;
320
+var TokenIterator = require("../../token_iterator").TokenIterator;
321
+var lang = require("../../lib/lang");
322
+
323
+var SAFE_INSERT_IN_TOKENS =
324
+    ["text", "paren.rparen", "punctuation.operator"];
325
+var SAFE_INSERT_BEFORE_TOKENS =
326
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
327
+
328
+var context;
329
+var contextCache = {};
330
+var initContext = function(editor) {
331
+    var id = -1;
332
+    if (editor.multiSelect) {
333
+        id = editor.selection.index;
334
+        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
335
+            contextCache = {rangeCount: editor.multiSelect.rangeCount};
336
+    }
337
+    if (contextCache[id])
338
+        return context = contextCache[id];
339
+    context = contextCache[id] = {
340
+        autoInsertedBrackets: 0,
341
+        autoInsertedRow: -1,
342
+        autoInsertedLineEnd: "",
343
+        maybeInsertedBrackets: 0,
344
+        maybeInsertedRow: -1,
345
+        maybeInsertedLineStart: "",
346
+        maybeInsertedLineEnd: ""
347
+    };
348
+};
349
+
350
+var CstyleBehaviour = function() {
351
+    this.add("braces", "insertion", function(state, action, editor, session, text) {
352
+        var cursor = editor.getCursorPosition();
353
+        var line = session.doc.getLine(cursor.row);
354
+        if (text == '{') {
355
+            initContext(editor);
356
+            var selection = editor.getSelectionRange();
357
+            var selected = session.doc.getTextRange(selection);
358
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
359
+                return {
360
+                    text: '{' + selected + '}',
361
+                    selection: false
362
+                };
363
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
364
+                if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
365
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
366
+                    return {
367
+                        text: '{}',
368
+                        selection: [1, 1]
369
+                    };
370
+                } else {
371
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
372
+                    return {
373
+                        text: '{',
374
+                        selection: [1, 1]
375
+                    };
376
+                }
377
+            }
378
+        } else if (text == '}') {
379
+            initContext(editor);
380
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
381
+            if (rightChar == '}') {
382
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
383
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
384
+                    CstyleBehaviour.popAutoInsertedClosing();
385
+                    return {
386
+                        text: '',
387
+                        selection: [1, 1]
388
+                    };
389
+                }
390
+            }
391
+        } else if (text == "\n" || text == "\r\n") {
392
+            initContext(editor);
393
+            var closing = "";
394
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
395
+                closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
396
+                CstyleBehaviour.clearMaybeInsertedClosing();
397
+            }
398
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
399
+            if (rightChar === '}') {
400
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
401
+                if (!openBracePos)
402
+                     return null;
403
+                var next_indent = this.$getIndent(session.getLine(openBracePos.row));
404
+            } else if (closing) {
405
+                var next_indent = this.$getIndent(line);
406
+            } else {
407
+                CstyleBehaviour.clearMaybeInsertedClosing();
408
+                return;
409
+            }
410
+            var indent = next_indent + session.getTabString();
411
+
412
+            return {
413
+                text: '\n' + indent + '\n' + next_indent + closing,
414
+                selection: [1, indent.length, 1, indent.length]
415
+            };
416
+        } else {
417
+            CstyleBehaviour.clearMaybeInsertedClosing();
418
+        }
419
+    });
420
+
421
+    this.add("braces", "deletion", function(state, action, editor, session, range) {
422
+        var selected = session.doc.getTextRange(range);
423
+        if (!range.isMultiLine() && selected == '{') {
424
+            initContext(editor);
425
+            var line = session.doc.getLine(range.start.row);
426
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
427
+            if (rightChar == '}') {
428
+                range.end.column++;
429
+                return range;
430
+            } else {
431
+                context.maybeInsertedBrackets--;
432
+            }
433
+        }
434
+    });
435
+
436
+    this.add("parens", "insertion", function(state, action, editor, session, text) {
437
+        if (text == '(') {
438
+            initContext(editor);
439
+            var selection = editor.getSelectionRange();
440
+            var selected = session.doc.getTextRange(selection);
441
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
442
+                return {
443
+                    text: '(' + selected + ')',
444
+                    selection: false
445
+                };
446
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
447
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
448
+                return {
449
+                    text: '()',
450
+                    selection: [1, 1]
451
+                };
452
+            }
453
+        } else if (text == ')') {
454
+            initContext(editor);
455
+            var cursor = editor.getCursorPosition();
456
+            var line = session.doc.getLine(cursor.row);
457
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
458
+            if (rightChar == ')') {
459
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
460
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
461
+                    CstyleBehaviour.popAutoInsertedClosing();
462
+                    return {
463
+                        text: '',
464
+                        selection: [1, 1]
465
+                    };
466
+                }
467
+            }
468
+        }
469
+    });
470
+
471
+    this.add("parens", "deletion", function(state, action, editor, session, range) {
472
+        var selected = session.doc.getTextRange(range);
473
+        if (!range.isMultiLine() && selected == '(') {
474
+            initContext(editor);
475
+            var line = session.doc.getLine(range.start.row);
476
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
477
+            if (rightChar == ')') {
478
+                range.end.column++;
479
+                return range;
480
+            }
481
+        }
482
+    });
483
+
484
+    this.add("brackets", "insertion", function(state, action, editor, session, text) {
485
+        if (text == '[') {
486
+            initContext(editor);
487
+            var selection = editor.getSelectionRange();
488
+            var selected = session.doc.getTextRange(selection);
489
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
490
+                return {
491
+                    text: '[' + selected + ']',
492
+                    selection: false
493
+                };
494
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
495
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
496
+                return {
497
+                    text: '[]',
498
+                    selection: [1, 1]
499
+                };
500
+            }
501
+        } else if (text == ']') {
502
+            initContext(editor);
503
+            var cursor = editor.getCursorPosition();
504
+            var line = session.doc.getLine(cursor.row);
505
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
506
+            if (rightChar == ']') {
507
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
508
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
509
+                    CstyleBehaviour.popAutoInsertedClosing();
510
+                    return {
511
+                        text: '',
512
+                        selection: [1, 1]
513
+                    };
514
+                }
515
+            }
516
+        }
517
+    });
518
+
519
+    this.add("brackets", "deletion", function(state, action, editor, session, range) {
520
+        var selected = session.doc.getTextRange(range);
521
+        if (!range.isMultiLine() && selected == '[') {
522
+            initContext(editor);
523
+            var line = session.doc.getLine(range.start.row);
524
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
525
+            if (rightChar == ']') {
526
+                range.end.column++;
527
+                return range;
528
+            }
529
+        }
530
+    });
531
+
532
+    this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
533
+        if (text == '"' || text == "'") {
534
+            initContext(editor);
535
+            var quote = text;
536
+            var selection = editor.getSelectionRange();
537
+            var selected = session.doc.getTextRange(selection);
538
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
539
+                return {
540
+                    text: quote + selected + quote,
541
+                    selection: false
542
+                };
543
+            } else {
544
+                var cursor = editor.getCursorPosition();
545
+                var line = session.doc.getLine(cursor.row);
546
+                var leftChar = line.substring(cursor.column-1, cursor.column);
547
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
548
+                
549
+                var token = session.getTokenAt(cursor.row, cursor.column);
550
+                var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
551
+                if (leftChar == "\\" && token && /escape/.test(token.type))
552
+                    return null;
553
+                
554
+                var stringBefore = token && /string/.test(token.type);
555
+                var stringAfter = !rightToken || /string/.test(rightToken.type);
556
+                
557
+                var pair;
558
+                if (rightChar == quote) {
559
+                    pair = stringBefore !== stringAfter;
560
+                } else {
561
+                    if (stringBefore && !stringAfter)
562
+                        return null; // wrap string with different quote
563
+                    if (stringBefore && stringAfter)
564
+                        return null; // do not pair quotes inside strings 
565
+                    var wordRe = session.$mode.tokenRe;
566
+                    wordRe.lastIndex = 0;
567
+                    var isWordBefore = wordRe.test(leftChar);
568
+                    wordRe.lastIndex = 0;
569
+                    var isWordAfter = wordRe.test(leftChar);
570
+                    if (isWordBefore || isWordAfter)
571
+                        return null; // before or after alphanumeric
572
+                    if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
573
+                        return null; // there is rightChar and it isn't closing
574
+                    pair = true;
575
+                }
576
+                return {
577
+                    text: pair ? quote + quote : "",
578
+                    selection: [1,1]
579
+                };
580
+            }
581
+        }
582
+    });
583
+
584
+    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
585
+        var selected = session.doc.getTextRange(range);
586
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
587
+            initContext(editor);
588
+            var line = session.doc.getLine(range.start.row);
589
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
590
+            if (rightChar == selected) {
591
+                range.end.column++;
592
+                return range;
593
+            }
594
+        }
595
+    });
596
+
597
+};
598
+
599
+    
600
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
601
+    var cursor = editor.getCursorPosition();
602
+    var iterator = new TokenIterator(session, cursor.row, cursor.column);
603
+    if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
604
+        var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
605
+        if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
606
+            return false;
607
+    }
608
+    iterator.stepForward();
609
+    return iterator.getCurrentTokenRow() !== cursor.row ||
610
+        this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
611
+};
612
+
613
+CstyleBehaviour.$matchTokenType = function(token, types) {
614
+    return types.indexOf(token.type || token) > -1;
615
+};
616
+
617
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
618
+    var cursor = editor.getCursorPosition();
619
+    var line = session.doc.getLine(cursor.row);
620
+    if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
621
+        context.autoInsertedBrackets = 0;
622
+    context.autoInsertedRow = cursor.row;
623
+    context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
624
+    context.autoInsertedBrackets++;
625
+};
626
+
627
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
628
+    var cursor = editor.getCursorPosition();
629
+    var line = session.doc.getLine(cursor.row);
630
+    if (!this.isMaybeInsertedClosing(cursor, line))
631
+        context.maybeInsertedBrackets = 0;
632
+    context.maybeInsertedRow = cursor.row;
633
+    context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
634
+    context.maybeInsertedLineEnd = line.substr(cursor.column);
635
+    context.maybeInsertedBrackets++;
636
+};
637
+
638
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
639
+    return context.autoInsertedBrackets > 0 &&
640
+        cursor.row === context.autoInsertedRow &&
641
+        bracket === context.autoInsertedLineEnd[0] &&
642
+        line.substr(cursor.column) === context.autoInsertedLineEnd;
643
+};
644
+
645
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
646
+    return context.maybeInsertedBrackets > 0 &&
647
+        cursor.row === context.maybeInsertedRow &&
648
+        line.substr(cursor.column) === context.maybeInsertedLineEnd &&
649
+        line.substr(0, cursor.column) == context.maybeInsertedLineStart;
650
+};
651
+
652
+CstyleBehaviour.popAutoInsertedClosing = function() {
653
+    context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
654
+    context.autoInsertedBrackets--;
655
+};
656
+
657
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
658
+    if (context) {
659
+        context.maybeInsertedBrackets = 0;
660
+        context.maybeInsertedRow = -1;
661
+    }
662
+};
663
+
664
+
665
+
666
+oop.inherits(CstyleBehaviour, Behaviour);
667
+
668
+exports.CstyleBehaviour = CstyleBehaviour;
669
+});
670
+
671
+ace.define("ace/mode/sh",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/sh_highlight_rules","ace/range","ace/mode/folding/cstyle","ace/mode/behaviour/cstyle"], function(require, exports, module) {
672
+"use strict";
673
+
674
+var oop = require("../lib/oop");
675
+var TextMode = require("./text").Mode;
676
+var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules;
677
+var Range = require("../range").Range;
678
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
679
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
680
+
681
+var Mode = function() {
682
+    this.HighlightRules = ShHighlightRules;
683
+    this.foldingRules = new CStyleFoldMode();
684
+    this.$behaviour = new CstyleBehaviour();
685
+};
686
+oop.inherits(Mode, TextMode);
687
+
688
+(function() {
689
+
690
+   
691
+    this.lineCommentStart = "#";
692
+
693
+    this.getNextLineIndent = function(state, line, tab) {
694
+        var indent = this.$getIndent(line);
695
+
696
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
697
+        var tokens = tokenizedLine.tokens;
698
+
699
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
700
+            return indent;
701
+        }
702
+
703
+        if (state == "start") {
704
+            var match = line.match(/^.*[\{\(\[\:]\s*$/);
705
+            if (match) {
706
+                indent += tab;
707
+            }
708
+        }
709
+
710
+        return indent;
711
+    };
712
+
713
+    var outdents = {
714
+        "pass": 1,
715
+        "return": 1,
716
+        "raise": 1,
717
+        "break": 1,
718
+        "continue": 1
719
+    };
720
+
721
+    this.checkOutdent = function(state, line, input) {
722
+        if (input !== "\r\n" && input !== "\r" && input !== "\n")
723
+            return false;
724
+
725
+        var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
726
+
727
+        if (!tokens)
728
+            return false;
729
+        do {
730
+            var last = tokens.pop();
731
+        } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
732
+
733
+        if (!last)
734
+            return false;
735
+
736
+        return (last.type == "keyword" && outdents[last.value]);
737
+    };
738
+
739
+    this.autoOutdent = function(state, doc, row) {
740
+
741
+        row += 1;
742
+        var indent = this.$getIndent(doc.getLine(row));
743
+        var tab = doc.getTabString();
744
+        if (indent.slice(-tab.length) == tab)
745
+            doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
746
+    };
747
+
748
+    this.$id = "ace/mode/sh";
749
+}).call(Mode.prototype);
750
+
751
+exports.Mode = Mode;
752
+});
753
+
754
+ace.define("ace/mode/dockerfile_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/sh_highlight_rules"], function(require, exports, module) {
755
+"use strict";
756
+
757
+var oop = require("../lib/oop");
758
+var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules;
759
+
760
+var DockerfileHighlightRules = function() {
761
+    ShHighlightRules.call(this);
762
+
763
+    var startRules = this.$rules.start;
764
+    for (var i = 0; i < startRules.length; i++) {
765
+        if (startRules[i].token == "variable.language") {
766
+            startRules.splice(i, 0, {
767
+                token: "constant.language",
768
+                regex: "(?:^(?:FROM|MAINTAINER|RUN|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD|COPY)\\b)",
769
+                caseInsensitive: true
770
+            });
771
+            break;
772
+        }
773
+    }
774
+    
775
+};
776
+
777
+oop.inherits(DockerfileHighlightRules, ShHighlightRules);
778
+
779
+exports.DockerfileHighlightRules = DockerfileHighlightRules;
780
+});
781
+
782
+ace.define("ace/mode/dockerfile",["require","exports","module","ace/lib/oop","ace/mode/sh","ace/mode/dockerfile_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
783
+"use strict";
784
+
785
+var oop = require("../lib/oop");
786
+var ShMode = require("./sh").Mode;
787
+var DockerfileHighlightRules = require("./dockerfile_highlight_rules").DockerfileHighlightRules;
788
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
789
+
790
+var Mode = function() {
791
+    ShMode.call(this);
792
+    
793
+    this.HighlightRules = DockerfileHighlightRules;
794
+    this.foldingRules = new CStyleFoldMode();
795
+};
796
+oop.inherits(Mode, ShMode);
797
+
798
+(function() {
799
+    this.$id = "ace/mode/dockerfile";
800
+}).call(Mode.prototype);
801
+
802
+exports.Mode = Mode;
803
+});

+ 413
- 0
generator/lib/ace/mode-dot.js Parādīt failu

@@ -0,0 +1,413 @@
1
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
2
+"use strict";
3
+
4
+var Range = require("../range").Range;
5
+
6
+var MatchingBraceOutdent = function() {};
7
+
8
+(function() {
9
+
10
+    this.checkOutdent = function(line, input) {
11
+        if (! /^\s+$/.test(line))
12
+            return false;
13
+
14
+        return /^\s*\}/.test(input);
15
+    };
16
+
17
+    this.autoOutdent = function(doc, row) {
18
+        var line = doc.getLine(row);
19
+        var match = line.match(/^(\s*\})/);
20
+
21
+        if (!match) return 0;
22
+
23
+        var column = match[1].length;
24
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
25
+
26
+        if (!openBracePos || openBracePos.row == row) return 0;
27
+
28
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
29
+        doc.replace(new Range(row, 0, row, column-1), indent);
30
+    };
31
+
32
+    this.$getIndent = function(line) {
33
+        return line.match(/^\s*/)[0];
34
+    };
35
+
36
+}).call(MatchingBraceOutdent.prototype);
37
+
38
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
39
+});
40
+
41
+ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
42
+"use strict";
43
+
44
+var oop = require("../lib/oop");
45
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
46
+
47
+var DocCommentHighlightRules = function() {
48
+    this.$rules = {
49
+        "start" : [ {
50
+            token : "comment.doc.tag",
51
+            regex : "@[\\w\\d_]+" // TODO: fix email addresses
52
+        }, 
53
+        DocCommentHighlightRules.getTagRule(),
54
+        {
55
+            defaultToken : "comment.doc",
56
+            caseInsensitive: true
57
+        }]
58
+    };
59
+};
60
+
61
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
62
+
63
+DocCommentHighlightRules.getTagRule = function(start) {
64
+    return {
65
+        token : "comment.doc.tag.storage.type",
66
+        regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
67
+    };
68
+}
69
+
70
+DocCommentHighlightRules.getStartRule = function(start) {
71
+    return {
72
+        token : "comment.doc", // doc comment
73
+        regex : "\\/\\*(?=\\*)",
74
+        next  : start
75
+    };
76
+};
77
+
78
+DocCommentHighlightRules.getEndRule = function (start) {
79
+    return {
80
+        token : "comment.doc", // closing comment
81
+        regex : "\\*\\/",
82
+        next  : start
83
+    };
84
+};
85
+
86
+
87
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
88
+
89
+});
90
+
91
+ace.define("ace/mode/dot_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/doc_comment_highlight_rules"], function(require, exports, module) {
92
+"use strict";
93
+
94
+var oop = require("../lib/oop");
95
+var lang = require("../lib/lang");
96
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
97
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
98
+
99
+var DotHighlightRules = function() {
100
+
101
+   var keywords = lang.arrayToMap(
102
+        ("strict|node|edge|graph|digraph|subgraph").split("|")
103
+   );
104
+
105
+   var attributes = lang.arrayToMap(
106
+        ("damping|k|url|area|arrowhead|arrowsize|arrowtail|aspect|bb|bgcolor|center|charset|clusterrank|color|colorscheme|comment|compound|concentrate|constraint|decorate|defaultdist|dim|dimen|dir|diredgeconstraints|distortion|dpi|edgeurl|edgehref|edgetarget|edgetooltip|epsilon|esep|fillcolor|fixedsize|fontcolor|fontname|fontnames|fontpath|fontsize|forcelabels|gradientangle|group|headurl|head_lp|headclip|headhref|headlabel|headport|headtarget|headtooltip|height|href|id|image|imagepath|imagescale|label|labelurl|label_scheme|labelangle|labeldistance|labelfloat|labelfontcolor|labelfontname|labelfontsize|labelhref|labeljust|labelloc|labeltarget|labeltooltip|landscape|layer|layerlistsep|layers|layerselect|layersep|layout|len|levels|levelsgap|lhead|lheight|lp|ltail|lwidth|margin|maxiter|mclimit|mindist|minlen|mode|model|mosek|nodesep|nojustify|normalize|nslimit|nslimit1|ordering|orientation|outputorder|overlap|overlap_scaling|pack|packmode|pad|page|pagedir|pencolor|penwidth|peripheries|pin|pos|quadtree|quantum|rank|rankdir|ranksep|ratio|rects|regular|remincross|repulsiveforce|resolution|root|rotate|rotation|samehead|sametail|samplepoints|scale|searchsize|sep|shape|shapefile|showboxes|sides|size|skew|smoothing|sortv|splines|start|style|stylesheet|tailurl|tail_lp|tailclip|tailhref|taillabel|tailport|tailtarget|tailtooltip|target|tooltip|truecolor|vertices|viewport|voro_margin|weight|width|xlabel|xlp|z").split("|")
107
+   );
108
+
109
+   this.$rules = {
110
+        "start" : [
111
+            {
112
+                token : "comment",
113
+                regex : /\/\/.*$/
114
+            }, {
115
+                token : "comment",
116
+                regex : /#.*$/
117
+            }, {
118
+                token : "comment", // multi line comment
119
+                merge : true,
120
+                regex : /\/\*/,
121
+                next : "comment"
122
+            }, {
123
+                token : "string",
124
+                regex : "'(?=.)",
125
+                next  : "qstring"
126
+            }, {
127
+                token : "string",
128
+                regex : '"(?=.)',
129
+                next  : "qqstring"
130
+            }, {
131
+                token : "constant.numeric",
132
+                regex : /[+\-]?\d+(?:(?:\.\d*)?(?:[eE][+\-]?\d+)?)?\b/
133
+            }, {
134
+                token : "keyword.operator",
135
+                regex : /\+|=|\->/
136
+            }, {
137
+                token : "punctuation.operator",
138
+                regex : /,|;/
139
+            }, {
140
+                token : "paren.lparen",
141
+                regex : /[\[{]/
142
+            }, {
143
+                token : "paren.rparen",
144
+                regex : /[\]}]/
145
+            }, {
146
+                token: "comment",
147
+                regex: /^#!.*$/
148
+            }, {
149
+                token: function(value) {
150
+                    if (keywords.hasOwnProperty(value.toLowerCase())) {
151
+                        return "keyword";
152
+                    }
153
+                    else if (attributes.hasOwnProperty(value.toLowerCase())) {
154
+                        return "variable";
155
+                    }
156
+                    else {
157
+                        return "text";
158
+                    }
159
+                },
160
+                regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
161
+           }
162
+        ],
163
+        "comment" : [
164
+            {
165
+                token : "comment", // closing comment
166
+                regex : ".*?\\*\\/",
167
+                merge : true,
168
+                next : "start"
169
+            }, {
170
+                token : "comment", // comment spanning whole line
171
+                merge : true,
172
+                regex : ".+"
173
+            }
174
+        ],
175
+        "qqstring" : [
176
+            {
177
+                token : "string",
178
+                regex : '[^"\\\\]+',
179
+                merge : true
180
+            }, {
181
+                token : "string",
182
+                regex : "\\\\$",
183
+                next  : "qqstring",
184
+                merge : true
185
+            }, {
186
+                token : "string",
187
+                regex : '"|$',
188
+                next  : "start",
189
+                merge : true
190
+            }
191
+        ],
192
+        "qstring" : [
193
+            {
194
+                token : "string",
195
+                regex : "[^'\\\\]+",
196
+                merge : true
197
+            }, {
198
+                token : "string",
199
+                regex : "\\\\$",
200
+                next  : "qstring",
201
+                merge : true
202
+            }, {
203
+                token : "string",
204
+                regex : "'|$",
205
+                next  : "start",
206
+                merge : true
207
+            }
208
+        ]
209
+   };
210
+};
211
+
212
+oop.inherits(DotHighlightRules, TextHighlightRules);
213
+
214
+exports.DotHighlightRules = DotHighlightRules;
215
+
216
+});
217
+
218
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
219
+"use strict";
220
+
221
+var oop = require("../../lib/oop");
222
+var Range = require("../../range").Range;
223
+var BaseFoldMode = require("./fold_mode").FoldMode;
224
+
225
+var FoldMode = exports.FoldMode = function(commentRegex) {
226
+    if (commentRegex) {
227
+        this.foldingStartMarker = new RegExp(
228
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
229
+        );
230
+        this.foldingStopMarker = new RegExp(
231
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
232
+        );
233
+    }
234
+};
235
+oop.inherits(FoldMode, BaseFoldMode);
236
+
237
+(function() {
238
+    
239
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
240
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
241
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
242
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
243
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
244
+    this._getFoldWidgetBase = this.getFoldWidget;
245
+    this.getFoldWidget = function(session, foldStyle, row) {
246
+        var line = session.getLine(row);
247
+    
248
+        if (this.singleLineBlockCommentRe.test(line)) {
249
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
250
+                return "";
251
+        }
252
+    
253
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
254
+    
255
+        if (!fw && this.startRegionRe.test(line))
256
+            return "start"; // lineCommentRegionStart
257
+    
258
+        return fw;
259
+    };
260
+
261
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
262
+        var line = session.getLine(row);
263
+        
264
+        if (this.startRegionRe.test(line))
265
+            return this.getCommentRegionBlock(session, line, row);
266
+        
267
+        var match = line.match(this.foldingStartMarker);
268
+        if (match) {
269
+            var i = match.index;
270
+
271
+            if (match[1])
272
+                return this.openingBracketBlock(session, match[1], row, i);
273
+                
274
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
275
+            
276
+            if (range && !range.isMultiLine()) {
277
+                if (forceMultiline) {
278
+                    range = this.getSectionRange(session, row);
279
+                } else if (foldStyle != "all")
280
+                    range = null;
281
+            }
282
+            
283
+            return range;
284
+        }
285
+
286
+        if (foldStyle === "markbegin")
287
+            return;
288
+
289
+        var match = line.match(this.foldingStopMarker);
290
+        if (match) {
291
+            var i = match.index + match[0].length;
292
+
293
+            if (match[1])
294
+                return this.closingBracketBlock(session, match[1], row, i);
295
+
296
+            return session.getCommentFoldRange(row, i, -1);
297
+        }
298
+    };
299
+    
300
+    this.getSectionRange = function(session, row) {
301
+        var line = session.getLine(row);
302
+        var startIndent = line.search(/\S/);
303
+        var startRow = row;
304
+        var startColumn = line.length;
305
+        row = row + 1;
306
+        var endRow = row;
307
+        var maxRow = session.getLength();
308
+        while (++row < maxRow) {
309
+            line = session.getLine(row);
310
+            var indent = line.search(/\S/);
311
+            if (indent === -1)
312
+                continue;
313
+            if  (startIndent > indent)
314
+                break;
315
+            var subRange = this.getFoldWidgetRange(session, "all", row);
316
+            
317
+            if (subRange) {
318
+                if (subRange.start.row <= startRow) {
319
+                    break;
320
+                } else if (subRange.isMultiLine()) {
321
+                    row = subRange.end.row;
322
+                } else if (startIndent == indent) {
323
+                    break;
324
+                }
325
+            }
326
+            endRow = row;
327
+        }
328
+        
329
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
330
+    };
331
+    
332
+    this.getCommentRegionBlock = function(session, line, row) {
333
+        var startColumn = line.search(/\s*$/);
334
+        var maxRow = session.getLength();
335
+        var startRow = row;
336
+        
337
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
338
+        var depth = 1;
339
+        while (++row < maxRow) {
340
+            line = session.getLine(row);
341
+            var m = re.exec(line);
342
+            if (!m) continue;
343
+            if (m[1]) depth--;
344
+            else depth++;
345
+
346
+            if (!depth) break;
347
+        }
348
+
349
+        var endRow = row;
350
+        if (endRow > startRow) {
351
+            return new Range(startRow, startColumn, endRow, line.length);
352
+        }
353
+    };
354
+
355
+}).call(FoldMode.prototype);
356
+
357
+});
358
+
359
+ace.define("ace/mode/dot",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/matching_brace_outdent","ace/mode/dot_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
360
+"use strict";
361
+
362
+var oop = require("../lib/oop");
363
+var TextMode = require("./text").Mode;
364
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
365
+var DotHighlightRules = require("./dot_highlight_rules").DotHighlightRules;
366
+var DotFoldMode = require("./folding/cstyle").FoldMode;
367
+
368
+var Mode = function() {
369
+    this.HighlightRules = DotHighlightRules;
370
+    this.$outdent = new MatchingBraceOutdent();
371
+    this.foldingRules = new DotFoldMode();
372
+};
373
+oop.inherits(Mode, TextMode);
374
+
375
+(function() {
376
+
377
+    this.lineCommentStart = ["//", "#"];
378
+    this.blockComment = {start: "/*", end: "*/"};
379
+
380
+    this.getNextLineIndent = function(state, line, tab) {
381
+        var indent = this.$getIndent(line);
382
+
383
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
384
+        var tokens = tokenizedLine.tokens;
385
+        var endState = tokenizedLine.state;
386
+
387
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
388
+            return indent;
389
+        }
390
+
391
+        if (state == "start") {
392
+            var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
393
+            if (match) {
394
+                indent += tab;
395
+            }
396
+        }
397
+
398
+        return indent;
399
+    };
400
+
401
+    this.checkOutdent = function(state, line, input) {
402
+        return this.$outdent.checkOutdent(line, input);
403
+    };
404
+
405
+    this.autoOutdent = function(state, doc, row) {
406
+        this.$outdent.autoOutdent(doc, row);
407
+    };
408
+
409
+    this.$id = "ace/mode/dot";
410
+}).call(Mode.prototype);
411
+
412
+exports.Mode = Mode;
413
+});

+ 128
- 0
generator/lib/ace/mode-eiffel.js Parādīt failu

@@ -0,0 +1,128 @@
1
+ace.define("ace/mode/eiffel_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 EiffelHighlightRules = function() {
8
+    var keywords = "across|agent|alias|all|attached|as|assign|attribute|check|" +
9
+        "class|convert|create|debug|deferred|detachable|do|else|elseif|end|" +
10
+        "ensure|expanded|export|external|feature|from|frozen|if|inherit|" +
11
+        "inspect|invariant|like|local|loop|not|note|obsolete|old|once|" +
12
+        "Precursor|redefine|rename|require|rescue|retry|select|separate|" +
13
+        "some|then|undefine|until|variant|when";
14
+
15
+    var operatorKeywords = "and|implies|or|xor";
16
+
17
+    var languageConstants = "Void";
18
+
19
+    var booleanConstants = "True|False";
20
+
21
+    var languageVariables = "Current|Result";
22
+
23
+    var keywordMapper = this.createKeywordMapper({
24
+        "constant.language": languageConstants,
25
+        "constant.language.boolean": booleanConstants,
26
+        "variable.language": languageVariables,
27
+        "keyword.operator": operatorKeywords,
28
+        "keyword": keywords
29
+    }, "identifier", true);
30
+
31
+    var simpleString = /(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)+?/;
32
+
33
+    this.$rules = {
34
+        "start": [{
35
+                token : "string.quoted.other", // Aligned-verbatim-strings (verbatim option not supported)
36
+                regex : /"\[/,
37
+                next: "aligned_verbatim_string"
38
+            }, {
39
+                token : "string.quoted.other", // Non-aligned-verbatim-strings (verbatim option not supported)
40
+                regex : /"\{/,
41
+                next: "non-aligned_verbatim_string"
42
+            }, {
43
+                token : "string.quoted.double",
44
+                regex : /"(?:[^%\b\f\n\r\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?"/
45
+            }, {
46
+                token : "comment.line.double-dash",
47
+                regex : /--.*/
48
+            }, {
49
+                token : "constant.character",
50
+                regex : /'(?:[^%\b\f\n\r\t\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)'/
51
+            }, {
52
+                token : "constant.numeric", // hexa | octal | bin
53
+                regex : /\b0(?:[xX][\da-fA-F](?:_*[\da-fA-F])*|[cC][0-7](?:_*[0-7])*|[bB][01](?:_*[01])*)\b/
54
+            }, {
55
+                token : "constant.numeric",
56
+                regex : /(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*|\d(?:_*\d)*\.?/
57
+            }, {
58
+                token : "paren.lparen",
59
+                regex : /[\[({]|<<|\|\(/
60
+            }, {
61
+                token : "paren.rparen",
62
+                regex : /[\])}]|>>|\|\)/
63
+            }, {
64
+                token : "keyword.operator", // punctuation
65
+                regex : /:=|->|\.(?=\w)|[;,:?]/
66
+            }, {
67
+                token : "keyword.operator",
68
+                regex : /\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/
69
+            }, {
70
+                token : function (v) {
71
+                    var result = keywordMapper (v);
72
+                    if (result === "identifier" && v === v.toUpperCase ()) {
73
+                        result =  "entity.name.type";
74
+                    }
75
+                    return result;
76
+                },
77
+                regex : /[a-zA-Z][a-zA-Z\d_]*\b/
78
+            }, {
79
+                token : "text",
80
+                regex : /\s+/
81
+            }
82
+        ],
83
+        "aligned_verbatim_string" : [{
84
+                token : "string",
85
+                regex : /]"/,
86
+                next : "start"
87
+            }, {
88
+                token : "string",
89
+                regex : simpleString
90
+            }
91
+        ],
92
+        "non-aligned_verbatim_string" : [{
93
+                token : "string.quoted.other",
94
+                regex : /}"/,
95
+                next : "start"
96
+            }, {
97
+                token : "string.quoted.other",
98
+                regex : simpleString
99
+            }
100
+        ]};
101
+};
102
+
103
+oop.inherits(EiffelHighlightRules, TextHighlightRules);
104
+
105
+exports.EiffelHighlightRules = EiffelHighlightRules;
106
+});
107
+
108
+ace.define("ace/mode/eiffel",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/eiffel_highlight_rules","ace/range"], function(require, exports, module) {
109
+"use strict";
110
+
111
+var oop = require("../lib/oop");
112
+var TextMode = require("./text").Mode;
113
+var EiffelHighlightRules = require("./eiffel_highlight_rules").EiffelHighlightRules;
114
+var Range = require("../range").Range;
115
+
116
+var Mode = function() {
117
+    this.HighlightRules = EiffelHighlightRules;
118
+};
119
+oop.inherits(Mode, TextMode);
120
+
121
+(function() {
122
+    this.lineCommentStart = "--";
123
+    this.$id = "ace/mode/eiffel";
124
+}).call(Mode.prototype);
125
+
126
+exports.Mode = Mode;
127
+
128
+});

+ 2950
- 0
generator/lib/ace/mode-ejs.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 493
- 0
generator/lib/ace/mode-elixir.js Parādīt failu

@@ -0,0 +1,493 @@
1
+ace.define("ace/mode/elixir_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 ElixirHighlightRules = function() {
8
+
9
+    this.$rules = { start: 
10
+       [ { token: 
11
+            [ 'meta.module.elixir',
12
+              'keyword.control.module.elixir',
13
+              'meta.module.elixir',
14
+              'entity.name.type.module.elixir' ],
15
+           regex: '^(\\s*)(defmodule)(\\s+)((?:[A-Z]\\w*\\s*\\.\\s*)*[A-Z]\\w*)' },
16
+         { token: 'comment.documentation.heredoc',
17
+           regex: '@(?:module|type)?doc (?:~[a-z])?"""',
18
+           push: 
19
+            [ { token: 'comment.documentation.heredoc',
20
+                regex: '\\s*"""',
21
+                next: 'pop' },
22
+              { include: '#interpolated_elixir' },
23
+              { include: '#escaped_char' },
24
+              { defaultToken: 'comment.documentation.heredoc' } ],
25
+           comment: '@doc with heredocs is treated as documentation' },
26
+         { token: 'comment.documentation.heredoc',
27
+           regex: '@(?:module|type)?doc ~[A-Z]"""',
28
+           push: 
29
+            [ { token: 'comment.documentation.heredoc',
30
+                regex: '\\s*"""',
31
+                next: 'pop' },
32
+              { defaultToken: 'comment.documentation.heredoc' } ],
33
+           comment: '@doc with heredocs is treated as documentation' },
34
+         { token: 'comment.documentation.heredoc',
35
+           regex: '@(?:module|type)?doc (?:~[a-z])?\'\'\'',
36
+           push: 
37
+            [ { token: 'comment.documentation.heredoc',
38
+                regex: '\\s*\'\'\'',
39
+                next: 'pop' },
40
+              { include: '#interpolated_elixir' },
41
+              { include: '#escaped_char' },
42
+              { defaultToken: 'comment.documentation.heredoc' } ],
43
+           comment: '@doc with heredocs is treated as documentation' },
44
+         { token: 'comment.documentation.heredoc',
45
+           regex: '@(?:module|type)?doc ~[A-Z]\'\'\'',
46
+           push: 
47
+            [ { token: 'comment.documentation.heredoc',
48
+                regex: '\\s*\'\'\'',
49
+                next: 'pop' },
50
+              { defaultToken: 'comment.documentation.heredoc' } ],
51
+           comment: '@doc with heredocs is treated as documentation' },
52
+         { token: 'comment.documentation.false',
53
+           regex: '@(?:module|type)?doc false',
54
+           comment: '@doc false is treated as documentation' },
55
+         { token: 'comment.documentation.string',
56
+           regex: '@(?:module|type)?doc "',
57
+           push: 
58
+            [ { token: 'comment.documentation.string',
59
+                regex: '"',
60
+                next: 'pop' },
61
+              { include: '#interpolated_elixir' },
62
+              { include: '#escaped_char' },
63
+              { defaultToken: 'comment.documentation.string' } ],
64
+           comment: '@doc with string is treated as documentation' },
65
+         { token: 'keyword.control.elixir',
66
+           regex: '\\b(?:do|end|case|bc|lc|for|if|cond|unless|try|receive|fn|defmodule|defp?|defprotocol|defimpl|defrecord|defstruct|defmacrop?|defdelegate|defcallback|defmacrocallback|defexception|defoverridable|exit|after|rescue|catch|else|raise|throw|import|require|alias|use|quote|unquote|super)\\b(?![?!])',
67
+           TODO: 'FIXME: regexp doesn\'t have js equivalent',
68
+           originalRegex: '(?<!\\.)\\b(do|end|case|bc|lc|for|if|cond|unless|try|receive|fn|defmodule|defp?|defprotocol|defimpl|defrecord|defstruct|defmacrop?|defdelegate|defcallback|defmacrocallback|defexception|defoverridable|exit|after|rescue|catch|else|raise|throw|import|require|alias|use|quote|unquote|super)\\b(?![?!])' },
69
+         { token: 'keyword.operator.elixir',
70
+           regex: '\\b(?:and|not|or|when|xor|in|inlist|inbits)\\b',
71
+           TODO: 'FIXME: regexp doesn\'t have js equivalent',
72
+           originalRegex: '(?<!\\.)\\b(and|not|or|when|xor|in|inlist|inbits)\\b',
73
+           comment: ' as above, just doesn\'t need a \'end\' and does a logic operation' },
74
+         { token: 'constant.language.elixir',
75
+           regex: '\\b(?:nil|true|false)\\b(?![?!])' },
76
+         { token: 'variable.language.elixir',
77
+           regex: '\\b__(?:CALLER|ENV|MODULE|DIR)__\\b(?![?!])' },
78
+         { token: 
79
+            [ 'punctuation.definition.variable.elixir',
80
+              'variable.other.readwrite.module.elixir' ],
81
+           regex: '(@)([a-zA-Z_]\\w*)' },
82
+         { token: 
83
+            [ 'punctuation.definition.variable.elixir',
84
+              'variable.other.anonymous.elixir' ],
85
+           regex: '(&)(\\d*)' },
86
+         { token: 'variable.other.constant.elixir',
87
+           regex: '\\b[A-Z]\\w*\\b' },
88
+         { token: 'constant.numeric.elixir',
89
+           regex: '\\b(?:0x[\\da-fA-F](?:_?[\\da-fA-F])*|\\d(?:_?\\d)*(?:\\.(?![^[:space:][:digit:]])(?:_?\\d)*)?(?:[eE][-+]?\\d(?:_?\\d)*)?|0b[01]+|0o[0-7]+)\\b',
90
+           TODO: 'FIXME: regexp doesn\'t have js equivalent',
91
+           originalRegex: '\\b(0x\\h(?>_?\\h)*|\\d(?>_?\\d)*(\\.(?![^[:space:][:digit:]])(?>_?\\d)*)?([eE][-+]?\\d(?>_?\\d)*)?|0b[01]+|0o[0-7]+)\\b' },
92
+         { token: 'punctuation.definition.constant.elixir',
93
+           regex: ':\'',
94
+           push: 
95
+            [ { token: 'punctuation.definition.constant.elixir',
96
+                regex: '\'',
97
+                next: 'pop' },
98
+              { include: '#interpolated_elixir' },
99
+              { include: '#escaped_char' },
100
+              { defaultToken: 'constant.other.symbol.single-quoted.elixir' } ] },
101
+         { token: 'punctuation.definition.constant.elixir',
102
+           regex: ':"',
103
+           push: 
104
+            [ { token: 'punctuation.definition.constant.elixir',
105
+                regex: '"',
106
+                next: 'pop' },
107
+              { include: '#interpolated_elixir' },
108
+              { include: '#escaped_char' },
109
+              { defaultToken: 'constant.other.symbol.double-quoted.elixir' } ] },
110
+         { token: 'punctuation.definition.string.begin.elixir',
111
+           regex: '(?:\'\'\')',
112
+           TODO: 'FIXME: regexp doesn\'t have js equivalent',
113
+           originalRegex: '(?>\'\'\')',
114
+           push: 
115
+            [ { token: 'punctuation.definition.string.end.elixir',
116
+                regex: '^\\s*\'\'\'',
117
+                next: 'pop' },
118
+              { include: '#interpolated_elixir' },
119
+              { include: '#escaped_char' },
120
+              { defaultToken: 'support.function.variable.quoted.single.heredoc.elixir' } ],
121
+           comment: 'Single-quoted heredocs' },
122
+         { token: 'punctuation.definition.string.begin.elixir',
123
+           regex: '\'',
124
+           push: 
125
+            [ { token: 'punctuation.definition.string.end.elixir',
126
+                regex: '\'',
127
+                next: 'pop' },
128
+              { include: '#interpolated_elixir' },
129
+              { include: '#escaped_char' },
130
+              { defaultToken: 'support.function.variable.quoted.single.elixir' } ],
131
+           comment: 'single quoted string (allows for interpolation)' },
132
+         { token: 'punctuation.definition.string.begin.elixir',
133
+           regex: '(?:""")',
134
+           TODO: 'FIXME: regexp doesn\'t have js equivalent',
135
+           originalRegex: '(?>""")',
136
+           push: 
137
+            [ { token: 'punctuation.definition.string.end.elixir',
138
+                regex: '^\\s*"""',
139
+                next: 'pop' },
140
+              { include: '#interpolated_elixir' },
141
+              { include: '#escaped_char' },
142
+              { defaultToken: 'string.quoted.double.heredoc.elixir' } ],
143
+           comment: 'Double-quoted heredocs' },
144
+         { token: 'punctuation.definition.string.begin.elixir',
145
+           regex: '"',
146
+           push: 
147
+            [ { token: 'punctuation.definition.string.end.elixir',
148
+                regex: '"',
149
+                next: 'pop' },
150
+              { include: '#interpolated_elixir' },
151
+              { include: '#escaped_char' },
152
+              { defaultToken: 'string.quoted.double.elixir' } ],
153
+           comment: 'double quoted string (allows for interpolation)' },
154
+         { token: 'punctuation.definition.string.begin.elixir',
155
+           regex: '~[a-z](?:""")',
156
+           TODO: 'FIXME: regexp doesn\'t have js equivalent',
157
+           originalRegex: '~[a-z](?>""")',
158
+           push: 
159
+            [ { token: 'punctuation.definition.string.end.elixir',
160
+                regex: '^\\s*"""',
161
+                next: 'pop' },
162
+              { include: '#interpolated_elixir' },
163
+              { include: '#escaped_char' },
164
+              { defaultToken: 'string.quoted.double.heredoc.elixir' } ],
165
+           comment: 'Double-quoted heredocs sigils' },
166
+         { token: 'punctuation.definition.string.begin.elixir',
167
+           regex: '~[a-z]\\{',
168
+           push: 
169
+            [ { token: 'punctuation.definition.string.end.elixir',
170
+                regex: '\\}[a-z]*',
171
+                next: 'pop' },
172
+              { include: '#interpolated_elixir' },
173
+              { include: '#escaped_char' },
174
+              { defaultToken: 'string.interpolated.elixir' } ],
175
+           comment: 'sigil (allow for interpolation)' },
176
+         { token: 'punctuation.definition.string.begin.elixir',
177
+           regex: '~[a-z]\\[',
178
+           push: 
179
+            [ { token: 'punctuation.definition.string.end.elixir',
180
+                regex: '\\][a-z]*',
181
+                next: 'pop' },
182
+              { include: '#interpolated_elixir' },
183
+              { include: '#escaped_char' },
184
+              { defaultToken: 'string.interpolated.elixir' } ],
185
+           comment: 'sigil (allow for interpolation)' },
186
+         { token: 'punctuation.definition.string.begin.elixir',
187
+           regex: '~[a-z]\\<',
188
+           push: 
189
+            [ { token: 'punctuation.definition.string.end.elixir',
190
+                regex: '\\>[a-z]*',
191
+                next: 'pop' },
192
+              { include: '#interpolated_elixir' },
193
+              { include: '#escaped_char' },
194
+              { defaultToken: 'string.interpolated.elixir' } ],
195
+           comment: 'sigil (allow for interpolation)' },
196
+         { token: 'punctuation.definition.string.begin.elixir',
197
+           regex: '~[a-z]\\(',
198
+           push: 
199
+            [ { token: 'punctuation.definition.string.end.elixir',
200
+                regex: '\\)[a-z]*',
201
+                next: 'pop' },
202
+              { include: '#interpolated_elixir' },
203
+              { include: '#escaped_char' },
204
+              { defaultToken: 'string.interpolated.elixir' } ],
205
+           comment: 'sigil (allow for interpolation)' },
206
+         { token: 'punctuation.definition.string.begin.elixir',
207
+           regex: '~[a-z][^\\w]',
208
+           push: 
209
+            [ { token: 'punctuation.definition.string.end.elixir',
210
+                regex: '[^\\w][a-z]*',
211
+                next: 'pop' },
212
+              { include: '#interpolated_elixir' },
213
+              { include: '#escaped_char' },
214
+              { include: '#escaped_char' },
215
+              { defaultToken: 'string.interpolated.elixir' } ],
216
+           comment: 'sigil (allow for interpolation)' },
217
+         { token: 'punctuation.definition.string.begin.elixir',
218
+           regex: '~[A-Z](?:""")',
219
+           TODO: 'FIXME: regexp doesn\'t have js equivalent',
220
+           originalRegex: '~[A-Z](?>""")',
221
+           push: 
222
+            [ { token: 'punctuation.definition.string.end.elixir',
223
+                regex: '^\\s*"""',
224
+                next: 'pop' },
225
+              { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
226
+           comment: 'Double-quoted heredocs sigils' },
227
+         { token: 'punctuation.definition.string.begin.elixir',
228
+           regex: '~[A-Z]\\{',
229
+           push: 
230
+            [ { token: 'punctuation.definition.string.end.elixir',
231
+                regex: '\\}[a-z]*',
232
+                next: 'pop' },
233
+              { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
234
+           comment: 'sigil (without interpolation)' },
235
+         { token: 'punctuation.definition.string.begin.elixir',
236
+           regex: '~[A-Z]\\[',
237
+           push: 
238
+            [ { token: 'punctuation.definition.string.end.elixir',
239
+                regex: '\\][a-z]*',
240
+                next: 'pop' },
241
+              { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
242
+           comment: 'sigil (without interpolation)' },
243
+         { token: 'punctuation.definition.string.begin.elixir',
244
+           regex: '~[A-Z]\\<',
245
+           push: 
246
+            [ { token: 'punctuation.definition.string.end.elixir',
247
+                regex: '\\>[a-z]*',
248
+                next: 'pop' },
249
+              { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
250
+           comment: 'sigil (without interpolation)' },
251
+         { token: 'punctuation.definition.string.begin.elixir',
252
+           regex: '~[A-Z]\\(',
253
+           push: 
254
+            [ { token: 'punctuation.definition.string.end.elixir',
255
+                regex: '\\)[a-z]*',
256
+                next: 'pop' },
257
+              { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
258
+           comment: 'sigil (without interpolation)' },
259
+         { token: 'punctuation.definition.string.begin.elixir',
260
+           regex: '~[A-Z][^\\w]',
261
+           push: 
262
+            [ { token: 'punctuation.definition.string.end.elixir',
263
+                regex: '[^\\w][a-z]*',
264
+                next: 'pop' },
265
+              { defaultToken: 'string.quoted.other.literal.upper.elixir' } ],
266
+           comment: 'sigil (without interpolation)' },
267
+         { token: ['punctuation.definition.constant.elixir', 'constant.other.symbol.elixir'],
268
+           regex: '(:)([a-zA-Z_][\\w@]*(?:[?!]|=(?![>=]))?|\\<\\>|===?|!==?|<<>>|<<<|>>>|~~~|::|<\\-|\\|>|=>|~|~=|=|/|\\\\\\\\|\\*\\*?|\\.\\.?\\.?|>=?|<=?|&&?&?|\\+\\+?|\\-\\-?|\\|\\|?\\|?|\\!|@|\\%?\\{\\}|%|\\[\\]|\\^(?:\\^\\^)?)',
269
+           TODO: 'FIXME: regexp doesn\'t have js equivalent',
270
+           originalRegex: '(?<!:)(:)(?>[a-zA-Z_][\\w@]*(?>[?!]|=(?![>=]))?|\\<\\>|===?|!==?|<<>>|<<<|>>>|~~~|::|<\\-|\\|>|=>|~|~=|=|/|\\\\\\\\|\\*\\*?|\\.\\.?\\.?|>=?|<=?|&&?&?|\\+\\+?|\\-\\-?|\\|\\|?\\|?|\\!|@|\\%?\\{\\}|%|\\[\\]|\\^(\\^\\^)?)',
271
+           comment: 'symbols' },
272
+         { token: 'punctuation.definition.constant.elixir',
273
+           regex: '(?:[a-zA-Z_][\\w@]*(?:[?!])?):(?!:)',
274
+           TODO: 'FIXME: regexp doesn\'t have js equivalent',
275
+           originalRegex: '(?>[a-zA-Z_][\\w@]*(?>[?!])?)(:)(?!:)',
276
+           comment: 'symbols' },
277
+         { token: 
278
+            [ 'punctuation.definition.comment.elixir',
279
+              'comment.line.number-sign.elixir' ],
280
+           regex: '(#)(.*)' },
281
+         { token: 'constant.numeric.elixir',
282
+           regex: '\\?(?:\\\\(?:x[\\da-fA-F]{1,2}(?![\\da-fA-F])\\b|[^xMC])|[^\\s\\\\])',
283
+           TODO: 'FIXME: regexp doesn\'t have js equivalent',
284
+           originalRegex: '(?<!\\w)\\?(\\\\(x\\h{1,2}(?!\\h)\\b|[^xMC])|[^\\s\\\\])',
285
+           comment: '\n\t\t\tmatches questionmark-letters.\n\n\t\t\texamples (1st alternation = hex):\n\t\t\t?\\x1     ?\\x61\n\n\t\t\texamples (2rd alternation = escaped):\n\t\t\t?\\n      ?\\b\n\n\t\t\texamples (3rd alternation = normal):\n\t\t\t?a       ?A       ?0 \n\t\t\t?*       ?"       ?( \n\t\t\t?.       ?#\n\t\t\t\n\t\t\tthe negative lookbehind prevents against matching\n\t\t\tp(42.tainted?)\n\t\t\t' },
286
+         { token: 'keyword.operator.assignment.augmented.elixir',
287
+           regex: '\\+=|\\-=|\\|\\|=|~=|&&=' },
288
+         { token: 'keyword.operator.comparison.elixir',
289
+           regex: '===?|!==?|<=?|>=?' },
290
+         { token: 'keyword.operator.bitwise.elixir',
291
+           regex: '\\|{3}|&{3}|\\^{3}|<{3}|>{3}|~{3}' },
292
+         { token: 'keyword.operator.logical.elixir',
293
+           regex: '!+|\\bnot\\b|&&|\\band\\b|\\|\\||\\bor\\b|\\bxor\\b',
294
+           originalRegex: '(?<=[ \\t])!+|\\bnot\\b|&&|\\band\\b|\\|\\||\\bor\\b|\\bxor\\b' },
295
+         { token: 'keyword.operator.arithmetic.elixir',
296
+           regex: '\\*|\\+|\\-|/' },
297
+         { token: 'keyword.operator.other.elixir',
298
+           regex: '\\||\\+\\+|\\-\\-|\\*\\*|\\\\\\\\|\\<\\-|\\<\\>|\\<\\<|\\>\\>|\\:\\:|\\.\\.|\\|>|~|=>' },
299
+         { token: 'keyword.operator.assignment.elixir', regex: '=' },
300
+         { token: 'punctuation.separator.other.elixir', regex: ':' },
301
+         { token: 'punctuation.separator.statement.elixir',
302
+           regex: '\\;' },
303
+         { token: 'punctuation.separator.object.elixir', regex: ',' },
304
+         { token: 'punctuation.separator.method.elixir', regex: '\\.' },
305
+         { token: 'punctuation.section.scope.elixir', regex: '\\{|\\}' },
306
+         { token: 'punctuation.section.array.elixir', regex: '\\[|\\]' },
307
+         { token: 'punctuation.section.function.elixir',
308
+           regex: '\\(|\\)' } ],
309
+      '#escaped_char': 
310
+       [ { token: 'constant.character.escape.elixir',
311
+           regex: '\\\\(?:x[\\da-fA-F]{1,2}|.)' } ],
312
+      '#interpolated_elixir': 
313
+       [ { token: 
314
+            [ 'source.elixir.embedded.source',
315
+              'source.elixir.embedded.source.empty' ],
316
+           regex: '(#\\{)(\\})' },
317
+         { todo: 
318
+            { token: 'punctuation.section.embedded.elixir',
319
+              regex: '#\\{',
320
+              push: 
321
+               [ { token: 'punctuation.section.embedded.elixir',
322
+                   regex: '\\}',
323
+                   next: 'pop' },
324
+                 { include: '#nest_curly_and_self' },
325
+                 { include: '$self' },
326
+                 { defaultToken: 'source.elixir.embedded.source' } ] } } ],
327
+      '#nest_curly_and_self': 
328
+       [ { token: 'punctuation.section.scope.elixir',
329
+           regex: '\\{',
330
+           push: 
331
+            [ { token: 'punctuation.section.scope.elixir',
332
+                regex: '\\}',
333
+                next: 'pop' },
334
+              { include: '#nest_curly_and_self' } ] },
335
+         { include: '$self' } ],
336
+      '#regex_sub': 
337
+       [ { include: '#interpolated_elixir' },
338
+         { include: '#escaped_char' },
339
+         { token: 
340
+            [ 'punctuation.definition.arbitrary-repitition.elixir',
341
+              'string.regexp.arbitrary-repitition.elixir',
342
+              'string.regexp.arbitrary-repitition.elixir',
343
+              'punctuation.definition.arbitrary-repitition.elixir' ],
344
+           regex: '(\\{)(\\d+)((?:,\\d+)?)(\\})' },
345
+         { token: 'punctuation.definition.character-class.elixir',
346
+           regex: '\\[(?:\\^?\\])?',
347
+           push: 
348
+            [ { token: 'punctuation.definition.character-class.elixir',
349
+                regex: '\\]',
350
+                next: 'pop' },
351
+              { include: '#escaped_char' },
352
+              { defaultToken: 'string.regexp.character-class.elixir' } ] },
353
+         { token: 'punctuation.definition.group.elixir',
354
+           regex: '\\(',
355
+           push: 
356
+            [ { token: 'punctuation.definition.group.elixir',
357
+                regex: '\\)',
358
+                next: 'pop' },
359
+              { include: '#regex_sub' },
360
+              { defaultToken: 'string.regexp.group.elixir' } ] },
361
+         { token: 
362
+            [ 'punctuation.definition.comment.elixir',
363
+              'comment.line.number-sign.elixir' ],
364
+           regex: '(?:^|\\s)(#)(\\s[[a-zA-Z0-9,. \\t?!-][^\\x00-\\x7F]]*$)',
365
+           originalRegex: '(?<=^|\\s)(#)\\s[[a-zA-Z0-9,. \\t?!-][^\\x{00}-\\x{7F}]]*$',
366
+           comment: 'We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags.' } ] }
367
+    
368
+    this.normalizeRules();
369
+};
370
+
371
+ElixirHighlightRules.metaData = { comment: 'Textmate bundle for Elixir Programming Language.',
372
+      fileTypes: [ 'ex', 'exs' ],
373
+      firstLineMatch: '^#!/.*\\belixir',
374
+      foldingStartMarker: '(after|else|catch|rescue|\\-\\>|\\{|\\[|do)\\s*$',
375
+      foldingStopMarker: '^\\s*((\\}|\\]|after|else|catch|rescue)\\s*$|end\\b)',
376
+      keyEquivalent: '^~E',
377
+      name: 'Elixir',
378
+      scopeName: 'source.elixir' }
379
+
380
+
381
+oop.inherits(ElixirHighlightRules, TextHighlightRules);
382
+
383
+exports.ElixirHighlightRules = ElixirHighlightRules;
384
+});
385
+
386
+ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
387
+"use strict";
388
+
389
+var oop = require("../../lib/oop");
390
+var BaseFoldMode = require("./fold_mode").FoldMode;
391
+var Range = require("../../range").Range;
392
+
393
+var FoldMode = exports.FoldMode = function() {};
394
+oop.inherits(FoldMode, BaseFoldMode);
395
+
396
+(function() {
397
+
398
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
399
+        var range = this.indentationBlock(session, row);
400
+        if (range)
401
+            return range;
402
+
403
+        var re = /\S/;
404
+        var line = session.getLine(row);
405
+        var startLevel = line.search(re);
406
+        if (startLevel == -1 || line[startLevel] != "#")
407
+            return;
408
+
409
+        var startColumn = line.length;
410
+        var maxRow = session.getLength();
411
+        var startRow = row;
412
+        var endRow = row;
413
+
414
+        while (++row < maxRow) {
415
+            line = session.getLine(row);
416
+            var level = line.search(re);
417
+
418
+            if (level == -1)
419
+                continue;
420
+
421
+            if (line[level] != "#")
422
+                break;
423
+
424
+            endRow = row;
425
+        }
426
+
427
+        if (endRow > startRow) {
428
+            var endColumn = session.getLine(endRow).length;
429
+            return new Range(startRow, startColumn, endRow, endColumn);
430
+        }
431
+    };
432
+    this.getFoldWidget = function(session, foldStyle, row) {
433
+        var line = session.getLine(row);
434
+        var indent = line.search(/\S/);
435
+        var next = session.getLine(row + 1);
436
+        var prev = session.getLine(row - 1);
437
+        var prevIndent = prev.search(/\S/);
438
+        var nextIndent = next.search(/\S/);
439
+
440
+        if (indent == -1) {
441
+            session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
442
+            return "";
443
+        }
444
+        if (prevIndent == -1) {
445
+            if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
446
+                session.foldWidgets[row - 1] = "";
447
+                session.foldWidgets[row + 1] = "";
448
+                return "start";
449
+            }
450
+        } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
451
+            if (session.getLine(row - 2).search(/\S/) == -1) {
452
+                session.foldWidgets[row - 1] = "start";
453
+                session.foldWidgets[row + 1] = "";
454
+                return "";
455
+            }
456
+        }
457
+
458
+        if (prevIndent!= -1 && prevIndent < indent)
459
+            session.foldWidgets[row - 1] = "start";
460
+        else
461
+            session.foldWidgets[row - 1] = "";
462
+
463
+        if (indent < nextIndent)
464
+            return "start";
465
+        else
466
+            return "";
467
+    };
468
+
469
+}).call(FoldMode.prototype);
470
+
471
+});
472
+
473
+ace.define("ace/mode/elixir",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/elixir_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module) {
474
+"use strict";
475
+
476
+var oop = require("../lib/oop");
477
+var TextMode = require("./text").Mode;
478
+var ElixirHighlightRules = require("./elixir_highlight_rules").ElixirHighlightRules;
479
+var FoldMode = require("./folding/coffee").FoldMode;
480
+
481
+var Mode = function() {
482
+    this.HighlightRules = ElixirHighlightRules;
483
+    this.foldingRules = new FoldMode();
484
+};
485
+oop.inherits(Mode, TextMode);
486
+
487
+(function() {
488
+    this.lineCommentStart = "#";
489
+    this.$id = "ace/mode/elixir"
490
+}).call(Mode.prototype);
491
+
492
+exports.Mode = Mode;
493
+});

+ 294
- 0
generator/lib/ace/mode-elm.js Parādīt failu

@@ -0,0 +1,294 @@
1
+ace.define("ace/mode/elm_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 ElmHighlightRules = function() {
8
+    var keywordMapper = this.createKeywordMapper({
9
+       "keyword": "as|case|class|data|default|deriving|do|else|export|foreign|" +
10
+            "hiding|jsevent|if|import|in|infix|infixl|infixr|instance|let|" +
11
+            "module|newtype|of|open|then|type|where|_|port|\u03BB"
12
+    }, "identifier");
13
+    
14
+    var escapeRe = /\\(\d+|['"\\&trnbvf])/;
15
+    
16
+    var smallRe = /[a-z_]/.source;
17
+    var largeRe = /[A-Z]/.source;
18
+    var idRe = /[a-z_A-Z0-9\']/.source;
19
+
20
+    this.$rules = {
21
+        start: [{
22
+            token: "string.start",
23
+            regex: '"',
24
+            next: "string"
25
+        }, {
26
+            token: "string.character",
27
+            regex: "'(?:" + escapeRe.source + "|.)'?"
28
+        }, {
29
+            regex: /0(?:[xX][0-9A-Fa-f]+|[oO][0-7]+)|\d+(\.\d+)?([eE][-+]?\d*)?/,
30
+            token: "constant.numeric"
31
+        }, {
32
+            token : "keyword",
33
+            regex : /\.\.|\||:|=|\\|\"|->|<-|\u2192/
34
+        }, {
35
+            token : "keyword.operator",
36
+            regex : /[-!#$%&*+.\/<=>?@\\^|~:\u03BB\u2192]+/
37
+        }, {
38
+            token : "operator.punctuation",
39
+            regex : /[,;`]/
40
+        }, {
41
+            regex : largeRe + idRe + "+\\.?",
42
+            token : function(value) {
43
+                if (value[value.length - 1] == ".")
44
+                    return "entity.name.function"; 
45
+                return "constant.language"; 
46
+            }
47
+        }, {
48
+            regex : "^" + smallRe  + idRe + "+",
49
+            token : function(value) {
50
+                return "constant.language"; 
51
+            }
52
+        }, {
53
+            token : keywordMapper,
54
+            regex : "[\\w\\xff-\\u218e\\u2455-\\uffff]+\\b"
55
+        }, {
56
+            regex: "{-#?",
57
+            token: "comment.start",
58
+            onMatch: function(value, currentState, stack) {
59
+                this.next = value.length == 2 ? "blockComment" : "docComment";
60
+                return this.token;
61
+            }
62
+        }, {
63
+            token: "variable.language",
64
+            regex: /\[markdown\|/,
65
+            next: "markdown"
66
+        }, {
67
+            token: "paren.lparen",
68
+            regex: /[\[({]/ 
69
+        }, {
70
+            token: "paren.rparen",
71
+            regex: /[\])}]/
72
+        }, ],
73
+        markdown: [{
74
+            regex: /\|\]/,
75
+            next: "start"
76
+        }, {
77
+            defaultToken : "string"
78
+        }],
79
+        blockComment: [{
80
+            regex: "{-",
81
+            token: "comment.start",
82
+            push: "blockComment"
83
+        }, {
84
+            regex: "-}",
85
+            token: "comment.end",
86
+            next: "pop"
87
+        }, {
88
+            defaultToken: "comment"
89
+        }],
90
+        docComment: [{
91
+            regex: "{-",
92
+            token: "comment.start",
93
+            push: "docComment"
94
+        }, {
95
+            regex: "-}",
96
+            token: "comment.end",
97
+            next: "pop" 
98
+        }, {
99
+            defaultToken: "doc.comment"
100
+        }],
101
+        string: [{
102
+            token: "constant.language.escape",
103
+            regex: escapeRe,
104
+        }, {
105
+            token: "text",
106
+            regex: /\\(\s|$)/,
107
+            next: "stringGap"
108
+        }, {
109
+            token: "string.end",
110
+            regex: '"',
111
+            next: "start"
112
+        }],
113
+        stringGap: [{
114
+            token: "text",
115
+            regex: /\\/,
116
+            next: "string"
117
+        }, {
118
+            token: "error",
119
+            regex: "",
120
+            next: "start"
121
+        }],
122
+    };
123
+    
124
+    this.normalizeRules();
125
+};
126
+
127
+oop.inherits(ElmHighlightRules, TextHighlightRules);
128
+
129
+exports.ElmHighlightRules = ElmHighlightRules;
130
+});
131
+
132
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
133
+"use strict";
134
+
135
+var oop = require("../../lib/oop");
136
+var Range = require("../../range").Range;
137
+var BaseFoldMode = require("./fold_mode").FoldMode;
138
+
139
+var FoldMode = exports.FoldMode = function(commentRegex) {
140
+    if (commentRegex) {
141
+        this.foldingStartMarker = new RegExp(
142
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
143
+        );
144
+        this.foldingStopMarker = new RegExp(
145
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
146
+        );
147
+    }
148
+};
149
+oop.inherits(FoldMode, BaseFoldMode);
150
+
151
+(function() {
152
+    
153
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
154
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
155
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
156
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
157
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
158
+    this._getFoldWidgetBase = this.getFoldWidget;
159
+    this.getFoldWidget = function(session, foldStyle, row) {
160
+        var line = session.getLine(row);
161
+    
162
+        if (this.singleLineBlockCommentRe.test(line)) {
163
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
164
+                return "";
165
+        }
166
+    
167
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
168
+    
169
+        if (!fw && this.startRegionRe.test(line))
170
+            return "start"; // lineCommentRegionStart
171
+    
172
+        return fw;
173
+    };
174
+
175
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
176
+        var line = session.getLine(row);
177
+        
178
+        if (this.startRegionRe.test(line))
179
+            return this.getCommentRegionBlock(session, line, row);
180
+        
181
+        var match = line.match(this.foldingStartMarker);
182
+        if (match) {
183
+            var i = match.index;
184
+
185
+            if (match[1])
186
+                return this.openingBracketBlock(session, match[1], row, i);
187
+                
188
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
189
+            
190
+            if (range && !range.isMultiLine()) {
191
+                if (forceMultiline) {
192
+                    range = this.getSectionRange(session, row);
193
+                } else if (foldStyle != "all")
194
+                    range = null;
195
+            }
196
+            
197
+            return range;
198
+        }
199
+
200
+        if (foldStyle === "markbegin")
201
+            return;
202
+
203
+        var match = line.match(this.foldingStopMarker);
204
+        if (match) {
205
+            var i = match.index + match[0].length;
206
+
207
+            if (match[1])
208
+                return this.closingBracketBlock(session, match[1], row, i);
209
+
210
+            return session.getCommentFoldRange(row, i, -1);
211
+        }
212
+    };
213
+    
214
+    this.getSectionRange = function(session, row) {
215
+        var line = session.getLine(row);
216
+        var startIndent = line.search(/\S/);
217
+        var startRow = row;
218
+        var startColumn = line.length;
219
+        row = row + 1;
220
+        var endRow = row;
221
+        var maxRow = session.getLength();
222
+        while (++row < maxRow) {
223
+            line = session.getLine(row);
224
+            var indent = line.search(/\S/);
225
+            if (indent === -1)
226
+                continue;
227
+            if  (startIndent > indent)
228
+                break;
229
+            var subRange = this.getFoldWidgetRange(session, "all", row);
230
+            
231
+            if (subRange) {
232
+                if (subRange.start.row <= startRow) {
233
+                    break;
234
+                } else if (subRange.isMultiLine()) {
235
+                    row = subRange.end.row;
236
+                } else if (startIndent == indent) {
237
+                    break;
238
+                }
239
+            }
240
+            endRow = row;
241
+        }
242
+        
243
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
244
+    };
245
+    
246
+    this.getCommentRegionBlock = function(session, line, row) {
247
+        var startColumn = line.search(/\s*$/);
248
+        var maxRow = session.getLength();
249
+        var startRow = row;
250
+        
251
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
252
+        var depth = 1;
253
+        while (++row < maxRow) {
254
+            line = session.getLine(row);
255
+            var m = re.exec(line);
256
+            if (!m) continue;
257
+            if (m[1]) depth--;
258
+            else depth++;
259
+
260
+            if (!depth) break;
261
+        }
262
+
263
+        var endRow = row;
264
+        if (endRow > startRow) {
265
+            return new Range(startRow, startColumn, endRow, line.length);
266
+        }
267
+    };
268
+
269
+}).call(FoldMode.prototype);
270
+
271
+});
272
+
273
+ace.define("ace/mode/elm",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/elm_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
274
+"use strict";
275
+
276
+var oop = require("../lib/oop");
277
+var TextMode = require("./text").Mode;
278
+var HighlightRules = require("./elm_highlight_rules").ElmHighlightRules;
279
+var FoldMode = require("./folding/cstyle").FoldMode;
280
+
281
+var Mode = function() {
282
+    this.HighlightRules = HighlightRules;
283
+    this.foldingRules = new FoldMode();
284
+};
285
+oop.inherits(Mode, TextMode);
286
+
287
+(function() {
288
+    this.lineCommentStart = "--";
289
+    this.blockComment = {start: "{-", end: "-}"};
290
+    this.$id = "ace/mode/elm";
291
+}).call(Mode.prototype);
292
+
293
+exports.Mode = Mode;
294
+});

+ 1002
- 0
generator/lib/ace/mode-erlang.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 290
- 0
generator/lib/ace/mode-forth.js Parādīt failu

@@ -0,0 +1,290 @@
1
+ace.define("ace/mode/forth_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 ForthHighlightRules = function() {
8
+
9
+    this.$rules = { start: [ { include: '#forth' } ],
10
+      '#comment': 
11
+       [ { token: 'comment.line.double-dash.forth',
12
+           regex: '(?:^|\\s)--\\s.*$',
13
+           comment: 'line comments for iForth' },
14
+         { token: 'comment.line.backslash.forth',
15
+           regex: '(?:^|\\s)\\\\[\\s\\S]*$',
16
+           comment: 'ANSI line comment' },
17
+         { token: 'comment.line.backslash-g.forth',
18
+           regex: '(?:^|\\s)\\\\[Gg] .*$',
19
+           comment: 'gForth line comment' },
20
+         { token: 'comment.block.forth',
21
+           regex: '(?:^|\\s)\\(\\*(?=\\s|$)',
22
+           push: 
23
+            [ { token: 'comment.block.forth',
24
+                regex: '(?:^|\\s)\\*\\)(?=\\s|$)',
25
+                next: 'pop' },
26
+              { defaultToken: 'comment.block.forth' } ],
27
+           comment: 'multiline comments for iForth' },
28
+         { token: 'comment.block.documentation.forth',
29
+           regex: '\\bDOC\\b',
30
+           caseInsensitive: true,
31
+           push: 
32
+            [ { token: 'comment.block.documentation.forth',
33
+                regex: '\\bENDDOC\\b',
34
+                caseInsensitive: true,
35
+                next: 'pop' },
36
+              { defaultToken: 'comment.block.documentation.forth' } ],
37
+           comment: 'documentation comments for iForth' },
38
+         { token: 'comment.line.parentheses.forth',
39
+           regex: '(?:^|\\s)\\.?\\( [^)]*\\)',
40
+           comment: 'ANSI line comment' } ],
41
+      '#constant': 
42
+       [ { token: 'constant.language.forth',
43
+           regex: '(?:^|\\s)(?:TRUE|FALSE|BL|PI|CELL|C/L|R/O|W/O|R/W)(?=\\s|$)',
44
+           caseInsensitive: true},
45
+         { token: 'constant.numeric.forth',
46
+           regex: '(?:^|\\s)[$#%]?[-+]?[0-9]+(?:\\.[0-9]*e-?[0-9]+|\\.?[0-9a-fA-F]*)(?=\\s|$)'},
47
+         { token: 'constant.character.forth',
48
+           regex: '(?:^|\\s)(?:[&^]\\S|(?:"|\')\\S(?:"|\'))(?=\\s|$)'}],
49
+      '#forth': 
50
+       [ { include: '#constant' },
51
+         { include: '#comment' },
52
+         { include: '#string' },
53
+         { include: '#word' },
54
+         { include: '#variable' },
55
+         { include: '#storage' },
56
+         { include: '#word-def' } ],
57
+      '#storage': 
58
+       [ { token: 'storage.type.forth',
59
+           regex: '(?:^|\\s)(?:2CONSTANT|2VARIABLE|ALIAS|CONSTANT|CREATE-INTERPRET/COMPILE[:]?|CREATE|DEFER|FCONSTANT|FIELD|FVARIABLE|USER|VALUE|VARIABLE|VOCABULARY)(?=\\s|$)',
60
+           caseInsensitive: true}],
61
+      '#string': 
62
+       [ { token: 'string.quoted.double.forth',
63
+           regex: '(ABORT" |BREAK" |\\." |C" |0"|S\\\\?" )([^"]+")',
64
+           caseInsensitive: true},
65
+         { token: 'string.unquoted.forth',
66
+           regex: '(?:INCLUDE|NEEDS|REQUIRE|USE)[ ]\\S+(?=\\s|$)',
67
+           caseInsensitive: true}],
68
+      '#variable': 
69
+       [ { token: 'variable.language.forth',
70
+           regex: '\\b(?:I|J)\\b',
71
+           caseInsensitive: true } ],
72
+      '#word': 
73
+       [ { token: 'keyword.control.immediate.forth',
74
+           regex: '(?:^|\\s)\\[(?:\\?DO|\\+LOOP|AGAIN|BEGIN|DEFINED|DO|ELSE|ENDIF|FOR|IF|IFDEF|IFUNDEF|LOOP|NEXT|REPEAT|THEN|UNTIL|WHILE)\\](?=\\s|$)',
75
+           caseInsensitive: true},
76
+         { token: 'keyword.other.immediate.forth',
77
+           regex: '(?:^|\\s)(?:COMPILE-ONLY|IMMEDIATE|IS|RESTRICT|TO|WHAT\'S|])(?=\\s|$)',
78
+           caseInsensitive: true},
79
+         { token: 'keyword.control.compile-only.forth',
80
+           regex: '(?:^|\\s)(?:-DO|\\-LOOP|\\?DO|\\?LEAVE|\\+DO|\\+LOOP|ABORT\\"|AGAIN|AHEAD|BEGIN|CASE|DO|ELSE|ENDCASE|ENDIF|ENDOF|ENDTRY\\-IFERROR|ENDTRY|FOR|IF|IFERROR|LEAVE|LOOP|NEXT|RECOVER|REPEAT|RESTORE|THEN|TRY|U\\-DO|U\\+DO|UNTIL|WHILE)(?=\\s|$)',
81
+           caseInsensitive: true},
82
+         { token: 'keyword.other.compile-only.forth',
83
+           regex: '(?:^|\\s)(?:\\?DUP-0=-IF|\\?DUP-IF|\\)|\\[|\\[\'\\]|\\[CHAR\\]|\\[COMPILE\\]|\\[IS\\]|\\[TO\\]|<COMPILATION|<INTERPRETATION|ASSERT\\(|ASSERT0\\(|ASSERT1\\(|ASSERT2\\(|ASSERT3\\(|COMPILATION>|DEFERS|DOES>|INTERPRETATION>|OF|POSTPONE)(?=\\s|$)',
84
+           caseInsensitive: true},
85
+         { token: 'keyword.other.non-immediate.forth',
86
+           regex: '(?:^|\\s)(?:\'|<IS>|<TO>|CHAR|END-STRUCT|INCLUDE[D]?|LOAD|NEEDS|REQUIRE[D]?|REVISION|SEE|STRUCT|THRU|USE)(?=\\s|$)',
87
+           caseInsensitive: true},
88
+         { token: 'keyword.other.warning.forth',
89
+           regex: '(?:^|\\s)(?:~~|BREAK:|BREAK"|DBG)(?=\\s|$)',
90
+           caseInsensitive: true}],
91
+      '#word-def': 
92
+       [ { token: 
93
+            [ 'keyword.other.compile-only.forth',
94
+              'keyword.other.compile-only.forth',
95
+              'meta.block.forth',
96
+              'entity.name.function.forth' ],
97
+           regex: '(:NONAME)|(^:|\\s:)(\\s)(\\S+)(?=\\s|$)',
98
+           caseInsensitive: true,
99
+           push: 
100
+            [ { token: 'keyword.other.compile-only.forth',
101
+                regex: ';(?:CODE)?',
102
+                caseInsensitive: true,
103
+                next: 'pop' },
104
+              { include: '#constant' },
105
+              { include: '#comment' },
106
+              { include: '#string' },
107
+              { include: '#word' },
108
+              { include: '#variable' },
109
+              { include: '#storage' },
110
+              { defaultToken: 'meta.block.forth' } ] } ] }
111
+    
112
+    this.normalizeRules();
113
+};
114
+
115
+ForthHighlightRules.metaData = { fileTypes: [ 'frt', 'fs', 'ldr' ],
116
+      foldingStartMarker: '/\\*\\*|\\{\\s*$',
117
+      foldingStopMarker: '\\*\\*/|^\\s*\\}',
118
+      keyEquivalent: '^~F',
119
+      name: 'Forth',
120
+      scopeName: 'source.forth' }
121
+
122
+
123
+oop.inherits(ForthHighlightRules, TextHighlightRules);
124
+
125
+exports.ForthHighlightRules = ForthHighlightRules;
126
+});
127
+
128
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
129
+"use strict";
130
+
131
+var oop = require("../../lib/oop");
132
+var Range = require("../../range").Range;
133
+var BaseFoldMode = require("./fold_mode").FoldMode;
134
+
135
+var FoldMode = exports.FoldMode = function(commentRegex) {
136
+    if (commentRegex) {
137
+        this.foldingStartMarker = new RegExp(
138
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
139
+        );
140
+        this.foldingStopMarker = new RegExp(
141
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
142
+        );
143
+    }
144
+};
145
+oop.inherits(FoldMode, BaseFoldMode);
146
+
147
+(function() {
148
+    
149
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
150
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
151
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
152
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
153
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
154
+    this._getFoldWidgetBase = this.getFoldWidget;
155
+    this.getFoldWidget = function(session, foldStyle, row) {
156
+        var line = session.getLine(row);
157
+    
158
+        if (this.singleLineBlockCommentRe.test(line)) {
159
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
160
+                return "";
161
+        }
162
+    
163
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
164
+    
165
+        if (!fw && this.startRegionRe.test(line))
166
+            return "start"; // lineCommentRegionStart
167
+    
168
+        return fw;
169
+    };
170
+
171
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
172
+        var line = session.getLine(row);
173
+        
174
+        if (this.startRegionRe.test(line))
175
+            return this.getCommentRegionBlock(session, line, row);
176
+        
177
+        var match = line.match(this.foldingStartMarker);
178
+        if (match) {
179
+            var i = match.index;
180
+
181
+            if (match[1])
182
+                return this.openingBracketBlock(session, match[1], row, i);
183
+                
184
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
185
+            
186
+            if (range && !range.isMultiLine()) {
187
+                if (forceMultiline) {
188
+                    range = this.getSectionRange(session, row);
189
+                } else if (foldStyle != "all")
190
+                    range = null;
191
+            }
192
+            
193
+            return range;
194
+        }
195
+
196
+        if (foldStyle === "markbegin")
197
+            return;
198
+
199
+        var match = line.match(this.foldingStopMarker);
200
+        if (match) {
201
+            var i = match.index + match[0].length;
202
+
203
+            if (match[1])
204
+                return this.closingBracketBlock(session, match[1], row, i);
205
+
206
+            return session.getCommentFoldRange(row, i, -1);
207
+        }
208
+    };
209
+    
210
+    this.getSectionRange = function(session, row) {
211
+        var line = session.getLine(row);
212
+        var startIndent = line.search(/\S/);
213
+        var startRow = row;
214
+        var startColumn = line.length;
215
+        row = row + 1;
216
+        var endRow = row;
217
+        var maxRow = session.getLength();
218
+        while (++row < maxRow) {
219
+            line = session.getLine(row);
220
+            var indent = line.search(/\S/);
221
+            if (indent === -1)
222
+                continue;
223
+            if  (startIndent > indent)
224
+                break;
225
+            var subRange = this.getFoldWidgetRange(session, "all", row);
226
+            
227
+            if (subRange) {
228
+                if (subRange.start.row <= startRow) {
229
+                    break;
230
+                } else if (subRange.isMultiLine()) {
231
+                    row = subRange.end.row;
232
+                } else if (startIndent == indent) {
233
+                    break;
234
+                }
235
+            }
236
+            endRow = row;
237
+        }
238
+        
239
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
240
+    };
241
+    
242
+    this.getCommentRegionBlock = function(session, line, row) {
243
+        var startColumn = line.search(/\s*$/);
244
+        var maxRow = session.getLength();
245
+        var startRow = row;
246
+        
247
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
248
+        var depth = 1;
249
+        while (++row < maxRow) {
250
+            line = session.getLine(row);
251
+            var m = re.exec(line);
252
+            if (!m) continue;
253
+            if (m[1]) depth--;
254
+            else depth++;
255
+
256
+            if (!depth) break;
257
+        }
258
+
259
+        var endRow = row;
260
+        if (endRow > startRow) {
261
+            return new Range(startRow, startColumn, endRow, line.length);
262
+        }
263
+    };
264
+
265
+}).call(FoldMode.prototype);
266
+
267
+});
268
+
269
+ace.define("ace/mode/forth",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/forth_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
270
+"use strict";
271
+
272
+var oop = require("../lib/oop");
273
+var TextMode = require("./text").Mode;
274
+var ForthHighlightRules = require("./forth_highlight_rules").ForthHighlightRules;
275
+var FoldMode = require("./folding/cstyle").FoldMode;
276
+
277
+var Mode = function() {
278
+    this.HighlightRules = ForthHighlightRules;
279
+    this.foldingRules = new FoldMode();
280
+};
281
+oop.inherits(Mode, TextMode);
282
+
283
+(function() {
284
+    this.lineCommentStart = "--";
285
+    this.blockComment = {start: "/*", end: "*/"};
286
+    this.$id = "ace/mode/forth";
287
+}).call(Mode.prototype);
288
+
289
+exports.Mode = Mode;
290
+});

+ 1020
- 0
generator/lib/ace/mode-ftl.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 85
- 0
generator/lib/ace/mode-gcode.js Parādīt failu

@@ -0,0 +1,85 @@
1
+ace.define("ace/mode/gcode_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 GcodeHighlightRules = function() {
8
+
9
+        var keywords = (
10
+            "IF|DO|WHILE|ENDWHILE|CALL|ENDIF|SUB|ENDSUB|GOTO|REPEAT|ENDREPEAT|CALL"
11
+            );
12
+
13
+        var builtinConstants = (
14
+            "PI"
15
+            );
16
+
17
+        var builtinFunctions = (
18
+            "ATAN|ABS|ACOS|ASIN|SIN|COS|EXP|FIX|FUP|ROUND|LN|TAN"
19
+            );
20
+        var keywordMapper = this.createKeywordMapper({
21
+            "support.function": builtinFunctions,
22
+            "keyword": keywords,
23
+            "constant.language": builtinConstants
24
+        }, "identifier", true);
25
+
26
+        this.$rules = {
27
+            "start" : [ {
28
+                token : "comment",
29
+                regex : "\\(.*\\)"
30
+            }, {
31
+                token : "comment",           // block number
32
+                regex : "([N])([0-9]+)"
33
+            }, {
34
+                token : "string",           // " string
35
+                regex : "([G])([0-9]+\\.?[0-9]?)"
36
+            }, {
37
+                token : "string",           // ' string
38
+                regex : "([M])([0-9]+\\.?[0-9]?)"
39
+            }, {
40
+                token : "constant.numeric", // float
41
+                regex : "([-+]?([0-9]*\\.?[0-9]+\\.?))|(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)"
42
+            }, {
43
+                token : keywordMapper,
44
+                regex : "[A-Z]"
45
+            }, {
46
+                token : "keyword.operator",
47
+                regex : "EQ|LT|GT|NE|GE|LE|OR|XOR"
48
+            }, {
49
+                token : "paren.lparen",
50
+                regex : "[\\[]"
51
+            }, {
52
+                token : "paren.rparen",
53
+                regex : "[\\]]"
54
+            }, {
55
+                token : "text",
56
+                regex : "\\s+"
57
+            } ]
58
+        };
59
+    };
60
+
61
+    oop.inherits(GcodeHighlightRules, TextHighlightRules);
62
+
63
+    exports.GcodeHighlightRules = GcodeHighlightRules;
64
+});
65
+
66
+ace.define("ace/mode/gcode",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/gcode_highlight_rules","ace/range"], function(require, exports, module) {
67
+    "use strict";
68
+
69
+    var oop = require("../lib/oop");
70
+    var TextMode = require("./text").Mode;
71
+    var GcodeHighlightRules = require("./gcode_highlight_rules").GcodeHighlightRules;
72
+    var Range = require("../range").Range;
73
+
74
+    var Mode = function() {
75
+        this.HighlightRules = GcodeHighlightRules;
76
+    };
77
+    oop.inherits(Mode, TextMode);
78
+
79
+    (function() {
80
+        this.$id = "ace/mode/gcode";
81
+    }).call(Mode.prototype);
82
+
83
+    exports.Mode = Mode;
84
+
85
+});

+ 129
- 0
generator/lib/ace/mode-gherkin.js Parādīt failu

@@ -0,0 +1,129 @@
1
+ace.define("ace/mode/gherkin_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
2
+
3
+var oop = require("../lib/oop");
4
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
5
+var stringEscape =  "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
6
+
7
+var GherkinHighlightRules = function() {
8
+    this.$rules = {
9
+    	start : [{
10
+            token: 'constant.numeric',
11
+            regex: "(?:(?:[1-9]\\d*)|(?:0))"
12
+ 		}, {
13
+    		token : "comment",
14
+    		regex : "#.*$"
15
+    	}, {
16
+    		token : "keyword",
17
+    		regex : "Feature:|Background:|Scenario:|Scenario\ Outline:|Examples:|Given|When|Then|And|But|\\*",
18
+    	}, {
19
+            token : "string",           // multi line """ string start
20
+            regex : '"{3}',
21
+            next : "qqstring3"
22
+        }, {
23
+            token : "string",           // " string
24
+            regex : '"',
25
+            next : "qqstring"
26
+        }, {
27
+        	token : "comment",
28
+        	regex : "@[A-Za-z0-9]+",
29
+        	next : "start"
30
+        }, {
31
+        	token : "comment",
32
+        	regex : "<.+>"
33
+        }, {
34
+        	token : "comment",
35
+        	regex : "\\| ",
36
+        	next : "table-item"
37
+        }, {
38
+        	token : "comment",
39
+        	regex : "\\|$",
40
+        	next : "start"
41
+        }],
42
+    	"qqstring3" : [ {
43
+            token : "constant.language.escape",
44
+            regex : stringEscape
45
+        }, {
46
+            token : "string", // multi line """ string end
47
+            regex : '"{3}',
48
+            next : "start"
49
+        }, {
50
+            defaultToken : "string"
51
+        }],
52
+    	"qqstring" : [{
53
+            token : "constant.language.escape",
54
+            regex : stringEscape
55
+        }, {
56
+            token : "string",
57
+            regex : "\\\\$",
58
+            next  : "qqstring"
59
+        }, {
60
+            token : "string",
61
+            regex : '"|$',
62
+            next  : "start"
63
+        }, {
64
+            defaultToken: "string"
65
+        }],
66
+        "table-item" : [{
67
+            token : "string",
68
+            regex : "[A-Za-z0-9 ]*",
69
+            next  : "start"
70
+        }],
71
+    };
72
+    
73
+}
74
+
75
+oop.inherits(GherkinHighlightRules, TextHighlightRules);
76
+
77
+exports.GherkinHighlightRules = GherkinHighlightRules;
78
+});
79
+
80
+ace.define("ace/mode/gherkin",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/gherkin_highlight_rules"], function(require, exports, module) {
81
+
82
+var oop = require("../lib/oop");
83
+var TextMode = require("./text").Mode;
84
+var GherkinHighlightRules = require("./gherkin_highlight_rules").GherkinHighlightRules;
85
+
86
+var Mode = function() {
87
+    this.HighlightRules = GherkinHighlightRules;
88
+};
89
+oop.inherits(Mode, TextMode);
90
+
91
+(function() {
92
+    this.lineCommentStart = "#";
93
+    this.$id = "ace/mode/gherkin";
94
+
95
+    this.getNextLineIndent = function(state, line, tab) {
96
+        var indent = this.$getIndent(line);
97
+        var space2 = "  ";
98
+
99
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
100
+        var tokens = tokenizedLine.tokens;
101
+        
102
+        console.log(state)
103
+        
104
+        if(line.match("[ ]*\\|")) {
105
+            indent += "| ";
106
+        }
107
+
108
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
109
+            return indent;
110
+        }
111
+        
112
+
113
+        if (state == "start") {
114
+            if (line.match("Scenario:|Feature:|Scenario\ Outline:|Background:")) {
115
+                indent += space2;
116
+            } else if(line.match("(Given|Then).+(:)$|Examples:")) {
117
+            	indent += space2;
118
+            } else if(line.match("\\*.+")) {
119
+            	indent += "* ";
120
+            } 
121
+        }
122
+        
123
+
124
+        return indent;
125
+    };
126
+}).call(Mode.prototype);
127
+
128
+exports.Mode = Mode;
129
+});

+ 51
- 0
generator/lib/ace/mode-gitignore.js Parādīt failu

@@ -0,0 +1,51 @@
1
+ace.define("ace/mode/gitignore_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 GitignoreHighlightRules = function() {
8
+    this.$rules = {
9
+        "start" : [
10
+            {
11
+                token : "comment",
12
+                regex : /^\s*#.*$/
13
+            }, {
14
+                token : "keyword", // negated patterns
15
+                regex : /^\s*!.*$/
16
+            }
17
+        ]
18
+    };
19
+    
20
+    this.normalizeRules();
21
+};
22
+
23
+GitignoreHighlightRules.metaData = {
24
+    fileTypes: ['gitignore'],
25
+    name: 'Gitignore'
26
+};
27
+
28
+oop.inherits(GitignoreHighlightRules, TextHighlightRules);
29
+
30
+exports.GitignoreHighlightRules = GitignoreHighlightRules;
31
+});
32
+
33
+ace.define("ace/mode/gitignore",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/gitignore_highlight_rules"], function(require, exports, module) {
34
+"use strict";
35
+
36
+var oop = require("../lib/oop");
37
+var TextMode = require("./text").Mode;
38
+var GitignoreHighlightRules = require("./gitignore_highlight_rules").GitignoreHighlightRules;
39
+
40
+var Mode = function() {
41
+    this.HighlightRules = GitignoreHighlightRules;
42
+};
43
+oop.inherits(Mode, TextMode);
44
+
45
+(function() {
46
+    this.lineCommentStart = "#";
47
+    this.$id = "ace/mode/gitignore";
48
+}).call(Mode.prototype);
49
+
50
+exports.Mode = Mode;
51
+});

+ 926
- 0
generator/lib/ace/mode-glsl.js Parādīt failu

@@ -0,0 +1,926 @@
1
+ace.define("ace/mode/doc_comment_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 DocCommentHighlightRules = function() {
8
+    this.$rules = {
9
+        "start" : [ {
10
+            token : "comment.doc.tag",
11
+            regex : "@[\\w\\d_]+" // TODO: fix email addresses
12
+        }, 
13
+        DocCommentHighlightRules.getTagRule(),
14
+        {
15
+            defaultToken : "comment.doc",
16
+            caseInsensitive: true
17
+        }]
18
+    };
19
+};
20
+
21
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22
+
23
+DocCommentHighlightRules.getTagRule = function(start) {
24
+    return {
25
+        token : "comment.doc.tag.storage.type",
26
+        regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+    };
28
+}
29
+
30
+DocCommentHighlightRules.getStartRule = function(start) {
31
+    return {
32
+        token : "comment.doc", // doc comment
33
+        regex : "\\/\\*(?=\\*)",
34
+        next  : start
35
+    };
36
+};
37
+
38
+DocCommentHighlightRules.getEndRule = function (start) {
39
+    return {
40
+        token : "comment.doc", // closing comment
41
+        regex : "\\*\\/",
42
+        next  : start
43
+    };
44
+};
45
+
46
+
47
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
48
+
49
+});
50
+
51
+ace.define("ace/mode/c_cpp_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52
+"use strict";
53
+
54
+var oop = require("../lib/oop");
55
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57
+var cFunctions = exports.cFunctions = "\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\b"
58
+
59
+var c_cppHighlightRules = function() {
60
+
61
+    var keywordControls = (
62
+        "break|case|continue|default|do|else|for|goto|if|_Pragma|" +
63
+        "return|switch|while|catch|operator|try|throw|using"
64
+    );
65
+    
66
+    var storageType = (
67
+        "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" +
68
+        "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" +
69
+        "class|wchar_t|template"
70
+    );
71
+
72
+    var storageModifiers = (
73
+        "const|extern|register|restrict|static|volatile|inline|private|" +
74
+        "protected|public|friend|explicit|virtual|export|mutable|typename|" +
75
+        "constexpr|new|delete"
76
+    );
77
+
78
+    var keywordOperators = (
79
+        "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" +
80
+        "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace"
81
+    );
82
+
83
+    var builtinConstants = (
84
+        "NULL|true|false|TRUE|FALSE"
85
+    );
86
+
87
+    var keywordMapper = this.$keywords = this.createKeywordMapper({
88
+        "keyword.control" : keywordControls,
89
+        "storage.type" : storageType,
90
+        "storage.modifier" : storageModifiers,
91
+        "keyword.operator" : keywordOperators,
92
+        "variable.language": "this",
93
+        "constant.language": builtinConstants
94
+    }, "identifier");
95
+
96
+    var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
97
+
98
+    this.$rules = { 
99
+        "start" : [
100
+            {
101
+                token : "comment",
102
+                regex : "//",
103
+                next : "singleLineComment"
104
+            },
105
+            DocCommentHighlightRules.getStartRule("doc-start"),
106
+            {
107
+                token : "comment", // multi line comment
108
+                regex : "\\/\\*",
109
+                next : "comment"
110
+            }, {
111
+                token : "string", // single line
112
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
113
+            }, {
114
+                token : "string", // multi line string start
115
+                regex : '["].*\\\\$',
116
+                next : "qqstring"
117
+            }, {
118
+                token : "string", // single line
119
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
120
+            }, {
121
+                token : "string", // multi line string start
122
+                regex : "['].*\\\\$",
123
+                next : "qstring"
124
+            }, {
125
+                token : "constant.numeric", // hex
126
+                regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
127
+            }, {
128
+                token : "constant.numeric", // float
129
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
130
+            }, {
131
+                token : "keyword", // pre-compiler directives
132
+                regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b",
133
+                next  : "directive"
134
+            }, {
135
+                token : "keyword", // special case pre-compiler directive
136
+                regex : "(?:#\\s*endif)\\b"
137
+            }, {
138
+                token : "support.function.C99.c",
139
+                regex : cFunctions
140
+            }, {
141
+                token : keywordMapper,
142
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
143
+            }, {
144
+                token : "keyword.operator",
145
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
146
+            }, {
147
+              token : "punctuation.operator",
148
+              regex : "\\?|\\:|\\,|\\;|\\."
149
+            }, {
150
+                token : "paren.lparen",
151
+                regex : "[[({]"
152
+            }, {
153
+                token : "paren.rparen",
154
+                regex : "[\\])}]"
155
+            }, {
156
+                token : "text",
157
+                regex : "\\s+"
158
+            }
159
+        ],
160
+        "comment" : [
161
+            {
162
+                token : "comment", // closing comment
163
+                regex : ".*?\\*\\/",
164
+                next : "start"
165
+            }, {
166
+                token : "comment", // comment spanning whole line
167
+                regex : ".+"
168
+            }
169
+        ],
170
+        "singleLineComment" : [
171
+            {
172
+                token : "comment",
173
+                regex : /\\$/,
174
+                next : "singleLineComment"
175
+            }, {
176
+                token : "comment",
177
+                regex : /$/,
178
+                next : "start"
179
+            }, {
180
+                defaultToken: "comment"
181
+            }
182
+        ],
183
+        "qqstring" : [
184
+            {
185
+                token : "string",
186
+                regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
187
+                next : "start"
188
+            }, {
189
+                defaultToken : "string"
190
+            }
191
+        ],
192
+        "qstring" : [
193
+            {
194
+                token : "string",
195
+                regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
196
+                next : "start"
197
+            }, {
198
+                defaultToken : "string"
199
+            }
200
+        ],
201
+        "directive" : [
202
+            {
203
+                token : "constant.other.multiline",
204
+                regex : /\\/
205
+            },
206
+            {
207
+                token : "constant.other.multiline",
208
+                regex : /.*\\/
209
+            },
210
+            {
211
+                token : "constant.other",
212
+                regex : "\\s*<.+?>",
213
+                next : "start"
214
+            },
215
+            {
216
+                token : "constant.other", // single line
217
+                regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',
218
+                next : "start"
219
+            }, 
220
+            {
221
+                token : "constant.other", // single line
222
+                regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
223
+                next : "start"
224
+            },
225
+            {
226
+                token : "constant.other",
227
+                regex : /[^\\\/]+/,
228
+                next : "start"
229
+            }
230
+        ]
231
+    };
232
+
233
+    this.embedRules(DocCommentHighlightRules, "doc-",
234
+        [ DocCommentHighlightRules.getEndRule("start") ]);
235
+};
236
+
237
+oop.inherits(c_cppHighlightRules, TextHighlightRules);
238
+
239
+exports.c_cppHighlightRules = c_cppHighlightRules;
240
+});
241
+
242
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
243
+"use strict";
244
+
245
+var Range = require("../range").Range;
246
+
247
+var MatchingBraceOutdent = function() {};
248
+
249
+(function() {
250
+
251
+    this.checkOutdent = function(line, input) {
252
+        if (! /^\s+$/.test(line))
253
+            return false;
254
+
255
+        return /^\s*\}/.test(input);
256
+    };
257
+
258
+    this.autoOutdent = function(doc, row) {
259
+        var line = doc.getLine(row);
260
+        var match = line.match(/^(\s*\})/);
261
+
262
+        if (!match) return 0;
263
+
264
+        var column = match[1].length;
265
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
266
+
267
+        if (!openBracePos || openBracePos.row == row) return 0;
268
+
269
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
270
+        doc.replace(new Range(row, 0, row, column-1), indent);
271
+    };
272
+
273
+    this.$getIndent = function(line) {
274
+        return line.match(/^\s*/)[0];
275
+    };
276
+
277
+}).call(MatchingBraceOutdent.prototype);
278
+
279
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
280
+});
281
+
282
+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) {
283
+"use strict";
284
+
285
+var oop = require("../../lib/oop");
286
+var Behaviour = require("../behaviour").Behaviour;
287
+var TokenIterator = require("../../token_iterator").TokenIterator;
288
+var lang = require("../../lib/lang");
289
+
290
+var SAFE_INSERT_IN_TOKENS =
291
+    ["text", "paren.rparen", "punctuation.operator"];
292
+var SAFE_INSERT_BEFORE_TOKENS =
293
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
294
+
295
+var context;
296
+var contextCache = {};
297
+var initContext = function(editor) {
298
+    var id = -1;
299
+    if (editor.multiSelect) {
300
+        id = editor.selection.index;
301
+        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
302
+            contextCache = {rangeCount: editor.multiSelect.rangeCount};
303
+    }
304
+    if (contextCache[id])
305
+        return context = contextCache[id];
306
+    context = contextCache[id] = {
307
+        autoInsertedBrackets: 0,
308
+        autoInsertedRow: -1,
309
+        autoInsertedLineEnd: "",
310
+        maybeInsertedBrackets: 0,
311
+        maybeInsertedRow: -1,
312
+        maybeInsertedLineStart: "",
313
+        maybeInsertedLineEnd: ""
314
+    };
315
+};
316
+
317
+var CstyleBehaviour = function() {
318
+    this.add("braces", "insertion", function(state, action, editor, session, text) {
319
+        var cursor = editor.getCursorPosition();
320
+        var line = session.doc.getLine(cursor.row);
321
+        if (text == '{') {
322
+            initContext(editor);
323
+            var selection = editor.getSelectionRange();
324
+            var selected = session.doc.getTextRange(selection);
325
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
326
+                return {
327
+                    text: '{' + selected + '}',
328
+                    selection: false
329
+                };
330
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
331
+                if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
332
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
333
+                    return {
334
+                        text: '{}',
335
+                        selection: [1, 1]
336
+                    };
337
+                } else {
338
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
339
+                    return {
340
+                        text: '{',
341
+                        selection: [1, 1]
342
+                    };
343
+                }
344
+            }
345
+        } else if (text == '}') {
346
+            initContext(editor);
347
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
348
+            if (rightChar == '}') {
349
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
350
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
351
+                    CstyleBehaviour.popAutoInsertedClosing();
352
+                    return {
353
+                        text: '',
354
+                        selection: [1, 1]
355
+                    };
356
+                }
357
+            }
358
+        } else if (text == "\n" || text == "\r\n") {
359
+            initContext(editor);
360
+            var closing = "";
361
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
362
+                closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
363
+                CstyleBehaviour.clearMaybeInsertedClosing();
364
+            }
365
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
366
+            if (rightChar === '}') {
367
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
368
+                if (!openBracePos)
369
+                     return null;
370
+                var next_indent = this.$getIndent(session.getLine(openBracePos.row));
371
+            } else if (closing) {
372
+                var next_indent = this.$getIndent(line);
373
+            } else {
374
+                CstyleBehaviour.clearMaybeInsertedClosing();
375
+                return;
376
+            }
377
+            var indent = next_indent + session.getTabString();
378
+
379
+            return {
380
+                text: '\n' + indent + '\n' + next_indent + closing,
381
+                selection: [1, indent.length, 1, indent.length]
382
+            };
383
+        } else {
384
+            CstyleBehaviour.clearMaybeInsertedClosing();
385
+        }
386
+    });
387
+
388
+    this.add("braces", "deletion", function(state, action, editor, session, range) {
389
+        var selected = session.doc.getTextRange(range);
390
+        if (!range.isMultiLine() && selected == '{') {
391
+            initContext(editor);
392
+            var line = session.doc.getLine(range.start.row);
393
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
394
+            if (rightChar == '}') {
395
+                range.end.column++;
396
+                return range;
397
+            } else {
398
+                context.maybeInsertedBrackets--;
399
+            }
400
+        }
401
+    });
402
+
403
+    this.add("parens", "insertion", function(state, action, editor, session, text) {
404
+        if (text == '(') {
405
+            initContext(editor);
406
+            var selection = editor.getSelectionRange();
407
+            var selected = session.doc.getTextRange(selection);
408
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
409
+                return {
410
+                    text: '(' + selected + ')',
411
+                    selection: false
412
+                };
413
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
414
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
415
+                return {
416
+                    text: '()',
417
+                    selection: [1, 1]
418
+                };
419
+            }
420
+        } else if (text == ')') {
421
+            initContext(editor);
422
+            var cursor = editor.getCursorPosition();
423
+            var line = session.doc.getLine(cursor.row);
424
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
425
+            if (rightChar == ')') {
426
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
427
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
428
+                    CstyleBehaviour.popAutoInsertedClosing();
429
+                    return {
430
+                        text: '',
431
+                        selection: [1, 1]
432
+                    };
433
+                }
434
+            }
435
+        }
436
+    });
437
+
438
+    this.add("parens", "deletion", function(state, action, editor, session, range) {
439
+        var selected = session.doc.getTextRange(range);
440
+        if (!range.isMultiLine() && selected == '(') {
441
+            initContext(editor);
442
+            var line = session.doc.getLine(range.start.row);
443
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
444
+            if (rightChar == ')') {
445
+                range.end.column++;
446
+                return range;
447
+            }
448
+        }
449
+    });
450
+
451
+    this.add("brackets", "insertion", function(state, action, editor, session, text) {
452
+        if (text == '[') {
453
+            initContext(editor);
454
+            var selection = editor.getSelectionRange();
455
+            var selected = session.doc.getTextRange(selection);
456
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
457
+                return {
458
+                    text: '[' + selected + ']',
459
+                    selection: false
460
+                };
461
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
462
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
463
+                return {
464
+                    text: '[]',
465
+                    selection: [1, 1]
466
+                };
467
+            }
468
+        } else if (text == ']') {
469
+            initContext(editor);
470
+            var cursor = editor.getCursorPosition();
471
+            var line = session.doc.getLine(cursor.row);
472
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
473
+            if (rightChar == ']') {
474
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
475
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
476
+                    CstyleBehaviour.popAutoInsertedClosing();
477
+                    return {
478
+                        text: '',
479
+                        selection: [1, 1]
480
+                    };
481
+                }
482
+            }
483
+        }
484
+    });
485
+
486
+    this.add("brackets", "deletion", function(state, action, editor, session, range) {
487
+        var selected = session.doc.getTextRange(range);
488
+        if (!range.isMultiLine() && selected == '[') {
489
+            initContext(editor);
490
+            var line = session.doc.getLine(range.start.row);
491
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
492
+            if (rightChar == ']') {
493
+                range.end.column++;
494
+                return range;
495
+            }
496
+        }
497
+    });
498
+
499
+    this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
500
+        if (text == '"' || text == "'") {
501
+            initContext(editor);
502
+            var quote = text;
503
+            var selection = editor.getSelectionRange();
504
+            var selected = session.doc.getTextRange(selection);
505
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
506
+                return {
507
+                    text: quote + selected + quote,
508
+                    selection: false
509
+                };
510
+            } else {
511
+                var cursor = editor.getCursorPosition();
512
+                var line = session.doc.getLine(cursor.row);
513
+                var leftChar = line.substring(cursor.column-1, cursor.column);
514
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
515
+                
516
+                var token = session.getTokenAt(cursor.row, cursor.column);
517
+                var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
518
+                if (leftChar == "\\" && token && /escape/.test(token.type))
519
+                    return null;
520
+                
521
+                var stringBefore = token && /string/.test(token.type);
522
+                var stringAfter = !rightToken || /string/.test(rightToken.type);
523
+                
524
+                var pair;
525
+                if (rightChar == quote) {
526
+                    pair = stringBefore !== stringAfter;
527
+                } else {
528
+                    if (stringBefore && !stringAfter)
529
+                        return null; // wrap string with different quote
530
+                    if (stringBefore && stringAfter)
531
+                        return null; // do not pair quotes inside strings 
532
+                    var wordRe = session.$mode.tokenRe;
533
+                    wordRe.lastIndex = 0;
534
+                    var isWordBefore = wordRe.test(leftChar);
535
+                    wordRe.lastIndex = 0;
536
+                    var isWordAfter = wordRe.test(leftChar);
537
+                    if (isWordBefore || isWordAfter)
538
+                        return null; // before or after alphanumeric
539
+                    if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
540
+                        return null; // there is rightChar and it isn't closing
541
+                    pair = true;
542
+                }
543
+                return {
544
+                    text: pair ? quote + quote : "",
545
+                    selection: [1,1]
546
+                };
547
+            }
548
+        }
549
+    });
550
+
551
+    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
552
+        var selected = session.doc.getTextRange(range);
553
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
554
+            initContext(editor);
555
+            var line = session.doc.getLine(range.start.row);
556
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
557
+            if (rightChar == selected) {
558
+                range.end.column++;
559
+                return range;
560
+            }
561
+        }
562
+    });
563
+
564
+};
565
+
566
+    
567
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
568
+    var cursor = editor.getCursorPosition();
569
+    var iterator = new TokenIterator(session, cursor.row, cursor.column);
570
+    if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
571
+        var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
572
+        if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
573
+            return false;
574
+    }
575
+    iterator.stepForward();
576
+    return iterator.getCurrentTokenRow() !== cursor.row ||
577
+        this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
578
+};
579
+
580
+CstyleBehaviour.$matchTokenType = function(token, types) {
581
+    return types.indexOf(token.type || token) > -1;
582
+};
583
+
584
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
585
+    var cursor = editor.getCursorPosition();
586
+    var line = session.doc.getLine(cursor.row);
587
+    if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
588
+        context.autoInsertedBrackets = 0;
589
+    context.autoInsertedRow = cursor.row;
590
+    context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
591
+    context.autoInsertedBrackets++;
592
+};
593
+
594
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
595
+    var cursor = editor.getCursorPosition();
596
+    var line = session.doc.getLine(cursor.row);
597
+    if (!this.isMaybeInsertedClosing(cursor, line))
598
+        context.maybeInsertedBrackets = 0;
599
+    context.maybeInsertedRow = cursor.row;
600
+    context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
601
+    context.maybeInsertedLineEnd = line.substr(cursor.column);
602
+    context.maybeInsertedBrackets++;
603
+};
604
+
605
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
606
+    return context.autoInsertedBrackets > 0 &&
607
+        cursor.row === context.autoInsertedRow &&
608
+        bracket === context.autoInsertedLineEnd[0] &&
609
+        line.substr(cursor.column) === context.autoInsertedLineEnd;
610
+};
611
+
612
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
613
+    return context.maybeInsertedBrackets > 0 &&
614
+        cursor.row === context.maybeInsertedRow &&
615
+        line.substr(cursor.column) === context.maybeInsertedLineEnd &&
616
+        line.substr(0, cursor.column) == context.maybeInsertedLineStart;
617
+};
618
+
619
+CstyleBehaviour.popAutoInsertedClosing = function() {
620
+    context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
621
+    context.autoInsertedBrackets--;
622
+};
623
+
624
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
625
+    if (context) {
626
+        context.maybeInsertedBrackets = 0;
627
+        context.maybeInsertedRow = -1;
628
+    }
629
+};
630
+
631
+
632
+
633
+oop.inherits(CstyleBehaviour, Behaviour);
634
+
635
+exports.CstyleBehaviour = CstyleBehaviour;
636
+});
637
+
638
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
639
+"use strict";
640
+
641
+var oop = require("../../lib/oop");
642
+var Range = require("../../range").Range;
643
+var BaseFoldMode = require("./fold_mode").FoldMode;
644
+
645
+var FoldMode = exports.FoldMode = function(commentRegex) {
646
+    if (commentRegex) {
647
+        this.foldingStartMarker = new RegExp(
648
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
649
+        );
650
+        this.foldingStopMarker = new RegExp(
651
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
652
+        );
653
+    }
654
+};
655
+oop.inherits(FoldMode, BaseFoldMode);
656
+
657
+(function() {
658
+    
659
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
660
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
661
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
662
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
663
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
664
+    this._getFoldWidgetBase = this.getFoldWidget;
665
+    this.getFoldWidget = function(session, foldStyle, row) {
666
+        var line = session.getLine(row);
667
+    
668
+        if (this.singleLineBlockCommentRe.test(line)) {
669
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
670
+                return "";
671
+        }
672
+    
673
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
674
+    
675
+        if (!fw && this.startRegionRe.test(line))
676
+            return "start"; // lineCommentRegionStart
677
+    
678
+        return fw;
679
+    };
680
+
681
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
682
+        var line = session.getLine(row);
683
+        
684
+        if (this.startRegionRe.test(line))
685
+            return this.getCommentRegionBlock(session, line, row);
686
+        
687
+        var match = line.match(this.foldingStartMarker);
688
+        if (match) {
689
+            var i = match.index;
690
+
691
+            if (match[1])
692
+                return this.openingBracketBlock(session, match[1], row, i);
693
+                
694
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
695
+            
696
+            if (range && !range.isMultiLine()) {
697
+                if (forceMultiline) {
698
+                    range = this.getSectionRange(session, row);
699
+                } else if (foldStyle != "all")
700
+                    range = null;
701
+            }
702
+            
703
+            return range;
704
+        }
705
+
706
+        if (foldStyle === "markbegin")
707
+            return;
708
+
709
+        var match = line.match(this.foldingStopMarker);
710
+        if (match) {
711
+            var i = match.index + match[0].length;
712
+
713
+            if (match[1])
714
+                return this.closingBracketBlock(session, match[1], row, i);
715
+
716
+            return session.getCommentFoldRange(row, i, -1);
717
+        }
718
+    };
719
+    
720
+    this.getSectionRange = function(session, row) {
721
+        var line = session.getLine(row);
722
+        var startIndent = line.search(/\S/);
723
+        var startRow = row;
724
+        var startColumn = line.length;
725
+        row = row + 1;
726
+        var endRow = row;
727
+        var maxRow = session.getLength();
728
+        while (++row < maxRow) {
729
+            line = session.getLine(row);
730
+            var indent = line.search(/\S/);
731
+            if (indent === -1)
732
+                continue;
733
+            if  (startIndent > indent)
734
+                break;
735
+            var subRange = this.getFoldWidgetRange(session, "all", row);
736
+            
737
+            if (subRange) {
738
+                if (subRange.start.row <= startRow) {
739
+                    break;
740
+                } else if (subRange.isMultiLine()) {
741
+                    row = subRange.end.row;
742
+                } else if (startIndent == indent) {
743
+                    break;
744
+                }
745
+            }
746
+            endRow = row;
747
+        }
748
+        
749
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
750
+    };
751
+    
752
+    this.getCommentRegionBlock = function(session, line, row) {
753
+        var startColumn = line.search(/\s*$/);
754
+        var maxRow = session.getLength();
755
+        var startRow = row;
756
+        
757
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
758
+        var depth = 1;
759
+        while (++row < maxRow) {
760
+            line = session.getLine(row);
761
+            var m = re.exec(line);
762
+            if (!m) continue;
763
+            if (m[1]) depth--;
764
+            else depth++;
765
+
766
+            if (!depth) break;
767
+        }
768
+
769
+        var endRow = row;
770
+        if (endRow > startRow) {
771
+            return new Range(startRow, startColumn, endRow, line.length);
772
+        }
773
+    };
774
+
775
+}).call(FoldMode.prototype);
776
+
777
+});
778
+
779
+ace.define("ace/mode/c_cpp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/c_cpp_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
780
+"use strict";
781
+
782
+var oop = require("../lib/oop");
783
+var TextMode = require("./text").Mode;
784
+var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
785
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
786
+var Range = require("../range").Range;
787
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
788
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
789
+
790
+var Mode = function() {
791
+    this.HighlightRules = c_cppHighlightRules;
792
+
793
+    this.$outdent = new MatchingBraceOutdent();
794
+    this.$behaviour = new CstyleBehaviour();
795
+
796
+    this.foldingRules = new CStyleFoldMode();
797
+};
798
+oop.inherits(Mode, TextMode);
799
+
800
+(function() {
801
+
802
+    this.lineCommentStart = "//";
803
+    this.blockComment = {start: "/*", end: "*/"};
804
+
805
+    this.getNextLineIndent = function(state, line, tab) {
806
+        var indent = this.$getIndent(line);
807
+
808
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
809
+        var tokens = tokenizedLine.tokens;
810
+        var endState = tokenizedLine.state;
811
+
812
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
813
+            return indent;
814
+        }
815
+
816
+        if (state == "start") {
817
+            var match = line.match(/^.*[\{\(\[]\s*$/);
818
+            if (match) {
819
+                indent += tab;
820
+            }
821
+        } else if (state == "doc-start") {
822
+            if (endState == "start") {
823
+                return "";
824
+            }
825
+            var match = line.match(/^\s*(\/?)\*/);
826
+            if (match) {
827
+                if (match[1]) {
828
+                    indent += " ";
829
+                }
830
+                indent += "* ";
831
+            }
832
+        }
833
+
834
+        return indent;
835
+    };
836
+
837
+    this.checkOutdent = function(state, line, input) {
838
+        return this.$outdent.checkOutdent(line, input);
839
+    };
840
+
841
+    this.autoOutdent = function(state, doc, row) {
842
+        this.$outdent.autoOutdent(doc, row);
843
+    };
844
+
845
+    this.$id = "ace/mode/c_cpp";
846
+}).call(Mode.prototype);
847
+
848
+exports.Mode = Mode;
849
+});
850
+
851
+ace.define("ace/mode/glsl_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/c_cpp_highlight_rules"], function(require, exports, module) {
852
+"use strict";
853
+
854
+var oop = require("../lib/oop");
855
+var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
856
+
857
+var glslHighlightRules = function() {
858
+
859
+    var keywords = (
860
+        "attribute|const|uniform|varying|break|continue|do|for|while|" +
861
+        "if|else|in|out|inout|float|int|void|bool|true|false|" +
862
+        "lowp|mediump|highp|precision|invariant|discard|return|mat2|mat3|" +
863
+        "mat4|vec2|vec3|vec4|ivec2|ivec3|ivec4|bvec2|bvec3|bvec4|sampler2D|" +
864
+        "samplerCube|struct"
865
+    );
866
+
867
+    var buildinConstants = (
868
+        "radians|degrees|sin|cos|tan|asin|acos|atan|pow|" +
869
+        "exp|log|exp2|log2|sqrt|inversesqrt|abs|sign|floor|ceil|fract|mod|" +
870
+        "min|max|clamp|mix|step|smoothstep|length|distance|dot|cross|" +
871
+        "normalize|faceforward|reflect|refract|matrixCompMult|lessThan|" +
872
+        "lessThanEqual|greaterThan|greaterThanEqual|equal|notEqual|any|all|" +
873
+        "not|dFdx|dFdy|fwidth|texture2D|texture2DProj|texture2DLod|" +
874
+        "texture2DProjLod|textureCube|textureCubeLod|" +
875
+        "gl_MaxVertexAttribs|gl_MaxVertexUniformVectors|gl_MaxVaryingVectors|" +
876
+        "gl_MaxVertexTextureImageUnits|gl_MaxCombinedTextureImageUnits|" +
877
+        "gl_MaxTextureImageUnits|gl_MaxFragmentUniformVectors|gl_MaxDrawBuffers|" +
878
+        "gl_DepthRangeParameters|gl_DepthRange|" +
879
+        "gl_Position|gl_PointSize|" +
880
+        "gl_FragCoord|gl_FrontFacing|gl_PointCoord|gl_FragColor|gl_FragData"
881
+    );
882
+
883
+    var keywordMapper = this.createKeywordMapper({
884
+        "variable.language": "this",
885
+        "keyword": keywords,
886
+        "constant.language": buildinConstants
887
+    }, "identifier");
888
+
889
+    this.$rules = new c_cppHighlightRules().$rules;
890
+    this.$rules.start.forEach(function(rule) {
891
+        if (typeof rule.token == "function")
892
+            rule.token = keywordMapper;
893
+    })
894
+};
895
+
896
+oop.inherits(glslHighlightRules, c_cppHighlightRules);
897
+
898
+exports.glslHighlightRules = glslHighlightRules;
899
+});
900
+
901
+ace.define("ace/mode/glsl",["require","exports","module","ace/lib/oop","ace/mode/c_cpp","ace/mode/glsl_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
902
+"use strict";
903
+
904
+var oop = require("../lib/oop");
905
+var CMode = require("./c_cpp").Mode;
906
+var glslHighlightRules = require("./glsl_highlight_rules").glslHighlightRules;
907
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
908
+var Range = require("../range").Range;
909
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
910
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
911
+
912
+var Mode = function() {
913
+    this.HighlightRules = glslHighlightRules;
914
+    
915
+    this.$outdent = new MatchingBraceOutdent();
916
+    this.$behaviour = new CstyleBehaviour();
917
+    this.foldingRules = new CStyleFoldMode();
918
+};
919
+oop.inherits(Mode, CMode);
920
+
921
+(function() {
922
+    this.$id = "ace/mode/glsl";
923
+}).call(Mode.prototype);
924
+
925
+exports.Mode = Mode;
926
+});

+ 751
- 0
generator/lib/ace/mode-golang.js Parādīt failu

@@ -0,0 +1,751 @@
1
+ace.define("ace/mode/doc_comment_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 DocCommentHighlightRules = function() {
8
+    this.$rules = {
9
+        "start" : [ {
10
+            token : "comment.doc.tag",
11
+            regex : "@[\\w\\d_]+" // TODO: fix email addresses
12
+        }, 
13
+        DocCommentHighlightRules.getTagRule(),
14
+        {
15
+            defaultToken : "comment.doc",
16
+            caseInsensitive: true
17
+        }]
18
+    };
19
+};
20
+
21
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22
+
23
+DocCommentHighlightRules.getTagRule = function(start) {
24
+    return {
25
+        token : "comment.doc.tag.storage.type",
26
+        regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+    };
28
+}
29
+
30
+DocCommentHighlightRules.getStartRule = function(start) {
31
+    return {
32
+        token : "comment.doc", // doc comment
33
+        regex : "\\/\\*(?=\\*)",
34
+        next  : start
35
+    };
36
+};
37
+
38
+DocCommentHighlightRules.getEndRule = function (start) {
39
+    return {
40
+        token : "comment.doc", // closing comment
41
+        regex : "\\*\\/",
42
+        next  : start
43
+    };
44
+};
45
+
46
+
47
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
48
+
49
+});
50
+
51
+ace.define("ace/mode/golang_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52
+    var oop = require("../lib/oop");
53
+    var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
54
+    var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
55
+
56
+    var GolangHighlightRules = function() {
57
+        var keywords = (
58
+            "else|break|case|return|goto|if|const|select|" +
59
+            "continue|struct|default|switch|for|range|" +
60
+            "func|import|package|chan|defer|fallthrough|go|interface|map|range|" +
61
+            "select|type|var"
62
+        );
63
+        var builtinTypes = (
64
+            "string|uint8|uint16|uint32|uint64|int8|int16|int32|int64|float32|" +
65
+            "float64|complex64|complex128|byte|rune|uint|int|uintptr|bool|error"
66
+        );
67
+        var builtinFunctions = (
68
+            "make|close|new|panic|recover"
69
+        );
70
+        var builtinConstants = ("nil|true|false|iota");
71
+
72
+        var keywordMapper = this.createKeywordMapper({
73
+            "keyword": keywords,
74
+            "constant.language": builtinConstants,
75
+            "support.function": builtinFunctions,
76
+            "support.type": builtinTypes
77
+        }, "identifier");
78
+
79
+        this.$rules = {
80
+            "start" : [
81
+                {
82
+                    token : "comment",
83
+                    regex : "\\/\\/.*$"
84
+                },
85
+                DocCommentHighlightRules.getStartRule("doc-start"),
86
+                {
87
+                    token : "comment", // multi line comment
88
+                    regex : "\\/\\*",
89
+                    next : "comment"
90
+                }, {
91
+                    token : "string", // single line
92
+                    regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
93
+                }, {
94
+                    token : "string", // single line
95
+                    regex : '[`](?:[^`]*)[`]'
96
+                }, {
97
+                    token : "string", // multi line string start
98
+                    merge : true,
99
+                    regex : '[`](?:[^`]*)$',
100
+                    next : "bqstring"
101
+                }, {
102
+                    token : "constant.numeric", // rune
103
+                    regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))[']"
104
+                }, {
105
+                    token : "constant.numeric", // hex
106
+                    regex : "0[xX][0-9a-fA-F]+\\b"
107
+                }, {
108
+                    token : "constant.numeric", // float
109
+                    regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
110
+                }, {
111
+                    token : keywordMapper,
112
+                    regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
113
+                }, {
114
+                    token : "keyword.operator",
115
+                    regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^="
116
+                }, {
117
+                    token : "punctuation.operator",
118
+                    regex : "\\?|\\:|\\,|\\;|\\."
119
+                }, {
120
+                    token : "paren.lparen",
121
+                    regex : "[[({]"
122
+                }, {
123
+                    token : "paren.rparen",
124
+                    regex : "[\\])}]"
125
+                }, {
126
+                    token : "text",
127
+                    regex : "\\s+"
128
+                }
129
+            ],
130
+            "comment" : [
131
+                {
132
+                    token : "comment", // closing comment
133
+                    regex : ".*?\\*\\/",
134
+                    next : "start"
135
+                }, {
136
+                    token : "comment", // comment spanning whole line
137
+                    regex : ".+"
138
+                }
139
+            ],
140
+            "bqstring" : [
141
+                {
142
+                    token : "string",
143
+                    regex : '(?:[^`]*)`',
144
+                    next : "start"
145
+                }, {
146
+                    token : "string",
147
+                    regex : '.+'
148
+                }
149
+            ]
150
+        };
151
+
152
+        this.embedRules(DocCommentHighlightRules, "doc-",
153
+            [ DocCommentHighlightRules.getEndRule("start") ]);
154
+    };
155
+    oop.inherits(GolangHighlightRules, TextHighlightRules);
156
+
157
+    exports.GolangHighlightRules = GolangHighlightRules;
158
+});
159
+
160
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
161
+"use strict";
162
+
163
+var Range = require("../range").Range;
164
+
165
+var MatchingBraceOutdent = function() {};
166
+
167
+(function() {
168
+
169
+    this.checkOutdent = function(line, input) {
170
+        if (! /^\s+$/.test(line))
171
+            return false;
172
+
173
+        return /^\s*\}/.test(input);
174
+    };
175
+
176
+    this.autoOutdent = function(doc, row) {
177
+        var line = doc.getLine(row);
178
+        var match = line.match(/^(\s*\})/);
179
+
180
+        if (!match) return 0;
181
+
182
+        var column = match[1].length;
183
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
184
+
185
+        if (!openBracePos || openBracePos.row == row) return 0;
186
+
187
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
188
+        doc.replace(new Range(row, 0, row, column-1), indent);
189
+    };
190
+
191
+    this.$getIndent = function(line) {
192
+        return line.match(/^\s*/)[0];
193
+    };
194
+
195
+}).call(MatchingBraceOutdent.prototype);
196
+
197
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
198
+});
199
+
200
+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) {
201
+"use strict";
202
+
203
+var oop = require("../../lib/oop");
204
+var Behaviour = require("../behaviour").Behaviour;
205
+var TokenIterator = require("../../token_iterator").TokenIterator;
206
+var lang = require("../../lib/lang");
207
+
208
+var SAFE_INSERT_IN_TOKENS =
209
+    ["text", "paren.rparen", "punctuation.operator"];
210
+var SAFE_INSERT_BEFORE_TOKENS =
211
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
212
+
213
+var context;
214
+var contextCache = {};
215
+var initContext = function(editor) {
216
+    var id = -1;
217
+    if (editor.multiSelect) {
218
+        id = editor.selection.index;
219
+        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
220
+            contextCache = {rangeCount: editor.multiSelect.rangeCount};
221
+    }
222
+    if (contextCache[id])
223
+        return context = contextCache[id];
224
+    context = contextCache[id] = {
225
+        autoInsertedBrackets: 0,
226
+        autoInsertedRow: -1,
227
+        autoInsertedLineEnd: "",
228
+        maybeInsertedBrackets: 0,
229
+        maybeInsertedRow: -1,
230
+        maybeInsertedLineStart: "",
231
+        maybeInsertedLineEnd: ""
232
+    };
233
+};
234
+
235
+var CstyleBehaviour = function() {
236
+    this.add("braces", "insertion", function(state, action, editor, session, text) {
237
+        var cursor = editor.getCursorPosition();
238
+        var line = session.doc.getLine(cursor.row);
239
+        if (text == '{') {
240
+            initContext(editor);
241
+            var selection = editor.getSelectionRange();
242
+            var selected = session.doc.getTextRange(selection);
243
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
244
+                return {
245
+                    text: '{' + selected + '}',
246
+                    selection: false
247
+                };
248
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
249
+                if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
250
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
251
+                    return {
252
+                        text: '{}',
253
+                        selection: [1, 1]
254
+                    };
255
+                } else {
256
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
257
+                    return {
258
+                        text: '{',
259
+                        selection: [1, 1]
260
+                    };
261
+                }
262
+            }
263
+        } else if (text == '}') {
264
+            initContext(editor);
265
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
266
+            if (rightChar == '}') {
267
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
268
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
269
+                    CstyleBehaviour.popAutoInsertedClosing();
270
+                    return {
271
+                        text: '',
272
+                        selection: [1, 1]
273
+                    };
274
+                }
275
+            }
276
+        } else if (text == "\n" || text == "\r\n") {
277
+            initContext(editor);
278
+            var closing = "";
279
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
280
+                closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
281
+                CstyleBehaviour.clearMaybeInsertedClosing();
282
+            }
283
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
284
+            if (rightChar === '}') {
285
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
286
+                if (!openBracePos)
287
+                     return null;
288
+                var next_indent = this.$getIndent(session.getLine(openBracePos.row));
289
+            } else if (closing) {
290
+                var next_indent = this.$getIndent(line);
291
+            } else {
292
+                CstyleBehaviour.clearMaybeInsertedClosing();
293
+                return;
294
+            }
295
+            var indent = next_indent + session.getTabString();
296
+
297
+            return {
298
+                text: '\n' + indent + '\n' + next_indent + closing,
299
+                selection: [1, indent.length, 1, indent.length]
300
+            };
301
+        } else {
302
+            CstyleBehaviour.clearMaybeInsertedClosing();
303
+        }
304
+    });
305
+
306
+    this.add("braces", "deletion", function(state, action, editor, session, range) {
307
+        var selected = session.doc.getTextRange(range);
308
+        if (!range.isMultiLine() && selected == '{') {
309
+            initContext(editor);
310
+            var line = session.doc.getLine(range.start.row);
311
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
312
+            if (rightChar == '}') {
313
+                range.end.column++;
314
+                return range;
315
+            } else {
316
+                context.maybeInsertedBrackets--;
317
+            }
318
+        }
319
+    });
320
+
321
+    this.add("parens", "insertion", function(state, action, editor, session, text) {
322
+        if (text == '(') {
323
+            initContext(editor);
324
+            var selection = editor.getSelectionRange();
325
+            var selected = session.doc.getTextRange(selection);
326
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
327
+                return {
328
+                    text: '(' + selected + ')',
329
+                    selection: false
330
+                };
331
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
332
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
333
+                return {
334
+                    text: '()',
335
+                    selection: [1, 1]
336
+                };
337
+            }
338
+        } else if (text == ')') {
339
+            initContext(editor);
340
+            var cursor = editor.getCursorPosition();
341
+            var line = session.doc.getLine(cursor.row);
342
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
343
+            if (rightChar == ')') {
344
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
345
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
346
+                    CstyleBehaviour.popAutoInsertedClosing();
347
+                    return {
348
+                        text: '',
349
+                        selection: [1, 1]
350
+                    };
351
+                }
352
+            }
353
+        }
354
+    });
355
+
356
+    this.add("parens", "deletion", function(state, action, editor, session, range) {
357
+        var selected = session.doc.getTextRange(range);
358
+        if (!range.isMultiLine() && selected == '(') {
359
+            initContext(editor);
360
+            var line = session.doc.getLine(range.start.row);
361
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
362
+            if (rightChar == ')') {
363
+                range.end.column++;
364
+                return range;
365
+            }
366
+        }
367
+    });
368
+
369
+    this.add("brackets", "insertion", function(state, action, editor, session, text) {
370
+        if (text == '[') {
371
+            initContext(editor);
372
+            var selection = editor.getSelectionRange();
373
+            var selected = session.doc.getTextRange(selection);
374
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
375
+                return {
376
+                    text: '[' + selected + ']',
377
+                    selection: false
378
+                };
379
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
380
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
381
+                return {
382
+                    text: '[]',
383
+                    selection: [1, 1]
384
+                };
385
+            }
386
+        } else if (text == ']') {
387
+            initContext(editor);
388
+            var cursor = editor.getCursorPosition();
389
+            var line = session.doc.getLine(cursor.row);
390
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
391
+            if (rightChar == ']') {
392
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
393
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
394
+                    CstyleBehaviour.popAutoInsertedClosing();
395
+                    return {
396
+                        text: '',
397
+                        selection: [1, 1]
398
+                    };
399
+                }
400
+            }
401
+        }
402
+    });
403
+
404
+    this.add("brackets", "deletion", function(state, action, editor, session, range) {
405
+        var selected = session.doc.getTextRange(range);
406
+        if (!range.isMultiLine() && selected == '[') {
407
+            initContext(editor);
408
+            var line = session.doc.getLine(range.start.row);
409
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
410
+            if (rightChar == ']') {
411
+                range.end.column++;
412
+                return range;
413
+            }
414
+        }
415
+    });
416
+
417
+    this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
418
+        if (text == '"' || text == "'") {
419
+            initContext(editor);
420
+            var quote = text;
421
+            var selection = editor.getSelectionRange();
422
+            var selected = session.doc.getTextRange(selection);
423
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
424
+                return {
425
+                    text: quote + selected + quote,
426
+                    selection: false
427
+                };
428
+            } else {
429
+                var cursor = editor.getCursorPosition();
430
+                var line = session.doc.getLine(cursor.row);
431
+                var leftChar = line.substring(cursor.column-1, cursor.column);
432
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
433
+                
434
+                var token = session.getTokenAt(cursor.row, cursor.column);
435
+                var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
436
+                if (leftChar == "\\" && token && /escape/.test(token.type))
437
+                    return null;
438
+                
439
+                var stringBefore = token && /string/.test(token.type);
440
+                var stringAfter = !rightToken || /string/.test(rightToken.type);
441
+                
442
+                var pair;
443
+                if (rightChar == quote) {
444
+                    pair = stringBefore !== stringAfter;
445
+                } else {
446
+                    if (stringBefore && !stringAfter)
447
+                        return null; // wrap string with different quote
448
+                    if (stringBefore && stringAfter)
449
+                        return null; // do not pair quotes inside strings 
450
+                    var wordRe = session.$mode.tokenRe;
451
+                    wordRe.lastIndex = 0;
452
+                    var isWordBefore = wordRe.test(leftChar);
453
+                    wordRe.lastIndex = 0;
454
+                    var isWordAfter = wordRe.test(leftChar);
455
+                    if (isWordBefore || isWordAfter)
456
+                        return null; // before or after alphanumeric
457
+                    if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
458
+                        return null; // there is rightChar and it isn't closing
459
+                    pair = true;
460
+                }
461
+                return {
462
+                    text: pair ? quote + quote : "",
463
+                    selection: [1,1]
464
+                };
465
+            }
466
+        }
467
+    });
468
+
469
+    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
470
+        var selected = session.doc.getTextRange(range);
471
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
472
+            initContext(editor);
473
+            var line = session.doc.getLine(range.start.row);
474
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
475
+            if (rightChar == selected) {
476
+                range.end.column++;
477
+                return range;
478
+            }
479
+        }
480
+    });
481
+
482
+};
483
+
484
+    
485
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
486
+    var cursor = editor.getCursorPosition();
487
+    var iterator = new TokenIterator(session, cursor.row, cursor.column);
488
+    if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
489
+        var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
490
+        if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
491
+            return false;
492
+    }
493
+    iterator.stepForward();
494
+    return iterator.getCurrentTokenRow() !== cursor.row ||
495
+        this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
496
+};
497
+
498
+CstyleBehaviour.$matchTokenType = function(token, types) {
499
+    return types.indexOf(token.type || token) > -1;
500
+};
501
+
502
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
503
+    var cursor = editor.getCursorPosition();
504
+    var line = session.doc.getLine(cursor.row);
505
+    if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
506
+        context.autoInsertedBrackets = 0;
507
+    context.autoInsertedRow = cursor.row;
508
+    context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
509
+    context.autoInsertedBrackets++;
510
+};
511
+
512
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
513
+    var cursor = editor.getCursorPosition();
514
+    var line = session.doc.getLine(cursor.row);
515
+    if (!this.isMaybeInsertedClosing(cursor, line))
516
+        context.maybeInsertedBrackets = 0;
517
+    context.maybeInsertedRow = cursor.row;
518
+    context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
519
+    context.maybeInsertedLineEnd = line.substr(cursor.column);
520
+    context.maybeInsertedBrackets++;
521
+};
522
+
523
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
524
+    return context.autoInsertedBrackets > 0 &&
525
+        cursor.row === context.autoInsertedRow &&
526
+        bracket === context.autoInsertedLineEnd[0] &&
527
+        line.substr(cursor.column) === context.autoInsertedLineEnd;
528
+};
529
+
530
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
531
+    return context.maybeInsertedBrackets > 0 &&
532
+        cursor.row === context.maybeInsertedRow &&
533
+        line.substr(cursor.column) === context.maybeInsertedLineEnd &&
534
+        line.substr(0, cursor.column) == context.maybeInsertedLineStart;
535
+};
536
+
537
+CstyleBehaviour.popAutoInsertedClosing = function() {
538
+    context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
539
+    context.autoInsertedBrackets--;
540
+};
541
+
542
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
543
+    if (context) {
544
+        context.maybeInsertedBrackets = 0;
545
+        context.maybeInsertedRow = -1;
546
+    }
547
+};
548
+
549
+
550
+
551
+oop.inherits(CstyleBehaviour, Behaviour);
552
+
553
+exports.CstyleBehaviour = CstyleBehaviour;
554
+});
555
+
556
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
557
+"use strict";
558
+
559
+var oop = require("../../lib/oop");
560
+var Range = require("../../range").Range;
561
+var BaseFoldMode = require("./fold_mode").FoldMode;
562
+
563
+var FoldMode = exports.FoldMode = function(commentRegex) {
564
+    if (commentRegex) {
565
+        this.foldingStartMarker = new RegExp(
566
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
567
+        );
568
+        this.foldingStopMarker = new RegExp(
569
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
570
+        );
571
+    }
572
+};
573
+oop.inherits(FoldMode, BaseFoldMode);
574
+
575
+(function() {
576
+    
577
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
578
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
579
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
580
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
581
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
582
+    this._getFoldWidgetBase = this.getFoldWidget;
583
+    this.getFoldWidget = function(session, foldStyle, row) {
584
+        var line = session.getLine(row);
585
+    
586
+        if (this.singleLineBlockCommentRe.test(line)) {
587
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
588
+                return "";
589
+        }
590
+    
591
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
592
+    
593
+        if (!fw && this.startRegionRe.test(line))
594
+            return "start"; // lineCommentRegionStart
595
+    
596
+        return fw;
597
+    };
598
+
599
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
600
+        var line = session.getLine(row);
601
+        
602
+        if (this.startRegionRe.test(line))
603
+            return this.getCommentRegionBlock(session, line, row);
604
+        
605
+        var match = line.match(this.foldingStartMarker);
606
+        if (match) {
607
+            var i = match.index;
608
+
609
+            if (match[1])
610
+                return this.openingBracketBlock(session, match[1], row, i);
611
+                
612
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
613
+            
614
+            if (range && !range.isMultiLine()) {
615
+                if (forceMultiline) {
616
+                    range = this.getSectionRange(session, row);
617
+                } else if (foldStyle != "all")
618
+                    range = null;
619
+            }
620
+            
621
+            return range;
622
+        }
623
+
624
+        if (foldStyle === "markbegin")
625
+            return;
626
+
627
+        var match = line.match(this.foldingStopMarker);
628
+        if (match) {
629
+            var i = match.index + match[0].length;
630
+
631
+            if (match[1])
632
+                return this.closingBracketBlock(session, match[1], row, i);
633
+
634
+            return session.getCommentFoldRange(row, i, -1);
635
+        }
636
+    };
637
+    
638
+    this.getSectionRange = function(session, row) {
639
+        var line = session.getLine(row);
640
+        var startIndent = line.search(/\S/);
641
+        var startRow = row;
642
+        var startColumn = line.length;
643
+        row = row + 1;
644
+        var endRow = row;
645
+        var maxRow = session.getLength();
646
+        while (++row < maxRow) {
647
+            line = session.getLine(row);
648
+            var indent = line.search(/\S/);
649
+            if (indent === -1)
650
+                continue;
651
+            if  (startIndent > indent)
652
+                break;
653
+            var subRange = this.getFoldWidgetRange(session, "all", row);
654
+            
655
+            if (subRange) {
656
+                if (subRange.start.row <= startRow) {
657
+                    break;
658
+                } else if (subRange.isMultiLine()) {
659
+                    row = subRange.end.row;
660
+                } else if (startIndent == indent) {
661
+                    break;
662
+                }
663
+            }
664
+            endRow = row;
665
+        }
666
+        
667
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
668
+    };
669
+    
670
+    this.getCommentRegionBlock = function(session, line, row) {
671
+        var startColumn = line.search(/\s*$/);
672
+        var maxRow = session.getLength();
673
+        var startRow = row;
674
+        
675
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
676
+        var depth = 1;
677
+        while (++row < maxRow) {
678
+            line = session.getLine(row);
679
+            var m = re.exec(line);
680
+            if (!m) continue;
681
+            if (m[1]) depth--;
682
+            else depth++;
683
+
684
+            if (!depth) break;
685
+        }
686
+
687
+        var endRow = row;
688
+        if (endRow > startRow) {
689
+            return new Range(startRow, startColumn, endRow, line.length);
690
+        }
691
+    };
692
+
693
+}).call(FoldMode.prototype);
694
+
695
+});
696
+
697
+ace.define("ace/mode/golang",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/golang_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
698
+
699
+var oop = require("../lib/oop");
700
+var TextMode = require("./text").Mode;
701
+var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules;
702
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
703
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
704
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
705
+
706
+var Mode = function() {
707
+    this.HighlightRules = GolangHighlightRules;
708
+    this.$outdent = new MatchingBraceOutdent();
709
+    this.foldingRules = new CStyleFoldMode();
710
+};
711
+oop.inherits(Mode, TextMode);
712
+
713
+(function() {
714
+    
715
+    this.lineCommentStart = "//";
716
+    this.blockComment = {start: "/*", end: "*/"};
717
+
718
+    this.getNextLineIndent = function(state, line, tab) {
719
+        var indent = this.$getIndent(line);
720
+
721
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
722
+        var tokens = tokenizedLine.tokens;
723
+        var endState = tokenizedLine.state;
724
+
725
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
726
+            return indent;
727
+        }
728
+        
729
+        if (state == "start") {
730
+            var match = line.match(/^.*[\{\(\[]\s*$/);
731
+            if (match) {
732
+                indent += tab;
733
+            }
734
+        }
735
+
736
+        return indent;
737
+    };//end getNextLineIndent
738
+
739
+    this.checkOutdent = function(state, line, input) {
740
+        return this.$outdent.checkOutdent(line, input);
741
+    };
742
+
743
+    this.autoOutdent = function(state, doc, row) {
744
+        this.$outdent.autoOutdent(doc, row);
745
+    };
746
+
747
+    this.$id = "ace/mode/golang";
748
+}).call(Mode.prototype);
749
+
750
+exports.Mode = Mode;
751
+});

+ 1217
- 0
generator/lib/ace/mode-groovy.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 525
- 0
generator/lib/ace/mode-haml.js Parādīt failu

@@ -0,0 +1,525 @@
1
+ace.define("ace/mode/ruby_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
+var constantOtherSymbol = exports.constantOtherSymbol = {
7
+    token : "constant.other.symbol.ruby", // symbol
8
+    regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
9
+};
10
+
11
+var qString = exports.qString = {
12
+    token : "string", // single line
13
+    regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
14
+};
15
+
16
+var qqString = exports.qqString = {
17
+    token : "string", // single line
18
+    regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
19
+};
20
+
21
+var tString = exports.tString = {
22
+    token : "string", // backtick string
23
+    regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
24
+};
25
+
26
+var constantNumericHex = exports.constantNumericHex = {
27
+    token : "constant.numeric", // hex
28
+    regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
29
+};
30
+
31
+var constantNumericFloat = exports.constantNumericFloat = {
32
+    token : "constant.numeric", // float
33
+    regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
34
+};
35
+
36
+var RubyHighlightRules = function() {
37
+
38
+    var builtinFunctions = (
39
+        "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
40
+        "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
41
+        "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
42
+        "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
43
+        "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
44
+        "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
45
+        "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
46
+        "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
47
+        "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
48
+        "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
49
+        "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
50
+        "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
51
+        "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
52
+        "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
53
+        "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
54
+        "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
55
+        "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
56
+        "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
57
+        "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
58
+        "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
59
+        "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
60
+        "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
61
+        "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
62
+        "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
63
+        "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
64
+        "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
65
+        "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
66
+        "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
67
+        "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
68
+        "has_many|has_one|belongs_to|has_and_belongs_to_many"
69
+    );
70
+
71
+    var keywords = (
72
+        "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
73
+        "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
74
+        "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
75
+    );
76
+
77
+    var buildinConstants = (
78
+        "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
79
+        "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
80
+    );
81
+
82
+    var builtinVariables = (
83
+        "\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" +
84
+        "$!|root_url|flash|session|cookies|params|request|response|logger|self"
85
+    );
86
+
87
+    var keywordMapper = this.$keywords = this.createKeywordMapper({
88
+        "keyword": keywords,
89
+        "constant.language": buildinConstants,
90
+        "variable.language": builtinVariables,
91
+        "support.function": builtinFunctions,
92
+        "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
93
+    }, "identifier");
94
+
95
+    this.$rules = {
96
+        "start" : [
97
+            {
98
+                token : "comment",
99
+                regex : "#.*$"
100
+            }, {
101
+                token : "comment", // multi line comment
102
+                regex : "^=begin(?:$|\\s.*$)",
103
+                next : "comment"
104
+            }, {
105
+                token : "string.regexp",
106
+                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
107
+            },
108
+
109
+            [{
110
+                regex: "[{}]", onMatch: function(val, state, stack) {
111
+                    this.next = val == "{" ? this.nextState : "";
112
+                    if (val == "{" && stack.length) {
113
+                        stack.unshift("start", state);
114
+                        return "paren.lparen";
115
+                    }
116
+                    if (val == "}" && stack.length) {
117
+                        stack.shift();
118
+                        this.next = stack.shift();
119
+                        if (this.next.indexOf("string") != -1)
120
+                            return "paren.end";
121
+                    }
122
+                    return val == "{" ? "paren.lparen" : "paren.rparen";
123
+                },
124
+                nextState: "start"
125
+            }, {
126
+                token : "string.start",
127
+                regex : /"/,
128
+                push  : [{
129
+                    token : "constant.language.escape",
130
+                    regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
131
+                }, {
132
+                    token : "paren.start",
133
+                    regex : /\#{/,
134
+                    push  : "start"
135
+                }, {
136
+                    token : "string.end",
137
+                    regex : /"/,
138
+                    next  : "pop"
139
+                }, {
140
+                    defaultToken: "string"
141
+                }]
142
+            }, {
143
+                token : "string.start",
144
+                regex : /`/,
145
+                push  : [{
146
+                    token : "constant.language.escape",
147
+                    regex : /\\(?:[nsrtvfbae'"\\]|c.|C-.|M-.(?:\\C-.)?|[0-7]{3}|x[\da-fA-F]{2}|u[\da-fA-F]{4})/
148
+                }, {
149
+                    token : "paren.start",
150
+                    regex : /\#{/,
151
+                    push  : "start"
152
+                }, {
153
+                    token : "string.end",
154
+                    regex : /`/,
155
+                    next  : "pop"
156
+                }, {
157
+                    defaultToken: "string"
158
+                }]
159
+            }, {
160
+                token : "string.start",
161
+                regex : /'/,
162
+                push  : [{
163
+                    token : "constant.language.escape",
164
+                    regex : /\\['\\]/
165
+                },  {
166
+                    token : "string.end",
167
+                    regex : /'/,
168
+                    next  : "pop"
169
+                }, {
170
+                    defaultToken: "string"
171
+                }]
172
+            }],
173
+
174
+            {
175
+                token : "text", // namespaces aren't symbols
176
+                regex : "::"
177
+            }, {
178
+                token : "variable.instance", // instance variable
179
+                regex : "@{1,2}[a-zA-Z_\\d]+"
180
+            }, {
181
+                token : "support.class", // class name
182
+                regex : "[A-Z][a-zA-Z_\\d]+"
183
+            },
184
+
185
+            constantOtherSymbol,
186
+            constantNumericHex,
187
+            constantNumericFloat,
188
+
189
+            {
190
+                token : "constant.language.boolean",
191
+                regex : "(?:true|false)\\b"
192
+            }, {
193
+                token : keywordMapper,
194
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
195
+            }, {
196
+                token : "punctuation.separator.key-value",
197
+                regex : "=>"
198
+            }, {
199
+                stateName: "heredoc",
200
+                onMatch : function(value, currentState, stack) {
201
+                    var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
202
+                    var tokens = value.split(this.splitRegex);
203
+                    stack.push(next, tokens[3]);
204
+                    return [
205
+                        {type:"constant", value: tokens[1]},
206
+                        {type:"string", value: tokens[2]},
207
+                        {type:"support.class", value: tokens[3]},
208
+                        {type:"string", value: tokens[4]}
209
+                    ];
210
+                },
211
+                regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
212
+                rules: {
213
+                    heredoc: [{
214
+                        onMatch:  function(value, currentState, stack) {
215
+                            if (value === stack[1]) {
216
+                                stack.shift();
217
+                                stack.shift();
218
+                                this.next = stack[0] || "start";
219
+                                return "support.class";
220
+                            }
221
+                            this.next = "";
222
+                            return "string";
223
+                        },
224
+                        regex: ".*$",
225
+                        next: "start"
226
+                    }],
227
+                    indentedHeredoc: [{
228
+                        token: "string",
229
+                        regex: "^ +"
230
+                    }, {
231
+                        onMatch:  function(value, currentState, stack) {
232
+                            if (value === stack[1]) {
233
+                                stack.shift();
234
+                                stack.shift();
235
+                                this.next = stack[0] || "start";
236
+                                return "support.class";
237
+                            }
238
+                            this.next = "";
239
+                            return "string";
240
+                        },
241
+                        regex: ".*$",
242
+                        next: "start"
243
+                    }]
244
+                }
245
+            }, {
246
+                regex : "$",
247
+                token : "empty",
248
+                next : function(currentState, stack) {
249
+                    if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
250
+                        return stack[0];
251
+                    return currentState;
252
+                }
253
+            }, {
254
+                token : "keyword.operator",
255
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
256
+            }, {
257
+                token : "paren.lparen",
258
+                regex : "[[({]"
259
+            }, {
260
+                token : "paren.rparen",
261
+                regex : "[\\])}]"
262
+            }, {
263
+                token : "text",
264
+                regex : "\\s+"
265
+            }
266
+        ],
267
+        "comment" : [
268
+            {
269
+                token : "comment", // closing comment
270
+                regex : "^=end(?:$|\\s.*$)",
271
+                next : "start"
272
+            }, {
273
+                token : "comment", // comment spanning whole line
274
+                regex : ".+"
275
+            }
276
+        ]
277
+    };
278
+
279
+    this.normalizeRules();
280
+};
281
+
282
+oop.inherits(RubyHighlightRules, TextHighlightRules);
283
+
284
+exports.RubyHighlightRules = RubyHighlightRules;
285
+});
286
+
287
+ace.define("ace/mode/haml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/ruby_highlight_rules"], function(require, exports, module) {
288
+"use strict";
289
+
290
+var oop = require("../lib/oop");
291
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
292
+var RubyExports = require("./ruby_highlight_rules");
293
+var RubyHighlightRules = RubyExports.RubyHighlightRules;
294
+
295
+var HamlHighlightRules = function() {
296
+
297
+    this.$rules = 
298
+        {
299
+    "start": [
300
+        {
301
+            token : "punctuation.section.comment",
302
+            regex : /^\s*\/.*/
303
+        },
304
+        {
305
+            token : "punctuation.section.comment",
306
+            regex : /^\s*#.*/
307
+        },
308
+        {
309
+            token: "string.quoted.double",
310
+            regex: "==.+?=="
311
+        },
312
+        {
313
+            token: "keyword.other.doctype",
314
+            regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?"
315
+        },
316
+        RubyExports.qString,
317
+        RubyExports.qqString,
318
+        RubyExports.tString,
319
+        {
320
+            token: ["entity.name.tag.haml"],
321
+            regex: /^\s*%[\w:]+/,
322
+            next: "tag_single"
323
+        },
324
+        {
325
+            token: [ "meta.escape.haml" ],
326
+            regex: "^\\s*\\\\."
327
+        },
328
+        RubyExports.constantNumericHex,
329
+        RubyExports.constantNumericFloat,
330
+        
331
+        RubyExports.constantOtherSymbol,
332
+        {
333
+            token: "text",
334
+            regex: "=|-|~",
335
+            next: "embedded_ruby"
336
+        }
337
+    ],
338
+    "tag_single": [
339
+        {
340
+            token: "entity.other.attribute-name.class.haml",
341
+            regex: "\\.[\\w-]+"
342
+        },
343
+        {
344
+            token: "entity.other.attribute-name.id.haml",
345
+            regex: "#[\\w-]+"
346
+        },
347
+        {
348
+            token: "punctuation.section",
349
+            regex: "\\{",
350
+            next: "section"
351
+        },
352
+        
353
+        RubyExports.constantOtherSymbol,
354
+        
355
+        {
356
+            token: "text",
357
+            regex: /\s/,
358
+            next: "start"
359
+        },
360
+        {
361
+            token: "empty",
362
+            regex: "$|(?!\\.|#|\\{|\\[|=|-|~|\\/)",
363
+            next: "start"
364
+        }
365
+    ],
366
+    "section": [
367
+        RubyExports.constantOtherSymbol,
368
+        
369
+        RubyExports.qString,
370
+        RubyExports.qqString,
371
+        RubyExports.tString,
372
+        
373
+        RubyExports.constantNumericHex,
374
+        RubyExports.constantNumericFloat,
375
+        {
376
+            token: "punctuation.section",
377
+            regex: "\\}",
378
+            next: "start"
379
+        } 
380
+    ],
381
+    "embedded_ruby": [ 
382
+        RubyExports.constantNumericHex,
383
+        RubyExports.constantNumericFloat,
384
+        {
385
+                token : "support.class", // class name
386
+                regex : "[A-Z][a-zA-Z_\\d]+"
387
+        },    
388
+        {
389
+            token : new RubyHighlightRules().getKeywords(),
390
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
391
+        },
392
+        {
393
+            token : ["keyword", "text", "text"],
394
+            regex : "(?:do|\\{)(?: \\|[^|]+\\|)?$",
395
+            next  : "start"
396
+        }, 
397
+        {
398
+            token : ["text"],
399
+            regex : "^$",
400
+            next  : "start"
401
+        }, 
402
+        {
403
+            token : ["text"],
404
+            regex : "^(?!.*\\|\\s*$)",
405
+            next  : "start"
406
+        }
407
+    ]
408
+}
409
+
410
+};
411
+
412
+oop.inherits(HamlHighlightRules, TextHighlightRules);
413
+
414
+exports.HamlHighlightRules = HamlHighlightRules;
415
+});
416
+
417
+ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
418
+"use strict";
419
+
420
+var oop = require("../../lib/oop");
421
+var BaseFoldMode = require("./fold_mode").FoldMode;
422
+var Range = require("../../range").Range;
423
+
424
+var FoldMode = exports.FoldMode = function() {};
425
+oop.inherits(FoldMode, BaseFoldMode);
426
+
427
+(function() {
428
+
429
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
430
+        var range = this.indentationBlock(session, row);
431
+        if (range)
432
+            return range;
433
+
434
+        var re = /\S/;
435
+        var line = session.getLine(row);
436
+        var startLevel = line.search(re);
437
+        if (startLevel == -1 || line[startLevel] != "#")
438
+            return;
439
+
440
+        var startColumn = line.length;
441
+        var maxRow = session.getLength();
442
+        var startRow = row;
443
+        var endRow = row;
444
+
445
+        while (++row < maxRow) {
446
+            line = session.getLine(row);
447
+            var level = line.search(re);
448
+
449
+            if (level == -1)
450
+                continue;
451
+
452
+            if (line[level] != "#")
453
+                break;
454
+
455
+            endRow = row;
456
+        }
457
+
458
+        if (endRow > startRow) {
459
+            var endColumn = session.getLine(endRow).length;
460
+            return new Range(startRow, startColumn, endRow, endColumn);
461
+        }
462
+    };
463
+    this.getFoldWidget = function(session, foldStyle, row) {
464
+        var line = session.getLine(row);
465
+        var indent = line.search(/\S/);
466
+        var next = session.getLine(row + 1);
467
+        var prev = session.getLine(row - 1);
468
+        var prevIndent = prev.search(/\S/);
469
+        var nextIndent = next.search(/\S/);
470
+
471
+        if (indent == -1) {
472
+            session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
473
+            return "";
474
+        }
475
+        if (prevIndent == -1) {
476
+            if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
477
+                session.foldWidgets[row - 1] = "";
478
+                session.foldWidgets[row + 1] = "";
479
+                return "start";
480
+            }
481
+        } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
482
+            if (session.getLine(row - 2).search(/\S/) == -1) {
483
+                session.foldWidgets[row - 1] = "start";
484
+                session.foldWidgets[row + 1] = "";
485
+                return "";
486
+            }
487
+        }
488
+
489
+        if (prevIndent!= -1 && prevIndent < indent)
490
+            session.foldWidgets[row - 1] = "start";
491
+        else
492
+            session.foldWidgets[row - 1] = "";
493
+
494
+        if (indent < nextIndent)
495
+            return "start";
496
+        else
497
+            return "";
498
+    };
499
+
500
+}).call(FoldMode.prototype);
501
+
502
+});
503
+
504
+ace.define("ace/mode/haml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/haml_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module) {
505
+"use strict";
506
+
507
+var oop = require("../lib/oop");
508
+var TextMode = require("./text").Mode;
509
+var HamlHighlightRules = require("./haml_highlight_rules").HamlHighlightRules;
510
+var FoldMode = require("./folding/coffee").FoldMode;
511
+
512
+var Mode = function() {
513
+    this.HighlightRules = HamlHighlightRules;
514
+    this.foldingRules = new FoldMode();
515
+};
516
+oop.inherits(Mode, TextMode);
517
+
518
+(function() {
519
+    this.lineCommentStart = ["//", "#"];
520
+    
521
+    this.$id = "ace/mode/haml";
522
+}).call(Mode.prototype);
523
+
524
+exports.Mode = Mode;
525
+});

+ 2543
- 0
generator/lib/ace/mode-handlebars.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 372
- 0
generator/lib/ace/mode-haskell.js Parādīt failu

@@ -0,0 +1,372 @@
1
+ace.define("ace/mode/haskell_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 HaskellHighlightRules = function() {
8
+
9
+    this.$rules = { start: 
10
+       [ { token: 
11
+            [ 'punctuation.definition.entity.haskell',
12
+              'keyword.operator.function.infix.haskell',
13
+              'punctuation.definition.entity.haskell' ],
14
+           regex: '(`)([a-zA-Z_\']*?)(`)',
15
+           comment: 'In case this regex seems unusual for an infix operator, note that Haskell allows any ordinary function application (elem 4 [1..10]) to be rewritten as an infix expression (4 `elem` [1..10]).' },
16
+         { token: 'constant.language.unit.haskell', regex: '\\(\\)' },
17
+         { token: 'constant.language.empty-list.haskell',
18
+           regex: '\\[\\]' },
19
+         { token: 'keyword.other.haskell',
20
+           regex: 'module',
21
+           push: 
22
+            [ { token: 'keyword.other.haskell', regex: 'where', next: 'pop' },
23
+              { include: '#module_name' },
24
+              { include: '#module_exports' },
25
+              { token: 'invalid', regex: '[a-z]+' },
26
+              { defaultToken: 'meta.declaration.module.haskell' } ] },
27
+         { token: 'keyword.other.haskell',
28
+           regex: '\\bclass\\b',
29
+           push: 
30
+            [ { token: 'keyword.other.haskell',
31
+                regex: '\\bwhere\\b',
32
+                next: 'pop' },
33
+              { token: 'support.class.prelude.haskell',
34
+                regex: '\\b(?:Monad|Functor|Eq|Ord|Read|Show|Num|(?:Frac|Ra)tional|Enum|Bounded|Real(?:Frac|Float)?|Integral|Floating)\\b' },
35
+              { token: 'entity.other.inherited-class.haskell',
36
+                regex: '[A-Z][A-Za-z_\']*' },
37
+              { token: 'variable.other.generic-type.haskell',
38
+                regex: '\\b[a-z][a-zA-Z0-9_\']*\\b' },
39
+              { defaultToken: 'meta.declaration.class.haskell' } ] },
40
+         { token: 'keyword.other.haskell',
41
+           regex: '\\binstance\\b',
42
+           push: 
43
+            [ { token: 'keyword.other.haskell',
44
+                regex: '\\bwhere\\b|$',
45
+                next: 'pop' },
46
+              { include: '#type_signature' },
47
+              { defaultToken: 'meta.declaration.instance.haskell' } ] },
48
+         { token: 'keyword.other.haskell',
49
+           regex: 'import',
50
+           push: 
51
+            [ { token: 'meta.import.haskell', regex: '$|;', next: 'pop' },
52
+              { token: 'keyword.other.haskell', regex: 'qualified|as|hiding' },
53
+              { include: '#module_name' },
54
+              { include: '#module_exports' },
55
+              { defaultToken: 'meta.import.haskell' } ] },
56
+         { token: [ 'keyword.other.haskell', 'meta.deriving.haskell' ],
57
+           regex: '(deriving)(\\s*\\()',
58
+           push: 
59
+            [ { token: 'meta.deriving.haskell', regex: '\\)', next: 'pop' },
60
+              { token: 'entity.other.inherited-class.haskell',
61
+                regex: '\\b[A-Z][a-zA-Z_\']*' },
62
+              { defaultToken: 'meta.deriving.haskell' } ] },
63
+         { token: 'keyword.other.haskell',
64
+           regex: '\\b(?:deriving|where|data|type|case|of|let|in|newtype|default)\\b' },
65
+         { token: 'keyword.operator.haskell', regex: '\\binfix[lr]?\\b' },
66
+         { token: 'keyword.control.haskell',
67
+           regex: '\\b(?:do|if|then|else)\\b' },
68
+         { token: 'constant.numeric.float.haskell',
69
+           regex: '\\b(?:[0-9]+\\.[0-9]+(?:[eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\\b',
70
+           comment: 'Floats are always decimal' },
71
+         { token: 'constant.numeric.haskell',
72
+           regex: '\\b(?:[0-9]+|0(?:[xX][0-9a-fA-F]+|[oO][0-7]+))\\b' },
73
+         { token: 
74
+            [ 'meta.preprocessor.c',
75
+              'punctuation.definition.preprocessor.c',
76
+              'meta.preprocessor.c' ],
77
+           regex: '^(\\s*)(#)(\\s*\\w+)',
78
+           comment: 'In addition to Haskell\'s "native" syntax, GHC permits the C preprocessor to be run on a source file.' },
79
+         { include: '#pragma' },
80
+         { token: 'punctuation.definition.string.begin.haskell',
81
+           regex: '"',
82
+           push: 
83
+            [ { token: 'punctuation.definition.string.end.haskell',
84
+                regex: '"',
85
+                next: 'pop' },
86
+              { token: 'constant.character.escape.haskell',
87
+                regex: '\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\"\'\\&])' },
88
+              { token: 'constant.character.escape.octal.haskell',
89
+                regex: '\\\\o[0-7]+|\\\\x[0-9A-Fa-f]+|\\\\[0-9]+' },
90
+              { token: 'constant.character.escape.control.haskell',
91
+                regex: '\\^[A-Z@\\[\\]\\\\\\^_]' },
92
+              { defaultToken: 'string.quoted.double.haskell' } ] },
93
+         { token: 
94
+            [ 'punctuation.definition.string.begin.haskell',
95
+              'string.quoted.single.haskell',
96
+              'constant.character.escape.haskell',
97
+              'constant.character.escape.octal.haskell',
98
+              'constant.character.escape.hexadecimal.haskell',
99
+              'constant.character.escape.control.haskell',
100
+              'punctuation.definition.string.end.haskell' ],
101
+           regex: '(\')(?:([\\ -\\[\\]-~])|(\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\"\'\\&]))|(\\\\o[0-7]+)|(\\\\x[0-9A-Fa-f]+)|(\\^[A-Z@\\[\\]\\\\\\^_]))(\')' },
102
+         { token: 
103
+            [ 'meta.function.type-declaration.haskell',
104
+              'entity.name.function.haskell',
105
+              'meta.function.type-declaration.haskell',
106
+              'keyword.other.double-colon.haskell' ],
107
+           regex: '^(\\s*)([a-z_][a-zA-Z0-9_\']*|\\([|!%$+\\-.,=</>]+\\))(\\s*)(::)',
108
+           push: 
109
+            [ { token: 'meta.function.type-declaration.haskell',
110
+                regex: '$',
111
+                next: 'pop' },
112
+              { include: '#type_signature' },
113
+              { defaultToken: 'meta.function.type-declaration.haskell' } ] },
114
+         { token: 'support.constant.haskell',
115
+           regex: '\\b(?:Just|Nothing|Left|Right|True|False|LT|EQ|GT|\\(\\)|\\[\\])\\b' },
116
+         { token: 'constant.other.haskell', regex: '\\b[A-Z]\\w*\\b' },
117
+         { include: '#comments' },
118
+         { token: 'support.function.prelude.haskell',
119
+           regex: '\\b(?:abs|acos|acosh|all|and|any|appendFile|applyM|asTypeOf|asin|asinh|atan|atan2|atanh|break|catch|ceiling|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|div|divMod|drop|dropWhile|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromEnum|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|head|id|init|interact|ioError|isDenormalized|isIEEE|isInfinite|isNaN|isNegativeZero|iterate|last|lcm|length|lex|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|odd|or|otherwise|pi|pred|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|read|readFile|readIO|readList|readLn|readParen|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showList|showParen|showString|shows|showsPrec|significand|signum|sin|sinh|snd|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|toEnum|toInteger|toRational|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\\b' },
120
+         { include: '#infix_op' },
121
+         { token: 'keyword.operator.haskell',
122
+           regex: '[|!%$?~+:\\-.=</>\\\\]+',
123
+           comment: 'In case this regex seems overly general, note that Haskell permits the definition of new operators which can be nearly any string of punctuation characters, such as $%^&*.' },
124
+         { token: 'punctuation.separator.comma.haskell', regex: ',' } ],
125
+      '#block_comment': 
126
+       [ { token: 'punctuation.definition.comment.haskell',
127
+           regex: '\\{-(?!#)',
128
+           push: 
129
+            [ { include: '#block_comment' },
130
+              { token: 'punctuation.definition.comment.haskell',
131
+                regex: '-\\}',
132
+                next: 'pop' },
133
+              { defaultToken: 'comment.block.haskell' } ] } ],
134
+      '#comments': 
135
+       [ { token: 'punctuation.definition.comment.haskell',
136
+           regex: '--.*',
137
+           push_: 
138
+            [ { token: 'comment.line.double-dash.haskell',
139
+                regex: '$',
140
+                next: 'pop' },
141
+              { defaultToken: 'comment.line.double-dash.haskell' } ] },
142
+         { include: '#block_comment' } ],
143
+      '#infix_op': 
144
+       [ { token: 'entity.name.function.infix.haskell',
145
+           regex: '\\([|!%$+:\\-.=</>]+\\)|\\(,+\\)' } ],
146
+      '#module_exports': 
147
+       [ { token: 'meta.declaration.exports.haskell',
148
+           regex: '\\(',
149
+           push: 
150
+            [ { token: 'meta.declaration.exports.haskell',
151
+                regex: '\\)',
152
+                next: 'pop' },
153
+              { token: 'entity.name.function.haskell',
154
+                regex: '\\b[a-z][a-zA-Z_\']*' },
155
+              { token: 'storage.type.haskell', regex: '\\b[A-Z][A-Za-z_\']*' },
156
+              { token: 'punctuation.separator.comma.haskell', regex: ',' },
157
+              { include: '#infix_op' },
158
+              { token: 'meta.other.unknown.haskell',
159
+                regex: '\\(.*?\\)',
160
+                comment: 'So named because I don\'t know what to call this.' },
161
+              { defaultToken: 'meta.declaration.exports.haskell' } ] } ],
162
+      '#module_name': 
163
+       [ { token: 'support.other.module.haskell',
164
+           regex: '[A-Z][A-Za-z._\']*' } ],
165
+      '#pragma': 
166
+       [ { token: 'meta.preprocessor.haskell',
167
+           regex: '\\{-#',
168
+           push: 
169
+            [ { token: 'meta.preprocessor.haskell',
170
+                regex: '#-\\}',
171
+                next: 'pop' },
172
+              { token: 'keyword.other.preprocessor.haskell',
173
+                regex: '\\b(?:LANGUAGE|UNPACK|INLINE)\\b' },
174
+              { defaultToken: 'meta.preprocessor.haskell' } ] } ],
175
+      '#type_signature': 
176
+       [ { token: 
177
+            [ 'meta.class-constraint.haskell',
178
+              'entity.other.inherited-class.haskell',
179
+              'meta.class-constraint.haskell',
180
+              'variable.other.generic-type.haskell',
181
+              'meta.class-constraint.haskell',
182
+              'keyword.other.big-arrow.haskell' ],
183
+           regex: '(\\(\\s*)([A-Z][A-Za-z]*)(\\s+)([a-z][A-Za-z_\']*)(\\)\\s*)(=>)' },
184
+         { include: '#pragma' },
185
+         { token: 'keyword.other.arrow.haskell', regex: '->' },
186
+         { token: 'keyword.other.big-arrow.haskell', regex: '=>' },
187
+         { token: 'support.type.prelude.haskell',
188
+           regex: '\\b(?:Int(?:eger)?|Maybe|Either|Bool|Float|Double|Char|String|Ordering|ShowS|ReadS|FilePath|IO(?:Error)?)\\b' },
189
+         { token: 'variable.other.generic-type.haskell',
190
+           regex: '\\b[a-z][a-zA-Z0-9_\']*\\b' },
191
+         { token: 'storage.type.haskell',
192
+           regex: '\\b[A-Z][a-zA-Z0-9_\']*\\b' },
193
+         { token: 'support.constant.unit.haskell', regex: '\\(\\)' },
194
+         { include: '#comments' } ] }
195
+    
196
+    this.normalizeRules();
197
+};
198
+
199
+HaskellHighlightRules.metaData = { fileTypes: [ 'hs' ],
200
+      keyEquivalent: '^~H',
201
+      name: 'Haskell',
202
+      scopeName: 'source.haskell' }
203
+
204
+
205
+oop.inherits(HaskellHighlightRules, TextHighlightRules);
206
+
207
+exports.HaskellHighlightRules = HaskellHighlightRules;
208
+});
209
+
210
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
211
+"use strict";
212
+
213
+var oop = require("../../lib/oop");
214
+var Range = require("../../range").Range;
215
+var BaseFoldMode = require("./fold_mode").FoldMode;
216
+
217
+var FoldMode = exports.FoldMode = function(commentRegex) {
218
+    if (commentRegex) {
219
+        this.foldingStartMarker = new RegExp(
220
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
221
+        );
222
+        this.foldingStopMarker = new RegExp(
223
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
224
+        );
225
+    }
226
+};
227
+oop.inherits(FoldMode, BaseFoldMode);
228
+
229
+(function() {
230
+    
231
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
232
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
233
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
234
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
235
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
236
+    this._getFoldWidgetBase = this.getFoldWidget;
237
+    this.getFoldWidget = function(session, foldStyle, row) {
238
+        var line = session.getLine(row);
239
+    
240
+        if (this.singleLineBlockCommentRe.test(line)) {
241
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
242
+                return "";
243
+        }
244
+    
245
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
246
+    
247
+        if (!fw && this.startRegionRe.test(line))
248
+            return "start"; // lineCommentRegionStart
249
+    
250
+        return fw;
251
+    };
252
+
253
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
254
+        var line = session.getLine(row);
255
+        
256
+        if (this.startRegionRe.test(line))
257
+            return this.getCommentRegionBlock(session, line, row);
258
+        
259
+        var match = line.match(this.foldingStartMarker);
260
+        if (match) {
261
+            var i = match.index;
262
+
263
+            if (match[1])
264
+                return this.openingBracketBlock(session, match[1], row, i);
265
+                
266
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
267
+            
268
+            if (range && !range.isMultiLine()) {
269
+                if (forceMultiline) {
270
+                    range = this.getSectionRange(session, row);
271
+                } else if (foldStyle != "all")
272
+                    range = null;
273
+            }
274
+            
275
+            return range;
276
+        }
277
+
278
+        if (foldStyle === "markbegin")
279
+            return;
280
+
281
+        var match = line.match(this.foldingStopMarker);
282
+        if (match) {
283
+            var i = match.index + match[0].length;
284
+
285
+            if (match[1])
286
+                return this.closingBracketBlock(session, match[1], row, i);
287
+
288
+            return session.getCommentFoldRange(row, i, -1);
289
+        }
290
+    };
291
+    
292
+    this.getSectionRange = function(session, row) {
293
+        var line = session.getLine(row);
294
+        var startIndent = line.search(/\S/);
295
+        var startRow = row;
296
+        var startColumn = line.length;
297
+        row = row + 1;
298
+        var endRow = row;
299
+        var maxRow = session.getLength();
300
+        while (++row < maxRow) {
301
+            line = session.getLine(row);
302
+            var indent = line.search(/\S/);
303
+            if (indent === -1)
304
+                continue;
305
+            if  (startIndent > indent)
306
+                break;
307
+            var subRange = this.getFoldWidgetRange(session, "all", row);
308
+            
309
+            if (subRange) {
310
+                if (subRange.start.row <= startRow) {
311
+                    break;
312
+                } else if (subRange.isMultiLine()) {
313
+                    row = subRange.end.row;
314
+                } else if (startIndent == indent) {
315
+                    break;
316
+                }
317
+            }
318
+            endRow = row;
319
+        }
320
+        
321
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
322
+    };
323
+    
324
+    this.getCommentRegionBlock = function(session, line, row) {
325
+        var startColumn = line.search(/\s*$/);
326
+        var maxRow = session.getLength();
327
+        var startRow = row;
328
+        
329
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
330
+        var depth = 1;
331
+        while (++row < maxRow) {
332
+            line = session.getLine(row);
333
+            var m = re.exec(line);
334
+            if (!m) continue;
335
+            if (m[1]) depth--;
336
+            else depth++;
337
+
338
+            if (!depth) break;
339
+        }
340
+
341
+        var endRow = row;
342
+        if (endRow > startRow) {
343
+            return new Range(startRow, startColumn, endRow, line.length);
344
+        }
345
+    };
346
+
347
+}).call(FoldMode.prototype);
348
+
349
+});
350
+
351
+ace.define("ace/mode/haskell",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/haskell_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
352
+"use strict";
353
+
354
+var oop = require("../lib/oop");
355
+var TextMode = require("./text").Mode;
356
+var HaskellHighlightRules = require("./haskell_highlight_rules").HaskellHighlightRules;
357
+var FoldMode = require("./folding/cstyle").FoldMode;
358
+
359
+var Mode = function() {
360
+    this.HighlightRules = HaskellHighlightRules;
361
+    this.foldingRules = new FoldMode();
362
+};
363
+oop.inherits(Mode, TextMode);
364
+
365
+(function() {
366
+    this.lineCommentStart = "--";
367
+    this.blockComment = {start: "/*", end: "*/"};
368
+    this.$id = "ace/mode/haskell";
369
+}).call(Mode.prototype);
370
+
371
+exports.Mode = Mode;
372
+});

+ 737
- 0
generator/lib/ace/mode-haxe.js Parādīt failu

@@ -0,0 +1,737 @@
1
+ace.define("ace/mode/doc_comment_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 DocCommentHighlightRules = function() {
8
+    this.$rules = {
9
+        "start" : [ {
10
+            token : "comment.doc.tag",
11
+            regex : "@[\\w\\d_]+" // TODO: fix email addresses
12
+        }, 
13
+        DocCommentHighlightRules.getTagRule(),
14
+        {
15
+            defaultToken : "comment.doc",
16
+            caseInsensitive: true
17
+        }]
18
+    };
19
+};
20
+
21
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22
+
23
+DocCommentHighlightRules.getTagRule = function(start) {
24
+    return {
25
+        token : "comment.doc.tag.storage.type",
26
+        regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+    };
28
+}
29
+
30
+DocCommentHighlightRules.getStartRule = function(start) {
31
+    return {
32
+        token : "comment.doc", // doc comment
33
+        regex : "\\/\\*(?=\\*)",
34
+        next  : start
35
+    };
36
+};
37
+
38
+DocCommentHighlightRules.getEndRule = function (start) {
39
+    return {
40
+        token : "comment.doc", // closing comment
41
+        regex : "\\*\\/",
42
+        next  : start
43
+    };
44
+};
45
+
46
+
47
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
48
+
49
+});
50
+
51
+ace.define("ace/mode/haxe_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52
+"use strict";
53
+
54
+var oop = require("../lib/oop");
55
+
56
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
57
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
58
+
59
+var HaxeHighlightRules = function() {
60
+
61
+    var keywords = (
62
+        "break|case|cast|catch|class|continue|default|else|enum|extends|for|function|if|implements|import|in|inline|interface|new|override|package|private|public|return|static|super|switch|this|throw|trace|try|typedef|untyped|var|while|Array|Void|Bool|Int|UInt|Float|Dynamic|String|List|Hash|IntHash|Error|Unknown|Type|Std"
63
+    );
64
+
65
+    var buildinConstants = (
66
+        "null|true|false"
67
+    );
68
+
69
+    var keywordMapper = this.createKeywordMapper({
70
+        "variable.language": "this",
71
+        "keyword": keywords,
72
+        "constant.language": buildinConstants
73
+    }, "identifier");
74
+
75
+    this.$rules = {
76
+        "start" : [
77
+            {
78
+                token : "comment",
79
+                regex : "\\/\\/.*$"
80
+            },
81
+            DocCommentHighlightRules.getStartRule("doc-start"),
82
+            {
83
+                token : "comment", // multi line comment
84
+                regex : "\\/\\*",
85
+                next : "comment"
86
+            }, {
87
+                token : "string.regexp",
88
+                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
89
+            }, {
90
+                token : "string", // single line
91
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
92
+            }, {
93
+                token : "string", // single line
94
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
95
+            }, {
96
+                token : "constant.numeric", // hex
97
+                regex : "0[xX][0-9a-fA-F]+\\b"
98
+            }, {
99
+                token : "constant.numeric", // float
100
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
101
+            }, {
102
+                token : "constant.language.boolean",
103
+                regex : "(?:true|false)\\b"
104
+            }, {
105
+                token : keywordMapper,
106
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
107
+            }, {
108
+                token : "keyword.operator",
109
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
110
+            }, {
111
+                token : "punctuation.operator",
112
+                regex : "\\?|\\:|\\,|\\;|\\."
113
+            }, {
114
+                token : "paren.lparen",
115
+                regex : "[[({<]"
116
+            }, {
117
+                token : "paren.rparen",
118
+                regex : "[\\])}>]"
119
+            }, {
120
+                token : "text",
121
+                regex : "\\s+"
122
+            }
123
+        ],
124
+        "comment" : [
125
+            {
126
+                token : "comment", // closing comment
127
+                regex : ".*?\\*\\/",
128
+                next : "start"
129
+            }, {
130
+                token : "comment", // comment spanning whole line
131
+                regex : ".+"
132
+            }
133
+        ]
134
+    };
135
+
136
+    this.embedRules(DocCommentHighlightRules, "doc-",
137
+        [ DocCommentHighlightRules.getEndRule("start") ]);
138
+};
139
+
140
+oop.inherits(HaxeHighlightRules, TextHighlightRules);
141
+
142
+exports.HaxeHighlightRules = HaxeHighlightRules;
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/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
186
+"use strict";
187
+
188
+var oop = require("../../lib/oop");
189
+var Behaviour = require("../behaviour").Behaviour;
190
+var TokenIterator = require("../../token_iterator").TokenIterator;
191
+var lang = require("../../lib/lang");
192
+
193
+var SAFE_INSERT_IN_TOKENS =
194
+    ["text", "paren.rparen", "punctuation.operator"];
195
+var SAFE_INSERT_BEFORE_TOKENS =
196
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
197
+
198
+var context;
199
+var contextCache = {};
200
+var initContext = function(editor) {
201
+    var id = -1;
202
+    if (editor.multiSelect) {
203
+        id = editor.selection.index;
204
+        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
205
+            contextCache = {rangeCount: editor.multiSelect.rangeCount};
206
+    }
207
+    if (contextCache[id])
208
+        return context = contextCache[id];
209
+    context = contextCache[id] = {
210
+        autoInsertedBrackets: 0,
211
+        autoInsertedRow: -1,
212
+        autoInsertedLineEnd: "",
213
+        maybeInsertedBrackets: 0,
214
+        maybeInsertedRow: -1,
215
+        maybeInsertedLineStart: "",
216
+        maybeInsertedLineEnd: ""
217
+    };
218
+};
219
+
220
+var CstyleBehaviour = function() {
221
+    this.add("braces", "insertion", function(state, action, editor, session, text) {
222
+        var cursor = editor.getCursorPosition();
223
+        var line = session.doc.getLine(cursor.row);
224
+        if (text == '{') {
225
+            initContext(editor);
226
+            var selection = editor.getSelectionRange();
227
+            var selected = session.doc.getTextRange(selection);
228
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
229
+                return {
230
+                    text: '{' + selected + '}',
231
+                    selection: false
232
+                };
233
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
234
+                if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
235
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
236
+                    return {
237
+                        text: '{}',
238
+                        selection: [1, 1]
239
+                    };
240
+                } else {
241
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
242
+                    return {
243
+                        text: '{',
244
+                        selection: [1, 1]
245
+                    };
246
+                }
247
+            }
248
+        } else if (text == '}') {
249
+            initContext(editor);
250
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
251
+            if (rightChar == '}') {
252
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
253
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
254
+                    CstyleBehaviour.popAutoInsertedClosing();
255
+                    return {
256
+                        text: '',
257
+                        selection: [1, 1]
258
+                    };
259
+                }
260
+            }
261
+        } else if (text == "\n" || text == "\r\n") {
262
+            initContext(editor);
263
+            var closing = "";
264
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
265
+                closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
266
+                CstyleBehaviour.clearMaybeInsertedClosing();
267
+            }
268
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
269
+            if (rightChar === '}') {
270
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
271
+                if (!openBracePos)
272
+                     return null;
273
+                var next_indent = this.$getIndent(session.getLine(openBracePos.row));
274
+            } else if (closing) {
275
+                var next_indent = this.$getIndent(line);
276
+            } else {
277
+                CstyleBehaviour.clearMaybeInsertedClosing();
278
+                return;
279
+            }
280
+            var indent = next_indent + session.getTabString();
281
+
282
+            return {
283
+                text: '\n' + indent + '\n' + next_indent + closing,
284
+                selection: [1, indent.length, 1, indent.length]
285
+            };
286
+        } else {
287
+            CstyleBehaviour.clearMaybeInsertedClosing();
288
+        }
289
+    });
290
+
291
+    this.add("braces", "deletion", function(state, action, editor, session, range) {
292
+        var selected = session.doc.getTextRange(range);
293
+        if (!range.isMultiLine() && selected == '{') {
294
+            initContext(editor);
295
+            var line = session.doc.getLine(range.start.row);
296
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
297
+            if (rightChar == '}') {
298
+                range.end.column++;
299
+                return range;
300
+            } else {
301
+                context.maybeInsertedBrackets--;
302
+            }
303
+        }
304
+    });
305
+
306
+    this.add("parens", "insertion", function(state, action, editor, session, text) {
307
+        if (text == '(') {
308
+            initContext(editor);
309
+            var selection = editor.getSelectionRange();
310
+            var selected = session.doc.getTextRange(selection);
311
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
312
+                return {
313
+                    text: '(' + selected + ')',
314
+                    selection: false
315
+                };
316
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
317
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
318
+                return {
319
+                    text: '()',
320
+                    selection: [1, 1]
321
+                };
322
+            }
323
+        } else if (text == ')') {
324
+            initContext(editor);
325
+            var cursor = editor.getCursorPosition();
326
+            var line = session.doc.getLine(cursor.row);
327
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
328
+            if (rightChar == ')') {
329
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
330
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
331
+                    CstyleBehaviour.popAutoInsertedClosing();
332
+                    return {
333
+                        text: '',
334
+                        selection: [1, 1]
335
+                    };
336
+                }
337
+            }
338
+        }
339
+    });
340
+
341
+    this.add("parens", "deletion", function(state, action, editor, session, range) {
342
+        var selected = session.doc.getTextRange(range);
343
+        if (!range.isMultiLine() && selected == '(') {
344
+            initContext(editor);
345
+            var line = session.doc.getLine(range.start.row);
346
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
347
+            if (rightChar == ')') {
348
+                range.end.column++;
349
+                return range;
350
+            }
351
+        }
352
+    });
353
+
354
+    this.add("brackets", "insertion", function(state, action, editor, session, text) {
355
+        if (text == '[') {
356
+            initContext(editor);
357
+            var selection = editor.getSelectionRange();
358
+            var selected = session.doc.getTextRange(selection);
359
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
360
+                return {
361
+                    text: '[' + selected + ']',
362
+                    selection: false
363
+                };
364
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
365
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
366
+                return {
367
+                    text: '[]',
368
+                    selection: [1, 1]
369
+                };
370
+            }
371
+        } else if (text == ']') {
372
+            initContext(editor);
373
+            var cursor = editor.getCursorPosition();
374
+            var line = session.doc.getLine(cursor.row);
375
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
376
+            if (rightChar == ']') {
377
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
378
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
379
+                    CstyleBehaviour.popAutoInsertedClosing();
380
+                    return {
381
+                        text: '',
382
+                        selection: [1, 1]
383
+                    };
384
+                }
385
+            }
386
+        }
387
+    });
388
+
389
+    this.add("brackets", "deletion", function(state, action, editor, session, range) {
390
+        var selected = session.doc.getTextRange(range);
391
+        if (!range.isMultiLine() && selected == '[') {
392
+            initContext(editor);
393
+            var line = session.doc.getLine(range.start.row);
394
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
395
+            if (rightChar == ']') {
396
+                range.end.column++;
397
+                return range;
398
+            }
399
+        }
400
+    });
401
+
402
+    this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
403
+        if (text == '"' || text == "'") {
404
+            initContext(editor);
405
+            var quote = text;
406
+            var selection = editor.getSelectionRange();
407
+            var selected = session.doc.getTextRange(selection);
408
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
409
+                return {
410
+                    text: quote + selected + quote,
411
+                    selection: false
412
+                };
413
+            } else {
414
+                var cursor = editor.getCursorPosition();
415
+                var line = session.doc.getLine(cursor.row);
416
+                var leftChar = line.substring(cursor.column-1, cursor.column);
417
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
418
+                
419
+                var token = session.getTokenAt(cursor.row, cursor.column);
420
+                var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
421
+                if (leftChar == "\\" && token && /escape/.test(token.type))
422
+                    return null;
423
+                
424
+                var stringBefore = token && /string/.test(token.type);
425
+                var stringAfter = !rightToken || /string/.test(rightToken.type);
426
+                
427
+                var pair;
428
+                if (rightChar == quote) {
429
+                    pair = stringBefore !== stringAfter;
430
+                } else {
431
+                    if (stringBefore && !stringAfter)
432
+                        return null; // wrap string with different quote
433
+                    if (stringBefore && stringAfter)
434
+                        return null; // do not pair quotes inside strings 
435
+                    var wordRe = session.$mode.tokenRe;
436
+                    wordRe.lastIndex = 0;
437
+                    var isWordBefore = wordRe.test(leftChar);
438
+                    wordRe.lastIndex = 0;
439
+                    var isWordAfter = wordRe.test(leftChar);
440
+                    if (isWordBefore || isWordAfter)
441
+                        return null; // before or after alphanumeric
442
+                    if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
443
+                        return null; // there is rightChar and it isn't closing
444
+                    pair = true;
445
+                }
446
+                return {
447
+                    text: pair ? quote + quote : "",
448
+                    selection: [1,1]
449
+                };
450
+            }
451
+        }
452
+    });
453
+
454
+    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
455
+        var selected = session.doc.getTextRange(range);
456
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
457
+            initContext(editor);
458
+            var line = session.doc.getLine(range.start.row);
459
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
460
+            if (rightChar == selected) {
461
+                range.end.column++;
462
+                return range;
463
+            }
464
+        }
465
+    });
466
+
467
+};
468
+
469
+    
470
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
471
+    var cursor = editor.getCursorPosition();
472
+    var iterator = new TokenIterator(session, cursor.row, cursor.column);
473
+    if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
474
+        var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
475
+        if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
476
+            return false;
477
+    }
478
+    iterator.stepForward();
479
+    return iterator.getCurrentTokenRow() !== cursor.row ||
480
+        this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
481
+};
482
+
483
+CstyleBehaviour.$matchTokenType = function(token, types) {
484
+    return types.indexOf(token.type || token) > -1;
485
+};
486
+
487
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
488
+    var cursor = editor.getCursorPosition();
489
+    var line = session.doc.getLine(cursor.row);
490
+    if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
491
+        context.autoInsertedBrackets = 0;
492
+    context.autoInsertedRow = cursor.row;
493
+    context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
494
+    context.autoInsertedBrackets++;
495
+};
496
+
497
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
498
+    var cursor = editor.getCursorPosition();
499
+    var line = session.doc.getLine(cursor.row);
500
+    if (!this.isMaybeInsertedClosing(cursor, line))
501
+        context.maybeInsertedBrackets = 0;
502
+    context.maybeInsertedRow = cursor.row;
503
+    context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
504
+    context.maybeInsertedLineEnd = line.substr(cursor.column);
505
+    context.maybeInsertedBrackets++;
506
+};
507
+
508
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
509
+    return context.autoInsertedBrackets > 0 &&
510
+        cursor.row === context.autoInsertedRow &&
511
+        bracket === context.autoInsertedLineEnd[0] &&
512
+        line.substr(cursor.column) === context.autoInsertedLineEnd;
513
+};
514
+
515
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
516
+    return context.maybeInsertedBrackets > 0 &&
517
+        cursor.row === context.maybeInsertedRow &&
518
+        line.substr(cursor.column) === context.maybeInsertedLineEnd &&
519
+        line.substr(0, cursor.column) == context.maybeInsertedLineStart;
520
+};
521
+
522
+CstyleBehaviour.popAutoInsertedClosing = function() {
523
+    context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
524
+    context.autoInsertedBrackets--;
525
+};
526
+
527
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
528
+    if (context) {
529
+        context.maybeInsertedBrackets = 0;
530
+        context.maybeInsertedRow = -1;
531
+    }
532
+};
533
+
534
+
535
+
536
+oop.inherits(CstyleBehaviour, Behaviour);
537
+
538
+exports.CstyleBehaviour = CstyleBehaviour;
539
+});
540
+
541
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
542
+"use strict";
543
+
544
+var oop = require("../../lib/oop");
545
+var Range = require("../../range").Range;
546
+var BaseFoldMode = require("./fold_mode").FoldMode;
547
+
548
+var FoldMode = exports.FoldMode = function(commentRegex) {
549
+    if (commentRegex) {
550
+        this.foldingStartMarker = new RegExp(
551
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
552
+        );
553
+        this.foldingStopMarker = new RegExp(
554
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
555
+        );
556
+    }
557
+};
558
+oop.inherits(FoldMode, BaseFoldMode);
559
+
560
+(function() {
561
+    
562
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
563
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
564
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
565
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
566
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
567
+    this._getFoldWidgetBase = this.getFoldWidget;
568
+    this.getFoldWidget = function(session, foldStyle, row) {
569
+        var line = session.getLine(row);
570
+    
571
+        if (this.singleLineBlockCommentRe.test(line)) {
572
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
573
+                return "";
574
+        }
575
+    
576
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
577
+    
578
+        if (!fw && this.startRegionRe.test(line))
579
+            return "start"; // lineCommentRegionStart
580
+    
581
+        return fw;
582
+    };
583
+
584
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
585
+        var line = session.getLine(row);
586
+        
587
+        if (this.startRegionRe.test(line))
588
+            return this.getCommentRegionBlock(session, line, row);
589
+        
590
+        var match = line.match(this.foldingStartMarker);
591
+        if (match) {
592
+            var i = match.index;
593
+
594
+            if (match[1])
595
+                return this.openingBracketBlock(session, match[1], row, i);
596
+                
597
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
598
+            
599
+            if (range && !range.isMultiLine()) {
600
+                if (forceMultiline) {
601
+                    range = this.getSectionRange(session, row);
602
+                } else if (foldStyle != "all")
603
+                    range = null;
604
+            }
605
+            
606
+            return range;
607
+        }
608
+
609
+        if (foldStyle === "markbegin")
610
+            return;
611
+
612
+        var match = line.match(this.foldingStopMarker);
613
+        if (match) {
614
+            var i = match.index + match[0].length;
615
+
616
+            if (match[1])
617
+                return this.closingBracketBlock(session, match[1], row, i);
618
+
619
+            return session.getCommentFoldRange(row, i, -1);
620
+        }
621
+    };
622
+    
623
+    this.getSectionRange = function(session, row) {
624
+        var line = session.getLine(row);
625
+        var startIndent = line.search(/\S/);
626
+        var startRow = row;
627
+        var startColumn = line.length;
628
+        row = row + 1;
629
+        var endRow = row;
630
+        var maxRow = session.getLength();
631
+        while (++row < maxRow) {
632
+            line = session.getLine(row);
633
+            var indent = line.search(/\S/);
634
+            if (indent === -1)
635
+                continue;
636
+            if  (startIndent > indent)
637
+                break;
638
+            var subRange = this.getFoldWidgetRange(session, "all", row);
639
+            
640
+            if (subRange) {
641
+                if (subRange.start.row <= startRow) {
642
+                    break;
643
+                } else if (subRange.isMultiLine()) {
644
+                    row = subRange.end.row;
645
+                } else if (startIndent == indent) {
646
+                    break;
647
+                }
648
+            }
649
+            endRow = row;
650
+        }
651
+        
652
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
653
+    };
654
+    
655
+    this.getCommentRegionBlock = function(session, line, row) {
656
+        var startColumn = line.search(/\s*$/);
657
+        var maxRow = session.getLength();
658
+        var startRow = row;
659
+        
660
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
661
+        var depth = 1;
662
+        while (++row < maxRow) {
663
+            line = session.getLine(row);
664
+            var m = re.exec(line);
665
+            if (!m) continue;
666
+            if (m[1]) depth--;
667
+            else depth++;
668
+
669
+            if (!depth) break;
670
+        }
671
+
672
+        var endRow = row;
673
+        if (endRow > startRow) {
674
+            return new Range(startRow, startColumn, endRow, line.length);
675
+        }
676
+    };
677
+
678
+}).call(FoldMode.prototype);
679
+
680
+});
681
+
682
+ace.define("ace/mode/haxe",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/haxe_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
683
+"use strict";
684
+
685
+var oop = require("../lib/oop");
686
+var TextMode = require("./text").Mode;
687
+var HaxeHighlightRules = require("./haxe_highlight_rules").HaxeHighlightRules;
688
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
689
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
690
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
691
+
692
+var Mode = function() {
693
+    this.HighlightRules = HaxeHighlightRules;
694
+    
695
+    this.$outdent = new MatchingBraceOutdent();
696
+    this.$behaviour = new CstyleBehaviour();
697
+    this.foldingRules = new CStyleFoldMode();
698
+};
699
+oop.inherits(Mode, TextMode);
700
+
701
+(function() {
702
+    this.lineCommentStart = "//";
703
+    this.blockComment = {start: "/*", end: "*/"};
704
+    
705
+    this.getNextLineIndent = function(state, line, tab) {
706
+        var indent = this.$getIndent(line);
707
+
708
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
709
+        var tokens = tokenizedLine.tokens;
710
+
711
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
712
+            return indent;
713
+        }
714
+
715
+        if (state == "start") {
716
+            var match = line.match(/^.*[\{\(\[]\s*$/);
717
+            if (match) {
718
+                indent += tab;
719
+            }
720
+        }
721
+
722
+        return indent;
723
+    };
724
+
725
+    this.checkOutdent = function(state, line, input) {
726
+        return this.$outdent.checkOutdent(line, input);
727
+    };
728
+
729
+    this.autoOutdent = function(state, doc, row) {
730
+        this.$outdent.autoOutdent(doc, row);
731
+    };
732
+
733
+    this.$id = "ace/mode/haxe";
734
+}).call(Mode.prototype);
735
+
736
+exports.Mode = Mode;
737
+});

+ 2427
- 0
generator/lib/ace/mode-html.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 2955
- 0
generator/lib/ace/mode-html_ruby.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 154
- 0
generator/lib/ace/mode-ini.js Parādīt failu

@@ -0,0 +1,154 @@
1
+ace.define("ace/mode/ini_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 escapeRe = "\\\\(?:[\\\\0abtrn;#=:]|x[a-fA-F\\d]{4})";
8
+
9
+var IniHighlightRules = function() {
10
+    this.$rules = {
11
+        start: [{
12
+            token: 'punctuation.definition.comment.ini',
13
+            regex: '#.*',
14
+            push_: [{
15
+                token: 'comment.line.number-sign.ini',
16
+                regex: '$|^',
17
+                next: 'pop'
18
+            }, {
19
+                defaultToken: 'comment.line.number-sign.ini'
20
+            }]
21
+        }, {
22
+            token: 'punctuation.definition.comment.ini',
23
+            regex: ';.*',
24
+            push_: [{
25
+                token: 'comment.line.semicolon.ini',
26
+                regex: '$|^',
27
+                next: 'pop'
28
+            }, {
29
+                defaultToken: 'comment.line.semicolon.ini'
30
+            }]
31
+        }, {
32
+            token: ['keyword.other.definition.ini', 'text', 'punctuation.separator.key-value.ini'],
33
+            regex: '\\b([a-zA-Z0-9_.-]+)\\b(\\s*)(=)'
34
+        }, {
35
+            token: ['punctuation.definition.entity.ini', 'constant.section.group-title.ini', 'punctuation.definition.entity.ini'],
36
+            regex: '^(\\[)(.*?)(\\])'
37
+        }, {
38
+            token: 'punctuation.definition.string.begin.ini',
39
+            regex: "'",
40
+            push: [{
41
+                token: 'punctuation.definition.string.end.ini',
42
+                regex: "'",
43
+                next: 'pop'
44
+            }, {
45
+                token: "constant.language.escape",
46
+                regex: escapeRe
47
+            }, {
48
+                defaultToken: 'string.quoted.single.ini'
49
+            }]
50
+        }, {
51
+            token: 'punctuation.definition.string.begin.ini',
52
+            regex: '"',
53
+            push: [{
54
+                token: "constant.language.escape",
55
+                regex: escapeRe
56
+            }, {
57
+                token: 'punctuation.definition.string.end.ini',
58
+                regex: '"',
59
+                next: 'pop'
60
+            }, {
61
+                defaultToken: 'string.quoted.double.ini'
62
+            }]
63
+        }]
64
+    };
65
+
66
+    this.normalizeRules();
67
+};
68
+
69
+IniHighlightRules.metaData = {
70
+    fileTypes: ['ini', 'conf'],
71
+    keyEquivalent: '^~I',
72
+    name: 'Ini',
73
+    scopeName: 'source.ini'
74
+};
75
+
76
+
77
+oop.inherits(IniHighlightRules, TextHighlightRules);
78
+
79
+exports.IniHighlightRules = IniHighlightRules;
80
+});
81
+
82
+ace.define("ace/mode/folding/ini",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
83
+"use strict";
84
+
85
+var oop = require("../../lib/oop");
86
+var Range = require("../../range").Range;
87
+var BaseFoldMode = require("./fold_mode").FoldMode;
88
+
89
+var FoldMode = exports.FoldMode = function() {
90
+};
91
+oop.inherits(FoldMode, BaseFoldMode);
92
+
93
+(function() {
94
+
95
+    this.foldingStartMarker = /^\s*\[([^\])]*)]\s*(?:$|[;#])/;
96
+
97
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
98
+        var re = this.foldingStartMarker;
99
+        var line = session.getLine(row);
100
+        
101
+        var m = line.match(re);
102
+        
103
+        if (!m) return;
104
+        
105
+        var startName = m[1] + ".";
106
+        
107
+        var startColumn = line.length;
108
+        var maxRow = session.getLength();
109
+        var startRow = row;
110
+        var endRow = row;
111
+
112
+        while (++row < maxRow) {
113
+            line = session.getLine(row);
114
+            if (/^\s*$/.test(line))
115
+                continue;
116
+            m = line.match(re);
117
+            if (m && m[1].lastIndexOf(startName, 0) !== 0)
118
+                break;
119
+
120
+            endRow = row;
121
+        }
122
+
123
+        if (endRow > startRow) {
124
+            var endColumn = session.getLine(endRow).length;
125
+            return new Range(startRow, startColumn, endRow, endColumn);
126
+        }
127
+    };
128
+
129
+}).call(FoldMode.prototype);
130
+
131
+});
132
+
133
+ace.define("ace/mode/ini",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ini_highlight_rules","ace/mode/folding/ini"], function(require, exports, module) {
134
+"use strict";
135
+
136
+var oop = require("../lib/oop");
137
+var TextMode = require("./text").Mode;
138
+var IniHighlightRules = require("./ini_highlight_rules").IniHighlightRules;
139
+var FoldMode = require("./folding/ini").FoldMode;
140
+
141
+var Mode = function() {
142
+    this.HighlightRules = IniHighlightRules;
143
+    this.foldingRules = new FoldMode();
144
+};
145
+oop.inherits(Mode, TextMode);
146
+
147
+(function() {
148
+    this.lineCommentStart = ";";
149
+    this.blockComment = {start: "/*", end: "*/"};
150
+    this.$id = "ace/mode/ini";
151
+}).call(Mode.prototype);
152
+
153
+exports.Mode = Mode;
154
+});

+ 247
- 0
generator/lib/ace/mode-io.js Parādīt failu

@@ -0,0 +1,247 @@
1
+ace.define("ace/mode/io_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 IoHighlightRules = function() {
8
+
9
+    this.$rules = { start: 
10
+       [ { token: [ 'text', 'meta.empty-parenthesis.io' ],
11
+           regex: '(\\()(\\))',
12
+           comment: 'we match this to overload return inside () --Allan; scoping rules for what gets the scope have changed, so we now group the ) instead of the ( -- Rob' },
13
+         { token: [ 'text', 'meta.comma-parenthesis.io' ],
14
+           regex: '(\\,)(\\))',
15
+           comment: 'We want to do the same for ,) -- Seckar; same as above -- Rob' },
16
+         { token: 'keyword.control.io',
17
+           regex: '\\b(?:if|ifTrue|ifFalse|ifTrueIfFalse|for|loop|reverseForeach|foreach|map|continue|break|while|do|return)\\b' },
18
+         { token: 'punctuation.definition.comment.io',
19
+           regex: '/\\*',
20
+           push: 
21
+            [ { token: 'punctuation.definition.comment.io',
22
+                regex: '\\*/',
23
+                next: 'pop' },
24
+              { defaultToken: 'comment.block.io' } ] },
25
+         { token: 'punctuation.definition.comment.io',
26
+           regex: '//',
27
+           push: 
28
+            [ { token: 'comment.line.double-slash.io',
29
+                regex: '$',
30
+                next: 'pop' },
31
+              { defaultToken: 'comment.line.double-slash.io' } ] },
32
+         { token: 'punctuation.definition.comment.io',
33
+           regex: '#',
34
+           push: 
35
+            [ { token: 'comment.line.number-sign.io', regex: '$', next: 'pop' },
36
+              { defaultToken: 'comment.line.number-sign.io' } ] },
37
+         { token: 'variable.language.io',
38
+           regex: '\\b(?:self|sender|target|proto|protos|parent)\\b',
39
+           comment: 'I wonder if some of this isn\'t variable.other.language? --Allan; scoping this as variable.language to match Objective-C\'s handling of \'self\', which is inconsistent with C++\'s handling of \'this\' but perhaps intentionally so -- Rob' },
40
+         { token: 'keyword.operator.io',
41
+           regex: '<=|>=|=|:=|\\*|\\||\\|\\||\\+|-|/|&|&&|>|<|\\?|@|@@|\\b(?:and|or)\\b' },
42
+         { token: 'constant.other.io', regex: '\\bGL[\\w_]+\\b' },
43
+         { token: 'support.class.io', regex: '\\b[A-Z](?:\\w+)?\\b' },
44
+         { token: 'support.function.io',
45
+           regex: '\\b(?:clone|call|init|method|list|vector|block|\\w+(?=\\s*\\())\\b' },
46
+         { token: 'support.function.open-gl.io',
47
+           regex: '\\bgl(?:u|ut)?[A-Z]\\w+\\b' },
48
+         { token: 'punctuation.definition.string.begin.io',
49
+           regex: '"""',
50
+           push: 
51
+            [ { token: 'punctuation.definition.string.end.io',
52
+                regex: '"""',
53
+                next: 'pop' },
54
+              { token: 'constant.character.escape.io', regex: '\\\\.' },
55
+              { defaultToken: 'string.quoted.triple.io' } ] },
56
+         { token: 'punctuation.definition.string.begin.io',
57
+           regex: '"',
58
+           push: 
59
+            [ { token: 'punctuation.definition.string.end.io',
60
+                regex: '"',
61
+                next: 'pop' },
62
+              { token: 'constant.character.escape.io', regex: '\\\\.' },
63
+              { defaultToken: 'string.quoted.double.io' } ] },
64
+         { token: 'constant.numeric.io',
65
+           regex: '\\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?\\b' },
66
+         { token: 'variable.other.global.io', regex: 'Lobby\\b' },
67
+         { token: 'constant.language.io',
68
+           regex: '\\b(?:TRUE|true|FALSE|false|NULL|null|Null|Nil|nil|YES|NO)\\b' } ] }
69
+    
70
+    this.normalizeRules();
71
+};
72
+
73
+IoHighlightRules.metaData = { fileTypes: [ 'io' ],
74
+      keyEquivalent: '^~I',
75
+      name: 'Io',
76
+      scopeName: 'source.io' }
77
+
78
+
79
+oop.inherits(IoHighlightRules, TextHighlightRules);
80
+
81
+exports.IoHighlightRules = IoHighlightRules;
82
+});
83
+
84
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
85
+"use strict";
86
+
87
+var oop = require("../../lib/oop");
88
+var Range = require("../../range").Range;
89
+var BaseFoldMode = require("./fold_mode").FoldMode;
90
+
91
+var FoldMode = exports.FoldMode = function(commentRegex) {
92
+    if (commentRegex) {
93
+        this.foldingStartMarker = new RegExp(
94
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
95
+        );
96
+        this.foldingStopMarker = new RegExp(
97
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
98
+        );
99
+    }
100
+};
101
+oop.inherits(FoldMode, BaseFoldMode);
102
+
103
+(function() {
104
+    
105
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
106
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
107
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
108
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
109
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
110
+    this._getFoldWidgetBase = this.getFoldWidget;
111
+    this.getFoldWidget = function(session, foldStyle, row) {
112
+        var line = session.getLine(row);
113
+    
114
+        if (this.singleLineBlockCommentRe.test(line)) {
115
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
116
+                return "";
117
+        }
118
+    
119
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
120
+    
121
+        if (!fw && this.startRegionRe.test(line))
122
+            return "start"; // lineCommentRegionStart
123
+    
124
+        return fw;
125
+    };
126
+
127
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
128
+        var line = session.getLine(row);
129
+        
130
+        if (this.startRegionRe.test(line))
131
+            return this.getCommentRegionBlock(session, line, row);
132
+        
133
+        var match = line.match(this.foldingStartMarker);
134
+        if (match) {
135
+            var i = match.index;
136
+
137
+            if (match[1])
138
+                return this.openingBracketBlock(session, match[1], row, i);
139
+                
140
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
141
+            
142
+            if (range && !range.isMultiLine()) {
143
+                if (forceMultiline) {
144
+                    range = this.getSectionRange(session, row);
145
+                } else if (foldStyle != "all")
146
+                    range = null;
147
+            }
148
+            
149
+            return range;
150
+        }
151
+
152
+        if (foldStyle === "markbegin")
153
+            return;
154
+
155
+        var match = line.match(this.foldingStopMarker);
156
+        if (match) {
157
+            var i = match.index + match[0].length;
158
+
159
+            if (match[1])
160
+                return this.closingBracketBlock(session, match[1], row, i);
161
+
162
+            return session.getCommentFoldRange(row, i, -1);
163
+        }
164
+    };
165
+    
166
+    this.getSectionRange = function(session, row) {
167
+        var line = session.getLine(row);
168
+        var startIndent = line.search(/\S/);
169
+        var startRow = row;
170
+        var startColumn = line.length;
171
+        row = row + 1;
172
+        var endRow = row;
173
+        var maxRow = session.getLength();
174
+        while (++row < maxRow) {
175
+            line = session.getLine(row);
176
+            var indent = line.search(/\S/);
177
+            if (indent === -1)
178
+                continue;
179
+            if  (startIndent > indent)
180
+                break;
181
+            var subRange = this.getFoldWidgetRange(session, "all", row);
182
+            
183
+            if (subRange) {
184
+                if (subRange.start.row <= startRow) {
185
+                    break;
186
+                } else if (subRange.isMultiLine()) {
187
+                    row = subRange.end.row;
188
+                } else if (startIndent == indent) {
189
+                    break;
190
+                }
191
+            }
192
+            endRow = row;
193
+        }
194
+        
195
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
196
+    };
197
+    
198
+    this.getCommentRegionBlock = function(session, line, row) {
199
+        var startColumn = line.search(/\s*$/);
200
+        var maxRow = session.getLength();
201
+        var startRow = row;
202
+        
203
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
204
+        var depth = 1;
205
+        while (++row < maxRow) {
206
+            line = session.getLine(row);
207
+            var m = re.exec(line);
208
+            if (!m) continue;
209
+            if (m[1]) depth--;
210
+            else depth++;
211
+
212
+            if (!depth) break;
213
+        }
214
+
215
+        var endRow = row;
216
+        if (endRow > startRow) {
217
+            return new Range(startRow, startColumn, endRow, line.length);
218
+        }
219
+    };
220
+
221
+}).call(FoldMode.prototype);
222
+
223
+});
224
+
225
+ace.define("ace/mode/io",["require","exports","module","ace/lib/oop","ace/mode/text","ace/tokenizer","ace/mode/io_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
226
+"use strict";
227
+
228
+var oop = require("../lib/oop");
229
+var TextMode = require("./text").Mode;
230
+var Tokenizer = require("../tokenizer").Tokenizer;
231
+var IoHighlightRules = require("./io_highlight_rules").IoHighlightRules;
232
+var FoldMode = require("./folding/cstyle").FoldMode;
233
+
234
+var Mode = function() {
235
+    this.HighlightRules = IoHighlightRules;
236
+    this.foldingRules = new FoldMode();
237
+};
238
+oop.inherits(Mode, TextMode);
239
+
240
+(function() {
241
+    this.lineCommentStart = "//";
242
+    this.blockComment = {start: "/*", end: "*/"};
243
+    this.$id = "ace/mode/io"
244
+}).call(Mode.prototype);
245
+
246
+exports.Mode = Mode;
247
+});

+ 696
- 0
generator/lib/ace/mode-jack.js Parādīt failu

@@ -0,0 +1,696 @@
1
+ace.define("ace/mode/jack_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 JackHighlightRules = function() {
8
+    this.$rules = {
9
+        "start" : [
10
+            {
11
+                token : "string",
12
+                regex : '"',
13
+                next  : "string2"
14
+            }, {
15
+                token : "string",
16
+                regex : "'",
17
+                next  : "string1"
18
+            }, {
19
+                token : "constant.numeric", // hex
20
+                regex: "-?0[xX][0-9a-fA-F]+\\b"
21
+            }, {
22
+                token : "constant.numeric", // float
23
+                regex : "(?:0|[-+]?[1-9][0-9]*)\\b"
24
+            }, {
25
+                token : "constant.binary",
26
+                regex : "<[0-9A-Fa-f][0-9A-Fa-f](\\s+[0-9A-Fa-f][0-9A-Fa-f])*>"
27
+            }, {
28
+                token : "constant.language.boolean",
29
+                regex : "(?:true|false)\\b"
30
+            }, {
31
+                token : "constant.language.null",
32
+                regex : "null\\b"
33
+            }, {
34
+                token : "storage.type",
35
+                regex: "(?:Integer|Boolean|Null|String|Buffer|Tuple|List|Object|Function|Coroutine|Form)\\b"
36
+            }, {
37
+                token : "keyword",
38
+                regex : "(?:return|abort|vars|for|delete|in|is|escape|exec|split|and|if|elif|else|while)\\b"
39
+            }, {
40
+                token : "language.builtin",
41
+                regex : "(?:lines|source|parse|read-stream|interval|substr|parseint|write|print|range|rand|inspect|bind|i-values|i-pairs|i-map|i-filter|i-chunk|i-all\\?|i-any\\?|i-collect|i-zip|i-merge|i-each)\\b"
42
+            }, {
43
+                token : "comment",
44
+                regex : "--.*$"
45
+            }, {
46
+                token : "paren.lparen",
47
+                regex : "[[({]"
48
+            }, {
49
+                token : "paren.rparen",
50
+                regex : "[\\])}]"
51
+            }, {
52
+                token : "storage.form",
53
+                regex : "@[a-z]+"
54
+            }, {
55
+                token : "constant.other.symbol",
56
+                regex : ':+[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?'
57
+            }, {
58
+                token : "variable",
59
+                regex : '[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?'
60
+            }, {
61
+                token : "keyword.operator",
62
+                regex : "\\|\\||\\^\\^|&&|!=|==|<=|<|>=|>|\\+|-|\\*|\\/|\\^|\\%|\\#|\\!"
63
+            }, {
64
+                token : "text",
65
+                regex : "\\s+"
66
+            }
67
+        ],
68
+        "string1" : [
69
+            {
70
+                token : "constant.language.escape",
71
+                regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['"\\\/bfnrt])/
72
+            }, {
73
+                token : "string",
74
+                regex : "[^'\\\\]+"
75
+            }, {
76
+                token : "string",
77
+                regex : "'",
78
+                next  : "start"
79
+            }, {
80
+                token : "string",
81
+                regex : "",
82
+                next  : "start"
83
+            }
84
+        ],
85
+        "string2" : [
86
+            {
87
+                token : "constant.language.escape",
88
+                regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['"\\\/bfnrt])/
89
+            }, {
90
+                token : "string",
91
+                regex : '[^"\\\\]+'
92
+            }, {
93
+                token : "string",
94
+                regex : '"',
95
+                next  : "start"
96
+            }, {
97
+                token : "string",
98
+                regex : "",
99
+                next  : "start"
100
+            }
101
+        ]
102
+    };
103
+    
104
+};
105
+
106
+oop.inherits(JackHighlightRules, TextHighlightRules);
107
+
108
+exports.JackHighlightRules = JackHighlightRules;
109
+});
110
+
111
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
112
+"use strict";
113
+
114
+var Range = require("../range").Range;
115
+
116
+var MatchingBraceOutdent = function() {};
117
+
118
+(function() {
119
+
120
+    this.checkOutdent = function(line, input) {
121
+        if (! /^\s+$/.test(line))
122
+            return false;
123
+
124
+        return /^\s*\}/.test(input);
125
+    };
126
+
127
+    this.autoOutdent = function(doc, row) {
128
+        var line = doc.getLine(row);
129
+        var match = line.match(/^(\s*\})/);
130
+
131
+        if (!match) return 0;
132
+
133
+        var column = match[1].length;
134
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
135
+
136
+        if (!openBracePos || openBracePos.row == row) return 0;
137
+
138
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
139
+        doc.replace(new Range(row, 0, row, column-1), indent);
140
+    };
141
+
142
+    this.$getIndent = function(line) {
143
+        return line.match(/^\s*/)[0];
144
+    };
145
+
146
+}).call(MatchingBraceOutdent.prototype);
147
+
148
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
149
+});
150
+
151
+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) {
152
+"use strict";
153
+
154
+var oop = require("../../lib/oop");
155
+var Behaviour = require("../behaviour").Behaviour;
156
+var TokenIterator = require("../../token_iterator").TokenIterator;
157
+var lang = require("../../lib/lang");
158
+
159
+var SAFE_INSERT_IN_TOKENS =
160
+    ["text", "paren.rparen", "punctuation.operator"];
161
+var SAFE_INSERT_BEFORE_TOKENS =
162
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
163
+
164
+var context;
165
+var contextCache = {};
166
+var initContext = function(editor) {
167
+    var id = -1;
168
+    if (editor.multiSelect) {
169
+        id = editor.selection.index;
170
+        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
171
+            contextCache = {rangeCount: editor.multiSelect.rangeCount};
172
+    }
173
+    if (contextCache[id])
174
+        return context = contextCache[id];
175
+    context = contextCache[id] = {
176
+        autoInsertedBrackets: 0,
177
+        autoInsertedRow: -1,
178
+        autoInsertedLineEnd: "",
179
+        maybeInsertedBrackets: 0,
180
+        maybeInsertedRow: -1,
181
+        maybeInsertedLineStart: "",
182
+        maybeInsertedLineEnd: ""
183
+    };
184
+};
185
+
186
+var CstyleBehaviour = function() {
187
+    this.add("braces", "insertion", function(state, action, editor, session, text) {
188
+        var cursor = editor.getCursorPosition();
189
+        var line = session.doc.getLine(cursor.row);
190
+        if (text == '{') {
191
+            initContext(editor);
192
+            var selection = editor.getSelectionRange();
193
+            var selected = session.doc.getTextRange(selection);
194
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
195
+                return {
196
+                    text: '{' + selected + '}',
197
+                    selection: false
198
+                };
199
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
200
+                if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
201
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
202
+                    return {
203
+                        text: '{}',
204
+                        selection: [1, 1]
205
+                    };
206
+                } else {
207
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
208
+                    return {
209
+                        text: '{',
210
+                        selection: [1, 1]
211
+                    };
212
+                }
213
+            }
214
+        } else if (text == '}') {
215
+            initContext(editor);
216
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
217
+            if (rightChar == '}') {
218
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
219
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
220
+                    CstyleBehaviour.popAutoInsertedClosing();
221
+                    return {
222
+                        text: '',
223
+                        selection: [1, 1]
224
+                    };
225
+                }
226
+            }
227
+        } else if (text == "\n" || text == "\r\n") {
228
+            initContext(editor);
229
+            var closing = "";
230
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
231
+                closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
232
+                CstyleBehaviour.clearMaybeInsertedClosing();
233
+            }
234
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
235
+            if (rightChar === '}') {
236
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
237
+                if (!openBracePos)
238
+                     return null;
239
+                var next_indent = this.$getIndent(session.getLine(openBracePos.row));
240
+            } else if (closing) {
241
+                var next_indent = this.$getIndent(line);
242
+            } else {
243
+                CstyleBehaviour.clearMaybeInsertedClosing();
244
+                return;
245
+            }
246
+            var indent = next_indent + session.getTabString();
247
+
248
+            return {
249
+                text: '\n' + indent + '\n' + next_indent + closing,
250
+                selection: [1, indent.length, 1, indent.length]
251
+            };
252
+        } else {
253
+            CstyleBehaviour.clearMaybeInsertedClosing();
254
+        }
255
+    });
256
+
257
+    this.add("braces", "deletion", function(state, action, editor, session, range) {
258
+        var selected = session.doc.getTextRange(range);
259
+        if (!range.isMultiLine() && selected == '{') {
260
+            initContext(editor);
261
+            var line = session.doc.getLine(range.start.row);
262
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
263
+            if (rightChar == '}') {
264
+                range.end.column++;
265
+                return range;
266
+            } else {
267
+                context.maybeInsertedBrackets--;
268
+            }
269
+        }
270
+    });
271
+
272
+    this.add("parens", "insertion", function(state, action, editor, session, text) {
273
+        if (text == '(') {
274
+            initContext(editor);
275
+            var selection = editor.getSelectionRange();
276
+            var selected = session.doc.getTextRange(selection);
277
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
278
+                return {
279
+                    text: '(' + selected + ')',
280
+                    selection: false
281
+                };
282
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
283
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
284
+                return {
285
+                    text: '()',
286
+                    selection: [1, 1]
287
+                };
288
+            }
289
+        } else if (text == ')') {
290
+            initContext(editor);
291
+            var cursor = editor.getCursorPosition();
292
+            var line = session.doc.getLine(cursor.row);
293
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
294
+            if (rightChar == ')') {
295
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
296
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
297
+                    CstyleBehaviour.popAutoInsertedClosing();
298
+                    return {
299
+                        text: '',
300
+                        selection: [1, 1]
301
+                    };
302
+                }
303
+            }
304
+        }
305
+    });
306
+
307
+    this.add("parens", "deletion", function(state, action, editor, session, range) {
308
+        var selected = session.doc.getTextRange(range);
309
+        if (!range.isMultiLine() && selected == '(') {
310
+            initContext(editor);
311
+            var line = session.doc.getLine(range.start.row);
312
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
313
+            if (rightChar == ')') {
314
+                range.end.column++;
315
+                return range;
316
+            }
317
+        }
318
+    });
319
+
320
+    this.add("brackets", "insertion", function(state, action, editor, session, text) {
321
+        if (text == '[') {
322
+            initContext(editor);
323
+            var selection = editor.getSelectionRange();
324
+            var selected = session.doc.getTextRange(selection);
325
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
326
+                return {
327
+                    text: '[' + selected + ']',
328
+                    selection: false
329
+                };
330
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
331
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
332
+                return {
333
+                    text: '[]',
334
+                    selection: [1, 1]
335
+                };
336
+            }
337
+        } else if (text == ']') {
338
+            initContext(editor);
339
+            var cursor = editor.getCursorPosition();
340
+            var line = session.doc.getLine(cursor.row);
341
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
342
+            if (rightChar == ']') {
343
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
344
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
345
+                    CstyleBehaviour.popAutoInsertedClosing();
346
+                    return {
347
+                        text: '',
348
+                        selection: [1, 1]
349
+                    };
350
+                }
351
+            }
352
+        }
353
+    });
354
+
355
+    this.add("brackets", "deletion", function(state, action, editor, session, range) {
356
+        var selected = session.doc.getTextRange(range);
357
+        if (!range.isMultiLine() && selected == '[') {
358
+            initContext(editor);
359
+            var line = session.doc.getLine(range.start.row);
360
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
361
+            if (rightChar == ']') {
362
+                range.end.column++;
363
+                return range;
364
+            }
365
+        }
366
+    });
367
+
368
+    this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
369
+        if (text == '"' || text == "'") {
370
+            initContext(editor);
371
+            var quote = text;
372
+            var selection = editor.getSelectionRange();
373
+            var selected = session.doc.getTextRange(selection);
374
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
375
+                return {
376
+                    text: quote + selected + quote,
377
+                    selection: false
378
+                };
379
+            } else {
380
+                var cursor = editor.getCursorPosition();
381
+                var line = session.doc.getLine(cursor.row);
382
+                var leftChar = line.substring(cursor.column-1, cursor.column);
383
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
384
+                
385
+                var token = session.getTokenAt(cursor.row, cursor.column);
386
+                var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
387
+                if (leftChar == "\\" && token && /escape/.test(token.type))
388
+                    return null;
389
+                
390
+                var stringBefore = token && /string/.test(token.type);
391
+                var stringAfter = !rightToken || /string/.test(rightToken.type);
392
+                
393
+                var pair;
394
+                if (rightChar == quote) {
395
+                    pair = stringBefore !== stringAfter;
396
+                } else {
397
+                    if (stringBefore && !stringAfter)
398
+                        return null; // wrap string with different quote
399
+                    if (stringBefore && stringAfter)
400
+                        return null; // do not pair quotes inside strings 
401
+                    var wordRe = session.$mode.tokenRe;
402
+                    wordRe.lastIndex = 0;
403
+                    var isWordBefore = wordRe.test(leftChar);
404
+                    wordRe.lastIndex = 0;
405
+                    var isWordAfter = wordRe.test(leftChar);
406
+                    if (isWordBefore || isWordAfter)
407
+                        return null; // before or after alphanumeric
408
+                    if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
409
+                        return null; // there is rightChar and it isn't closing
410
+                    pair = true;
411
+                }
412
+                return {
413
+                    text: pair ? quote + quote : "",
414
+                    selection: [1,1]
415
+                };
416
+            }
417
+        }
418
+    });
419
+
420
+    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
421
+        var selected = session.doc.getTextRange(range);
422
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
423
+            initContext(editor);
424
+            var line = session.doc.getLine(range.start.row);
425
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
426
+            if (rightChar == selected) {
427
+                range.end.column++;
428
+                return range;
429
+            }
430
+        }
431
+    });
432
+
433
+};
434
+
435
+    
436
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
437
+    var cursor = editor.getCursorPosition();
438
+    var iterator = new TokenIterator(session, cursor.row, cursor.column);
439
+    if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
440
+        var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
441
+        if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
442
+            return false;
443
+    }
444
+    iterator.stepForward();
445
+    return iterator.getCurrentTokenRow() !== cursor.row ||
446
+        this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
447
+};
448
+
449
+CstyleBehaviour.$matchTokenType = function(token, types) {
450
+    return types.indexOf(token.type || token) > -1;
451
+};
452
+
453
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
454
+    var cursor = editor.getCursorPosition();
455
+    var line = session.doc.getLine(cursor.row);
456
+    if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
457
+        context.autoInsertedBrackets = 0;
458
+    context.autoInsertedRow = cursor.row;
459
+    context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
460
+    context.autoInsertedBrackets++;
461
+};
462
+
463
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
464
+    var cursor = editor.getCursorPosition();
465
+    var line = session.doc.getLine(cursor.row);
466
+    if (!this.isMaybeInsertedClosing(cursor, line))
467
+        context.maybeInsertedBrackets = 0;
468
+    context.maybeInsertedRow = cursor.row;
469
+    context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
470
+    context.maybeInsertedLineEnd = line.substr(cursor.column);
471
+    context.maybeInsertedBrackets++;
472
+};
473
+
474
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
475
+    return context.autoInsertedBrackets > 0 &&
476
+        cursor.row === context.autoInsertedRow &&
477
+        bracket === context.autoInsertedLineEnd[0] &&
478
+        line.substr(cursor.column) === context.autoInsertedLineEnd;
479
+};
480
+
481
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
482
+    return context.maybeInsertedBrackets > 0 &&
483
+        cursor.row === context.maybeInsertedRow &&
484
+        line.substr(cursor.column) === context.maybeInsertedLineEnd &&
485
+        line.substr(0, cursor.column) == context.maybeInsertedLineStart;
486
+};
487
+
488
+CstyleBehaviour.popAutoInsertedClosing = function() {
489
+    context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
490
+    context.autoInsertedBrackets--;
491
+};
492
+
493
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
494
+    if (context) {
495
+        context.maybeInsertedBrackets = 0;
496
+        context.maybeInsertedRow = -1;
497
+    }
498
+};
499
+
500
+
501
+
502
+oop.inherits(CstyleBehaviour, Behaviour);
503
+
504
+exports.CstyleBehaviour = CstyleBehaviour;
505
+});
506
+
507
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
508
+"use strict";
509
+
510
+var oop = require("../../lib/oop");
511
+var Range = require("../../range").Range;
512
+var BaseFoldMode = require("./fold_mode").FoldMode;
513
+
514
+var FoldMode = exports.FoldMode = function(commentRegex) {
515
+    if (commentRegex) {
516
+        this.foldingStartMarker = new RegExp(
517
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
518
+        );
519
+        this.foldingStopMarker = new RegExp(
520
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
521
+        );
522
+    }
523
+};
524
+oop.inherits(FoldMode, BaseFoldMode);
525
+
526
+(function() {
527
+    
528
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
529
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
530
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
531
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
532
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
533
+    this._getFoldWidgetBase = this.getFoldWidget;
534
+    this.getFoldWidget = function(session, foldStyle, row) {
535
+        var line = session.getLine(row);
536
+    
537
+        if (this.singleLineBlockCommentRe.test(line)) {
538
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
539
+                return "";
540
+        }
541
+    
542
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
543
+    
544
+        if (!fw && this.startRegionRe.test(line))
545
+            return "start"; // lineCommentRegionStart
546
+    
547
+        return fw;
548
+    };
549
+
550
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
551
+        var line = session.getLine(row);
552
+        
553
+        if (this.startRegionRe.test(line))
554
+            return this.getCommentRegionBlock(session, line, row);
555
+        
556
+        var match = line.match(this.foldingStartMarker);
557
+        if (match) {
558
+            var i = match.index;
559
+
560
+            if (match[1])
561
+                return this.openingBracketBlock(session, match[1], row, i);
562
+                
563
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
564
+            
565
+            if (range && !range.isMultiLine()) {
566
+                if (forceMultiline) {
567
+                    range = this.getSectionRange(session, row);
568
+                } else if (foldStyle != "all")
569
+                    range = null;
570
+            }
571
+            
572
+            return range;
573
+        }
574
+
575
+        if (foldStyle === "markbegin")
576
+            return;
577
+
578
+        var match = line.match(this.foldingStopMarker);
579
+        if (match) {
580
+            var i = match.index + match[0].length;
581
+
582
+            if (match[1])
583
+                return this.closingBracketBlock(session, match[1], row, i);
584
+
585
+            return session.getCommentFoldRange(row, i, -1);
586
+        }
587
+    };
588
+    
589
+    this.getSectionRange = function(session, row) {
590
+        var line = session.getLine(row);
591
+        var startIndent = line.search(/\S/);
592
+        var startRow = row;
593
+        var startColumn = line.length;
594
+        row = row + 1;
595
+        var endRow = row;
596
+        var maxRow = session.getLength();
597
+        while (++row < maxRow) {
598
+            line = session.getLine(row);
599
+            var indent = line.search(/\S/);
600
+            if (indent === -1)
601
+                continue;
602
+            if  (startIndent > indent)
603
+                break;
604
+            var subRange = this.getFoldWidgetRange(session, "all", row);
605
+            
606
+            if (subRange) {
607
+                if (subRange.start.row <= startRow) {
608
+                    break;
609
+                } else if (subRange.isMultiLine()) {
610
+                    row = subRange.end.row;
611
+                } else if (startIndent == indent) {
612
+                    break;
613
+                }
614
+            }
615
+            endRow = row;
616
+        }
617
+        
618
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
619
+    };
620
+    
621
+    this.getCommentRegionBlock = function(session, line, row) {
622
+        var startColumn = line.search(/\s*$/);
623
+        var maxRow = session.getLength();
624
+        var startRow = row;
625
+        
626
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
627
+        var depth = 1;
628
+        while (++row < maxRow) {
629
+            line = session.getLine(row);
630
+            var m = re.exec(line);
631
+            if (!m) continue;
632
+            if (m[1]) depth--;
633
+            else depth++;
634
+
635
+            if (!depth) break;
636
+        }
637
+
638
+        var endRow = row;
639
+        if (endRow > startRow) {
640
+            return new Range(startRow, startColumn, endRow, line.length);
641
+        }
642
+    };
643
+
644
+}).call(FoldMode.prototype);
645
+
646
+});
647
+
648
+ace.define("ace/mode/jack",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/jack_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
649
+"use strict";
650
+
651
+var oop = require("../lib/oop");
652
+var TextMode = require("./text").Mode;
653
+var HighlightRules = require("./jack_highlight_rules").JackHighlightRules;
654
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
655
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
656
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
657
+
658
+var Mode = function() {
659
+    this.HighlightRules = HighlightRules;
660
+    this.$outdent = new MatchingBraceOutdent();
661
+    this.$behaviour = new CstyleBehaviour();
662
+    this.foldingRules = new CStyleFoldMode();
663
+};
664
+oop.inherits(Mode, TextMode);
665
+
666
+(function() {
667
+
668
+    this.lineCommentStart = "--";
669
+
670
+    this.getNextLineIndent = function(state, line, tab) {
671
+        var indent = this.$getIndent(line);
672
+
673
+        if (state == "start") {
674
+            var match = line.match(/^.*[\{\(\[]\s*$/);
675
+            if (match) {
676
+                indent += tab;
677
+            }
678
+        }
679
+
680
+        return indent;
681
+    };
682
+
683
+    this.checkOutdent = function(state, line, input) {
684
+        return this.$outdent.checkOutdent(line, input);
685
+    };
686
+
687
+    this.autoOutdent = function(state, doc, row) {
688
+        this.$outdent.autoOutdent(doc, row);
689
+    };
690
+
691
+
692
+    this.$id = "ace/mode/jack";
693
+}).call(Mode.prototype);
694
+
695
+exports.Mode = Mode;
696
+});

+ 2039
- 0
generator/lib/ace/mode-jade.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 1172
- 0
generator/lib/ace/mode-java.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 1025
- 0
generator/lib/ace/mode-javascript.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 668
- 0
generator/lib/ace/mode-json.js Parādīt failu

@@ -0,0 +1,668 @@
1
+ace.define("ace/mode/json_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 JsonHighlightRules = function() {
8
+    this.$rules = {
9
+        "start" : [
10
+            {
11
+                token : "variable", // single line
12
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'
13
+            }, {
14
+                token : "string", // single line
15
+                regex : '"',
16
+                next  : "string"
17
+            }, {
18
+                token : "constant.numeric", // hex
19
+                regex : "0[xX][0-9a-fA-F]+\\b"
20
+            }, {
21
+                token : "constant.numeric", // float
22
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
23
+            }, {
24
+                token : "constant.language.boolean",
25
+                regex : "(?:true|false)\\b"
26
+            }, {
27
+                token : "invalid.illegal", // single quoted strings are not allowed
28
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
29
+            }, {
30
+                token : "invalid.illegal", // comments are not allowed
31
+                regex : "\\/\\/.*$"
32
+            }, {
33
+                token : "paren.lparen",
34
+                regex : "[[({]"
35
+            }, {
36
+                token : "paren.rparen",
37
+                regex : "[\\])}]"
38
+            }, {
39
+                token : "text",
40
+                regex : "\\s+"
41
+            }
42
+        ],
43
+        "string" : [
44
+            {
45
+                token : "constant.language.escape",
46
+                regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/
47
+            }, {
48
+                token : "string",
49
+                regex : '[^"\\\\]+'
50
+            }, {
51
+                token : "string",
52
+                regex : '"',
53
+                next  : "start"
54
+            }, {
55
+                token : "string",
56
+                regex : "",
57
+                next  : "start"
58
+            }
59
+        ]
60
+    };
61
+    
62
+};
63
+
64
+oop.inherits(JsonHighlightRules, TextHighlightRules);
65
+
66
+exports.JsonHighlightRules = JsonHighlightRules;
67
+});
68
+
69
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
70
+"use strict";
71
+
72
+var Range = require("../range").Range;
73
+
74
+var MatchingBraceOutdent = function() {};
75
+
76
+(function() {
77
+
78
+    this.checkOutdent = function(line, input) {
79
+        if (! /^\s+$/.test(line))
80
+            return false;
81
+
82
+        return /^\s*\}/.test(input);
83
+    };
84
+
85
+    this.autoOutdent = function(doc, row) {
86
+        var line = doc.getLine(row);
87
+        var match = line.match(/^(\s*\})/);
88
+
89
+        if (!match) return 0;
90
+
91
+        var column = match[1].length;
92
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
93
+
94
+        if (!openBracePos || openBracePos.row == row) return 0;
95
+
96
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
97
+        doc.replace(new Range(row, 0, row, column-1), indent);
98
+    };
99
+
100
+    this.$getIndent = function(line) {
101
+        return line.match(/^\s*/)[0];
102
+    };
103
+
104
+}).call(MatchingBraceOutdent.prototype);
105
+
106
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
107
+});
108
+
109
+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) {
110
+"use strict";
111
+
112
+var oop = require("../../lib/oop");
113
+var Behaviour = require("../behaviour").Behaviour;
114
+var TokenIterator = require("../../token_iterator").TokenIterator;
115
+var lang = require("../../lib/lang");
116
+
117
+var SAFE_INSERT_IN_TOKENS =
118
+    ["text", "paren.rparen", "punctuation.operator"];
119
+var SAFE_INSERT_BEFORE_TOKENS =
120
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
121
+
122
+var context;
123
+var contextCache = {};
124
+var initContext = function(editor) {
125
+    var id = -1;
126
+    if (editor.multiSelect) {
127
+        id = editor.selection.index;
128
+        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
129
+            contextCache = {rangeCount: editor.multiSelect.rangeCount};
130
+    }
131
+    if (contextCache[id])
132
+        return context = contextCache[id];
133
+    context = contextCache[id] = {
134
+        autoInsertedBrackets: 0,
135
+        autoInsertedRow: -1,
136
+        autoInsertedLineEnd: "",
137
+        maybeInsertedBrackets: 0,
138
+        maybeInsertedRow: -1,
139
+        maybeInsertedLineStart: "",
140
+        maybeInsertedLineEnd: ""
141
+    };
142
+};
143
+
144
+var CstyleBehaviour = function() {
145
+    this.add("braces", "insertion", function(state, action, editor, session, text) {
146
+        var cursor = editor.getCursorPosition();
147
+        var line = session.doc.getLine(cursor.row);
148
+        if (text == '{') {
149
+            initContext(editor);
150
+            var selection = editor.getSelectionRange();
151
+            var selected = session.doc.getTextRange(selection);
152
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
153
+                return {
154
+                    text: '{' + selected + '}',
155
+                    selection: false
156
+                };
157
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
158
+                if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
159
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
160
+                    return {
161
+                        text: '{}',
162
+                        selection: [1, 1]
163
+                    };
164
+                } else {
165
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
166
+                    return {
167
+                        text: '{',
168
+                        selection: [1, 1]
169
+                    };
170
+                }
171
+            }
172
+        } else if (text == '}') {
173
+            initContext(editor);
174
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
175
+            if (rightChar == '}') {
176
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
177
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
178
+                    CstyleBehaviour.popAutoInsertedClosing();
179
+                    return {
180
+                        text: '',
181
+                        selection: [1, 1]
182
+                    };
183
+                }
184
+            }
185
+        } else if (text == "\n" || text == "\r\n") {
186
+            initContext(editor);
187
+            var closing = "";
188
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
189
+                closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
190
+                CstyleBehaviour.clearMaybeInsertedClosing();
191
+            }
192
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
193
+            if (rightChar === '}') {
194
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
195
+                if (!openBracePos)
196
+                     return null;
197
+                var next_indent = this.$getIndent(session.getLine(openBracePos.row));
198
+            } else if (closing) {
199
+                var next_indent = this.$getIndent(line);
200
+            } else {
201
+                CstyleBehaviour.clearMaybeInsertedClosing();
202
+                return;
203
+            }
204
+            var indent = next_indent + session.getTabString();
205
+
206
+            return {
207
+                text: '\n' + indent + '\n' + next_indent + closing,
208
+                selection: [1, indent.length, 1, indent.length]
209
+            };
210
+        } else {
211
+            CstyleBehaviour.clearMaybeInsertedClosing();
212
+        }
213
+    });
214
+
215
+    this.add("braces", "deletion", function(state, action, editor, session, range) {
216
+        var selected = session.doc.getTextRange(range);
217
+        if (!range.isMultiLine() && selected == '{') {
218
+            initContext(editor);
219
+            var line = session.doc.getLine(range.start.row);
220
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
221
+            if (rightChar == '}') {
222
+                range.end.column++;
223
+                return range;
224
+            } else {
225
+                context.maybeInsertedBrackets--;
226
+            }
227
+        }
228
+    });
229
+
230
+    this.add("parens", "insertion", function(state, action, editor, session, text) {
231
+        if (text == '(') {
232
+            initContext(editor);
233
+            var selection = editor.getSelectionRange();
234
+            var selected = session.doc.getTextRange(selection);
235
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
236
+                return {
237
+                    text: '(' + selected + ')',
238
+                    selection: false
239
+                };
240
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
241
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
242
+                return {
243
+                    text: '()',
244
+                    selection: [1, 1]
245
+                };
246
+            }
247
+        } else if (text == ')') {
248
+            initContext(editor);
249
+            var cursor = editor.getCursorPosition();
250
+            var line = session.doc.getLine(cursor.row);
251
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
252
+            if (rightChar == ')') {
253
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
254
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
255
+                    CstyleBehaviour.popAutoInsertedClosing();
256
+                    return {
257
+                        text: '',
258
+                        selection: [1, 1]
259
+                    };
260
+                }
261
+            }
262
+        }
263
+    });
264
+
265
+    this.add("parens", "deletion", function(state, action, editor, session, range) {
266
+        var selected = session.doc.getTextRange(range);
267
+        if (!range.isMultiLine() && selected == '(') {
268
+            initContext(editor);
269
+            var line = session.doc.getLine(range.start.row);
270
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
271
+            if (rightChar == ')') {
272
+                range.end.column++;
273
+                return range;
274
+            }
275
+        }
276
+    });
277
+
278
+    this.add("brackets", "insertion", function(state, action, editor, session, text) {
279
+        if (text == '[') {
280
+            initContext(editor);
281
+            var selection = editor.getSelectionRange();
282
+            var selected = session.doc.getTextRange(selection);
283
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
284
+                return {
285
+                    text: '[' + selected + ']',
286
+                    selection: false
287
+                };
288
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
289
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
290
+                return {
291
+                    text: '[]',
292
+                    selection: [1, 1]
293
+                };
294
+            }
295
+        } else if (text == ']') {
296
+            initContext(editor);
297
+            var cursor = editor.getCursorPosition();
298
+            var line = session.doc.getLine(cursor.row);
299
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
300
+            if (rightChar == ']') {
301
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
302
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
303
+                    CstyleBehaviour.popAutoInsertedClosing();
304
+                    return {
305
+                        text: '',
306
+                        selection: [1, 1]
307
+                    };
308
+                }
309
+            }
310
+        }
311
+    });
312
+
313
+    this.add("brackets", "deletion", function(state, action, editor, session, range) {
314
+        var selected = session.doc.getTextRange(range);
315
+        if (!range.isMultiLine() && selected == '[') {
316
+            initContext(editor);
317
+            var line = session.doc.getLine(range.start.row);
318
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
319
+            if (rightChar == ']') {
320
+                range.end.column++;
321
+                return range;
322
+            }
323
+        }
324
+    });
325
+
326
+    this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
327
+        if (text == '"' || text == "'") {
328
+            initContext(editor);
329
+            var quote = text;
330
+            var selection = editor.getSelectionRange();
331
+            var selected = session.doc.getTextRange(selection);
332
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
333
+                return {
334
+                    text: quote + selected + quote,
335
+                    selection: false
336
+                };
337
+            } else {
338
+                var cursor = editor.getCursorPosition();
339
+                var line = session.doc.getLine(cursor.row);
340
+                var leftChar = line.substring(cursor.column-1, cursor.column);
341
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
342
+                
343
+                var token = session.getTokenAt(cursor.row, cursor.column);
344
+                var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
345
+                if (leftChar == "\\" && token && /escape/.test(token.type))
346
+                    return null;
347
+                
348
+                var stringBefore = token && /string/.test(token.type);
349
+                var stringAfter = !rightToken || /string/.test(rightToken.type);
350
+                
351
+                var pair;
352
+                if (rightChar == quote) {
353
+                    pair = stringBefore !== stringAfter;
354
+                } else {
355
+                    if (stringBefore && !stringAfter)
356
+                        return null; // wrap string with different quote
357
+                    if (stringBefore && stringAfter)
358
+                        return null; // do not pair quotes inside strings 
359
+                    var wordRe = session.$mode.tokenRe;
360
+                    wordRe.lastIndex = 0;
361
+                    var isWordBefore = wordRe.test(leftChar);
362
+                    wordRe.lastIndex = 0;
363
+                    var isWordAfter = wordRe.test(leftChar);
364
+                    if (isWordBefore || isWordAfter)
365
+                        return null; // before or after alphanumeric
366
+                    if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
367
+                        return null; // there is rightChar and it isn't closing
368
+                    pair = true;
369
+                }
370
+                return {
371
+                    text: pair ? quote + quote : "",
372
+                    selection: [1,1]
373
+                };
374
+            }
375
+        }
376
+    });
377
+
378
+    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
379
+        var selected = session.doc.getTextRange(range);
380
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
381
+            initContext(editor);
382
+            var line = session.doc.getLine(range.start.row);
383
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
384
+            if (rightChar == selected) {
385
+                range.end.column++;
386
+                return range;
387
+            }
388
+        }
389
+    });
390
+
391
+};
392
+
393
+    
394
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
395
+    var cursor = editor.getCursorPosition();
396
+    var iterator = new TokenIterator(session, cursor.row, cursor.column);
397
+    if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
398
+        var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
399
+        if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
400
+            return false;
401
+    }
402
+    iterator.stepForward();
403
+    return iterator.getCurrentTokenRow() !== cursor.row ||
404
+        this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
405
+};
406
+
407
+CstyleBehaviour.$matchTokenType = function(token, types) {
408
+    return types.indexOf(token.type || token) > -1;
409
+};
410
+
411
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
412
+    var cursor = editor.getCursorPosition();
413
+    var line = session.doc.getLine(cursor.row);
414
+    if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
415
+        context.autoInsertedBrackets = 0;
416
+    context.autoInsertedRow = cursor.row;
417
+    context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
418
+    context.autoInsertedBrackets++;
419
+};
420
+
421
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
422
+    var cursor = editor.getCursorPosition();
423
+    var line = session.doc.getLine(cursor.row);
424
+    if (!this.isMaybeInsertedClosing(cursor, line))
425
+        context.maybeInsertedBrackets = 0;
426
+    context.maybeInsertedRow = cursor.row;
427
+    context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
428
+    context.maybeInsertedLineEnd = line.substr(cursor.column);
429
+    context.maybeInsertedBrackets++;
430
+};
431
+
432
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
433
+    return context.autoInsertedBrackets > 0 &&
434
+        cursor.row === context.autoInsertedRow &&
435
+        bracket === context.autoInsertedLineEnd[0] &&
436
+        line.substr(cursor.column) === context.autoInsertedLineEnd;
437
+};
438
+
439
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
440
+    return context.maybeInsertedBrackets > 0 &&
441
+        cursor.row === context.maybeInsertedRow &&
442
+        line.substr(cursor.column) === context.maybeInsertedLineEnd &&
443
+        line.substr(0, cursor.column) == context.maybeInsertedLineStart;
444
+};
445
+
446
+CstyleBehaviour.popAutoInsertedClosing = function() {
447
+    context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
448
+    context.autoInsertedBrackets--;
449
+};
450
+
451
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
452
+    if (context) {
453
+        context.maybeInsertedBrackets = 0;
454
+        context.maybeInsertedRow = -1;
455
+    }
456
+};
457
+
458
+
459
+
460
+oop.inherits(CstyleBehaviour, Behaviour);
461
+
462
+exports.CstyleBehaviour = CstyleBehaviour;
463
+});
464
+
465
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
466
+"use strict";
467
+
468
+var oop = require("../../lib/oop");
469
+var Range = require("../../range").Range;
470
+var BaseFoldMode = require("./fold_mode").FoldMode;
471
+
472
+var FoldMode = exports.FoldMode = function(commentRegex) {
473
+    if (commentRegex) {
474
+        this.foldingStartMarker = new RegExp(
475
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
476
+        );
477
+        this.foldingStopMarker = new RegExp(
478
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
479
+        );
480
+    }
481
+};
482
+oop.inherits(FoldMode, BaseFoldMode);
483
+
484
+(function() {
485
+    
486
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
487
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
488
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
489
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
490
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
491
+    this._getFoldWidgetBase = this.getFoldWidget;
492
+    this.getFoldWidget = function(session, foldStyle, row) {
493
+        var line = session.getLine(row);
494
+    
495
+        if (this.singleLineBlockCommentRe.test(line)) {
496
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
497
+                return "";
498
+        }
499
+    
500
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
501
+    
502
+        if (!fw && this.startRegionRe.test(line))
503
+            return "start"; // lineCommentRegionStart
504
+    
505
+        return fw;
506
+    };
507
+
508
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
509
+        var line = session.getLine(row);
510
+        
511
+        if (this.startRegionRe.test(line))
512
+            return this.getCommentRegionBlock(session, line, row);
513
+        
514
+        var match = line.match(this.foldingStartMarker);
515
+        if (match) {
516
+            var i = match.index;
517
+
518
+            if (match[1])
519
+                return this.openingBracketBlock(session, match[1], row, i);
520
+                
521
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
522
+            
523
+            if (range && !range.isMultiLine()) {
524
+                if (forceMultiline) {
525
+                    range = this.getSectionRange(session, row);
526
+                } else if (foldStyle != "all")
527
+                    range = null;
528
+            }
529
+            
530
+            return range;
531
+        }
532
+
533
+        if (foldStyle === "markbegin")
534
+            return;
535
+
536
+        var match = line.match(this.foldingStopMarker);
537
+        if (match) {
538
+            var i = match.index + match[0].length;
539
+
540
+            if (match[1])
541
+                return this.closingBracketBlock(session, match[1], row, i);
542
+
543
+            return session.getCommentFoldRange(row, i, -1);
544
+        }
545
+    };
546
+    
547
+    this.getSectionRange = function(session, row) {
548
+        var line = session.getLine(row);
549
+        var startIndent = line.search(/\S/);
550
+        var startRow = row;
551
+        var startColumn = line.length;
552
+        row = row + 1;
553
+        var endRow = row;
554
+        var maxRow = session.getLength();
555
+        while (++row < maxRow) {
556
+            line = session.getLine(row);
557
+            var indent = line.search(/\S/);
558
+            if (indent === -1)
559
+                continue;
560
+            if  (startIndent > indent)
561
+                break;
562
+            var subRange = this.getFoldWidgetRange(session, "all", row);
563
+            
564
+            if (subRange) {
565
+                if (subRange.start.row <= startRow) {
566
+                    break;
567
+                } else if (subRange.isMultiLine()) {
568
+                    row = subRange.end.row;
569
+                } else if (startIndent == indent) {
570
+                    break;
571
+                }
572
+            }
573
+            endRow = row;
574
+        }
575
+        
576
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
577
+    };
578
+    
579
+    this.getCommentRegionBlock = function(session, line, row) {
580
+        var startColumn = line.search(/\s*$/);
581
+        var maxRow = session.getLength();
582
+        var startRow = row;
583
+        
584
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
585
+        var depth = 1;
586
+        while (++row < maxRow) {
587
+            line = session.getLine(row);
588
+            var m = re.exec(line);
589
+            if (!m) continue;
590
+            if (m[1]) depth--;
591
+            else depth++;
592
+
593
+            if (!depth) break;
594
+        }
595
+
596
+        var endRow = row;
597
+        if (endRow > startRow) {
598
+            return new Range(startRow, startColumn, endRow, line.length);
599
+        }
600
+    };
601
+
602
+}).call(FoldMode.prototype);
603
+
604
+});
605
+
606
+ace.define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle","ace/worker/worker_client"], function(require, exports, module) {
607
+"use strict";
608
+
609
+var oop = require("../lib/oop");
610
+var TextMode = require("./text").Mode;
611
+var HighlightRules = require("./json_highlight_rules").JsonHighlightRules;
612
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
613
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
614
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
615
+var WorkerClient = require("../worker/worker_client").WorkerClient;
616
+
617
+var Mode = function() {
618
+    this.HighlightRules = HighlightRules;
619
+    this.$outdent = new MatchingBraceOutdent();
620
+    this.$behaviour = new CstyleBehaviour();
621
+    this.foldingRules = new CStyleFoldMode();
622
+};
623
+oop.inherits(Mode, TextMode);
624
+
625
+(function() {
626
+
627
+    this.getNextLineIndent = function(state, line, tab) {
628
+        var indent = this.$getIndent(line);
629
+
630
+        if (state == "start") {
631
+            var match = line.match(/^.*[\{\(\[]\s*$/);
632
+            if (match) {
633
+                indent += tab;
634
+            }
635
+        }
636
+
637
+        return indent;
638
+    };
639
+
640
+    this.checkOutdent = function(state, line, input) {
641
+        return this.$outdent.checkOutdent(line, input);
642
+    };
643
+
644
+    this.autoOutdent = function(state, doc, row) {
645
+        this.$outdent.autoOutdent(doc, row);
646
+    };
647
+
648
+    this.createWorker = function(session) {
649
+        var worker = new WorkerClient(["ace"], "ace/mode/json_worker", "JsonWorker");
650
+        worker.attachToDocument(session.getDocument());
651
+
652
+        worker.on("error", function(e) {
653
+            session.setAnnotations([e.data]);
654
+        });
655
+
656
+        worker.on("ok", function() {
657
+            session.clearAnnotations();
658
+        });
659
+
660
+        return worker;
661
+    };
662
+
663
+
664
+    this.$id = "ace/mode/json";
665
+}).call(Mode.prototype);
666
+
667
+exports.Mode = Mode;
668
+});

+ 2954
- 0
generator/lib/ace/mode-jsoniq.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 1584
- 0
generator/lib/ace/mode-jsp.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 762
- 0
generator/lib/ace/mode-jsx.js Parādīt failu

@@ -0,0 +1,762 @@
1
+ace.define("ace/mode/doc_comment_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 DocCommentHighlightRules = function() {
8
+    this.$rules = {
9
+        "start" : [ {
10
+            token : "comment.doc.tag",
11
+            regex : "@[\\w\\d_]+" // TODO: fix email addresses
12
+        }, 
13
+        DocCommentHighlightRules.getTagRule(),
14
+        {
15
+            defaultToken : "comment.doc",
16
+            caseInsensitive: true
17
+        }]
18
+    };
19
+};
20
+
21
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22
+
23
+DocCommentHighlightRules.getTagRule = function(start) {
24
+    return {
25
+        token : "comment.doc.tag.storage.type",
26
+        regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+    };
28
+}
29
+
30
+DocCommentHighlightRules.getStartRule = function(start) {
31
+    return {
32
+        token : "comment.doc", // doc comment
33
+        regex : "\\/\\*(?=\\*)",
34
+        next  : start
35
+    };
36
+};
37
+
38
+DocCommentHighlightRules.getEndRule = function (start) {
39
+    return {
40
+        token : "comment.doc", // closing comment
41
+        regex : "\\*\\/",
42
+        next  : start
43
+    };
44
+};
45
+
46
+
47
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
48
+
49
+});
50
+
51
+ace.define("ace/mode/jsx_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52
+var oop = require("../lib/oop");
53
+var lang = require("../lib/lang");
54
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
55
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
56
+
57
+var JsxHighlightRules = function() {
58
+    var keywords = lang.arrayToMap(
59
+        ("break|do|instanceof|typeof|case|else|new|var|catch|finally|return|void|continue|for|switch|default|while|function|this|" +
60
+         "if|throw|" +
61
+         "delete|in|try|" +
62
+         "class|extends|super|import|from|into|implements|interface|static|mixin|override|abstract|final|" +
63
+         "number|int|string|boolean|variant|" +
64
+         "log|assert").split("|")
65
+    );
66
+    
67
+    var buildinConstants = lang.arrayToMap(
68
+        ("null|true|false|NaN|Infinity|__FILE__|__LINE__|undefined").split("|")
69
+    );
70
+    
71
+    var reserved = lang.arrayToMap(
72
+        ("debugger|with|" +
73
+         "const|export|" +
74
+         "let|private|public|yield|protected|" +
75
+         "extern|native|as|operator|__fake__|__readonly__").split("|")
76
+    );
77
+    
78
+    var identifierRe = "[a-zA-Z_][a-zA-Z0-9_]*\\b";
79
+    
80
+    this.$rules = {
81
+        "start" : [
82
+            {
83
+                token : "comment",
84
+                regex : "\\/\\/.*$"
85
+            },
86
+            DocCommentHighlightRules.getStartRule("doc-start"),
87
+            {
88
+                token : "comment", // multi line comment
89
+                regex : "\\/\\*",
90
+                next : "comment"
91
+            }, {
92
+                token : "string.regexp",
93
+                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
94
+            }, {
95
+                token : "string", // single line
96
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
97
+            }, {
98
+                token : "string", // single line
99
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
100
+            }, {
101
+                token : "constant.numeric", // hex
102
+                regex : "0[xX][0-9a-fA-F]+\\b"
103
+            }, {
104
+                token : "constant.numeric", // float
105
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
106
+            }, {
107
+                token : "constant.language.boolean",
108
+                regex : "(?:true|false)\\b"
109
+            }, {
110
+                token : [
111
+                    "storage.type",
112
+                    "text",
113
+                    "entity.name.function"
114
+                ],
115
+                regex : "(function)(\\s+)(" + identifierRe + ")"
116
+            }, {
117
+                token : function(value) {
118
+                    if (value == "this")
119
+                        return "variable.language";
120
+                    else if (value == "function")
121
+                        return "storage.type";
122
+                    else if (keywords.hasOwnProperty(value) || reserved.hasOwnProperty(value))
123
+                        return "keyword";
124
+                    else if (buildinConstants.hasOwnProperty(value))
125
+                        return "constant.language";
126
+                    else if (/^_?[A-Z][a-zA-Z0-9_]*$/.test(value))
127
+                        return "language.support.class";
128
+                    else
129
+                        return "identifier";
130
+                },
131
+                regex : identifierRe
132
+            }, {
133
+                token : "keyword.operator",
134
+                regex : "!|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
135
+            }, {
136
+                token : "punctuation.operator",
137
+                regex : "\\?|\\:|\\,|\\;|\\."
138
+            }, {
139
+                token : "paren.lparen",
140
+                regex : "[[({<]"
141
+            }, {
142
+                token : "paren.rparen",
143
+                regex : "[\\])}>]"
144
+            }, {
145
+                token : "text",
146
+                regex : "\\s+"
147
+            }
148
+        ],
149
+        "comment" : [
150
+            {
151
+                token : "comment", // closing comment
152
+                regex : ".*?\\*\\/",
153
+                next : "start"
154
+            }, {
155
+                token : "comment", // comment spanning whole line
156
+                regex : ".+"
157
+            }
158
+        ]
159
+    };
160
+    
161
+    this.embedRules(DocCommentHighlightRules, "doc-",
162
+        [ DocCommentHighlightRules.getEndRule("start") ]);
163
+};
164
+
165
+oop.inherits(JsxHighlightRules, TextHighlightRules);
166
+
167
+exports.JsxHighlightRules = JsxHighlightRules;
168
+});
169
+
170
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
171
+"use strict";
172
+
173
+var Range = require("../range").Range;
174
+
175
+var MatchingBraceOutdent = function() {};
176
+
177
+(function() {
178
+
179
+    this.checkOutdent = function(line, input) {
180
+        if (! /^\s+$/.test(line))
181
+            return false;
182
+
183
+        return /^\s*\}/.test(input);
184
+    };
185
+
186
+    this.autoOutdent = function(doc, row) {
187
+        var line = doc.getLine(row);
188
+        var match = line.match(/^(\s*\})/);
189
+
190
+        if (!match) return 0;
191
+
192
+        var column = match[1].length;
193
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
194
+
195
+        if (!openBracePos || openBracePos.row == row) return 0;
196
+
197
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
198
+        doc.replace(new Range(row, 0, row, column-1), indent);
199
+    };
200
+
201
+    this.$getIndent = function(line) {
202
+        return line.match(/^\s*/)[0];
203
+    };
204
+
205
+}).call(MatchingBraceOutdent.prototype);
206
+
207
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
208
+});
209
+
210
+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) {
211
+"use strict";
212
+
213
+var oop = require("../../lib/oop");
214
+var Behaviour = require("../behaviour").Behaviour;
215
+var TokenIterator = require("../../token_iterator").TokenIterator;
216
+var lang = require("../../lib/lang");
217
+
218
+var SAFE_INSERT_IN_TOKENS =
219
+    ["text", "paren.rparen", "punctuation.operator"];
220
+var SAFE_INSERT_BEFORE_TOKENS =
221
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
222
+
223
+var context;
224
+var contextCache = {};
225
+var initContext = function(editor) {
226
+    var id = -1;
227
+    if (editor.multiSelect) {
228
+        id = editor.selection.index;
229
+        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
230
+            contextCache = {rangeCount: editor.multiSelect.rangeCount};
231
+    }
232
+    if (contextCache[id])
233
+        return context = contextCache[id];
234
+    context = contextCache[id] = {
235
+        autoInsertedBrackets: 0,
236
+        autoInsertedRow: -1,
237
+        autoInsertedLineEnd: "",
238
+        maybeInsertedBrackets: 0,
239
+        maybeInsertedRow: -1,
240
+        maybeInsertedLineStart: "",
241
+        maybeInsertedLineEnd: ""
242
+    };
243
+};
244
+
245
+var CstyleBehaviour = function() {
246
+    this.add("braces", "insertion", function(state, action, editor, session, text) {
247
+        var cursor = editor.getCursorPosition();
248
+        var line = session.doc.getLine(cursor.row);
249
+        if (text == '{') {
250
+            initContext(editor);
251
+            var selection = editor.getSelectionRange();
252
+            var selected = session.doc.getTextRange(selection);
253
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
254
+                return {
255
+                    text: '{' + selected + '}',
256
+                    selection: false
257
+                };
258
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
259
+                if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
260
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
261
+                    return {
262
+                        text: '{}',
263
+                        selection: [1, 1]
264
+                    };
265
+                } else {
266
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
267
+                    return {
268
+                        text: '{',
269
+                        selection: [1, 1]
270
+                    };
271
+                }
272
+            }
273
+        } else if (text == '}') {
274
+            initContext(editor);
275
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
276
+            if (rightChar == '}') {
277
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
278
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
279
+                    CstyleBehaviour.popAutoInsertedClosing();
280
+                    return {
281
+                        text: '',
282
+                        selection: [1, 1]
283
+                    };
284
+                }
285
+            }
286
+        } else if (text == "\n" || text == "\r\n") {
287
+            initContext(editor);
288
+            var closing = "";
289
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
290
+                closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
291
+                CstyleBehaviour.clearMaybeInsertedClosing();
292
+            }
293
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
294
+            if (rightChar === '}') {
295
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
296
+                if (!openBracePos)
297
+                     return null;
298
+                var next_indent = this.$getIndent(session.getLine(openBracePos.row));
299
+            } else if (closing) {
300
+                var next_indent = this.$getIndent(line);
301
+            } else {
302
+                CstyleBehaviour.clearMaybeInsertedClosing();
303
+                return;
304
+            }
305
+            var indent = next_indent + session.getTabString();
306
+
307
+            return {
308
+                text: '\n' + indent + '\n' + next_indent + closing,
309
+                selection: [1, indent.length, 1, indent.length]
310
+            };
311
+        } else {
312
+            CstyleBehaviour.clearMaybeInsertedClosing();
313
+        }
314
+    });
315
+
316
+    this.add("braces", "deletion", function(state, action, editor, session, range) {
317
+        var selected = session.doc.getTextRange(range);
318
+        if (!range.isMultiLine() && selected == '{') {
319
+            initContext(editor);
320
+            var line = session.doc.getLine(range.start.row);
321
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
322
+            if (rightChar == '}') {
323
+                range.end.column++;
324
+                return range;
325
+            } else {
326
+                context.maybeInsertedBrackets--;
327
+            }
328
+        }
329
+    });
330
+
331
+    this.add("parens", "insertion", function(state, action, editor, session, text) {
332
+        if (text == '(') {
333
+            initContext(editor);
334
+            var selection = editor.getSelectionRange();
335
+            var selected = session.doc.getTextRange(selection);
336
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
337
+                return {
338
+                    text: '(' + selected + ')',
339
+                    selection: false
340
+                };
341
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
342
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
343
+                return {
344
+                    text: '()',
345
+                    selection: [1, 1]
346
+                };
347
+            }
348
+        } else if (text == ')') {
349
+            initContext(editor);
350
+            var cursor = editor.getCursorPosition();
351
+            var line = session.doc.getLine(cursor.row);
352
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
353
+            if (rightChar == ')') {
354
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
355
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
356
+                    CstyleBehaviour.popAutoInsertedClosing();
357
+                    return {
358
+                        text: '',
359
+                        selection: [1, 1]
360
+                    };
361
+                }
362
+            }
363
+        }
364
+    });
365
+
366
+    this.add("parens", "deletion", function(state, action, editor, session, range) {
367
+        var selected = session.doc.getTextRange(range);
368
+        if (!range.isMultiLine() && selected == '(') {
369
+            initContext(editor);
370
+            var line = session.doc.getLine(range.start.row);
371
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
372
+            if (rightChar == ')') {
373
+                range.end.column++;
374
+                return range;
375
+            }
376
+        }
377
+    });
378
+
379
+    this.add("brackets", "insertion", function(state, action, editor, session, text) {
380
+        if (text == '[') {
381
+            initContext(editor);
382
+            var selection = editor.getSelectionRange();
383
+            var selected = session.doc.getTextRange(selection);
384
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
385
+                return {
386
+                    text: '[' + selected + ']',
387
+                    selection: false
388
+                };
389
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
390
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
391
+                return {
392
+                    text: '[]',
393
+                    selection: [1, 1]
394
+                };
395
+            }
396
+        } else if (text == ']') {
397
+            initContext(editor);
398
+            var cursor = editor.getCursorPosition();
399
+            var line = session.doc.getLine(cursor.row);
400
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
401
+            if (rightChar == ']') {
402
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
403
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
404
+                    CstyleBehaviour.popAutoInsertedClosing();
405
+                    return {
406
+                        text: '',
407
+                        selection: [1, 1]
408
+                    };
409
+                }
410
+            }
411
+        }
412
+    });
413
+
414
+    this.add("brackets", "deletion", function(state, action, editor, session, range) {
415
+        var selected = session.doc.getTextRange(range);
416
+        if (!range.isMultiLine() && selected == '[') {
417
+            initContext(editor);
418
+            var line = session.doc.getLine(range.start.row);
419
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
420
+            if (rightChar == ']') {
421
+                range.end.column++;
422
+                return range;
423
+            }
424
+        }
425
+    });
426
+
427
+    this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
428
+        if (text == '"' || text == "'") {
429
+            initContext(editor);
430
+            var quote = text;
431
+            var selection = editor.getSelectionRange();
432
+            var selected = session.doc.getTextRange(selection);
433
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
434
+                return {
435
+                    text: quote + selected + quote,
436
+                    selection: false
437
+                };
438
+            } else {
439
+                var cursor = editor.getCursorPosition();
440
+                var line = session.doc.getLine(cursor.row);
441
+                var leftChar = line.substring(cursor.column-1, cursor.column);
442
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
443
+                
444
+                var token = session.getTokenAt(cursor.row, cursor.column);
445
+                var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
446
+                if (leftChar == "\\" && token && /escape/.test(token.type))
447
+                    return null;
448
+                
449
+                var stringBefore = token && /string/.test(token.type);
450
+                var stringAfter = !rightToken || /string/.test(rightToken.type);
451
+                
452
+                var pair;
453
+                if (rightChar == quote) {
454
+                    pair = stringBefore !== stringAfter;
455
+                } else {
456
+                    if (stringBefore && !stringAfter)
457
+                        return null; // wrap string with different quote
458
+                    if (stringBefore && stringAfter)
459
+                        return null; // do not pair quotes inside strings 
460
+                    var wordRe = session.$mode.tokenRe;
461
+                    wordRe.lastIndex = 0;
462
+                    var isWordBefore = wordRe.test(leftChar);
463
+                    wordRe.lastIndex = 0;
464
+                    var isWordAfter = wordRe.test(leftChar);
465
+                    if (isWordBefore || isWordAfter)
466
+                        return null; // before or after alphanumeric
467
+                    if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
468
+                        return null; // there is rightChar and it isn't closing
469
+                    pair = true;
470
+                }
471
+                return {
472
+                    text: pair ? quote + quote : "",
473
+                    selection: [1,1]
474
+                };
475
+            }
476
+        }
477
+    });
478
+
479
+    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
480
+        var selected = session.doc.getTextRange(range);
481
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
482
+            initContext(editor);
483
+            var line = session.doc.getLine(range.start.row);
484
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
485
+            if (rightChar == selected) {
486
+                range.end.column++;
487
+                return range;
488
+            }
489
+        }
490
+    });
491
+
492
+};
493
+
494
+    
495
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
496
+    var cursor = editor.getCursorPosition();
497
+    var iterator = new TokenIterator(session, cursor.row, cursor.column);
498
+    if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
499
+        var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
500
+        if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
501
+            return false;
502
+    }
503
+    iterator.stepForward();
504
+    return iterator.getCurrentTokenRow() !== cursor.row ||
505
+        this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
506
+};
507
+
508
+CstyleBehaviour.$matchTokenType = function(token, types) {
509
+    return types.indexOf(token.type || token) > -1;
510
+};
511
+
512
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
513
+    var cursor = editor.getCursorPosition();
514
+    var line = session.doc.getLine(cursor.row);
515
+    if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
516
+        context.autoInsertedBrackets = 0;
517
+    context.autoInsertedRow = cursor.row;
518
+    context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
519
+    context.autoInsertedBrackets++;
520
+};
521
+
522
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
523
+    var cursor = editor.getCursorPosition();
524
+    var line = session.doc.getLine(cursor.row);
525
+    if (!this.isMaybeInsertedClosing(cursor, line))
526
+        context.maybeInsertedBrackets = 0;
527
+    context.maybeInsertedRow = cursor.row;
528
+    context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
529
+    context.maybeInsertedLineEnd = line.substr(cursor.column);
530
+    context.maybeInsertedBrackets++;
531
+};
532
+
533
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
534
+    return context.autoInsertedBrackets > 0 &&
535
+        cursor.row === context.autoInsertedRow &&
536
+        bracket === context.autoInsertedLineEnd[0] &&
537
+        line.substr(cursor.column) === context.autoInsertedLineEnd;
538
+};
539
+
540
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
541
+    return context.maybeInsertedBrackets > 0 &&
542
+        cursor.row === context.maybeInsertedRow &&
543
+        line.substr(cursor.column) === context.maybeInsertedLineEnd &&
544
+        line.substr(0, cursor.column) == context.maybeInsertedLineStart;
545
+};
546
+
547
+CstyleBehaviour.popAutoInsertedClosing = function() {
548
+    context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
549
+    context.autoInsertedBrackets--;
550
+};
551
+
552
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
553
+    if (context) {
554
+        context.maybeInsertedBrackets = 0;
555
+        context.maybeInsertedRow = -1;
556
+    }
557
+};
558
+
559
+
560
+
561
+oop.inherits(CstyleBehaviour, Behaviour);
562
+
563
+exports.CstyleBehaviour = CstyleBehaviour;
564
+});
565
+
566
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
567
+"use strict";
568
+
569
+var oop = require("../../lib/oop");
570
+var Range = require("../../range").Range;
571
+var BaseFoldMode = require("./fold_mode").FoldMode;
572
+
573
+var FoldMode = exports.FoldMode = function(commentRegex) {
574
+    if (commentRegex) {
575
+        this.foldingStartMarker = new RegExp(
576
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
577
+        );
578
+        this.foldingStopMarker = new RegExp(
579
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
580
+        );
581
+    }
582
+};
583
+oop.inherits(FoldMode, BaseFoldMode);
584
+
585
+(function() {
586
+    
587
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
588
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
589
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
590
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
591
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
592
+    this._getFoldWidgetBase = this.getFoldWidget;
593
+    this.getFoldWidget = function(session, foldStyle, row) {
594
+        var line = session.getLine(row);
595
+    
596
+        if (this.singleLineBlockCommentRe.test(line)) {
597
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
598
+                return "";
599
+        }
600
+    
601
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
602
+    
603
+        if (!fw && this.startRegionRe.test(line))
604
+            return "start"; // lineCommentRegionStart
605
+    
606
+        return fw;
607
+    };
608
+
609
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
610
+        var line = session.getLine(row);
611
+        
612
+        if (this.startRegionRe.test(line))
613
+            return this.getCommentRegionBlock(session, line, row);
614
+        
615
+        var match = line.match(this.foldingStartMarker);
616
+        if (match) {
617
+            var i = match.index;
618
+
619
+            if (match[1])
620
+                return this.openingBracketBlock(session, match[1], row, i);
621
+                
622
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
623
+            
624
+            if (range && !range.isMultiLine()) {
625
+                if (forceMultiline) {
626
+                    range = this.getSectionRange(session, row);
627
+                } else if (foldStyle != "all")
628
+                    range = null;
629
+            }
630
+            
631
+            return range;
632
+        }
633
+
634
+        if (foldStyle === "markbegin")
635
+            return;
636
+
637
+        var match = line.match(this.foldingStopMarker);
638
+        if (match) {
639
+            var i = match.index + match[0].length;
640
+
641
+            if (match[1])
642
+                return this.closingBracketBlock(session, match[1], row, i);
643
+
644
+            return session.getCommentFoldRange(row, i, -1);
645
+        }
646
+    };
647
+    
648
+    this.getSectionRange = function(session, row) {
649
+        var line = session.getLine(row);
650
+        var startIndent = line.search(/\S/);
651
+        var startRow = row;
652
+        var startColumn = line.length;
653
+        row = row + 1;
654
+        var endRow = row;
655
+        var maxRow = session.getLength();
656
+        while (++row < maxRow) {
657
+            line = session.getLine(row);
658
+            var indent = line.search(/\S/);
659
+            if (indent === -1)
660
+                continue;
661
+            if  (startIndent > indent)
662
+                break;
663
+            var subRange = this.getFoldWidgetRange(session, "all", row);
664
+            
665
+            if (subRange) {
666
+                if (subRange.start.row <= startRow) {
667
+                    break;
668
+                } else if (subRange.isMultiLine()) {
669
+                    row = subRange.end.row;
670
+                } else if (startIndent == indent) {
671
+                    break;
672
+                }
673
+            }
674
+            endRow = row;
675
+        }
676
+        
677
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
678
+    };
679
+    
680
+    this.getCommentRegionBlock = function(session, line, row) {
681
+        var startColumn = line.search(/\s*$/);
682
+        var maxRow = session.getLength();
683
+        var startRow = row;
684
+        
685
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
686
+        var depth = 1;
687
+        while (++row < maxRow) {
688
+            line = session.getLine(row);
689
+            var m = re.exec(line);
690
+            if (!m) continue;
691
+            if (m[1]) depth--;
692
+            else depth++;
693
+
694
+            if (!depth) break;
695
+        }
696
+
697
+        var endRow = row;
698
+        if (endRow > startRow) {
699
+            return new Range(startRow, startColumn, endRow, line.length);
700
+        }
701
+    };
702
+
703
+}).call(FoldMode.prototype);
704
+
705
+});
706
+
707
+ace.define("ace/mode/jsx",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/jsx_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
708
+"use strict";
709
+
710
+var oop = require("../lib/oop");
711
+var TextMode = require("./text").Mode;
712
+var JsxHighlightRules = require("./jsx_highlight_rules").JsxHighlightRules;
713
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
714
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
715
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
716
+
717
+function Mode() {
718
+    this.HighlightRules = JsxHighlightRules;
719
+    this.$outdent = new MatchingBraceOutdent();
720
+    this.$behaviour = new CstyleBehaviour();
721
+    this.foldingRules = new CStyleFoldMode();
722
+}
723
+oop.inherits(Mode, TextMode);
724
+
725
+(function() {
726
+
727
+    this.lineCommentStart = "//";
728
+    this.blockComment = {start: "/*", end: "*/"};
729
+
730
+    this.getNextLineIndent = function(state, line, tab) {
731
+        var indent = this.$getIndent(line);
732
+
733
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
734
+        var tokens = tokenizedLine.tokens;
735
+
736
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
737
+            return indent;
738
+        }
739
+
740
+        if (state == "start") {
741
+            var match = line.match(/^.*[\{\(\[]\s*$/);
742
+            if (match) {
743
+                indent += tab;
744
+            }
745
+        }
746
+
747
+        return indent;
748
+    };
749
+
750
+    this.checkOutdent = function(state, line, input) {
751
+        return this.$outdent.checkOutdent(line, input);
752
+    };
753
+
754
+    this.autoOutdent = function(state, doc, row) {
755
+        this.$outdent.autoOutdent(doc, row);
756
+    };
757
+
758
+    this.$id = "ace/mode/jsx";
759
+}).call(Mode.prototype);
760
+
761
+exports.Mode = Mode;
762
+});

+ 296
- 0
generator/lib/ace/mode-julia.js Parādīt failu

@@ -0,0 +1,296 @@
1
+ace.define("ace/mode/julia_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 JuliaHighlightRules = function() {
8
+
9
+    this.$rules = { start: 
10
+       [ { include: '#function_decl' },
11
+         { include: '#function_call' },
12
+         { include: '#type_decl' },
13
+         { include: '#keyword' },
14
+         { include: '#operator' },
15
+         { include: '#number' },
16
+         { include: '#string' },
17
+         { include: '#comment' } ],
18
+      '#bracket': 
19
+       [ { token: 'keyword.bracket.julia',
20
+           regex: '\\(|\\)|\\[|\\]|\\{|\\}|,' } ],
21
+      '#comment': 
22
+       [ { token: 
23
+            [ 'punctuation.definition.comment.julia',
24
+              'comment.line.number-sign.julia' ],
25
+           regex: '(#)(?!\\{)(.*$)'} ],
26
+      '#function_call': 
27
+       [ { token: [ 'support.function.julia', 'text' ],
28
+           regex: '([a-zA-Z0-9_]+!?)([\\w\\xff-\\u218e\\u2455-\\uffff]*\\()'} ],
29
+      '#function_decl': 
30
+       [ { token: [ 'keyword.other.julia', 'meta.function.julia',
31
+               'entity.name.function.julia', 'meta.function.julia','text' ],
32
+           regex: '(function|macro)(\\s*)([a-zA-Z0-9_\\{]+!?)([\\w\\xff-\\u218e\\u2455-\\uffff]*)([(\\\\{])'} ],
33
+      '#keyword':
34
+       [ { token: 'keyword.other.julia',
35
+           regex: '\\b(?:function|type|immutable|macro|quote|abstract|bitstype|typealias|module|baremodule|new)\\b' },
36
+         { token: 'keyword.control.julia',
37
+           regex: '\\b(?:if|else|elseif|while|for|in|begin|let|end|do|try|catch|finally|return|break|continue)\\b' },
38
+         { token: 'storage.modifier.variable.julia',
39
+           regex: '\\b(?:global|local|const|export|import|importall|using)\\b' },
40
+         { token: 'variable.macro.julia', regex: '@[\\w\\xff-\\u218e\\u2455-\\uffff]+\\b' } ],
41
+      '#number': 
42
+       [ { token: 'constant.numeric.julia',
43
+           regex: '\\b0(?:x|X)[0-9a-fA-F]*|(?:\\b[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]*)?(?:im)?|\\bInf(?:32)?\\b|\\bNaN(?:32)?\\b|\\btrue\\b|\\bfalse\\b' } ],
44
+      '#operator': 
45
+       [ { token: 'keyword.operator.update.julia',
46
+           regex: '=|:=|\\+=|-=|\\*=|/=|//=|\\.//=|\\.\\*=|\\\\=|\\.\\\\=|^=|\\.^=|%=|\\|=|&=|\\$=|<<=|>>=' },
47
+         { token: 'keyword.operator.ternary.julia', regex: '\\?|:' },
48
+         { token: 'keyword.operator.boolean.julia',
49
+           regex: '\\|\\||&&|!' },
50
+         { token: 'keyword.operator.arrow.julia', regex: '->|<-|-->' },
51
+         { token: 'keyword.operator.relation.julia',
52
+           regex: '>|<|>=|<=|==|!=|\\.>|\\.<|\\.>=|\\.>=|\\.==|\\.!=|\\.=|\\.!|<:|:>' },
53
+         { token: 'keyword.operator.range.julia', regex: ':' },
54
+         { token: 'keyword.operator.shift.julia', regex: '<<|>>' },
55
+         { token: 'keyword.operator.bitwise.julia', regex: '\\||\\&|~' },
56
+         { token: 'keyword.operator.arithmetic.julia',
57
+           regex: '\\+|-|\\*|\\.\\*|/|\\./|//|\\.//|%|\\.%|\\\\|\\.\\\\|\\^|\\.\\^' },
58
+         { token: 'keyword.operator.isa.julia', regex: '::' },
59
+         { token: 'keyword.operator.dots.julia',
60
+           regex: '\\.(?=[a-zA-Z])|\\.\\.+' },
61
+         { token: 'keyword.operator.interpolation.julia',
62
+           regex: '\\$#?(?=.)' },
63
+         { token: [ 'variable', 'keyword.operator.transposed-variable.julia' ],
64
+           regex: '([\\w\\xff-\\u218e\\u2455-\\uffff]+)((?:\'|\\.\')*\\.?\')' },
65
+         { token: 'text',
66
+           regex: '\\[|\\('},
67
+         { token: [ 'text', 'keyword.operator.transposed-matrix.julia' ],
68
+            regex: "([\\]\\)])((?:'|\\.')*\\.?')"} ],
69
+      '#string': 
70
+       [ { token: 'punctuation.definition.string.begin.julia',
71
+           regex: '\'',
72
+           push: 
73
+            [ { token: 'punctuation.definition.string.end.julia',
74
+                regex: '\'',
75
+                next: 'pop' },
76
+              { include: '#string_escaped_char' },
77
+              { defaultToken: 'string.quoted.single.julia' } ] },
78
+         { token: 'punctuation.definition.string.begin.julia',
79
+           regex: '"',
80
+           push: 
81
+            [ { token: 'punctuation.definition.string.end.julia',
82
+                regex: '"',
83
+                next: 'pop' },
84
+              { include: '#string_escaped_char' },
85
+              { defaultToken: 'string.quoted.double.julia' } ] },
86
+         { token: 'punctuation.definition.string.begin.julia',
87
+           regex: '\\b[\\w\\xff-\\u218e\\u2455-\\uffff]+"',
88
+           push: 
89
+            [ { token: 'punctuation.definition.string.end.julia',
90
+                regex: '"[\\w\\xff-\\u218e\\u2455-\\uffff]*',
91
+                next: 'pop' },
92
+              { include: '#string_custom_escaped_char' },
93
+              { defaultToken: 'string.quoted.custom-double.julia' } ] },
94
+         { token: 'punctuation.definition.string.begin.julia',
95
+           regex: '`',
96
+           push: 
97
+            [ { token: 'punctuation.definition.string.end.julia',
98
+                regex: '`',
99
+                next: 'pop' },
100
+              { include: '#string_escaped_char' },
101
+              { defaultToken: 'string.quoted.backtick.julia' } ] } ],
102
+      '#string_custom_escaped_char': [ { token: 'constant.character.escape.julia', regex: '\\\\"' } ],
103
+      '#string_escaped_char': 
104
+       [ { token: 'constant.character.escape.julia',
105
+           regex: '\\\\(?:\\\\|[0-3]\\d{,2}|[4-7]\\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8}|.)' } ],
106
+      '#type_decl': 
107
+       [ { token: 
108
+            [ 'keyword.control.type.julia',
109
+              'meta.type.julia',
110
+              'entity.name.type.julia',
111
+              'entity.other.inherited-class.julia',
112
+              'punctuation.separator.inheritance.julia',
113
+              'entity.other.inherited-class.julia' ],
114
+           regex: '(type|immutable)(\\s+)([a-zA-Z0-9_]+)(?:(\\s*)(<:)(\\s*[.a-zA-Z0-9_:]+))?' },
115
+         { token: [ 'other.typed-variable.julia', 'support.type.julia' ],
116
+           regex: '([a-zA-Z0-9_]+)(::[a-zA-Z0-9_{}]+)' } ] }
117
+    
118
+    this.normalizeRules();
119
+};
120
+
121
+JuliaHighlightRules.metaData = { fileTypes: [ 'jl' ],
122
+      firstLineMatch: '^#!.*\\bjulia\\s*$',
123
+      foldingStartMarker: '^\\s*(?:if|while|for|begin|function|macro|module|baremodule|type|immutable|let)\\b(?!.*\\bend\\b).*$',
124
+      foldingStopMarker: '^\\s*(?:end)\\b.*$',
125
+      name: 'Julia',
126
+      scopeName: 'source.julia' }
127
+
128
+
129
+oop.inherits(JuliaHighlightRules, TextHighlightRules);
130
+
131
+exports.JuliaHighlightRules = JuliaHighlightRules;
132
+});
133
+
134
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
135
+"use strict";
136
+
137
+var oop = require("../../lib/oop");
138
+var Range = require("../../range").Range;
139
+var BaseFoldMode = require("./fold_mode").FoldMode;
140
+
141
+var FoldMode = exports.FoldMode = function(commentRegex) {
142
+    if (commentRegex) {
143
+        this.foldingStartMarker = new RegExp(
144
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
145
+        );
146
+        this.foldingStopMarker = new RegExp(
147
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
148
+        );
149
+    }
150
+};
151
+oop.inherits(FoldMode, BaseFoldMode);
152
+
153
+(function() {
154
+    
155
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
156
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
157
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
158
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
159
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
160
+    this._getFoldWidgetBase = this.getFoldWidget;
161
+    this.getFoldWidget = function(session, foldStyle, row) {
162
+        var line = session.getLine(row);
163
+    
164
+        if (this.singleLineBlockCommentRe.test(line)) {
165
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
166
+                return "";
167
+        }
168
+    
169
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
170
+    
171
+        if (!fw && this.startRegionRe.test(line))
172
+            return "start"; // lineCommentRegionStart
173
+    
174
+        return fw;
175
+    };
176
+
177
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
178
+        var line = session.getLine(row);
179
+        
180
+        if (this.startRegionRe.test(line))
181
+            return this.getCommentRegionBlock(session, line, row);
182
+        
183
+        var match = line.match(this.foldingStartMarker);
184
+        if (match) {
185
+            var i = match.index;
186
+
187
+            if (match[1])
188
+                return this.openingBracketBlock(session, match[1], row, i);
189
+                
190
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
191
+            
192
+            if (range && !range.isMultiLine()) {
193
+                if (forceMultiline) {
194
+                    range = this.getSectionRange(session, row);
195
+                } else if (foldStyle != "all")
196
+                    range = null;
197
+            }
198
+            
199
+            return range;
200
+        }
201
+
202
+        if (foldStyle === "markbegin")
203
+            return;
204
+
205
+        var match = line.match(this.foldingStopMarker);
206
+        if (match) {
207
+            var i = match.index + match[0].length;
208
+
209
+            if (match[1])
210
+                return this.closingBracketBlock(session, match[1], row, i);
211
+
212
+            return session.getCommentFoldRange(row, i, -1);
213
+        }
214
+    };
215
+    
216
+    this.getSectionRange = function(session, row) {
217
+        var line = session.getLine(row);
218
+        var startIndent = line.search(/\S/);
219
+        var startRow = row;
220
+        var startColumn = line.length;
221
+        row = row + 1;
222
+        var endRow = row;
223
+        var maxRow = session.getLength();
224
+        while (++row < maxRow) {
225
+            line = session.getLine(row);
226
+            var indent = line.search(/\S/);
227
+            if (indent === -1)
228
+                continue;
229
+            if  (startIndent > indent)
230
+                break;
231
+            var subRange = this.getFoldWidgetRange(session, "all", row);
232
+            
233
+            if (subRange) {
234
+                if (subRange.start.row <= startRow) {
235
+                    break;
236
+                } else if (subRange.isMultiLine()) {
237
+                    row = subRange.end.row;
238
+                } else if (startIndent == indent) {
239
+                    break;
240
+                }
241
+            }
242
+            endRow = row;
243
+        }
244
+        
245
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
246
+    };
247
+    
248
+    this.getCommentRegionBlock = function(session, line, row) {
249
+        var startColumn = line.search(/\s*$/);
250
+        var maxRow = session.getLength();
251
+        var startRow = row;
252
+        
253
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
254
+        var depth = 1;
255
+        while (++row < maxRow) {
256
+            line = session.getLine(row);
257
+            var m = re.exec(line);
258
+            if (!m) continue;
259
+            if (m[1]) depth--;
260
+            else depth++;
261
+
262
+            if (!depth) break;
263
+        }
264
+
265
+        var endRow = row;
266
+        if (endRow > startRow) {
267
+            return new Range(startRow, startColumn, endRow, line.length);
268
+        }
269
+    };
270
+
271
+}).call(FoldMode.prototype);
272
+
273
+});
274
+
275
+ace.define("ace/mode/julia",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/julia_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
276
+"use strict";
277
+
278
+var oop = require("../lib/oop");
279
+var TextMode = require("./text").Mode;
280
+var JuliaHighlightRules = require("./julia_highlight_rules").JuliaHighlightRules;
281
+var FoldMode = require("./folding/cstyle").FoldMode;
282
+
283
+var Mode = function() {
284
+    this.HighlightRules = JuliaHighlightRules;
285
+    this.foldingRules = new FoldMode();
286
+};
287
+oop.inherits(Mode, TextMode);
288
+
289
+(function() {
290
+    this.lineCommentStart = "#";
291
+    this.blockComment = "";
292
+    this.$id = "ace/mode/julia";
293
+}).call(Mode.prototype);
294
+
295
+exports.Mode = Mode;
296
+});

+ 223
- 0
generator/lib/ace/mode-latex.js Parādīt failu

@@ -0,0 +1,223 @@
1
+ace.define("ace/mode/latex_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 LatexHighlightRules = function() {  
8
+
9
+    this.$rules = {
10
+        "start" : [{
11
+            token : "comment",
12
+            regex : "%.*$"
13
+        }, {
14
+            token : ["keyword", "lparen", "variable.parameter", "rparen", "lparen", "storage.type", "rparen"],
15
+            regex : "(\\\\(?:documentclass|usepackage|input))(?:(\\[)([^\\]]*)(\\]))?({)([^}]*)(})"
16
+        }, {
17
+            token : ["keyword","lparen", "variable.parameter", "rparen"],
18
+            regex : "(\\\\(?:label|v?ref|cite(?:[^{]*)))(?:({)([^}]*)(}))?"
19
+        }, {
20
+            token : ["storage.type", "lparen", "variable.parameter", "rparen"],
21
+            regex : "(\\\\(?:begin|end))({)(\\w*)(})"
22
+        }, {
23
+            token : "storage.type",
24
+            regex : "\\\\[a-zA-Z]+"
25
+        }, {
26
+            token : "lparen",
27
+            regex : "[[({]"
28
+        }, {
29
+            token : "rparen",
30
+            regex : "[\\])}]"
31
+        }, {
32
+            token : "constant.character.escape",
33
+            regex : "\\\\[^a-zA-Z]?"
34
+        }, {
35
+            token : "string",
36
+            regex : "\\${1,2}",
37
+            next  : "equation"
38
+        }],
39
+        "equation" : [{
40
+            token : "comment",
41
+            regex : "%.*$"
42
+        }, {
43
+            token : "string",
44
+            regex : "\\${1,2}",
45
+            next  : "start"
46
+        }, {
47
+            token : "constant.character.escape",
48
+            regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
49
+        }, {
50
+            token : "error", 
51
+            regex : "^\\s*$", 
52
+            next : "start" 
53
+        }, {
54
+            defaultToken : "string"
55
+        }]
56
+
57
+    };
58
+};
59
+oop.inherits(LatexHighlightRules, TextHighlightRules);
60
+
61
+exports.LatexHighlightRules = LatexHighlightRules;
62
+
63
+});
64
+
65
+ace.define("ace/mode/folding/latex",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function(require, exports, module) {
66
+"use strict";
67
+
68
+var oop = require("../../lib/oop");
69
+var BaseFoldMode = require("./fold_mode").FoldMode;
70
+var Range = require("../../range").Range;
71
+var TokenIterator = require("../../token_iterator").TokenIterator;
72
+
73
+var FoldMode = exports.FoldMode = function() {};
74
+
75
+oop.inherits(FoldMode, BaseFoldMode);
76
+
77
+(function() {
78
+
79
+    this.foldingStartMarker = /^\s*\\(begin)|(section|subsection|paragraph)\b|{\s*$/;
80
+    this.foldingStopMarker = /^\s*\\(end)\b|^\s*}/;
81
+
82
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
83
+        var line = session.doc.getLine(row);
84
+        var match = this.foldingStartMarker.exec(line);
85
+        if (match) {
86
+            if (match[1])
87
+                return this.latexBlock(session, row, match[0].length - 1);
88
+            if (match[2])
89
+                return this.latexSection(session, row, match[0].length - 1);
90
+
91
+            return this.openingBracketBlock(session, "{", row, match.index);
92
+        }
93
+
94
+        var match = this.foldingStopMarker.exec(line);
95
+        if (match) {
96
+            if (match[1])
97
+                return this.latexBlock(session, row, match[0].length - 1);
98
+
99
+            return this.closingBracketBlock(session, "}", row, match.index + match[0].length);
100
+        }
101
+    };
102
+
103
+    this.latexBlock = function(session, row, column) {
104
+        var keywords = {
105
+            "\\begin": 1,
106
+            "\\end": -1
107
+        };
108
+
109
+        var stream = new TokenIterator(session, row, column);
110
+        var token = stream.getCurrentToken();
111
+        if (!token || !(token.type == "storage.type" || token.type == "constant.character.escape"))
112
+            return;
113
+
114
+        var val = token.value;
115
+        var dir = keywords[val];
116
+
117
+        var getType = function() {
118
+            var token = stream.stepForward();
119
+            var type = token.type == "lparen" ?stream.stepForward().value : "";
120
+            if (dir === -1) {
121
+                stream.stepBackward();
122
+                if (type)
123
+                    stream.stepBackward();
124
+            }
125
+            return type;
126
+        };
127
+        var stack = [getType()];
128
+        var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length;
129
+        var startRow = row;
130
+
131
+        stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
132
+        while(token = stream.step()) {
133
+            if (!token || !(token.type == "storage.type" || token.type == "constant.character.escape"))
134
+                continue;
135
+            var level = keywords[token.value];
136
+            if (!level)
137
+                continue;
138
+            var type = getType();
139
+            if (level === dir)
140
+                stack.unshift(type);
141
+            else if (stack.shift() !== type || !stack.length)
142
+                break;
143
+        }
144
+
145
+        if (stack.length)
146
+            return;
147
+
148
+        var row = stream.getCurrentTokenRow();
149
+        if (dir === -1)
150
+            return new Range(row, session.getLine(row).length, startRow, startColumn);
151
+        stream.stepBackward();
152
+        return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn());
153
+    };
154
+
155
+    this.latexSection = function(session, row, column) {
156
+        var keywords = ["\\subsection", "\\section", "\\begin", "\\end", "\\paragraph"];
157
+
158
+        var stream = new TokenIterator(session, row, column);
159
+        var token = stream.getCurrentToken();
160
+        if (!token || token.type != "storage.type")
161
+            return;
162
+
163
+        var startLevel = keywords.indexOf(token.value);
164
+        var stackDepth = 0
165
+        var endRow = row;
166
+
167
+        while(token = stream.stepForward()) {
168
+            if (token.type !== "storage.type")
169
+                continue;
170
+            var level = keywords.indexOf(token.value);
171
+
172
+            if (level >= 2) {
173
+                if (!stackDepth)
174
+                    endRow = stream.getCurrentTokenRow() - 1;
175
+                stackDepth += level == 2 ? 1 : - 1;
176
+                if (stackDepth < 0)
177
+                    break
178
+            } else if (level >= startLevel)
179
+                break;
180
+        }
181
+
182
+        if (!stackDepth)
183
+            endRow = stream.getCurrentTokenRow() - 1;
184
+
185
+        while (endRow > row && !/\S/.test(session.getLine(endRow)))
186
+            endRow--;
187
+
188
+        return new Range(
189
+            row, session.getLine(row).length,
190
+            endRow, session.getLine(endRow).length
191
+        );
192
+    };
193
+
194
+}).call(FoldMode.prototype);
195
+
196
+});
197
+
198
+ace.define("ace/mode/latex",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/latex_highlight_rules","ace/mode/folding/latex","ace/range"], function(require, exports, module) {
199
+"use strict";
200
+
201
+var oop = require("../lib/oop");
202
+var TextMode = require("./text").Mode;
203
+var LatexHighlightRules = require("./latex_highlight_rules").LatexHighlightRules;
204
+var LatexFoldMode = require("./folding/latex").FoldMode;
205
+var Range = require("../range").Range;
206
+
207
+var Mode = function() {
208
+    this.HighlightRules = LatexHighlightRules;
209
+    this.foldingRules = new LatexFoldMode();
210
+};
211
+oop.inherits(Mode, TextMode);
212
+
213
+(function() {
214
+    this.type = "text";
215
+    
216
+    this.lineCommentStart = "%";
217
+
218
+    this.$id = "ace/mode/latex";
219
+}).call(Mode.prototype);
220
+
221
+exports.Mode = Mode;
222
+
223
+});

+ 897
- 0
generator/lib/ace/mode-less.js Parādīt failu

@@ -0,0 +1,897 @@
1
+ace.define("ace/mode/less_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
+
8
+var LessHighlightRules = function() {
9
+    
10
+    var properties = lang.arrayToMap( (function () {
11
+
12
+        var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
13
+        
14
+        var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" + 
15
+             "background-size|binding|border-bottom-colors|border-left-colors|" + 
16
+             "border-right-colors|border-top-colors|border-end|border-end-color|" + 
17
+             "border-end-style|border-end-width|border-image|border-start|" + 
18
+             "border-start-color|border-start-style|border-start-width|box-align|" + 
19
+             "box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" + 
20
+             "box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" + 
21
+             "column-rule-width|column-rule-style|column-rule-color|float-edge|" + 
22
+             "font-feature-settings|font-language-override|force-broken-image-icon|" + 
23
+             "image-region|margin-end|margin-start|opacity|outline|outline-color|" + 
24
+             "outline-offset|outline-radius|outline-radius-bottomleft|" + 
25
+             "outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" + 
26
+             "outline-style|outline-width|padding-end|padding-start|stack-sizing|" + 
27
+             "tab-size|text-blink|text-decoration-color|text-decoration-line|" + 
28
+             "text-decoration-style|transform|transform-origin|transition|" + 
29
+             "transition-delay|transition-duration|transition-property|" + 
30
+             "transition-timing-function|user-focus|user-input|user-modify|user-select|" +
31
+             "window-shadow|border-radius").split("|");
32
+        
33
+        var properties = ("azimuth|background-attachment|background-color|background-image|" +
34
+            "background-position|background-repeat|background|border-bottom-color|" +
35
+            "border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
36
+            "border-color|border-left-color|border-left-style|border-left-width|" +
37
+            "border-left|border-right-color|border-right-style|border-right-width|" +
38
+            "border-right|border-spacing|border-style|border-top-color|" +
39
+            "border-top-style|border-top-width|border-top|border-width|border|" +
40
+            "bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
41
+            "counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
42
+            "elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
43
+            "font-stretch|font-style|font-variant|font-weight|font|height|left|" +
44
+            "letter-spacing|line-height|list-style-image|list-style-position|" +
45
+            "list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
46
+            "margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
47
+            "min-width|opacity|orphans|outline-color|" +
48
+            "outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
49
+            "padding-left|padding-right|padding-top|padding|page-break-after|" +
50
+            "page-break-before|page-break-inside|page|pause-after|pause-before|" +
51
+            "pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
52
+            "size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
53
+            "stress|table-layout|text-align|text-decoration|text-indent|" +
54
+            "text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
55
+            "visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
56
+            "z-index").split("|");
57
+        var ret = [];
58
+        for (var i=0, ln=browserPrefix.length; i<ln; i++) {
59
+            Array.prototype.push.apply(
60
+                ret,
61
+                (( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
62
+            );
63
+        }
64
+        Array.prototype.push.apply(ret, prefixProperties);
65
+        Array.prototype.push.apply(ret, properties);
66
+        
67
+        return ret;
68
+        
69
+    })() );
70
+    
71
+
72
+
73
+    var functions = lang.arrayToMap(
74
+        ("hsl|hsla|rgb|rgba|url|attr|counter|counters|lighten|darken|saturate|" +
75
+        "desaturate|fadein|fadeout|fade|spin|mix|hue|saturation|lightness|" +
76
+        "alpha|round|ceil|floor|percentage|color|iscolor|isnumber|isstring|" +
77
+        "iskeyword|isurl|ispixel|ispercentage|isem").split("|")
78
+    );
79
+
80
+    var constants = lang.arrayToMap(
81
+        ("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
82
+        "block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
83
+        "char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
84
+        "decimal-leading-zero|decimal|default|disabled|disc|" +
85
+        "distribute-all-lines|distribute-letter|distribute-space|" +
86
+        "distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
87
+        "hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
88
+        "ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
89
+        "ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
90
+        "inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
91
+        "keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
92
+        "lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
93
+        "medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
94
+        "nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
95
+        "overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
96
+        "ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
97
+        "solid|square|static|strict|super|sw-resize|table-footer-group|" +
98
+        "table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
99
+        "transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
100
+        "vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
101
+        "zero").split("|")
102
+    );
103
+
104
+    var colors = lang.arrayToMap(
105
+        ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
106
+        "purple|red|silver|teal|white|yellow").split("|")
107
+    );
108
+    
109
+    var keywords = lang.arrayToMap(
110
+        ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|" +
111
+        "@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|" +
112
+        "def|end|declare|when|not|and").split("|")
113
+    );
114
+    
115
+    var tags = lang.arrayToMap(
116
+        ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" + 
117
+         "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" + 
118
+         "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" + 
119
+         "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" + 
120
+         "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" + 
121
+         "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" + 
122
+         "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" + 
123
+         "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" + 
124
+         "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
125
+    );
126
+
127
+    var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
128
+
129
+    this.$rules = {
130
+        "start" : [
131
+            {
132
+                token : "comment",
133
+                regex : "\\/\\/.*$"
134
+            },
135
+            {
136
+                token : "comment", // multi line comment
137
+                regex : "\\/\\*",
138
+                next : "comment"
139
+            }, {
140
+                token : "string", // single line
141
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
142
+            }, {
143
+                token : "string", // single line
144
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
145
+            }, {
146
+                token : "constant.numeric",
147
+                regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
148
+            }, {
149
+                token : "constant.numeric", // hex6 color
150
+                regex : "#[a-f0-9]{6}"
151
+            }, {
152
+                token : "constant.numeric", // hex3 color
153
+                regex : "#[a-f0-9]{3}"
154
+            }, {
155
+                token : "constant.numeric",
156
+                regex : numRe
157
+            }, {
158
+                token : function(value) {
159
+                    if (keywords.hasOwnProperty(value))
160
+                        return "keyword";
161
+                    else
162
+                        return "variable";
163
+                },
164
+                regex : "@[a-z0-9_\\-@]*\\b"
165
+            }, {
166
+                token : function(value) {
167
+                    if (properties.hasOwnProperty(value.toLowerCase()))
168
+                        return "support.type";
169
+                    else if (keywords.hasOwnProperty(value))
170
+                        return "keyword";
171
+                    else if (constants.hasOwnProperty(value))
172
+                        return "constant.language";
173
+                    else if (functions.hasOwnProperty(value))
174
+                        return "support.function";
175
+                    else if (colors.hasOwnProperty(value.toLowerCase()))
176
+                        return "support.constant.color";
177
+                    else if (tags.hasOwnProperty(value.toLowerCase()))
178
+                        return "variable.language";
179
+                    else
180
+                        return "text";
181
+                },
182
+                regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
183
+            }, {
184
+                token: "variable.language",
185
+                regex: "#[a-z0-9-_]+"
186
+            }, {
187
+                token: "variable.language",
188
+                regex: "\\.[a-z0-9-_]+"
189
+            }, {
190
+                token: "variable.language",
191
+                regex: ":[a-z0-9-_]+"
192
+            }, {
193
+                token: "constant",
194
+                regex: "[a-z0-9-_]+"
195
+            }, {
196
+                token : "keyword.operator",
197
+                regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
198
+            }, {
199
+                token : "paren.lparen",
200
+                regex : "[[({]"
201
+            }, {
202
+                token : "paren.rparen",
203
+                regex : "[\\])}]"
204
+            }, {
205
+                token : "text",
206
+                regex : "\\s+"
207
+            }, {
208
+                caseInsensitive: true
209
+            }
210
+        ],
211
+        "comment" : [
212
+            {
213
+                token : "comment", // closing comment
214
+                regex : ".*?\\*\\/",
215
+                next : "start"
216
+            }, {
217
+                token : "comment", // comment spanning whole line
218
+                regex : ".+"
219
+            }
220
+        ]
221
+    };
222
+};
223
+
224
+oop.inherits(LessHighlightRules, TextHighlightRules);
225
+
226
+exports.LessHighlightRules = LessHighlightRules;
227
+
228
+});
229
+
230
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
231
+"use strict";
232
+
233
+var Range = require("../range").Range;
234
+
235
+var MatchingBraceOutdent = function() {};
236
+
237
+(function() {
238
+
239
+    this.checkOutdent = function(line, input) {
240
+        if (! /^\s+$/.test(line))
241
+            return false;
242
+
243
+        return /^\s*\}/.test(input);
244
+    };
245
+
246
+    this.autoOutdent = function(doc, row) {
247
+        var line = doc.getLine(row);
248
+        var match = line.match(/^(\s*\})/);
249
+
250
+        if (!match) return 0;
251
+
252
+        var column = match[1].length;
253
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
254
+
255
+        if (!openBracePos || openBracePos.row == row) return 0;
256
+
257
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
258
+        doc.replace(new Range(row, 0, row, column-1), indent);
259
+    };
260
+
261
+    this.$getIndent = function(line) {
262
+        return line.match(/^\s*/)[0];
263
+    };
264
+
265
+}).call(MatchingBraceOutdent.prototype);
266
+
267
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
268
+});
269
+
270
+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) {
271
+"use strict";
272
+
273
+var oop = require("../../lib/oop");
274
+var Behaviour = require("../behaviour").Behaviour;
275
+var TokenIterator = require("../../token_iterator").TokenIterator;
276
+var lang = require("../../lib/lang");
277
+
278
+var SAFE_INSERT_IN_TOKENS =
279
+    ["text", "paren.rparen", "punctuation.operator"];
280
+var SAFE_INSERT_BEFORE_TOKENS =
281
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
282
+
283
+var context;
284
+var contextCache = {};
285
+var initContext = function(editor) {
286
+    var id = -1;
287
+    if (editor.multiSelect) {
288
+        id = editor.selection.index;
289
+        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
290
+            contextCache = {rangeCount: editor.multiSelect.rangeCount};
291
+    }
292
+    if (contextCache[id])
293
+        return context = contextCache[id];
294
+    context = contextCache[id] = {
295
+        autoInsertedBrackets: 0,
296
+        autoInsertedRow: -1,
297
+        autoInsertedLineEnd: "",
298
+        maybeInsertedBrackets: 0,
299
+        maybeInsertedRow: -1,
300
+        maybeInsertedLineStart: "",
301
+        maybeInsertedLineEnd: ""
302
+    };
303
+};
304
+
305
+var CstyleBehaviour = function() {
306
+    this.add("braces", "insertion", function(state, action, editor, session, text) {
307
+        var cursor = editor.getCursorPosition();
308
+        var line = session.doc.getLine(cursor.row);
309
+        if (text == '{') {
310
+            initContext(editor);
311
+            var selection = editor.getSelectionRange();
312
+            var selected = session.doc.getTextRange(selection);
313
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
314
+                return {
315
+                    text: '{' + selected + '}',
316
+                    selection: false
317
+                };
318
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
319
+                if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
320
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
321
+                    return {
322
+                        text: '{}',
323
+                        selection: [1, 1]
324
+                    };
325
+                } else {
326
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
327
+                    return {
328
+                        text: '{',
329
+                        selection: [1, 1]
330
+                    };
331
+                }
332
+            }
333
+        } else if (text == '}') {
334
+            initContext(editor);
335
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
336
+            if (rightChar == '}') {
337
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
338
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
339
+                    CstyleBehaviour.popAutoInsertedClosing();
340
+                    return {
341
+                        text: '',
342
+                        selection: [1, 1]
343
+                    };
344
+                }
345
+            }
346
+        } else if (text == "\n" || text == "\r\n") {
347
+            initContext(editor);
348
+            var closing = "";
349
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
350
+                closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
351
+                CstyleBehaviour.clearMaybeInsertedClosing();
352
+            }
353
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
354
+            if (rightChar === '}') {
355
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
356
+                if (!openBracePos)
357
+                     return null;
358
+                var next_indent = this.$getIndent(session.getLine(openBracePos.row));
359
+            } else if (closing) {
360
+                var next_indent = this.$getIndent(line);
361
+            } else {
362
+                CstyleBehaviour.clearMaybeInsertedClosing();
363
+                return;
364
+            }
365
+            var indent = next_indent + session.getTabString();
366
+
367
+            return {
368
+                text: '\n' + indent + '\n' + next_indent + closing,
369
+                selection: [1, indent.length, 1, indent.length]
370
+            };
371
+        } else {
372
+            CstyleBehaviour.clearMaybeInsertedClosing();
373
+        }
374
+    });
375
+
376
+    this.add("braces", "deletion", function(state, action, editor, session, range) {
377
+        var selected = session.doc.getTextRange(range);
378
+        if (!range.isMultiLine() && selected == '{') {
379
+            initContext(editor);
380
+            var line = session.doc.getLine(range.start.row);
381
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
382
+            if (rightChar == '}') {
383
+                range.end.column++;
384
+                return range;
385
+            } else {
386
+                context.maybeInsertedBrackets--;
387
+            }
388
+        }
389
+    });
390
+
391
+    this.add("parens", "insertion", function(state, action, editor, session, text) {
392
+        if (text == '(') {
393
+            initContext(editor);
394
+            var selection = editor.getSelectionRange();
395
+            var selected = session.doc.getTextRange(selection);
396
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
397
+                return {
398
+                    text: '(' + selected + ')',
399
+                    selection: false
400
+                };
401
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
402
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
403
+                return {
404
+                    text: '()',
405
+                    selection: [1, 1]
406
+                };
407
+            }
408
+        } else if (text == ')') {
409
+            initContext(editor);
410
+            var cursor = editor.getCursorPosition();
411
+            var line = session.doc.getLine(cursor.row);
412
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
413
+            if (rightChar == ')') {
414
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
415
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
416
+                    CstyleBehaviour.popAutoInsertedClosing();
417
+                    return {
418
+                        text: '',
419
+                        selection: [1, 1]
420
+                    };
421
+                }
422
+            }
423
+        }
424
+    });
425
+
426
+    this.add("parens", "deletion", function(state, action, editor, session, range) {
427
+        var selected = session.doc.getTextRange(range);
428
+        if (!range.isMultiLine() && selected == '(') {
429
+            initContext(editor);
430
+            var line = session.doc.getLine(range.start.row);
431
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
432
+            if (rightChar == ')') {
433
+                range.end.column++;
434
+                return range;
435
+            }
436
+        }
437
+    });
438
+
439
+    this.add("brackets", "insertion", function(state, action, editor, session, text) {
440
+        if (text == '[') {
441
+            initContext(editor);
442
+            var selection = editor.getSelectionRange();
443
+            var selected = session.doc.getTextRange(selection);
444
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
445
+                return {
446
+                    text: '[' + selected + ']',
447
+                    selection: false
448
+                };
449
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
450
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
451
+                return {
452
+                    text: '[]',
453
+                    selection: [1, 1]
454
+                };
455
+            }
456
+        } else if (text == ']') {
457
+            initContext(editor);
458
+            var cursor = editor.getCursorPosition();
459
+            var line = session.doc.getLine(cursor.row);
460
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
461
+            if (rightChar == ']') {
462
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
463
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
464
+                    CstyleBehaviour.popAutoInsertedClosing();
465
+                    return {
466
+                        text: '',
467
+                        selection: [1, 1]
468
+                    };
469
+                }
470
+            }
471
+        }
472
+    });
473
+
474
+    this.add("brackets", "deletion", function(state, action, editor, session, range) {
475
+        var selected = session.doc.getTextRange(range);
476
+        if (!range.isMultiLine() && selected == '[') {
477
+            initContext(editor);
478
+            var line = session.doc.getLine(range.start.row);
479
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
480
+            if (rightChar == ']') {
481
+                range.end.column++;
482
+                return range;
483
+            }
484
+        }
485
+    });
486
+
487
+    this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
488
+        if (text == '"' || text == "'") {
489
+            initContext(editor);
490
+            var quote = text;
491
+            var selection = editor.getSelectionRange();
492
+            var selected = session.doc.getTextRange(selection);
493
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
494
+                return {
495
+                    text: quote + selected + quote,
496
+                    selection: false
497
+                };
498
+            } else {
499
+                var cursor = editor.getCursorPosition();
500
+                var line = session.doc.getLine(cursor.row);
501
+                var leftChar = line.substring(cursor.column-1, cursor.column);
502
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
503
+                
504
+                var token = session.getTokenAt(cursor.row, cursor.column);
505
+                var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
506
+                if (leftChar == "\\" && token && /escape/.test(token.type))
507
+                    return null;
508
+                
509
+                var stringBefore = token && /string/.test(token.type);
510
+                var stringAfter = !rightToken || /string/.test(rightToken.type);
511
+                
512
+                var pair;
513
+                if (rightChar == quote) {
514
+                    pair = stringBefore !== stringAfter;
515
+                } else {
516
+                    if (stringBefore && !stringAfter)
517
+                        return null; // wrap string with different quote
518
+                    if (stringBefore && stringAfter)
519
+                        return null; // do not pair quotes inside strings 
520
+                    var wordRe = session.$mode.tokenRe;
521
+                    wordRe.lastIndex = 0;
522
+                    var isWordBefore = wordRe.test(leftChar);
523
+                    wordRe.lastIndex = 0;
524
+                    var isWordAfter = wordRe.test(leftChar);
525
+                    if (isWordBefore || isWordAfter)
526
+                        return null; // before or after alphanumeric
527
+                    if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
528
+                        return null; // there is rightChar and it isn't closing
529
+                    pair = true;
530
+                }
531
+                return {
532
+                    text: pair ? quote + quote : "",
533
+                    selection: [1,1]
534
+                };
535
+            }
536
+        }
537
+    });
538
+
539
+    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
540
+        var selected = session.doc.getTextRange(range);
541
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
542
+            initContext(editor);
543
+            var line = session.doc.getLine(range.start.row);
544
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
545
+            if (rightChar == selected) {
546
+                range.end.column++;
547
+                return range;
548
+            }
549
+        }
550
+    });
551
+
552
+};
553
+
554
+    
555
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
556
+    var cursor = editor.getCursorPosition();
557
+    var iterator = new TokenIterator(session, cursor.row, cursor.column);
558
+    if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
559
+        var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
560
+        if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
561
+            return false;
562
+    }
563
+    iterator.stepForward();
564
+    return iterator.getCurrentTokenRow() !== cursor.row ||
565
+        this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
566
+};
567
+
568
+CstyleBehaviour.$matchTokenType = function(token, types) {
569
+    return types.indexOf(token.type || token) > -1;
570
+};
571
+
572
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
573
+    var cursor = editor.getCursorPosition();
574
+    var line = session.doc.getLine(cursor.row);
575
+    if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
576
+        context.autoInsertedBrackets = 0;
577
+    context.autoInsertedRow = cursor.row;
578
+    context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
579
+    context.autoInsertedBrackets++;
580
+};
581
+
582
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
583
+    var cursor = editor.getCursorPosition();
584
+    var line = session.doc.getLine(cursor.row);
585
+    if (!this.isMaybeInsertedClosing(cursor, line))
586
+        context.maybeInsertedBrackets = 0;
587
+    context.maybeInsertedRow = cursor.row;
588
+    context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
589
+    context.maybeInsertedLineEnd = line.substr(cursor.column);
590
+    context.maybeInsertedBrackets++;
591
+};
592
+
593
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
594
+    return context.autoInsertedBrackets > 0 &&
595
+        cursor.row === context.autoInsertedRow &&
596
+        bracket === context.autoInsertedLineEnd[0] &&
597
+        line.substr(cursor.column) === context.autoInsertedLineEnd;
598
+};
599
+
600
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
601
+    return context.maybeInsertedBrackets > 0 &&
602
+        cursor.row === context.maybeInsertedRow &&
603
+        line.substr(cursor.column) === context.maybeInsertedLineEnd &&
604
+        line.substr(0, cursor.column) == context.maybeInsertedLineStart;
605
+};
606
+
607
+CstyleBehaviour.popAutoInsertedClosing = function() {
608
+    context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
609
+    context.autoInsertedBrackets--;
610
+};
611
+
612
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
613
+    if (context) {
614
+        context.maybeInsertedBrackets = 0;
615
+        context.maybeInsertedRow = -1;
616
+    }
617
+};
618
+
619
+
620
+
621
+oop.inherits(CstyleBehaviour, Behaviour);
622
+
623
+exports.CstyleBehaviour = CstyleBehaviour;
624
+});
625
+
626
+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) {
627
+"use strict";
628
+
629
+var oop = require("../../lib/oop");
630
+var Behaviour = require("../behaviour").Behaviour;
631
+var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
632
+var TokenIterator = require("../../token_iterator").TokenIterator;
633
+
634
+var CssBehaviour = function () {
635
+
636
+    this.inherit(CstyleBehaviour);
637
+
638
+    this.add("colon", "insertion", function (state, action, editor, session, text) {
639
+        if (text === ':') {
640
+            var cursor = editor.getCursorPosition();
641
+            var iterator = new TokenIterator(session, cursor.row, cursor.column);
642
+            var token = iterator.getCurrentToken();
643
+            if (token && token.value.match(/\s+/)) {
644
+                token = iterator.stepBackward();
645
+            }
646
+            if (token && token.type === 'support.type') {
647
+                var line = session.doc.getLine(cursor.row);
648
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
649
+                if (rightChar === ':') {
650
+                    return {
651
+                       text: '',
652
+                       selection: [1, 1]
653
+                    }
654
+                }
655
+                if (!line.substring(cursor.column).match(/^\s*;/)) {
656
+                    return {
657
+                       text: ':;',
658
+                       selection: [1, 1]
659
+                    }
660
+                }
661
+            }
662
+        }
663
+    });
664
+
665
+    this.add("colon", "deletion", function (state, action, editor, session, range) {
666
+        var selected = session.doc.getTextRange(range);
667
+        if (!range.isMultiLine() && selected === ':') {
668
+            var cursor = editor.getCursorPosition();
669
+            var iterator = new TokenIterator(session, cursor.row, cursor.column);
670
+            var token = iterator.getCurrentToken();
671
+            if (token && token.value.match(/\s+/)) {
672
+                token = iterator.stepBackward();
673
+            }
674
+            if (token && token.type === 'support.type') {
675
+                var line = session.doc.getLine(range.start.row);
676
+                var rightChar = line.substring(range.end.column, range.end.column + 1);
677
+                if (rightChar === ';') {
678
+                    range.end.column ++;
679
+                    return range;
680
+                }
681
+            }
682
+        }
683
+    });
684
+
685
+    this.add("semicolon", "insertion", function (state, action, editor, session, text) {
686
+        if (text === ';') {
687
+            var cursor = editor.getCursorPosition();
688
+            var line = session.doc.getLine(cursor.row);
689
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
690
+            if (rightChar === ';') {
691
+                return {
692
+                   text: '',
693
+                   selection: [1, 1]
694
+                }
695
+            }
696
+        }
697
+    });
698
+
699
+}
700
+oop.inherits(CssBehaviour, CstyleBehaviour);
701
+
702
+exports.CssBehaviour = CssBehaviour;
703
+});
704
+
705
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
706
+"use strict";
707
+
708
+var oop = require("../../lib/oop");
709
+var Range = require("../../range").Range;
710
+var BaseFoldMode = require("./fold_mode").FoldMode;
711
+
712
+var FoldMode = exports.FoldMode = function(commentRegex) {
713
+    if (commentRegex) {
714
+        this.foldingStartMarker = new RegExp(
715
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
716
+        );
717
+        this.foldingStopMarker = new RegExp(
718
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
719
+        );
720
+    }
721
+};
722
+oop.inherits(FoldMode, BaseFoldMode);
723
+
724
+(function() {
725
+    
726
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
727
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
728
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
729
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
730
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
731
+    this._getFoldWidgetBase = this.getFoldWidget;
732
+    this.getFoldWidget = function(session, foldStyle, row) {
733
+        var line = session.getLine(row);
734
+    
735
+        if (this.singleLineBlockCommentRe.test(line)) {
736
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
737
+                return "";
738
+        }
739
+    
740
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
741
+    
742
+        if (!fw && this.startRegionRe.test(line))
743
+            return "start"; // lineCommentRegionStart
744
+    
745
+        return fw;
746
+    };
747
+
748
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
749
+        var line = session.getLine(row);
750
+        
751
+        if (this.startRegionRe.test(line))
752
+            return this.getCommentRegionBlock(session, line, row);
753
+        
754
+        var match = line.match(this.foldingStartMarker);
755
+        if (match) {
756
+            var i = match.index;
757
+
758
+            if (match[1])
759
+                return this.openingBracketBlock(session, match[1], row, i);
760
+                
761
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
762
+            
763
+            if (range && !range.isMultiLine()) {
764
+                if (forceMultiline) {
765
+                    range = this.getSectionRange(session, row);
766
+                } else if (foldStyle != "all")
767
+                    range = null;
768
+            }
769
+            
770
+            return range;
771
+        }
772
+
773
+        if (foldStyle === "markbegin")
774
+            return;
775
+
776
+        var match = line.match(this.foldingStopMarker);
777
+        if (match) {
778
+            var i = match.index + match[0].length;
779
+
780
+            if (match[1])
781
+                return this.closingBracketBlock(session, match[1], row, i);
782
+
783
+            return session.getCommentFoldRange(row, i, -1);
784
+        }
785
+    };
786
+    
787
+    this.getSectionRange = function(session, row) {
788
+        var line = session.getLine(row);
789
+        var startIndent = line.search(/\S/);
790
+        var startRow = row;
791
+        var startColumn = line.length;
792
+        row = row + 1;
793
+        var endRow = row;
794
+        var maxRow = session.getLength();
795
+        while (++row < maxRow) {
796
+            line = session.getLine(row);
797
+            var indent = line.search(/\S/);
798
+            if (indent === -1)
799
+                continue;
800
+            if  (startIndent > indent)
801
+                break;
802
+            var subRange = this.getFoldWidgetRange(session, "all", row);
803
+            
804
+            if (subRange) {
805
+                if (subRange.start.row <= startRow) {
806
+                    break;
807
+                } else if (subRange.isMultiLine()) {
808
+                    row = subRange.end.row;
809
+                } else if (startIndent == indent) {
810
+                    break;
811
+                }
812
+            }
813
+            endRow = row;
814
+        }
815
+        
816
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
817
+    };
818
+    
819
+    this.getCommentRegionBlock = function(session, line, row) {
820
+        var startColumn = line.search(/\s*$/);
821
+        var maxRow = session.getLength();
822
+        var startRow = row;
823
+        
824
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
825
+        var depth = 1;
826
+        while (++row < maxRow) {
827
+            line = session.getLine(row);
828
+            var m = re.exec(line);
829
+            if (!m) continue;
830
+            if (m[1]) depth--;
831
+            else depth++;
832
+
833
+            if (!depth) break;
834
+        }
835
+
836
+        var endRow = row;
837
+        if (endRow > startRow) {
838
+            return new Range(startRow, startColumn, endRow, line.length);
839
+        }
840
+    };
841
+
842
+}).call(FoldMode.prototype);
843
+
844
+});
845
+
846
+ace.define("ace/mode/less",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/less_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
847
+"use strict";
848
+
849
+var oop = require("../lib/oop");
850
+var TextMode = require("./text").Mode;
851
+var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules;
852
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
853
+var CssBehaviour = require("./behaviour/css").CssBehaviour;
854
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
855
+
856
+var Mode = function() {
857
+    this.HighlightRules = LessHighlightRules;
858
+    this.$outdent = new MatchingBraceOutdent();
859
+    this.$behaviour = new CssBehaviour();
860
+    this.foldingRules = new CStyleFoldMode();
861
+};
862
+oop.inherits(Mode, TextMode);
863
+
864
+(function() {
865
+
866
+    this.lineCommentStart = "//";
867
+    this.blockComment = {start: "/*", end: "*/"};
868
+    
869
+    this.getNextLineIndent = function(state, line, tab) {
870
+        var indent = this.$getIndent(line);
871
+        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
872
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
873
+            return indent;
874
+        }
875
+
876
+        var match = line.match(/^.*\{\s*$/);
877
+        if (match) {
878
+            indent += tab;
879
+        }
880
+
881
+        return indent;
882
+    };
883
+
884
+    this.checkOutdent = function(state, line, input) {
885
+        return this.$outdent.checkOutdent(line, input);
886
+    };
887
+
888
+    this.autoOutdent = function(state, doc, row) {
889
+        this.$outdent.autoOutdent(doc, row);
890
+    };
891
+
892
+    this.$id = "ace/mode/less";
893
+}).call(Mode.prototype);
894
+
895
+exports.Mode = Mode;
896
+
897
+});

+ 1022
- 0
generator/lib/ace/mode-liquid.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 104
- 0
generator/lib/ace/mode-lisp.js Parādīt failu

@@ -0,0 +1,104 @@
1
+ace.define("ace/mode/lisp_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 LispHighlightRules = function() {
8
+    var keywordControl = "case|do|let|loop|if|else|when";
9
+    var keywordOperator = "eq|neq|and|or";
10
+    var constantLanguage = "null|nil";
11
+    var supportFunctions = "cons|car|cdr|cond|lambda|format|setq|setf|quote|eval|append|list|listp|memberp|t|load|progn";
12
+
13
+    var keywordMapper = this.createKeywordMapper({
14
+        "keyword.control": keywordControl,
15
+        "keyword.operator": keywordOperator,
16
+        "constant.language": constantLanguage,
17
+        "support.function": supportFunctions
18
+    }, "identifier", true);
19
+
20
+    this.$rules = 
21
+        {
22
+    "start": [
23
+        {
24
+            token : "comment",
25
+            regex : ";.*$"
26
+        },
27
+        {
28
+            token: ["storage.type.function-type.lisp", "text", "entity.name.function.lisp"],
29
+            regex: "(?:\\b(?:(defun|defmethod|defmacro))\\b)(\\s+)((?:\\w|\\-|\\!|\\?)*)"
30
+        },
31
+        {
32
+            token: ["punctuation.definition.constant.character.lisp", "constant.character.lisp"],
33
+            regex: "(#)((?:\\w|[\\\\+-=<>'\"&#])+)"
34
+        },
35
+        {
36
+            token: ["punctuation.definition.variable.lisp", "variable.other.global.lisp", "punctuation.definition.variable.lisp"],
37
+            regex: "(\\*)(\\S*)(\\*)"
38
+        },
39
+        {
40
+            token : "constant.numeric", // hex
41
+            regex : "0[xX][0-9a-fA-F]+(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
42
+        }, 
43
+        {
44
+            token : "constant.numeric", // float
45
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
46
+        },
47
+        {
48
+                token : keywordMapper,
49
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
50
+        },
51
+        {
52
+            token : "string",
53
+            regex : '"(?=.)',
54
+            next  : "qqstring"
55
+        }
56
+    ],
57
+    "qqstring": [
58
+        {
59
+            token: "constant.character.escape.lisp",
60
+            regex: "\\\\."
61
+        },
62
+        {
63
+            token : "string",
64
+            regex : '[^"\\\\]+'
65
+        }, {
66
+            token : "string",
67
+            regex : "\\\\$",
68
+            next  : "qqstring"
69
+        }, {
70
+            token : "string",
71
+            regex : '"|$',
72
+            next  : "start"
73
+        }
74
+    ]
75
+}
76
+
77
+};
78
+
79
+oop.inherits(LispHighlightRules, TextHighlightRules);
80
+
81
+exports.LispHighlightRules = LispHighlightRules;
82
+});
83
+
84
+ace.define("ace/mode/lisp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/lisp_highlight_rules"], function(require, exports, module) {
85
+"use strict";
86
+
87
+var oop = require("../lib/oop");
88
+var TextMode = require("./text").Mode;
89
+var LispHighlightRules = require("./lisp_highlight_rules").LispHighlightRules;
90
+
91
+var Mode = function() {
92
+    this.HighlightRules = LispHighlightRules;
93
+};
94
+oop.inherits(Mode, TextMode);
95
+
96
+(function() {
97
+       
98
+    this.lineCommentStart = ";";
99
+    
100
+    this.$id = "ace/mode/lisp";
101
+}).call(Mode.prototype);
102
+
103
+exports.Mode = Mode;
104
+});

+ 289
- 0
generator/lib/ace/mode-livescript.js Parādīt failu

@@ -0,0 +1,289 @@
1
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
2
+"use strict";
3
+
4
+var Range = require("../range").Range;
5
+
6
+var MatchingBraceOutdent = function() {};
7
+
8
+(function() {
9
+
10
+    this.checkOutdent = function(line, input) {
11
+        if (! /^\s+$/.test(line))
12
+            return false;
13
+
14
+        return /^\s*\}/.test(input);
15
+    };
16
+
17
+    this.autoOutdent = function(doc, row) {
18
+        var line = doc.getLine(row);
19
+        var match = line.match(/^(\s*\})/);
20
+
21
+        if (!match) return 0;
22
+
23
+        var column = match[1].length;
24
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
25
+
26
+        if (!openBracePos || openBracePos.row == row) return 0;
27
+
28
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
29
+        doc.replace(new Range(row, 0, row, column-1), indent);
30
+    };
31
+
32
+    this.$getIndent = function(line) {
33
+        return line.match(/^\s*/)[0];
34
+    };
35
+
36
+}).call(MatchingBraceOutdent.prototype);
37
+
38
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
39
+});
40
+
41
+ace.define("ace/mode/livescript",["require","exports","module","ace/tokenizer","ace/mode/matching_brace_outdent","ace/range","ace/mode/text"], function(require, exports, module){
42
+  var identifier, LiveScriptMode, keywordend, stringfill;
43
+  identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*';
44
+  exports.Mode = LiveScriptMode = (function(superclass){
45
+    var indenter, prototype = extend$((import$(LiveScriptMode, superclass).displayName = 'LiveScriptMode', LiveScriptMode), superclass).prototype, constructor = LiveScriptMode;
46
+    function LiveScriptMode(){
47
+      var that;
48
+      this.$tokenizer = new (require('../tokenizer')).Tokenizer(LiveScriptMode.Rules);
49
+      if (that = require('../mode/matching_brace_outdent')) {
50
+        this.$outdent = new that.MatchingBraceOutdent;
51
+      }
52
+      this.$id = "ace/mode/livescript";
53
+    }
54
+    indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$');
55
+    prototype.getNextLineIndent = function(state, line, tab){
56
+      var indent, tokens;
57
+      indent = this.$getIndent(line);
58
+      tokens = this.$tokenizer.getLineTokens(line, state).tokens;
59
+      if (!(tokens.length && tokens[tokens.length - 1].type === 'comment')) {
60
+        if (state === 'start' && indenter.test(line)) {
61
+          indent += tab;
62
+        }
63
+      }
64
+      return indent;
65
+    };
66
+    prototype.toggleCommentLines = function(state, doc, startRow, endRow){
67
+      var comment, range, i$, i, out, line;
68
+      comment = /^(\s*)#/;
69
+      range = new (require('../range')).Range(0, 0, 0, 0);
70
+      for (i$ = startRow; i$ <= endRow; ++i$) {
71
+        i = i$;
72
+        if (out = comment.test(line = doc.getLine(i))) {
73
+          line = line.replace(comment, '$1');
74
+        } else {
75
+          line = line.replace(/^\s*/, '$&#');
76
+        }
77
+        range.end.row = range.start.row = i;
78
+        range.end.column = line.length + 1;
79
+        doc.replace(range, line);
80
+      }
81
+      return 1 - out * 2;
82
+    };
83
+    prototype.checkOutdent = function(state, line, input){
84
+      var ref$;
85
+      return (ref$ = this.$outdent) != null ? ref$.checkOutdent(line, input) : void 8;
86
+    };
87
+    prototype.autoOutdent = function(state, doc, row){
88
+      var ref$;
89
+      return (ref$ = this.$outdent) != null ? ref$.autoOutdent(doc, row) : void 8;
90
+    };
91
+    return LiveScriptMode;
92
+  }(require('../mode/text').Mode));
93
+  keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
94
+  stringfill = {
95
+    token: 'string',
96
+    regex: '.+'
97
+  };
98
+  LiveScriptMode.Rules = {
99
+    start: [
100
+      {
101
+        token: 'keyword',
102
+        regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)' + keywordend
103
+      }, {
104
+        token: 'constant.language',
105
+        regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend
106
+      }, {
107
+        token: 'invalid.illegal',
108
+        regex: '(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)' + keywordend
109
+      }, {
110
+        token: 'language.support.class',
111
+        regex: '(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)' + keywordend
112
+      }, {
113
+        token: 'language.support.function',
114
+        regex: '(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)' + keywordend
115
+      }, {
116
+        token: 'variable.language',
117
+        regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend
118
+      }, {
119
+        token: 'identifier',
120
+        regex: identifier + '\\s*:(?![:=])'
121
+      }, {
122
+        token: 'variable',
123
+        regex: identifier
124
+      }, {
125
+        token: 'keyword.operator',
126
+        regex: '(?:\\.{3}|\\s+\\?)'
127
+      }, {
128
+        token: 'keyword.variable',
129
+        regex: '(?:@+|::|\\.\\.)',
130
+        next: 'key'
131
+      }, {
132
+        token: 'keyword.operator',
133
+        regex: '\\.\\s*',
134
+        next: 'key'
135
+      }, {
136
+        token: 'string',
137
+        regex: '\\\\\\S[^\\s,;)}\\]]*'
138
+      }, {
139
+        token: 'string.doc',
140
+        regex: '\'\'\'',
141
+        next: 'qdoc'
142
+      }, {
143
+        token: 'string.doc',
144
+        regex: '"""',
145
+        next: 'qqdoc'
146
+      }, {
147
+        token: 'string',
148
+        regex: '\'',
149
+        next: 'qstring'
150
+      }, {
151
+        token: 'string',
152
+        regex: '"',
153
+        next: 'qqstring'
154
+      }, {
155
+        token: 'string',
156
+        regex: '`',
157
+        next: 'js'
158
+      }, {
159
+        token: 'string',
160
+        regex: '<\\[',
161
+        next: 'words'
162
+      }, {
163
+        token: 'string.regex',
164
+        regex: '//',
165
+        next: 'heregex'
166
+      }, {
167
+        token: 'comment.doc',
168
+        regex: '/\\*',
169
+        next: 'comment'
170
+      }, {
171
+        token: 'comment',
172
+        regex: '#.*'
173
+      }, {
174
+        token: 'string.regex',
175
+        regex: '\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}',
176
+        next: 'key'
177
+      }, {
178
+        token: 'constant.numeric',
179
+        regex: '(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)'
180
+      }, {
181
+        token: 'lparen',
182
+        regex: '[({[]'
183
+      }, {
184
+        token: 'rparen',
185
+        regex: '[)}\\]]',
186
+        next: 'key'
187
+      }, {
188
+        token: 'keyword.operator',
189
+        regex: '\\S+'
190
+      }, {
191
+        token: 'text',
192
+        regex: '\\s+'
193
+      }
194
+    ],
195
+    heregex: [
196
+      {
197
+        token: 'string.regex',
198
+        regex: '.*?//[gimy$?]{0,4}',
199
+        next: 'start'
200
+      }, {
201
+        token: 'string.regex',
202
+        regex: '\\s*#{'
203
+      }, {
204
+        token: 'comment.regex',
205
+        regex: '\\s+(?:#.*)?'
206
+      }, {
207
+        token: 'string.regex',
208
+        regex: '\\S+'
209
+      }
210
+    ],
211
+    key: [
212
+      {
213
+        token: 'keyword.operator',
214
+        regex: '[.?@!]+'
215
+      }, {
216
+        token: 'identifier',
217
+        regex: identifier,
218
+        next: 'start'
219
+      }, {
220
+        token: 'text',
221
+        regex: '.',
222
+        next: 'start'
223
+      }
224
+    ],
225
+    comment: [
226
+      {
227
+        token: 'comment.doc',
228
+        regex: '.*?\\*/',
229
+        next: 'start'
230
+      }, {
231
+        token: 'comment.doc',
232
+        regex: '.+'
233
+      }
234
+    ],
235
+    qdoc: [
236
+      {
237
+        token: 'string',
238
+        regex: ".*?'''",
239
+        next: 'key'
240
+      }, stringfill
241
+    ],
242
+    qqdoc: [
243
+      {
244
+        token: 'string',
245
+        regex: '.*?"""',
246
+        next: 'key'
247
+      }, stringfill
248
+    ],
249
+    qstring: [
250
+      {
251
+        token: 'string',
252
+        regex: '[^\\\\\']*(?:\\\\.[^\\\\\']*)*\'',
253
+        next: 'key'
254
+      }, stringfill
255
+    ],
256
+    qqstring: [
257
+      {
258
+        token: 'string',
259
+        regex: '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
260
+        next: 'key'
261
+      }, stringfill
262
+    ],
263
+    js: [
264
+      {
265
+        token: 'string',
266
+        regex: '[^\\\\`]*(?:\\\\.[^\\\\`]*)*`',
267
+        next: 'key'
268
+      }, stringfill
269
+    ],
270
+    words: [
271
+      {
272
+        token: 'string',
273
+        regex: '.*?\\]>',
274
+        next: 'key'
275
+      }, stringfill
276
+    ]
277
+  };
278
+function extend$(sub, sup){
279
+  function fun(){} fun.prototype = (sub.superclass = sup).prototype;
280
+  (sub.prototype = new fun).constructor = sub;
281
+  if (typeof sup.extended == 'function') sup.extended(sub);
282
+  return sub;
283
+}
284
+function import$(obj, src){
285
+  var own = {}.hasOwnProperty;
286
+  for (var key in src) if (own.call(src, key)) obj[key] = src[key];
287
+  return obj;
288
+}
289
+});

+ 666
- 0
generator/lib/ace/mode-logiql.js Parādīt failu

@@ -0,0 +1,666 @@
1
+ace.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
+ace.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
+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) {
163
+"use strict";
164
+
165
+var oop = require("../../lib/oop");
166
+var Behaviour = require("../behaviour").Behaviour;
167
+var TokenIterator = require("../../token_iterator").TokenIterator;
168
+var lang = require("../../lib/lang");
169
+
170
+var SAFE_INSERT_IN_TOKENS =
171
+    ["text", "paren.rparen", "punctuation.operator"];
172
+var SAFE_INSERT_BEFORE_TOKENS =
173
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
174
+
175
+var context;
176
+var contextCache = {};
177
+var initContext = function(editor) {
178
+    var id = -1;
179
+    if (editor.multiSelect) {
180
+        id = editor.selection.index;
181
+        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
182
+            contextCache = {rangeCount: editor.multiSelect.rangeCount};
183
+    }
184
+    if (contextCache[id])
185
+        return context = contextCache[id];
186
+    context = contextCache[id] = {
187
+        autoInsertedBrackets: 0,
188
+        autoInsertedRow: -1,
189
+        autoInsertedLineEnd: "",
190
+        maybeInsertedBrackets: 0,
191
+        maybeInsertedRow: -1,
192
+        maybeInsertedLineStart: "",
193
+        maybeInsertedLineEnd: ""
194
+    };
195
+};
196
+
197
+var CstyleBehaviour = function() {
198
+    this.add("braces", "insertion", function(state, action, editor, session, text) {
199
+        var cursor = editor.getCursorPosition();
200
+        var line = session.doc.getLine(cursor.row);
201
+        if (text == '{') {
202
+            initContext(editor);
203
+            var selection = editor.getSelectionRange();
204
+            var selected = session.doc.getTextRange(selection);
205
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
206
+                return {
207
+                    text: '{' + selected + '}',
208
+                    selection: false
209
+                };
210
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
211
+                if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
212
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
213
+                    return {
214
+                        text: '{}',
215
+                        selection: [1, 1]
216
+                    };
217
+                } else {
218
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
219
+                    return {
220
+                        text: '{',
221
+                        selection: [1, 1]
222
+                    };
223
+                }
224
+            }
225
+        } else if (text == '}') {
226
+            initContext(editor);
227
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
228
+            if (rightChar == '}') {
229
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
230
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
231
+                    CstyleBehaviour.popAutoInsertedClosing();
232
+                    return {
233
+                        text: '',
234
+                        selection: [1, 1]
235
+                    };
236
+                }
237
+            }
238
+        } else if (text == "\n" || text == "\r\n") {
239
+            initContext(editor);
240
+            var closing = "";
241
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
242
+                closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
243
+                CstyleBehaviour.clearMaybeInsertedClosing();
244
+            }
245
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
246
+            if (rightChar === '}') {
247
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
248
+                if (!openBracePos)
249
+                     return null;
250
+                var next_indent = this.$getIndent(session.getLine(openBracePos.row));
251
+            } else if (closing) {
252
+                var next_indent = this.$getIndent(line);
253
+            } else {
254
+                CstyleBehaviour.clearMaybeInsertedClosing();
255
+                return;
256
+            }
257
+            var indent = next_indent + session.getTabString();
258
+
259
+            return {
260
+                text: '\n' + indent + '\n' + next_indent + closing,
261
+                selection: [1, indent.length, 1, indent.length]
262
+            };
263
+        } else {
264
+            CstyleBehaviour.clearMaybeInsertedClosing();
265
+        }
266
+    });
267
+
268
+    this.add("braces", "deletion", function(state, action, editor, session, range) {
269
+        var selected = session.doc.getTextRange(range);
270
+        if (!range.isMultiLine() && selected == '{') {
271
+            initContext(editor);
272
+            var line = session.doc.getLine(range.start.row);
273
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
274
+            if (rightChar == '}') {
275
+                range.end.column++;
276
+                return range;
277
+            } else {
278
+                context.maybeInsertedBrackets--;
279
+            }
280
+        }
281
+    });
282
+
283
+    this.add("parens", "insertion", function(state, action, editor, session, text) {
284
+        if (text == '(') {
285
+            initContext(editor);
286
+            var selection = editor.getSelectionRange();
287
+            var selected = session.doc.getTextRange(selection);
288
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
289
+                return {
290
+                    text: '(' + selected + ')',
291
+                    selection: false
292
+                };
293
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
294
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
295
+                return {
296
+                    text: '()',
297
+                    selection: [1, 1]
298
+                };
299
+            }
300
+        } else if (text == ')') {
301
+            initContext(editor);
302
+            var cursor = editor.getCursorPosition();
303
+            var line = session.doc.getLine(cursor.row);
304
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
305
+            if (rightChar == ')') {
306
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
307
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
308
+                    CstyleBehaviour.popAutoInsertedClosing();
309
+                    return {
310
+                        text: '',
311
+                        selection: [1, 1]
312
+                    };
313
+                }
314
+            }
315
+        }
316
+    });
317
+
318
+    this.add("parens", "deletion", function(state, action, editor, session, range) {
319
+        var selected = session.doc.getTextRange(range);
320
+        if (!range.isMultiLine() && selected == '(') {
321
+            initContext(editor);
322
+            var line = session.doc.getLine(range.start.row);
323
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
324
+            if (rightChar == ')') {
325
+                range.end.column++;
326
+                return range;
327
+            }
328
+        }
329
+    });
330
+
331
+    this.add("brackets", "insertion", function(state, action, editor, session, text) {
332
+        if (text == '[') {
333
+            initContext(editor);
334
+            var selection = editor.getSelectionRange();
335
+            var selected = session.doc.getTextRange(selection);
336
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
337
+                return {
338
+                    text: '[' + selected + ']',
339
+                    selection: false
340
+                };
341
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
342
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
343
+                return {
344
+                    text: '[]',
345
+                    selection: [1, 1]
346
+                };
347
+            }
348
+        } else if (text == ']') {
349
+            initContext(editor);
350
+            var cursor = editor.getCursorPosition();
351
+            var line = session.doc.getLine(cursor.row);
352
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
353
+            if (rightChar == ']') {
354
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
355
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
356
+                    CstyleBehaviour.popAutoInsertedClosing();
357
+                    return {
358
+                        text: '',
359
+                        selection: [1, 1]
360
+                    };
361
+                }
362
+            }
363
+        }
364
+    });
365
+
366
+    this.add("brackets", "deletion", function(state, action, editor, session, range) {
367
+        var selected = session.doc.getTextRange(range);
368
+        if (!range.isMultiLine() && selected == '[') {
369
+            initContext(editor);
370
+            var line = session.doc.getLine(range.start.row);
371
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
372
+            if (rightChar == ']') {
373
+                range.end.column++;
374
+                return range;
375
+            }
376
+        }
377
+    });
378
+
379
+    this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
380
+        if (text == '"' || text == "'") {
381
+            initContext(editor);
382
+            var quote = text;
383
+            var selection = editor.getSelectionRange();
384
+            var selected = session.doc.getTextRange(selection);
385
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
386
+                return {
387
+                    text: quote + selected + quote,
388
+                    selection: false
389
+                };
390
+            } else {
391
+                var cursor = editor.getCursorPosition();
392
+                var line = session.doc.getLine(cursor.row);
393
+                var leftChar = line.substring(cursor.column-1, cursor.column);
394
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
395
+                
396
+                var token = session.getTokenAt(cursor.row, cursor.column);
397
+                var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
398
+                if (leftChar == "\\" && token && /escape/.test(token.type))
399
+                    return null;
400
+                
401
+                var stringBefore = token && /string/.test(token.type);
402
+                var stringAfter = !rightToken || /string/.test(rightToken.type);
403
+                
404
+                var pair;
405
+                if (rightChar == quote) {
406
+                    pair = stringBefore !== stringAfter;
407
+                } else {
408
+                    if (stringBefore && !stringAfter)
409
+                        return null; // wrap string with different quote
410
+                    if (stringBefore && stringAfter)
411
+                        return null; // do not pair quotes inside strings 
412
+                    var wordRe = session.$mode.tokenRe;
413
+                    wordRe.lastIndex = 0;
414
+                    var isWordBefore = wordRe.test(leftChar);
415
+                    wordRe.lastIndex = 0;
416
+                    var isWordAfter = wordRe.test(leftChar);
417
+                    if (isWordBefore || isWordAfter)
418
+                        return null; // before or after alphanumeric
419
+                    if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
420
+                        return null; // there is rightChar and it isn't closing
421
+                    pair = true;
422
+                }
423
+                return {
424
+                    text: pair ? quote + quote : "",
425
+                    selection: [1,1]
426
+                };
427
+            }
428
+        }
429
+    });
430
+
431
+    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
432
+        var selected = session.doc.getTextRange(range);
433
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
434
+            initContext(editor);
435
+            var line = session.doc.getLine(range.start.row);
436
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
437
+            if (rightChar == selected) {
438
+                range.end.column++;
439
+                return range;
440
+            }
441
+        }
442
+    });
443
+
444
+};
445
+
446
+    
447
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
448
+    var cursor = editor.getCursorPosition();
449
+    var iterator = new TokenIterator(session, cursor.row, cursor.column);
450
+    if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
451
+        var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
452
+        if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
453
+            return false;
454
+    }
455
+    iterator.stepForward();
456
+    return iterator.getCurrentTokenRow() !== cursor.row ||
457
+        this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
458
+};
459
+
460
+CstyleBehaviour.$matchTokenType = function(token, types) {
461
+    return types.indexOf(token.type || token) > -1;
462
+};
463
+
464
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
465
+    var cursor = editor.getCursorPosition();
466
+    var line = session.doc.getLine(cursor.row);
467
+    if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
468
+        context.autoInsertedBrackets = 0;
469
+    context.autoInsertedRow = cursor.row;
470
+    context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
471
+    context.autoInsertedBrackets++;
472
+};
473
+
474
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
475
+    var cursor = editor.getCursorPosition();
476
+    var line = session.doc.getLine(cursor.row);
477
+    if (!this.isMaybeInsertedClosing(cursor, line))
478
+        context.maybeInsertedBrackets = 0;
479
+    context.maybeInsertedRow = cursor.row;
480
+    context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
481
+    context.maybeInsertedLineEnd = line.substr(cursor.column);
482
+    context.maybeInsertedBrackets++;
483
+};
484
+
485
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
486
+    return context.autoInsertedBrackets > 0 &&
487
+        cursor.row === context.autoInsertedRow &&
488
+        bracket === context.autoInsertedLineEnd[0] &&
489
+        line.substr(cursor.column) === context.autoInsertedLineEnd;
490
+};
491
+
492
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
493
+    return context.maybeInsertedBrackets > 0 &&
494
+        cursor.row === context.maybeInsertedRow &&
495
+        line.substr(cursor.column) === context.maybeInsertedLineEnd &&
496
+        line.substr(0, cursor.column) == context.maybeInsertedLineStart;
497
+};
498
+
499
+CstyleBehaviour.popAutoInsertedClosing = function() {
500
+    context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
501
+    context.autoInsertedBrackets--;
502
+};
503
+
504
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
505
+    if (context) {
506
+        context.maybeInsertedBrackets = 0;
507
+        context.maybeInsertedRow = -1;
508
+    }
509
+};
510
+
511
+
512
+
513
+oop.inherits(CstyleBehaviour, Behaviour);
514
+
515
+exports.CstyleBehaviour = CstyleBehaviour;
516
+});
517
+
518
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
519
+"use strict";
520
+
521
+var Range = require("../range").Range;
522
+
523
+var MatchingBraceOutdent = function() {};
524
+
525
+(function() {
526
+
527
+    this.checkOutdent = function(line, input) {
528
+        if (! /^\s+$/.test(line))
529
+            return false;
530
+
531
+        return /^\s*\}/.test(input);
532
+    };
533
+
534
+    this.autoOutdent = function(doc, row) {
535
+        var line = doc.getLine(row);
536
+        var match = line.match(/^(\s*\})/);
537
+
538
+        if (!match) return 0;
539
+
540
+        var column = match[1].length;
541
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
542
+
543
+        if (!openBracePos || openBracePos.row == row) return 0;
544
+
545
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
546
+        doc.replace(new Range(row, 0, row, column-1), indent);
547
+    };
548
+
549
+    this.$getIndent = function(line) {
550
+        return line.match(/^\s*/)[0];
551
+    };
552
+
553
+}).call(MatchingBraceOutdent.prototype);
554
+
555
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
556
+});
557
+
558
+ace.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) {
559
+"use strict";
560
+
561
+var oop = require("../lib/oop");
562
+var TextMode = require("./text").Mode;
563
+var LogiQLHighlightRules = require("./logiql_highlight_rules").LogiQLHighlightRules;
564
+var FoldMode = require("./folding/coffee").FoldMode;
565
+var TokenIterator = require("../token_iterator").TokenIterator;
566
+var Range = require("../range").Range;
567
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
568
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
569
+
570
+var Mode = function() {
571
+    this.HighlightRules = LogiQLHighlightRules;
572
+    this.foldingRules = new FoldMode();
573
+    this.$outdent = new MatchingBraceOutdent();
574
+    this.$behaviour = new CstyleBehaviour();
575
+};
576
+oop.inherits(Mode, TextMode);
577
+
578
+(function() {
579
+    this.lineCommentStart = "//";
580
+    this.blockComment = {start: "/*", end: "*/"};
581
+
582
+    this.getNextLineIndent = function(state, line, tab) {
583
+        var indent = this.$getIndent(line);
584
+
585
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
586
+        var tokens = tokenizedLine.tokens;
587
+        var endState = tokenizedLine.state;
588
+        if (/comment|string/.test(endState))  
589
+            return indent;
590
+        if (tokens.length && tokens[tokens.length - 1].type == "comment.single")
591
+            return indent;
592
+
593
+        var match = line.match();
594
+        if (/(-->|<--|<-|->|{)\s*$/.test(line))
595
+            indent += tab;
596
+        return indent;
597
+    };
598
+
599
+    this.checkOutdent = function(state, line, input) {
600
+        if (this.$outdent.checkOutdent(line, input))
601
+            return true;
602
+
603
+        if (input !== "\n" && input !== "\r\n")
604
+            return false;
605
+            
606
+        if (!/^\s+/.test(line))
607
+            return false;
608
+
609
+        return true;
610
+    };
611
+
612
+    this.autoOutdent = function(state, doc, row) {
613
+        if (this.$outdent.autoOutdent(doc, row))
614
+            return;
615
+        var prevLine = doc.getLine(row);
616
+        var match = prevLine.match(/^\s+/);
617
+        var column = prevLine.lastIndexOf(".") + 1;
618
+        if (!match || !row || !column) return 0;
619
+
620
+        var line = doc.getLine(row + 1);
621
+        var startRange = this.getMatching(doc, {row: row, column: column});
622
+        if (!startRange || startRange.start.row == row) return 0;
623
+
624
+        column = match[0].length;
625
+        var indent = this.$getIndent(doc.getLine(startRange.start.row));
626
+        doc.replace(new Range(row + 1, 0, row + 1, column), indent);
627
+    };
628
+
629
+    this.getMatching = function(session, row, column) {
630
+        if (row == undefined)
631
+            row = session.selection.lead
632
+        if (typeof row == "object") {
633
+            column = row.column;
634
+            row = row.row;
635
+        }
636
+
637
+        var startToken = session.getTokenAt(row, column);
638
+        var KW_START = "keyword.start", KW_END = "keyword.end";
639
+        var tok;
640
+        if (!startToken)
641
+            return;
642
+        if (startToken.type == KW_START) {
643
+            var it = new TokenIterator(session, row, column);
644
+            it.step = it.stepForward;
645
+        } else if (startToken.type == KW_END) {
646
+            var it = new TokenIterator(session, row, column);
647
+            it.step = it.stepBackward;
648
+        } else
649
+            return;
650
+
651
+        while (tok = it.step()) {
652
+            if (tok.type == KW_START || tok.type == KW_END)
653
+                break;
654
+        }
655
+        if (!tok || tok.type == startToken.type)
656
+            return;
657
+
658
+        var col = it.getCurrentTokenColumn();
659
+        var row = it.getCurrentTokenRow();
660
+        return new Range(row, col, row, col + tok.value.length);
661
+    };
662
+    this.$id = "ace/mode/logiql";
663
+}).call(Mode.prototype);
664
+
665
+exports.Mode = Mode;
666
+});

+ 693
- 0
generator/lib/ace/mode-lsl.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 426
- 0
generator/lib/ace/mode-lua.js Parādīt failu

@@ -0,0 +1,426 @@
1
+ace.define("ace/mode/lua_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 LuaHighlightRules = function() {
8
+
9
+    var keywords = (
10
+        "break|do|else|elseif|end|for|function|if|in|local|repeat|"+
11
+         "return|then|until|while|or|and|not"
12
+    );
13
+
14
+    var builtinConstants = ("true|false|nil|_G|_VERSION");
15
+
16
+    var functions = (
17
+        "string|xpcall|package|tostring|print|os|unpack|require|"+
18
+        "getfenv|setmetatable|next|assert|tonumber|io|rawequal|"+
19
+        "collectgarbage|getmetatable|module|rawset|math|debug|"+
20
+        "pcall|table|newproxy|type|coroutine|_G|select|gcinfo|"+
21
+        "pairs|rawget|loadstring|ipairs|_VERSION|dofile|setfenv|"+
22
+        "load|error|loadfile|"+
23
+
24
+        "sub|upper|len|gfind|rep|find|match|char|dump|gmatch|"+
25
+        "reverse|byte|format|gsub|lower|preload|loadlib|loaded|"+
26
+        "loaders|cpath|config|path|seeall|exit|setlocale|date|"+
27
+        "getenv|difftime|remove|time|clock|tmpname|rename|execute|"+
28
+        "lines|write|close|flush|open|output|type|read|stderr|"+
29
+        "stdin|input|stdout|popen|tmpfile|log|max|acos|huge|"+
30
+        "ldexp|pi|cos|tanh|pow|deg|tan|cosh|sinh|random|randomseed|"+
31
+        "frexp|ceil|floor|rad|abs|sqrt|modf|asin|min|mod|fmod|log10|"+
32
+        "atan2|exp|sin|atan|getupvalue|debug|sethook|getmetatable|"+
33
+        "gethook|setmetatable|setlocal|traceback|setfenv|getinfo|"+
34
+        "setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|"+
35
+        "foreachi|maxn|foreach|concat|sort|remove|resume|yield|"+
36
+        "status|wrap|create|running|"+
37
+        "__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+
38
+         "__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber"
39
+    );
40
+
41
+    var stdLibaries = ("string|package|os|io|math|debug|table|coroutine");
42
+
43
+    var futureReserved = "";
44
+
45
+    var deprecatedIn5152 = ("setn|foreach|foreachi|gcinfo|log10|maxn");
46
+
47
+    var keywordMapper = this.createKeywordMapper({
48
+        "keyword": keywords,
49
+        "support.function": functions,
50
+        "invalid.deprecated": deprecatedIn5152,
51
+        "constant.library": stdLibaries,
52
+        "constant.language": builtinConstants,
53
+        "invalid.illegal": futureReserved,
54
+        "variable.language": "self"
55
+    }, "identifier");
56
+
57
+    var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
58
+    var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
59
+    var integer = "(?:" + decimalInteger + "|" + hexInteger + ")";
60
+
61
+    var fraction = "(?:\\.\\d+)";
62
+    var intPart = "(?:\\d+)";
63
+    var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
64
+    var floatNumber = "(?:" + pointFloat + ")";
65
+
66
+    this.$rules = {
67
+        "start" : [{
68
+            stateName: "bracketedComment",
69
+            onMatch : function(value, currentState, stack){
70
+                stack.unshift(this.next, value.length - 2, currentState);
71
+                return "comment";
72
+            },
73
+            regex : /\-\-\[=*\[/,
74
+            next  : [
75
+                {
76
+                    onMatch : function(value, currentState, stack) {
77
+                        if (value.length == stack[1]) {
78
+                            stack.shift();
79
+                            stack.shift();
80
+                            this.next = stack.shift();
81
+                        } else {
82
+                            this.next = "";
83
+                        }
84
+                        return "comment";
85
+                    },
86
+                    regex : /\]=*\]/,
87
+                    next  : "start"
88
+                }, {
89
+                    defaultToken : "comment"
90
+                }
91
+            ]
92
+        },
93
+
94
+        {
95
+            token : "comment",
96
+            regex : "\\-\\-.*$"
97
+        },
98
+        {
99
+            stateName: "bracketedString",
100
+            onMatch : function(value, currentState, stack){
101
+                stack.unshift(this.next, value.length, currentState);
102
+                return "comment";
103
+            },
104
+            regex : /\[=*\[/,
105
+            next  : [
106
+                {
107
+                    onMatch : function(value, currentState, stack) {
108
+                        if (value.length == stack[1]) {
109
+                            stack.shift();
110
+                            stack.shift();
111
+                            this.next = stack.shift();
112
+                        } else {
113
+                            this.next = "";
114
+                        }
115
+                        return "comment";
116
+                    },
117
+                    
118
+                    regex : /\]=*\]/,
119
+                    next  : "start"
120
+                }, {
121
+                    defaultToken : "comment"
122
+                }
123
+            ]
124
+        },
125
+        {
126
+            token : "string",           // " string
127
+            regex : '"(?:[^\\\\]|\\\\.)*?"'
128
+        }, {
129
+            token : "string",           // ' string
130
+            regex : "'(?:[^\\\\]|\\\\.)*?'"
131
+        }, {
132
+            token : "constant.numeric", // float
133
+            regex : floatNumber
134
+        }, {
135
+            token : "constant.numeric", // integer
136
+            regex : integer + "\\b"
137
+        }, {
138
+            token : keywordMapper,
139
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
140
+        }, {
141
+            token : "keyword.operator",
142
+            regex : "\\+|\\-|\\*|\\/|%|\\#|\\^|~|<|>|<=|=>|==|~=|=|\\:|\\.\\.\\.|\\.\\."
143
+        }, {
144
+            token : "paren.lparen",
145
+            regex : "[\\[\\(\\{]"
146
+        }, {
147
+            token : "paren.rparen",
148
+            regex : "[\\]\\)\\}]"
149
+        }, {
150
+            token : "text",
151
+            regex : "\\s+|\\w+"
152
+        } ]
153
+    };
154
+    
155
+    this.normalizeRules();
156
+}
157
+
158
+oop.inherits(LuaHighlightRules, TextHighlightRules);
159
+
160
+exports.LuaHighlightRules = LuaHighlightRules;
161
+});
162
+
163
+ace.define("ace/mode/folding/lua",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range","ace/token_iterator"], function(require, exports, module) {
164
+"use strict";
165
+
166
+var oop = require("../../lib/oop");
167
+var BaseFoldMode = require("./fold_mode").FoldMode;
168
+var Range = require("../../range").Range;
169
+var TokenIterator = require("../../token_iterator").TokenIterator;
170
+
171
+
172
+var FoldMode = exports.FoldMode = function() {};
173
+
174
+oop.inherits(FoldMode, BaseFoldMode);
175
+
176
+(function() {
177
+
178
+    this.foldingStartMarker = /\b(function|then|do|repeat)\b|{\s*$|(\[=*\[)/;
179
+    this.foldingStopMarker = /\bend\b|^\s*}|\]=*\]/;
180
+
181
+    this.getFoldWidget = function(session, foldStyle, row) {
182
+        var line = session.getLine(row);
183
+        var isStart = this.foldingStartMarker.test(line);
184
+        var isEnd = this.foldingStopMarker.test(line);
185
+
186
+        if (isStart && !isEnd) {
187
+            var match = line.match(this.foldingStartMarker);
188
+            if (match[1] == "then" && /\belseif\b/.test(line))
189
+                return;
190
+            if (match[1]) {
191
+                if (session.getTokenAt(row, match.index + 1).type === "keyword")
192
+                    return "start";
193
+            } else if (match[2]) {
194
+                var type = session.bgTokenizer.getState(row) || "";
195
+                if (type[0] == "bracketedComment" || type[0] == "bracketedString")
196
+                    return "start";
197
+            } else {
198
+                return "start";
199
+            }
200
+        }
201
+        if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd)
202
+            return "";
203
+
204
+        var match = line.match(this.foldingStopMarker);
205
+        if (match[0] === "end") {
206
+            if (session.getTokenAt(row, match.index + 1).type === "keyword")
207
+                return "end";
208
+        } else if (match[0][0] === "]") {
209
+            var type = session.bgTokenizer.getState(row - 1) || "";
210
+            if (type[0] == "bracketedComment" || type[0] == "bracketedString")
211
+                return "end";
212
+        } else
213
+            return "end";
214
+    };
215
+
216
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
217
+        var line = session.doc.getLine(row);
218
+        var match = this.foldingStartMarker.exec(line);
219
+        if (match) {
220
+            if (match[1])
221
+                return this.luaBlock(session, row, match.index + 1);
222
+
223
+            if (match[2])
224
+                return session.getCommentFoldRange(row, match.index + 1);
225
+
226
+            return this.openingBracketBlock(session, "{", row, match.index);
227
+        }
228
+
229
+        var match = this.foldingStopMarker.exec(line);
230
+        if (match) {
231
+            if (match[0] === "end") {
232
+                if (session.getTokenAt(row, match.index + 1).type === "keyword")
233
+                    return this.luaBlock(session, row, match.index + 1);
234
+            }
235
+
236
+            if (match[0][0] === "]")
237
+                return session.getCommentFoldRange(row, match.index + 1);
238
+
239
+            return this.closingBracketBlock(session, "}", row, match.index + match[0].length);
240
+        }
241
+    };
242
+
243
+    this.luaBlock = function(session, row, column) {
244
+        var stream = new TokenIterator(session, row, column);
245
+        var indentKeywords = {
246
+            "function": 1,
247
+            "do": 1,
248
+            "then": 1,
249
+            "elseif": -1,
250
+            "end": -1,
251
+            "repeat": 1,
252
+            "until": -1
253
+        };
254
+
255
+        var token = stream.getCurrentToken();
256
+        if (!token || token.type != "keyword")
257
+            return;
258
+
259
+        var val = token.value;
260
+        var stack = [val];
261
+        var dir = indentKeywords[val];
262
+
263
+        if (!dir)
264
+            return;
265
+
266
+        var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length;
267
+        var startRow = row;
268
+
269
+        stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
270
+        while(token = stream.step()) {
271
+            if (token.type !== "keyword")
272
+                continue;
273
+            var level = dir * indentKeywords[token.value];
274
+
275
+            if (level > 0) {
276
+                stack.unshift(token.value);
277
+            } else if (level <= 0) {
278
+                stack.shift();
279
+                if (!stack.length && token.value != "elseif")
280
+                    break;
281
+                if (level === 0)
282
+                    stack.unshift(token.value);
283
+            }
284
+        }
285
+
286
+        var row = stream.getCurrentTokenRow();
287
+        if (dir === -1)
288
+            return new Range(row, session.getLine(row).length, startRow, startColumn);
289
+        else
290
+            return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn());
291
+    };
292
+
293
+}).call(FoldMode.prototype);
294
+
295
+});
296
+
297
+ace.define("ace/mode/lua",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/lua_highlight_rules","ace/mode/folding/lua","ace/range","ace/worker/worker_client"], function(require, exports, module) {
298
+"use strict";
299
+
300
+var oop = require("../lib/oop");
301
+var TextMode = require("./text").Mode;
302
+var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
303
+var LuaFoldMode = require("./folding/lua").FoldMode;
304
+var Range = require("../range").Range;
305
+var WorkerClient = require("../worker/worker_client").WorkerClient;
306
+
307
+var Mode = function() {
308
+    this.HighlightRules = LuaHighlightRules;
309
+    
310
+    this.foldingRules = new LuaFoldMode();
311
+};
312
+oop.inherits(Mode, TextMode);
313
+
314
+(function() {
315
+   
316
+    this.lineCommentStart = "--";
317
+    this.blockComment = {start: "--[", end: "]--"};
318
+    
319
+    var indentKeywords = {
320
+        "function": 1,
321
+        "then": 1,
322
+        "do": 1,
323
+        "else": 1,
324
+        "elseif": 1,
325
+        "repeat": 1,
326
+        "end": -1,
327
+        "until": -1
328
+    };
329
+    var outdentKeywords = [
330
+        "else",
331
+        "elseif",
332
+        "end",
333
+        "until"
334
+    ];
335
+
336
+    function getNetIndentLevel(tokens) {
337
+        var level = 0;
338
+        for (var i = 0; i < tokens.length; i++) {
339
+            var token = tokens[i];
340
+            if (token.type == "keyword") {
341
+                if (token.value in indentKeywords) {
342
+                    level += indentKeywords[token.value];
343
+                }
344
+            } else if (token.type == "paren.lparen") {
345
+                level ++;
346
+            } else if (token.type == "paren.rparen") {
347
+                level --;
348
+            }
349
+        }
350
+        if (level < 0) {
351
+            return -1;
352
+        } else if (level > 0) {
353
+            return 1;
354
+        } else {
355
+            return 0;
356
+        }
357
+    }
358
+
359
+    this.getNextLineIndent = function(state, line, tab) {
360
+        var indent = this.$getIndent(line);
361
+        var level = 0;
362
+
363
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
364
+        var tokens = tokenizedLine.tokens;
365
+
366
+        if (state == "start") {
367
+            level = getNetIndentLevel(tokens);
368
+        }
369
+        if (level > 0) {
370
+            return indent + tab;
371
+        } else if (level < 0 && indent.substr(indent.length - tab.length) == tab) {
372
+            if (!this.checkOutdent(state, line, "\n")) {
373
+                return indent.substr(0, indent.length - tab.length);
374
+            }
375
+        }
376
+        return indent;
377
+    };
378
+
379
+    this.checkOutdent = function(state, line, input) {
380
+        if (input != "\n" && input != "\r" && input != "\r\n")
381
+            return false;
382
+
383
+        if (line.match(/^\s*[\)\}\]]$/))
384
+            return true;
385
+
386
+        var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
387
+
388
+        if (!tokens || !tokens.length)
389
+            return false;
390
+
391
+        return (tokens[0].type == "keyword" && outdentKeywords.indexOf(tokens[0].value) != -1);
392
+    };
393
+
394
+    this.autoOutdent = function(state, session, row) {
395
+        var prevLine = session.getLine(row - 1);
396
+        var prevIndent = this.$getIndent(prevLine).length;
397
+        var prevTokens = this.getTokenizer().getLineTokens(prevLine, "start").tokens;
398
+        var tabLength = session.getTabString().length;
399
+        var expectedIndent = prevIndent + tabLength * getNetIndentLevel(prevTokens);
400
+        var curIndent = this.$getIndent(session.getLine(row)).length;
401
+        if (curIndent < expectedIndent) {
402
+            return;
403
+        }
404
+        session.outdentRows(new Range(row, 0, row + 2, 0));
405
+    };
406
+
407
+    this.createWorker = function(session) {
408
+        var worker = new WorkerClient(["ace"], "ace/mode/lua_worker", "Worker");
409
+        worker.attachToDocument(session.getDocument());
410
+        
411
+        worker.on("error", function(e) {
412
+            session.setAnnotations([e.data]);
413
+        });
414
+        
415
+        worker.on("ok", function(e) {
416
+            session.clearAnnotations();
417
+        });
418
+        
419
+        return worker;
420
+    };
421
+
422
+    this.$id = "ace/mode/lua";
423
+}).call(Mode.prototype);
424
+
425
+exports.Mode = Mode;
426
+});

+ 2927
- 0
generator/lib/ace/mode-luapage.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 69
- 0
generator/lib/ace/mode-lucene.js Parādīt failu

@@ -0,0 +1,69 @@
1
+ace.define("ace/mode/lucene_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
+
8
+var LuceneHighlightRules = function() {
9
+    this.$rules = {
10
+        "start" : [
11
+            {
12
+                token : "constant.character.negation",
13
+                regex : "[\\-]"
14
+            }, {
15
+                token : "constant.character.interro",
16
+                regex : "[\\?]"
17
+            }, {
18
+                token : "constant.character.asterisk",
19
+                regex : "[\\*]"
20
+            }, {
21
+                token: 'constant.character.proximity',
22
+                regex: '~[0-9]+\\b'
23
+            }, {
24
+                token : 'keyword.operator',
25
+                regex: '(?:AND|OR|NOT)\\b'
26
+            }, {
27
+                token : "paren.lparen",
28
+                regex : "[\\(]"
29
+            }, {
30
+                token : "paren.rparen",
31
+                regex : "[\\)]"
32
+            }, {
33
+                token : "keyword",
34
+                regex : "[\\S]+:"
35
+            }, {
36
+                token : "string",           // " string
37
+                regex : '".*?"'
38
+            }, {
39
+                token : "text",
40
+                regex : "\\s+"
41
+            }
42
+        ]
43
+    };
44
+};
45
+
46
+oop.inherits(LuceneHighlightRules, TextHighlightRules);
47
+
48
+exports.LuceneHighlightRules = LuceneHighlightRules;
49
+});
50
+
51
+ace.define("ace/mode/lucene",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/lucene_highlight_rules"], function(require, exports, module) {
52
+'use strict';
53
+
54
+var oop = require("../lib/oop");
55
+var TextMode = require("./text").Mode;
56
+var LuceneHighlightRules = require("./lucene_highlight_rules").LuceneHighlightRules;
57
+
58
+var Mode = function() {
59
+    this.HighlightRules = LuceneHighlightRules;
60
+};
61
+
62
+oop.inherits(Mode, TextMode);
63
+
64
+(function() {
65
+    this.$id = "ace/mode/lucene";
66
+}).call(Mode.prototype);
67
+
68
+exports.Mode = Mode;
69
+});

+ 357
- 0
generator/lib/ace/mode-makefile.js Parādīt failu

@@ -0,0 +1,357 @@
1
+ace.define("ace/mode/sh_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 reservedKeywords = exports.reservedKeywords = (
8
+        '!|{|}|case|do|done|elif|else|'+
9
+        'esac|fi|for|if|in|then|until|while|'+
10
+        '&|;|export|local|read|typeset|unset|'+
11
+        'elif|select|set'
12
+    );
13
+
14
+var languageConstructs = exports.languageConstructs = (
15
+    '[|]|alias|bg|bind|break|builtin|'+
16
+     'cd|command|compgen|complete|continue|'+
17
+     'dirs|disown|echo|enable|eval|exec|'+
18
+     'exit|fc|fg|getopts|hash|help|history|'+
19
+     'jobs|kill|let|logout|popd|printf|pushd|'+
20
+     'pwd|return|set|shift|shopt|source|'+
21
+     'suspend|test|times|trap|type|ulimit|'+
22
+     'umask|unalias|wait'
23
+);
24
+
25
+var ShHighlightRules = function() {
26
+    var keywordMapper = this.createKeywordMapper({
27
+        "keyword": reservedKeywords,
28
+        "support.function.builtin": languageConstructs,
29
+        "invalid.deprecated": "debugger"
30
+    }, "identifier");
31
+
32
+    var integer = "(?:(?:[1-9]\\d*)|(?:0))";
33
+
34
+    var fraction = "(?:\\.\\d+)";
35
+    var intPart = "(?:\\d+)";
36
+    var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
37
+    var exponentFloat = "(?:(?:" + pointFloat + "|" +  intPart + ")" + ")";
38
+    var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
39
+    var fileDescriptor = "(?:&" + intPart + ")";
40
+
41
+    var variableName = "[a-zA-Z_][a-zA-Z0-9_]*";
42
+    var variable = "(?:(?:\\$" + variableName + ")|(?:" + variableName + "=))";
43
+
44
+    var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
45
+
46
+    var func = "(?:" + variableName + "\\s*\\(\\))";
47
+
48
+    this.$rules = {
49
+        "start" : [{
50
+            token : "constant",
51
+            regex : /\\./
52
+        }, {
53
+            token : ["text", "comment"],
54
+            regex : /(^|\s)(#.*)$/
55
+        }, {
56
+            token : "string",
57
+            regex : '"',
58
+            push : [{
59
+                token : "constant.language.escape",
60
+                regex : /\\(?:[$abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/
61
+            }, {
62
+                token : "constant",
63
+                regex : /\$\w+/
64
+            }, {
65
+                token : "string",
66
+                regex : '"',
67
+                next: "pop"
68
+            }, {
69
+                defaultToken: "string"
70
+            }]
71
+        }, {
72
+            regex : "<<<",
73
+            token : "keyword.operator"
74
+        }, {
75
+            stateName: "heredoc",
76
+            regex : "(<<)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
77
+            onMatch : function(value, currentState, stack) {
78
+                var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
79
+                var tokens = value.split(this.splitRegex);
80
+                stack.push(next, tokens[4]);
81
+                return [
82
+                    {type:"constant", value: tokens[1]},
83
+                    {type:"text", value: tokens[2]},
84
+                    {type:"string", value: tokens[3]},
85
+                    {type:"support.class", value: tokens[4]},
86
+                    {type:"string", value: tokens[5]}
87
+                ];
88
+            },
89
+            rules: {
90
+                heredoc: [{
91
+                    onMatch:  function(value, currentState, stack) {
92
+                        if (value === stack[1]) {
93
+                            stack.shift();
94
+                            stack.shift();
95
+                            this.next = stack[0] || "start";
96
+                            return "support.class";
97
+                        }
98
+                        this.next = "";
99
+                        return "string";
100
+                    },
101
+                    regex: ".*$",
102
+                    next: "start"
103
+                }],
104
+                indentedHeredoc: [{
105
+                    token: "string",
106
+                    regex: "^\t+"
107
+                }, {
108
+                    onMatch:  function(value, currentState, stack) {
109
+                        if (value === stack[1]) {
110
+                            stack.shift();
111
+                            stack.shift();
112
+                            this.next = stack[0] || "start";
113
+                            return "support.class";
114
+                        }
115
+                        this.next = "";
116
+                        return "string";
117
+                    },
118
+                    regex: ".*$",
119
+                    next: "start"
120
+                }]
121
+            }
122
+        }, {
123
+            regex : "$",
124
+            token : "empty",
125
+            next : function(currentState, stack) {
126
+                if (stack[0] === "heredoc" || stack[0] === "indentedHeredoc")
127
+                    return stack[0];
128
+                return currentState;
129
+            }
130
+        }, {
131
+            token : "variable.language",
132
+            regex : builtinVariable
133
+        }, {
134
+            token : "variable",
135
+            regex : variable
136
+        }, {
137
+            token : "support.function",
138
+            regex : func
139
+        }, {
140
+            token : "support.function",
141
+            regex : fileDescriptor
142
+        }, {
143
+            token : "string",           // ' string
144
+            start : "'", end : "'"
145
+        }, {
146
+            token : "constant.numeric", // float
147
+            regex : floatNumber
148
+        }, {
149
+            token : "constant.numeric", // integer
150
+            regex : integer + "\\b"
151
+        }, {
152
+            token : keywordMapper,
153
+            regex : "[a-zA-Z_][a-zA-Z0-9_]*\\b"
154
+        }, {
155
+            token : "keyword.operator",
156
+            regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!="
157
+        }, {
158
+            token : "paren.lparen",
159
+            regex : "[\\[\\(\\{]"
160
+        }, {
161
+            token : "paren.rparen",
162
+            regex : "[\\]\\)\\}]"
163
+        } ]
164
+    };
165
+    
166
+    this.normalizeRules();
167
+};
168
+
169
+oop.inherits(ShHighlightRules, TextHighlightRules);
170
+
171
+exports.ShHighlightRules = ShHighlightRules;
172
+});
173
+
174
+ace.define("ace/mode/makefile_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules","ace/mode/sh_highlight_rules"], function(require, exports, module) {
175
+"use strict";
176
+
177
+var oop = require("../lib/oop");
178
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
179
+
180
+var ShHighlightFile = require("./sh_highlight_rules");
181
+
182
+var MakefileHighlightRules = function() {
183
+
184
+    var keywordMapper = this.createKeywordMapper({
185
+        "keyword": ShHighlightFile.reservedKeywords,
186
+        "support.function.builtin": ShHighlightFile.languageConstructs,
187
+        "invalid.deprecated": "debugger"
188
+    }, "string");
189
+
190
+    this.$rules = 
191
+        {
192
+    "start": [
193
+        {
194
+            token: "string.interpolated.backtick.makefile",
195
+            regex: "`",
196
+            next: "shell-start"
197
+        },
198
+        {
199
+            token: "punctuation.definition.comment.makefile",
200
+            regex: /#(?=.)/,
201
+            next: "comment"
202
+        },
203
+        {
204
+            token: [ "keyword.control.makefile"],
205
+            regex: "^(?:\\s*\\b)(\\-??include|ifeq|ifneq|ifdef|ifndef|else|endif|vpath|export|unexport|define|endef|override)(?:\\b)"
206
+        },
207
+        {// ^([^\t ]+(\s[^\t ]+)*:(?!\=))\s*.*
208
+            token: ["entity.name.function.makefile", "text"],
209
+            regex: "^([^\\t ]+(?:\\s[^\\t ]+)*:)(\\s*.*)"
210
+        }
211
+    ],
212
+    "comment": [
213
+        {
214
+            token : "punctuation.definition.comment.makefile",
215
+            regex : /.+\\/
216
+        },
217
+        {
218
+            token : "punctuation.definition.comment.makefile",
219
+            regex : ".+",
220
+            next  : "start"
221
+        }
222
+    ],
223
+    "shell-start": [
224
+        {
225
+            token: keywordMapper,
226
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
227
+        }, 
228
+        {
229
+            token: "string",
230
+            regex : "\\w+"
231
+        }, 
232
+        {
233
+            token : "string.interpolated.backtick.makefile",
234
+            regex : "`",
235
+            next  : "start"
236
+        }
237
+    ]
238
+}
239
+
240
+};
241
+
242
+oop.inherits(MakefileHighlightRules, TextHighlightRules);
243
+
244
+exports.MakefileHighlightRules = MakefileHighlightRules;
245
+});
246
+
247
+ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
248
+"use strict";
249
+
250
+var oop = require("../../lib/oop");
251
+var BaseFoldMode = require("./fold_mode").FoldMode;
252
+var Range = require("../../range").Range;
253
+
254
+var FoldMode = exports.FoldMode = function() {};
255
+oop.inherits(FoldMode, BaseFoldMode);
256
+
257
+(function() {
258
+
259
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
260
+        var range = this.indentationBlock(session, row);
261
+        if (range)
262
+            return range;
263
+
264
+        var re = /\S/;
265
+        var line = session.getLine(row);
266
+        var startLevel = line.search(re);
267
+        if (startLevel == -1 || line[startLevel] != "#")
268
+            return;
269
+
270
+        var startColumn = line.length;
271
+        var maxRow = session.getLength();
272
+        var startRow = row;
273
+        var endRow = row;
274
+
275
+        while (++row < maxRow) {
276
+            line = session.getLine(row);
277
+            var level = line.search(re);
278
+
279
+            if (level == -1)
280
+                continue;
281
+
282
+            if (line[level] != "#")
283
+                break;
284
+
285
+            endRow = row;
286
+        }
287
+
288
+        if (endRow > startRow) {
289
+            var endColumn = session.getLine(endRow).length;
290
+            return new Range(startRow, startColumn, endRow, endColumn);
291
+        }
292
+    };
293
+    this.getFoldWidget = function(session, foldStyle, row) {
294
+        var line = session.getLine(row);
295
+        var indent = line.search(/\S/);
296
+        var next = session.getLine(row + 1);
297
+        var prev = session.getLine(row - 1);
298
+        var prevIndent = prev.search(/\S/);
299
+        var nextIndent = next.search(/\S/);
300
+
301
+        if (indent == -1) {
302
+            session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
303
+            return "";
304
+        }
305
+        if (prevIndent == -1) {
306
+            if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
307
+                session.foldWidgets[row - 1] = "";
308
+                session.foldWidgets[row + 1] = "";
309
+                return "start";
310
+            }
311
+        } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
312
+            if (session.getLine(row - 2).search(/\S/) == -1) {
313
+                session.foldWidgets[row - 1] = "start";
314
+                session.foldWidgets[row + 1] = "";
315
+                return "";
316
+            }
317
+        }
318
+
319
+        if (prevIndent!= -1 && prevIndent < indent)
320
+            session.foldWidgets[row - 1] = "start";
321
+        else
322
+            session.foldWidgets[row - 1] = "";
323
+
324
+        if (indent < nextIndent)
325
+            return "start";
326
+        else
327
+            return "";
328
+    };
329
+
330
+}).call(FoldMode.prototype);
331
+
332
+});
333
+
334
+ace.define("ace/mode/makefile",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/makefile_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module) {
335
+"use strict";
336
+
337
+var oop = require("../lib/oop");
338
+var TextMode = require("./text").Mode;
339
+var MakefileHighlightRules = require("./makefile_highlight_rules").MakefileHighlightRules;
340
+var FoldMode = require("./folding/coffee").FoldMode;
341
+
342
+var Mode = function() {
343
+    this.HighlightRules = MakefileHighlightRules;
344
+    this.foldingRules = new FoldMode();
345
+};
346
+oop.inherits(Mode, TextMode);
347
+
348
+(function() {
349
+       
350
+    this.lineCommentStart = "#";    
351
+    this.$indentWithTabs = true;
352
+    
353
+    this.$id = "ace/mode/makefile";
354
+}).call(Mode.prototype);
355
+
356
+exports.Mode = Mode;
357
+});

+ 2795
- 0
generator/lib/ace/mode-markdown.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 1981
- 0
generator/lib/ace/mode-mask.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 256
- 0
generator/lib/ace/mode-matlab.js Parādīt failu

@@ -0,0 +1,256 @@
1
+ace.define("ace/mode/matlab_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 MatlabHighlightRules = function() {
8
+
9
+var keywords = (
10
+        "break|case|catch|classdef|continue|else|elseif|end|for|function|global|if|otherwise|parfor|persistent|return|spmd|switch|try|while"
11
+    );
12
+
13
+    var builtinConstants = (
14
+        "true|false|inf|Inf|nan|NaN|eps|pi|ans|nargin|nargout|varargin|varargout"
15
+    );
16
+
17
+    var builtinFunctions = (
18
+        "abs|accumarray|acos(?:d|h)?|acot(?:d|h)?|acsc(?:d|h)?|actxcontrol(?:list|select)?|actxGetRunningServer|actxserver|addlistener|addpath|addpref|addtodate|"+
19
+		"airy|align|alim|all|allchild|alpha|alphamap|amd|ancestor|and|angle|annotation|any|area|arrayfun|asec(?:d|h)?|asin(?:d|h)?|assert|assignin|atan(?:2|d|h)?|" +
20
+		"audiodevinfo|audioplayer|audiorecorder|aufinfo|auread|autumn|auwrite|avifile|aviinfo|aviread|axes|axis|balance|bar(?:3|3h|h)?|base2dec|beep|BeginInvoke|bench|"+
21
+		"bessel(?:h|i|j|k|y)|beta|betainc|betaincinv|betaln|bicg|bicgstab|bicgstabl|bin2dec|bitand|bitcmp|bitget|bitmax|bitnot|bitor|bitset|bitshift|bitxor|blanks|blkdiag|"+
22
+		"bone|box|brighten|brush|bsxfun|builddocsearchdb|builtin|bvp4c|bvp5c|bvpget|bvpinit|bvpset|bvpxtend|calendar|calllib|callSoapService|camdolly|cameratoolbar|camlight|"+
23
+		"camlookat|camorbit|campan|campos|camproj|camroll|camtarget|camup|camva|camzoom|cart2pol|cart2sph|cast|cat|caxis|cd|cdf2rdf|cdfepoch|cdfinfo|cdflib(?:\.(?:close|closeVar|"+
24
+		"computeEpoch|computeEpoch16|create|createAttr|createVar|delete|deleteAttr|deleteAttrEntry|deleteAttrgEntry|deleteVar|deleteVarRecords|epoch16Breakdown|epochBreakdown|getAttrEntry|"+
25
+		"getAttrgEntry|getAttrMaxEntry|getAttrMaxgEntry|getAttrName|getAttrNum|getAttrScope|getCacheSize|getChecksum|getCompression|getCompressionCacheSize|getConstantNames|"+
26
+		"getConstantValue|getCopyright|getFileBackward|getFormat|getLibraryCopyright|getLibraryVersion|getMajority|getName|getNumAttrEntries|getNumAttrgEntries|getNumAttributes|"+
27
+		"getNumgAttributes|getReadOnlyMode|getStageCacheSize|getValidate|getVarAllocRecords|getVarBlockingFactor|getVarCacheSize|getVarCompression|getVarData|getVarMaxAllocRecNum|"+
28
+		"getVarMaxWrittenRecNum|getVarName|getVarNum|getVarNumRecsWritten|getVarPadValue|getVarRecordData|getVarReservePercent|getVarsMaxWrittenRecNum|getVarSparseRecords|getVersion|"+
29
+		"hyperGetVarData|hyperPutVarData|inquire|inquireAttr|inquireAttrEntry|inquireAttrgEntry|inquireVar|open|putAttrEntry|putAttrgEntry|putVarData|putVarRecordData|renameAttr|"+
30
+		"renameVar|setCacheSize|setChecksum|setCompression|setCompressionCacheSize|setFileBackward|setFormat|setMajority|setReadOnlyMode|setStageCacheSize|setValidate|"+
31
+		"setVarAllocBlockRecords|setVarBlockingFactor|setVarCacheSize|setVarCompression|setVarInitialRecs|setVarPadValue|SetVarReservePercent|setVarsCacheSize|setVarSparseRecords))?|"+
32
+		"cdfread|cdfwrite|ceil|cell2mat|cell2struct|celldisp|cellfun|cellplot|cellstr|cgs|checkcode|checkin|checkout|chol|cholinc|cholupdate|circshift|cla|clabel|class|clc|clear|"+
33
+		"clearvars|clf|clipboard|clock|close|closereq|cmopts|cmpermute|cmunique|colamd|colon|colorbar|colordef|colormap|colormapeditor|colperm|Combine|comet|comet3|commandhistory|"+
34
+		"commandwindow|compan|compass|complex|computer|cond|condeig|condest|coneplot|conj|containers\.Map|contour(?:3|c|f|slice)?|contrast|conv|conv2|convhull|convhulln|convn|cool|"+
35
+		"copper|copyfile|copyobj|corrcoef|cos(?:d|h)?|cot(?:d|h)?|cov|cplxpair|cputime|createClassFromWsdl|createSoapMessage|cross|csc(?:d|h)?|csvread|csvwrite|ctranspose|cumprod|"+
36
+		"cumsum|cumtrapz|curl|customverctrl|cylinder|daqread|daspect|datacursormode|datatipinfo|date|datenum|datestr|datetick|datevec|dbclear|dbcont|dbdown|dblquad|dbmex|dbquit|"+
37
+		"dbstack|dbstatus|dbstep|dbstop|dbtype|dbup|dde23|ddeget|ddesd|ddeset|deal|deblank|dec2base|dec2bin|dec2hex|decic|deconv|del2|delaunay|delaunay3|delaunayn|DelaunayTri|delete|"+
38
+		"demo|depdir|depfun|det|detrend|deval|diag|dialog|diary|diff|diffuse|dir|disp|display|dither|divergence|dlmread|dlmwrite|dmperm|doc|docsearch|dos|dot|dragrect|drawnow|dsearch|"+
39
+		"dsearchn|dynamicprops|echo|echodemo|edit|eig|eigs|ellipj|ellipke|ellipsoid|empty|enableNETfromNetworkDrive|enableservice|EndInvoke|enumeration|eomday|eq|erf|erfc|erfcinv|"+
40
+		"erfcx|erfinv|error|errorbar|errordlg|etime|etree|etreeplot|eval|evalc|evalin|event\.(?:EventData|listener|PropertyEvent|proplistener)|exifread|exist|exit|exp|expint|expm|"+
41
+		"expm1|export2wsdlg|eye|ezcontour|ezcontourf|ezmesh|ezmeshc|ezplot|ezplot3|ezpolar|ezsurf|ezsurfc|factor|factorial|fclose|feather|feature|feof|ferror|feval|fft|fft2|fftn|"+
42
+		"fftshift|fftw|fgetl|fgets|fieldnames|figure|figurepalette|fileattrib|filebrowser|filemarker|fileparts|fileread|filesep|fill|fill3|filter|filter2|find|findall|findfigs|"+
43
+		"findobj|findstr|finish|fitsdisp|fitsinfo|fitsread|fitswrite|fix|flag|flipdim|fliplr|flipud|floor|flow|fminbnd|fminsearch|fopen|format|fplot|fprintf|frame2im|fread|freqspace|"+
44
+		"frewind|fscanf|fseek|ftell|FTP|full|fullfile|func2str|functions|funm|fwrite|fzero|gallery|gamma|gammainc|gammaincinv|gammaln|gca|gcbf|gcbo|gcd|gcf|gco|ge|genpath|genvarname|"+
45
+		"get|getappdata|getenv|getfield|getframe|getpixelposition|getpref|ginput|gmres|gplot|grabcode|gradient|gray|graymon|grid|griddata(?:3|n)?|griddedInterpolant|gsvd|gt|gtext|"+
46
+		"guidata|guide|guihandles|gunzip|gzip|h5create|h5disp|h5info|h5read|h5readatt|h5write|h5writeatt|hadamard|handle|hankel|hdf|hdf5|hdf5info|hdf5read|hdf5write|hdfinfo|"+
47
+		"hdfread|hdftool|help|helpbrowser|helpdesk|helpdlg|helpwin|hess|hex2dec|hex2num|hgexport|hggroup|hgload|hgsave|hgsetget|hgtransform|hidden|hilb|hist|histc|hold|home|horzcat|"+
48
+		"hostid|hot|hsv|hsv2rgb|hypot|ichol|idivide|ifft|ifft2|ifftn|ifftshift|ilu|im2frame|im2java|imag|image|imagesc|imapprox|imfinfo|imformats|import|importdata|imread|imwrite|"+
49
+		"ind2rgb|ind2sub|inferiorto|info|inline|inmem|inpolygon|input|inputdlg|inputname|inputParser|inspect|instrcallback|instrfind|instrfindall|int2str|integral(?:2|3)?|interp(?:1|"+
50
+		"1q|2|3|ft|n)|interpstreamspeed|intersect|intmax|intmin|inv|invhilb|ipermute|isa|isappdata|iscell|iscellstr|ischar|iscolumn|isdir|isempty|isequal|isequaln|isequalwithequalnans|"+
51
+		"isfield|isfinite|isfloat|isglobal|ishandle|ishghandle|ishold|isinf|isinteger|isjava|iskeyword|isletter|islogical|ismac|ismatrix|ismember|ismethod|isnan|isnumeric|isobject|"+
52
+		"isocaps|isocolors|isonormals|isosurface|ispc|ispref|isprime|isprop|isreal|isrow|isscalar|issorted|isspace|issparse|isstr|isstrprop|isstruct|isstudent|isunix|isvarname|"+
53
+		"isvector|javaaddpath|javaArray|javachk|javaclasspath|javacomponent|javaMethod|javaMethodEDT|javaObject|javaObjectEDT|javarmpath|jet|keyboard|kron|lasterr|lasterror|"+
54
+		"lastwarn|lcm|ldivide|ldl|le|legend|legendre|length|libfunctions|libfunctionsview|libisloaded|libpointer|libstruct|license|light|lightangle|lighting|lin2mu|line|lines|"+
55
+		"linkaxes|linkdata|linkprop|linsolve|linspace|listdlg|listfonts|load|loadlibrary|loadobj|log|log10|log1p|log2|loglog|logm|logspace|lookfor|lower|ls|lscov|lsqnonneg|lsqr|"+
56
+		"lt|lu|luinc|magic|makehgtform|mat2cell|mat2str|material|matfile|matlab\.io\.MatFile|matlab\.mixin\.(?:Copyable|Heterogeneous(?:\.getDefaultScalarElement)?)|matlabrc|"+
57
+		"matlabroot|max|maxNumCompThreads|mean|median|membrane|memmapfile|memory|menu|mesh|meshc|meshgrid|meshz|meta\.(?:class(?:\.fromName)?|DynamicProperty|EnumeratedValue|event|"+
58
+		"MetaData|method|package(?:\.(?:fromName|getAllPackages))?|property)|metaclass|methods|methodsview|mex(?:\.getCompilerConfigurations)?|MException|mexext|mfilename|min|minres|"+
59
+		"minus|mislocked|mkdir|mkpp|mldivide|mlint|mlintrpt|mlock|mmfileinfo|mmreader|mod|mode|more|move|movefile|movegui|movie|movie2avi|mpower|mrdivide|msgbox|mtimes|mu2lin|"+
60
+		"multibandread|multibandwrite|munlock|namelengthmax|nargchk|narginchk|nargoutchk|native2unicode|nccreate|ncdisp|nchoosek|ncinfo|ncread|ncreadatt|ncwrite|ncwriteatt|"+
61
+		"ncwriteschema|ndgrid|ndims|ne|NET(?:\.(?:addAssembly|Assembly|convertArray|createArray|createGeneric|disableAutoRelease|enableAutoRelease|GenericClass|invokeGenericMethod|"+
62
+		"NetException|setStaticProperty))?|netcdf\.(?:abort|close|copyAtt|create|defDim|defGrp|defVar|defVarChunking|defVarDeflate|defVarFill|defVarFletcher32|delAtt|endDef|getAtt|"+
63
+		"getChunkCache|getConstant|getConstantNames|getVar|inq|inqAtt|inqAttID|inqAttName|inqDim|inqDimID|inqDimIDs|inqFormat|inqGrpName|inqGrpNameFull|inqGrpParent|inqGrps|"+
64
+		"inqLibVers|inqNcid|inqUnlimDims|inqVar|inqVarChunking|inqVarDeflate|inqVarFill|inqVarFletcher32|inqVarID|inqVarIDs|open|putAtt|putVar|reDef|renameAtt|renameDim|renameVar|"+
65
+		"setChunkCache|setDefaultFormat|setFill|sync)|newplot|nextpow2|nnz|noanimate|nonzeros|norm|normest|not|notebook|now|nthroot|null|num2cell|num2hex|num2str|numel|nzmax|"+
66
+		"ode(?:113|15i|15s|23|23s|23t|23tb|45)|odeget|odeset|odextend|onCleanup|ones|open|openfig|opengl|openvar|optimget|optimset|or|ordeig|orderfields|ordqz|ordschur|orient|"+
67
+		"orth|pack|padecoef|pagesetupdlg|pan|pareto|parseSoapResponse|pascal|patch|path|path2rc|pathsep|pathtool|pause|pbaspect|pcg|pchip|pcode|pcolor|pdepe|pdeval|peaks|perl|perms|"+
68
+		"permute|pie|pink|pinv|planerot|playshow|plot|plot3|plotbrowser|plotedit|plotmatrix|plottools|plotyy|plus|pol2cart|polar|poly|polyarea|polyder|polyeig|polyfit|polyint|polyval|"+
69
+		"polyvalm|pow2|power|ppval|prefdir|preferences|primes|print|printdlg|printopt|printpreview|prod|profile|profsave|propedit|propertyeditor|psi|publish|PutCharArray|PutFullMatrix|"+
70
+		"PutWorkspaceData|pwd|qhull|qmr|qr|qrdelete|qrinsert|qrupdate|quad|quad2d|quadgk|quadl|quadv|questdlg|quit|quiver|quiver3|qz|rand|randi|randn|randperm|RandStream(?:\.(?:create|"+
71
+		"getDefaultStream|getGlobalStream|list|setDefaultStream|setGlobalStream))?|rank|rat|rats|rbbox|rcond|rdivide|readasync|real|reallog|realmax|realmin|realpow|realsqrt|record|"+
72
+		"rectangle|rectint|recycle|reducepatch|reducevolume|refresh|refreshdata|regexp|regexpi|regexprep|regexptranslate|rehash|rem|Remove|RemoveAll|repmat|reset|reshape|residue|"+
73
+		"restoredefaultpath|rethrow|rgb2hsv|rgb2ind|rgbplot|ribbon|rmappdata|rmdir|rmfield|rmpath|rmpref|rng|roots|rose|rosser|rot90|rotate|rotate3d|round|rref|rsf2csf|run|save|saveas|"+
74
+		"saveobj|savepath|scatter|scatter3|schur|sec|secd|sech|selectmoveresize|semilogx|semilogy|sendmail|serial|set|setappdata|setdiff|setenv|setfield|setpixelposition|setpref|setstr|"+
75
+		"setxor|shading|shg|shiftdim|showplottool|shrinkfaces|sign|sin(?:d|h)?|size|slice|smooth3|snapnow|sort|sortrows|sound|soundsc|spalloc|spaugment|spconvert|spdiags|specular|speye|"+
76
+		"spfun|sph2cart|sphere|spinmap|spline|spones|spparms|sprand|sprandn|sprandsym|sprank|spring|sprintf|spy|sqrt|sqrtm|squeeze|ss2tf|sscanf|stairs|startup|std|stem|stem3|stopasync|"+
77
+		"str2double|str2func|str2mat|str2num|strcat|strcmp|strcmpi|stream2|stream3|streamline|streamparticles|streamribbon|streamslice|streamtube|strfind|strjust|strmatch|strncmp|"+
78
+		"strncmpi|strread|strrep|strtok|strtrim|struct2cell|structfun|strvcat|sub2ind|subplot|subsasgn|subsindex|subspace|subsref|substruct|subvolume|sum|summer|superclasses|superiorto|"+
79
+		"support|surf|surf2patch|surface|surfc|surfl|surfnorm|svd|svds|swapbytes|symamd|symbfact|symmlq|symrcm|symvar|system|tan(?:d|h)?|tar|tempdir|tempname|tetramesh|texlabel|text|"+
80
+		"textread|textscan|textwrap|tfqmr|throw|tic|Tiff(?:\.(?:getTagNames|getVersion))?|timer|timerfind|timerfindall|times|timeseries|title|toc|todatenum|toeplitz|toolboxdir|trace|"+
81
+		"transpose|trapz|treelayout|treeplot|tril|trimesh|triplequad|triplot|TriRep|TriScatteredInterp|trisurf|triu|tscollection|tsearch|tsearchn|tstool|type|typecast|uibuttongroup|"+
82
+		"uicontextmenu|uicontrol|uigetdir|uigetfile|uigetpref|uiimport|uimenu|uiopen|uipanel|uipushtool|uiputfile|uiresume|uisave|uisetcolor|uisetfont|uisetpref|uistack|uitable|"+
83
+		"uitoggletool|uitoolbar|uiwait|uminus|undocheckout|unicode2native|union|unique|unix|unloadlibrary|unmesh|unmkpp|untar|unwrap|unzip|uplus|upper|urlread|urlwrite|usejava|"+
84
+		"userpath|validateattributes|validatestring|vander|var|vectorize|ver|verctrl|verLessThan|version|vertcat|VideoReader(?:\.isPlatformSupported)?|VideoWriter(?:\.getProfiles)?|"+
85
+		"view|viewmtx|visdiff|volumebounds|voronoi|voronoin|wait|waitbar|waitfor|waitforbuttonpress|warndlg|warning|waterfall|wavfinfo|wavplay|wavread|wavrecord|wavwrite|web|weekday|"+
86
+		"what|whatsnew|which|whitebg|who|whos|wilkinson|winopen|winqueryreg|winter|wk1finfo|wk1read|wk1write|workspace|xlabel|xlim|xlsfinfo|xlsread|xlswrite|xmlread|xmlwrite|xor|xslt|"+
87
+		"ylabel|ylim|zeros|zip|zlabel|zlim|zoom|addedvarplot|andrewsplot|anova(?:1|2|n)|ansaribradley|aoctool|barttest|bbdesign|beta(?:cdf|fit|inv|like|pdf|rnd|stat)|bino(?:cdf|fit|inv|"+
88
+		"pdf|rnd|stat)|biplot|bootci|bootstrp|boxplot|candexch|candgen|canoncorr|capability|capaplot|caseread|casewrite|categorical|ccdesign|cdfplot|chi2(?:cdf|gof|inv|pdf|rnd|stat)|"+
89
+		"cholcov|Classification(?:BaggedEnsemble|Discriminant(?:\.(?:fit|make|template))?|Ensemble|KNN(?:\.(?:fit|template))?|PartitionedEnsemble|PartitionedModel|Tree(?:\.(?:fit|"+
90
+		"template))?)|classify|classregtree|cluster|clusterdata|cmdscale|combnk|Compact(?:Classification(?:Discriminant|Ensemble|Tree)|Regression(?:Ensemble|Tree)|TreeBagger)|confusionmat|"+
91
+		"controlchart|controlrules|cophenet|copula(?:cdf|fit|param|pdf|rnd|stat)|cordexch|corr|corrcov|coxphfit|createns|crosstab|crossval|cvpartition|datasample|dataset|daugment|dcovary|"+
92
+		"dendrogram|dfittool|disttool|dummyvar|dwtest|ecdf|ecdfhist|ev(?:cdf|fit|inv|like|pdf|rnd|stat)|ExhaustiveSearcher|exp(?:cdf|fit|inv|like|pdf|rnd|stat)|factoran|fcdf|ff2n|finv|"+
93
+		"fitdist|fitensemble|fpdf|fracfact|fracfactgen|friedman|frnd|fstat|fsurfht|fullfact|gagerr|gam(?:cdf|fit|inv|like|pdf|rnd|stat)|GeneralizedLinearModel(?:\.fit)?|geo(?:cdf|inv|mean|"+
94
+		"pdf|rnd|stat)|gev(?:cdf|fit|inv|like|pdf|rnd|stat)|gline|glmfit|glmval|glyphplot|gmdistribution(?:\.fit)?|gname|gp(?:cdf|fit|inv|like|pdf|rnd|stat)|gplotmatrix|grp2idx|grpstats|"+
95
+		"gscatter|haltonset|harmmean|hist3|histfit|hmm(?:decode|estimate|generate|train|viterbi)|hougen|hyge(?:cdf|inv|pdf|rnd|stat)|icdf|inconsistent|interactionplot|invpred|iqr|iwishrnd|"+
96
+		"jackknife|jbtest|johnsrnd|KDTreeSearcher|kmeans|knnsearch|kruskalwallis|ksdensity|kstest|kstest2|kurtosis|lasso|lassoglm|lassoPlot|leverage|lhsdesign|lhsnorm|lillietest|"+
97
+		"LinearModel(?:\.fit)?|linhyptest|linkage|logn(?:cdf|fit|inv|like|pdf|rnd|stat)|lsline|mad|mahal|maineffectsplot|manova1|manovacluster|mdscale|mhsample|mle|mlecov|mnpdf|"+
98
+		"mnrfit|mnrnd|mnrval|moment|multcompare|multivarichart|mvn(?:cdf|pdf|rnd)|mvregress|mvregresslike|mvt(?:cdf|pdf|rnd)|NaiveBayes(?:\.fit)?|nan(?:cov|max|mean|median|min|std|"+
99
+		"sum|var)|nbin(?:cdf|fit|inv|pdf|rnd|stat)|ncf(?:cdf|inv|pdf|rnd|stat)|nct(?:cdf|inv|pdf|rnd|stat)|ncx2(?:cdf|inv|pdf|rnd|stat)|NeighborSearcher|nlinfit|nlintool|nlmefit|nlmefitsa|"+
100
+		"nlparci|nlpredci|nnmf|nominal|NonLinearModel(?:\.fit)?|norm(?:cdf|fit|inv|like|pdf|rnd|stat)|normplot|normspec|ordinal|outlierMeasure|parallelcoords|paretotails|partialcorr|"+
101
+		"pcacov|pcares|pdf|pdist|pdist2|pearsrnd|perfcurve|perms|piecewisedistribution|plsregress|poiss(?:cdf|fit|inv|pdf|rnd|tat)|polyconf|polytool|prctile|princomp|ProbDist(?:Kernel|"+
102
+		"Parametric|UnivKernel|UnivParam)?|probplot|procrustes|qqplot|qrandset|qrandstream|quantile|randg|random|randsample|randtool|range|rangesearch|ranksum|rayl(?:cdf|fit|inv|pdf|"+
103
+		"rnd|stat)|rcoplot|refcurve|refline|regress|Regression(?:BaggedEnsemble|Ensemble|PartitionedEnsemble|PartitionedModel|Tree(?:\.(?:fit|template))?)|regstats|relieff|ridge|"+
104
+		"robustdemo|robustfit|rotatefactors|rowexch|rsmdemo|rstool|runstest|sampsizepwr|scatterhist|sequentialfs|signrank|signtest|silhouette|skewness|slicesample|sobolset|squareform|"+
105
+		"statget|statset|stepwise|stepwisefit|surfht|tabulate|tblread|tblwrite|tcdf|tdfread|tiedrank|tinv|tpdf|TreeBagger|treedisp|treefit|treeprune|treetest|treeval|trimmean|trnd|tstat|"+
106
+		"ttest|ttest2|unid(?:cdf|inv|pdf|rnd|stat)|unif(?:cdf|inv|it|pdf|rnd|stat)|vartest(?:2|n)?|wbl(?:cdf|fit|inv|like|pdf|rnd|stat)|wblplot|wishrnd|x2fx|xptread|zscore|ztest"+
107
+		"adapthisteq|analyze75info|analyze75read|applycform|applylut|axes2pix|bestblk|blockproc|bwarea|bwareaopen|bwboundaries|bwconncomp|bwconvhull|bwdist|bwdistgeodesic|bweuler|"+
108
+		"bwhitmiss|bwlabel|bwlabeln|bwmorph|bwpack|bwperim|bwselect|bwtraceboundary|bwulterode|bwunpack|checkerboard|col2im|colfilt|conndef|convmtx2|corner|cornermetric|corr2|cp2tform|"+
109
+		"cpcorr|cpselect|cpstruct2pairs|dct2|dctmtx|deconvblind|deconvlucy|deconvreg|deconvwnr|decorrstretch|demosaic|dicom(?:anon|dict|info|lookup|read|uid|write)|edge|edgetaper|entropy|"+
110
+		"entropyfilt|fan2para|fanbeam|findbounds|fliptform|freqz2|fsamp2|fspecial|ftrans2|fwind1|fwind2|getheight|getimage|getimagemodel|getline|getneighbors|getnhood|getpts|"+
111
+		"getrangefromclass|getrect|getsequence|gray2ind|graycomatrix|graycoprops|graydist|grayslice|graythresh|hdrread|hdrwrite|histeq|hough|houghlines|houghpeaks|iccfind|iccread|"+
112
+		"iccroot|iccwrite|idct2|ifanbeam|im2bw|im2col|im2double|im2int16|im2java2d|im2single|im2uint16|im2uint8|imabsdiff|imadd|imadjust|ImageAdapter|imageinfo|imagemodel|imapplymatrix|"+
113
+		"imattributes|imbothat|imclearborder|imclose|imcolormaptool|imcomplement|imcontour|imcontrast|imcrop|imdilate|imdisplayrange|imdistline|imdivide|imellipse|imerode|imextendedmax|"+
114
+		"imextendedmin|imfill|imfilter|imfindcircles|imfreehand|imfuse|imgca|imgcf|imgetfile|imhandles|imhist|imhmax|imhmin|imimposemin|imlincomb|imline|immagbox|immovie|immultiply|imnoise|"+
115
+		"imopen|imoverview|imoverviewpanel|impixel|impixelinfo|impixelinfoval|impixelregion|impixelregionpanel|implay|impoint|impoly|impositionrect|improfile|imputfile|impyramid|"+
116
+		"imreconstruct|imrect|imregconfig|imregionalmax|imregionalmin|imregister|imresize|imroi|imrotate|imsave|imscrollpanel|imshow|imshowpair|imsubtract|imtool|imtophat|imtransform|"+
117
+		"imview|ind2gray|ind2rgb|interfileinfo|interfileread|intlut|ippl|iptaddcallback|iptcheckconn|iptcheckhandle|iptcheckinput|iptcheckmap|iptchecknargin|iptcheckstrs|iptdemos|iptgetapi|"+
118
+		"iptGetPointerBehavior|iptgetpref|ipticondir|iptnum2ordinal|iptPointerManager|iptprefs|iptremovecallback|iptSetPointerBehavior|iptsetpref|iptwindowalign|iradon|isbw|isflat|isgray|"+
119
+		"isicc|isind|isnitf|isrgb|isrset|lab2double|lab2uint16|lab2uint8|label2rgb|labelmatrix|makecform|makeConstrainToRectFcn|makehdr|makelut|makeresampler|maketform|mat2gray|mean2|"+
120
+		"medfilt2|montage|nitfinfo|nitfread|nlfilter|normxcorr2|ntsc2rgb|openrset|ordfilt2|otf2psf|padarray|para2fan|phantom|poly2mask|psf2otf|qtdecomp|qtgetblk|qtsetblk|radon|rangefilt|"+
121
+		"reflect|regionprops|registration\.metric\.(?:MattesMutualInformation|MeanSquares)|registration\.optimizer\.(?:OnePlusOneEvolutionary|RegularStepGradientDescent)|rgb2gray|"+
122
+		"rgb2ntsc|rgb2ycbcr|roicolor|roifill|roifilt2|roipoly|rsetwrite|std2|stdfilt|strel|stretchlim|subimage|tformarray|tformfwd|tforminv|tonemap|translate|truesize|uintlut|viscircles|"+
123
+		"warp|watershed|whitepoint|wiener2|xyz2double|xyz2uint16|ycbcr2rgb|bintprog|color|fgoalattain|fminbnd|fmincon|fminimax|fminsearch|fminunc|fseminf|fsolve|fzero|fzmult|gangstr|ktrlink|"+
124
+		"linprog|lsqcurvefit|lsqlin|lsqnonlin|lsqnonneg|optimget|optimset|optimtool|quadprog"
125
+    );
126
+    var storageType = (
127
+        "cell|struct|char|double|single|logical|u?int(?:8|16|32|64)|sparse"
128
+    );
129
+    var keywordMapper = this.createKeywordMapper({
130
+        "storage.type": storageType,
131
+        "support.function": builtinFunctions,
132
+        "keyword": keywords,
133
+        "constant.language": builtinConstants
134
+    }, "identifier", true);
135
+
136
+    this.$rules = {
137
+        start: [{ 
138
+            token : "string",
139
+            regex : "'",
140
+            stateName : "qstring",
141
+            next  : [{
142
+                token : "constant.language.escape",
143
+                regex : "''"
144
+            }, {
145
+                token : "string",
146
+                regex : "'|$",
147
+                next  : "start"
148
+            }, {
149
+                defaultToken: "string"
150
+            }]
151
+        }, {
152
+            token : "text",
153
+            regex : "\\s+"
154
+        }, {
155
+            regex: "",
156
+            next: "noQstring"
157
+        }],        
158
+        noQstring : [{
159
+            regex: "^\\s*%{\\s*$",
160
+            token: "comment.start",
161
+            push: "blockComment"
162
+        }, {
163
+            token : "comment",
164
+            regex : "%[^\r\n]*"
165
+        }, {
166
+            token : "string",
167
+            regex : '"',
168
+            stateName : "qqstring",
169
+            next  : [{
170
+                token : "constant.language.escape",
171
+                regex : /\\./
172
+            }, {
173
+                token : "string",
174
+                regex : "\\\\$",
175
+                next  : "qqstring"
176
+            }, {
177
+                token : "string",
178
+                regex : '"|$',
179
+                next  : "start"
180
+            }, {
181
+                defaultToken: "string"
182
+            }]
183
+        }, {
184
+            token : "constant.numeric", // float
185
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
186
+        }, {
187
+            token : keywordMapper,
188
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
189
+        }, {
190
+            token : "keyword.operator",
191
+            regex : "\\+|\\-|\\/|\\/\\/|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=",
192
+            next: "start"
193
+        }, {
194
+            token : "punctuation.operator",
195
+            regex : "\\?|\\:|\\,|\\;|\\.",
196
+            next: "start"
197
+        }, {
198
+            token : "paren.lparen",
199
+            regex : "[({\\[]",
200
+            next: "start"
201
+        }, {
202
+            token : "paren.rparen",
203
+            regex : "[\\]})]"
204
+        }, {
205
+            token : "text",
206
+            regex : "\\s+"
207
+        }, {
208
+            token : "text",
209
+            regex : "$",
210
+            next  : "start"
211
+        }],
212
+        blockComment: [{
213
+            regex: "^\\s*%{\\s*$",
214
+            token: "comment.start",
215
+            push: "blockComment"
216
+        }, {
217
+            regex: "^\\s*%}\\s*$",
218
+            token: "comment.end",
219
+            next: "pop"
220
+        }, {
221
+            defaultToken: "comment"
222
+        }],
223
+    };
224
+    
225
+    this.normalizeRules();
226
+};
227
+
228
+oop.inherits(MatlabHighlightRules, TextHighlightRules);
229
+
230
+exports.MatlabHighlightRules = MatlabHighlightRules;
231
+});
232
+
233
+ace.define("ace/mode/matlab",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/matlab_highlight_rules","ace/range"], function(require, exports, module) {
234
+"use strict";
235
+
236
+var oop = require("../lib/oop");
237
+var TextMode = require("./text").Mode;
238
+var MatlabHighlightRules = require("./matlab_highlight_rules").MatlabHighlightRules;
239
+var Range = require("../range").Range;
240
+
241
+var Mode = function() {
242
+    this.HighlightRules = MatlabHighlightRules;
243
+};
244
+oop.inherits(Mode, TextMode);
245
+
246
+(function() {
247
+
248
+    this.lineCommentStart = "%";
249
+    this.blockComment = {start: "%{", end: "%}"};
250
+
251
+    this.$id = "ace/mode/matlab";
252
+}).call(Mode.prototype);
253
+
254
+exports.Mode = Mode;
255
+
256
+});

+ 613
- 0
generator/lib/ace/mode-mel.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 674
- 0
generator/lib/ace/mode-mushcode.js Parādīt failu

@@ -0,0 +1,674 @@
1
+ace.define("ace/mode/mushcode_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 MushCodeRules = function() {
8
+
9
+
10
+    var keywords = (
11
+ "@if|"+
12
+ "@ifelse|"+
13
+ "@switch|"+
14
+ "@halt|"+
15
+ "@dolist|"+
16
+ "@create|"+
17
+ "@scent|"+
18
+ "@sound|"+
19
+ "@touch|"+
20
+ "@ataste|"+
21
+ "@osound|"+
22
+ "@ahear|"+
23
+ "@aahear|"+
24
+ "@amhear|"+
25
+ "@otouch|"+
26
+ "@otaste|"+
27
+ "@drop|"+
28
+ "@odrop|"+
29
+ "@adrop|"+
30
+ "@dropfail|"+
31
+ "@odropfail|"+
32
+ "@smell|"+
33
+ "@oemit|"+
34
+ "@emit|"+
35
+ "@pemit|"+
36
+ "@parent|"+
37
+ "@clone|"+
38
+ "@taste|"+
39
+ "whisper|"+
40
+ "page|"+
41
+ "say|"+
42
+ "pose|"+
43
+ "semipose|"+
44
+ "teach|"+
45
+ "touch|"+
46
+ "taste|"+
47
+ "smell|"+
48
+ "listen|"+
49
+ "look|"+
50
+ "move|"+
51
+ "go|"+
52
+ "home|"+
53
+ "follow|"+
54
+ "unfollow|"+
55
+ "desert|"+
56
+ "dismiss|"+
57
+ "@tel"
58
+    );
59
+
60
+    var builtinConstants = (
61
+        "=#0"
62
+    );
63
+
64
+    var builtinFunctions = (
65
+ "default|"+
66
+ "edefault|"+
67
+ "eval|"+
68
+ "get_eval|"+
69
+ "get|"+
70
+ "grep|"+
71
+ "grepi|"+
72
+ "hasattr|"+
73
+ "hasattrp|"+
74
+ "hasattrval|"+
75
+ "hasattrpval|"+
76
+ "lattr|"+
77
+ "nattr|"+
78
+ "poss|"+
79
+ "udefault|"+
80
+ "ufun|"+
81
+ "u|"+
82
+ "v|"+
83
+ "uldefault|"+
84
+ "xget|"+
85
+ "zfun|"+
86
+ "band|"+
87
+ "bnand|"+
88
+ "bnot|"+
89
+ "bor|"+
90
+ "bxor|"+
91
+ "shl|"+
92
+ "shr|"+
93
+ "and|"+
94
+ "cand|"+
95
+ "cor|"+
96
+ "eq|"+
97
+ "gt|"+
98
+ "gte|"+
99
+ "lt|"+
100
+ "lte|"+
101
+ "nand|"+
102
+ "neq|"+
103
+ "nor|"+
104
+ "not|"+
105
+ "or|"+
106
+ "t|"+
107
+ "xor|"+
108
+ "con|"+
109
+ "entrances|"+
110
+ "exit|"+
111
+ "followers|"+
112
+ "home|"+
113
+ "lcon|"+
114
+ "lexits|"+
115
+ "loc|"+
116
+ "locate|"+
117
+ "lparent|"+
118
+ "lsearch|"+
119
+ "next|"+
120
+ "num|"+
121
+ "owner|"+
122
+ "parent|"+
123
+ "pmatch|"+
124
+ "rloc|"+
125
+ "rnum|"+
126
+ "room|"+
127
+ "where|"+
128
+ "zone|"+
129
+ "worn|"+
130
+ "held|"+
131
+ "carried|"+
132
+ "acos|"+
133
+ "asin|"+
134
+ "atan|"+
135
+ "ceil|"+
136
+ "cos|"+
137
+ "e|"+
138
+ "exp|"+
139
+ "fdiv|"+
140
+ "fmod|"+
141
+ "floor|"+
142
+ "log|"+
143
+ "ln|"+
144
+ "pi|"+
145
+ "power|"+
146
+ "round|"+
147
+ "sin|"+
148
+ "sqrt|"+
149
+ "tan|"+
150
+ "aposs|"+
151
+ "andflags|"+
152
+ "conn|"+
153
+ "commandssent|"+
154
+ "controls|"+
155
+ "doing|"+
156
+ "elock|"+
157
+ "findable|"+
158
+ "flags|"+
159
+ "fullname|"+
160
+ "hasflag|"+
161
+ "haspower|"+
162
+ "hastype|"+
163
+ "hidden|"+
164
+ "idle|"+
165
+ "isbaker|"+
166
+ "lock|"+
167
+ "lstats|"+
168
+ "money|"+
169
+ "who|"+
170
+ "name|"+
171
+ "nearby|"+
172
+ "obj|"+
173
+ "objflags|"+
174
+ "photo|"+
175
+ "poll|"+
176
+ "powers|"+
177
+ "pendingtext|"+
178
+ "receivedtext|"+
179
+ "restarts|"+
180
+ "restarttime|"+
181
+ "subj|"+
182
+ "shortestpath|"+
183
+ "tmoney|"+
184
+ "type|"+
185
+ "visible|"+
186
+ "cat|"+
187
+ "element|"+
188
+ "elements|"+
189
+ "extract|"+
190
+ "filter|"+
191
+ "filterbool|"+
192
+ "first|"+
193
+ "foreach|"+
194
+ "fold|"+
195
+ "grab|"+
196
+ "graball|"+
197
+ "index|"+
198
+ "insert|"+
199
+ "itemize|"+
200
+ "items|"+
201
+ "iter|"+
202
+ "last|"+
203
+ "ldelete|"+
204
+ "map|"+
205
+ "match|"+
206
+ "matchall|"+
207
+ "member|"+
208
+ "mix|"+
209
+ "munge|"+
210
+ "pick|"+
211
+ "remove|"+
212
+ "replace|"+
213
+ "rest|"+
214
+ "revwords|"+
215
+ "setdiff|"+
216
+ "setinter|"+
217
+ "setunion|"+
218
+ "shuffle|"+
219
+ "sort|"+
220
+ "sortby|"+
221
+ "splice|"+
222
+ "step|"+
223
+ "wordpos|"+
224
+ "words|"+
225
+ "add|"+
226
+ "lmath|"+
227
+ "max|"+
228
+ "mean|"+
229
+ "median|"+
230
+ "min|"+
231
+ "mul|"+
232
+ "percent|"+
233
+ "sign|"+
234
+ "stddev|"+
235
+ "sub|"+
236
+ "val|"+
237
+ "bound|"+
238
+ "abs|"+
239
+ "inc|"+
240
+ "dec|"+
241
+ "dist2d|"+
242
+ "dist3d|"+
243
+ "div|"+
244
+ "floordiv|"+
245
+ "mod|"+
246
+ "modulo|"+
247
+ "remainder|"+
248
+ "vadd|"+
249
+ "vdim|"+
250
+ "vdot|"+
251
+ "vmag|"+
252
+ "vmax|"+
253
+ "vmin|"+
254
+ "vmul|"+
255
+ "vsub|"+
256
+ "vunit|"+
257
+ "regedit|"+
258
+ "regeditall|"+
259
+ "regeditalli|"+
260
+ "regediti|"+
261
+ "regmatch|"+
262
+ "regmatchi|"+
263
+ "regrab|"+
264
+ "regraball|"+
265
+ "regraballi|"+
266
+ "regrabi|"+
267
+ "regrep|"+
268
+ "regrepi|"+
269
+ "after|"+
270
+ "alphamin|"+
271
+ "alphamax|"+
272
+ "art|"+
273
+ "before|"+
274
+ "brackets|"+
275
+ "capstr|"+
276
+ "case|"+
277
+ "caseall|"+
278
+ "center|"+
279
+ "containsfansi|"+
280
+ "comp|"+
281
+ "decompose|"+
282
+ "decrypt|"+
283
+ "delete|"+
284
+ "edit|"+
285
+ "encrypt|"+
286
+ "escape|"+
287
+ "if|"+
288
+ "ifelse|"+
289
+ "lcstr|"+
290
+ "left|"+
291
+ "lit|"+
292
+ "ljust|"+
293
+ "merge|"+
294
+ "mid|"+
295
+ "ostrlen|"+
296
+ "pos|"+
297
+ "repeat|"+
298
+ "reverse|"+
299
+ "right|"+
300
+ "rjust|"+
301
+ "scramble|"+
302
+ "secure|"+
303
+ "space|"+
304
+ "spellnum|"+
305
+ "squish|"+
306
+ "strcat|"+
307
+ "strmatch|"+
308
+ "strinsert|"+
309
+ "stripansi|"+
310
+ "stripfansi|"+
311
+ "strlen|"+
312
+ "switch|"+
313
+ "switchall|"+
314
+ "table|"+
315
+ "tr|"+
316
+ "trim|"+
317
+ "ucstr|"+
318
+ "unsafe|"+
319
+ "wrap|"+
320
+ "ctitle|"+
321
+ "cwho|"+
322
+ "channels|"+
323
+ "clock|"+
324
+ "cflags|"+
325
+ "ilev|"+
326
+ "itext|"+
327
+ "inum|"+
328
+ "convsecs|"+
329
+ "convutcsecs|"+
330
+ "convtime|"+
331
+ "ctime|"+
332
+ "etimefmt|"+
333
+ "isdaylight|"+
334
+ "mtime|"+
335
+ "secs|"+
336
+ "msecs|"+
337
+ "starttime|"+
338
+ "time|"+
339
+ "timefmt|"+
340
+ "timestring|"+
341
+ "utctime|"+
342
+ "atrlock|"+
343
+ "clone|"+
344
+ "create|"+
345
+ "cook|"+
346
+ "dig|"+
347
+ "emit|"+
348
+ "lemit|"+
349
+ "link|"+
350
+ "oemit|"+
351
+ "open|"+
352
+ "pemit|"+
353
+ "remit|"+
354
+ "set|"+
355
+ "tel|"+
356
+ "wipe|"+
357
+ "zemit|"+
358
+ "fbcreate|"+
359
+ "fbdestroy|"+
360
+ "fbwrite|"+
361
+ "fbclear|"+
362
+ "fbcopy|"+
363
+ "fbcopyto|"+
364
+ "fbclip|"+
365
+ "fbdump|"+
366
+ "fbflush|"+
367
+ "fbhset|"+
368
+ "fblist|"+
369
+ "fbstats|"+
370
+ "qentries|"+
371
+ "qentry|"+
372
+ "play|"+
373
+ "ansi|"+
374
+ "break|"+
375
+ "c|"+
376
+ "asc|"+
377
+ "die|"+
378
+ "isdbref|"+
379
+ "isint|"+
380
+ "isnum|"+
381
+ "isletters|"+
382
+ "linecoords|"+
383
+ "localize|"+
384
+ "lnum|"+
385
+ "nameshort|"+
386
+ "null|"+
387
+ "objeval|"+
388
+ "r|"+
389
+ "rand|"+
390
+ "s|"+
391
+ "setq|"+
392
+ "setr|"+
393
+ "soundex|"+
394
+ "soundslike|"+
395
+ "valid|"+
396
+ "vchart|"+
397
+ "vchart2|"+
398
+ "vlabel|"+
399
+ "@@|"+
400
+ "bakerdays|"+
401
+ "bodybuild|"+
402
+ "box|"+
403
+ "capall|"+
404
+ "catalog|"+
405
+ "children|"+
406
+ "ctrailer|"+
407
+ "darttime|"+
408
+ "debt|"+
409
+ "detailbar|"+
410
+ "exploredroom|"+
411
+ "fansitoansi|"+
412
+ "fansitoxansi|"+
413
+ "fullbar|"+
414
+ "halfbar|"+
415
+ "isdarted|"+
416
+ "isnewbie|"+
417
+ "isword|"+
418
+ "lambda|"+
419
+ "lobjects|"+
420
+ "lplayers|"+
421
+ "lthings|"+
422
+ "lvexits|"+
423
+ "lvobjects|"+
424
+ "lvplayers|"+
425
+ "lvthings|"+
426
+ "newswrap|"+
427
+ "numsuffix|"+
428
+ "playerson|"+
429
+ "playersthisweek|"+
430
+ "randomad|"+
431
+ "randword|"+
432
+ "realrandword|"+
433
+ "replacechr|"+
434
+ "second|"+
435
+ "splitamount|"+
436
+ "strlenall|"+
437
+ "text|"+
438
+ "third|"+
439
+ "tofansi|"+
440
+ "totalac|"+
441
+ "unique|"+
442
+ "getaddressroom|"+
443
+ "listpropertycomm|"+
444
+ "listpropertyres|"+
445
+ "lotowner|"+
446
+ "lotrating|"+
447
+ "lotratingcount|"+
448
+ "lotvalue|"+
449
+ "boughtproduct|"+
450
+ "companyabb|"+
451
+ "companyicon|"+
452
+ "companylist|"+
453
+ "companyname|"+
454
+ "companyowners|"+
455
+ "companyvalue|"+
456
+ "employees|"+
457
+ "invested|"+
458
+ "productlist|"+
459
+ "productname|"+
460
+ "productowners|"+
461
+ "productrating|"+
462
+ "productratingcount|"+
463
+ "productsoldat|"+
464
+ "producttype|"+
465
+ "ratedproduct|"+
466
+ "soldproduct|"+
467
+ "topproducts|"+
468
+ "totalspentonproduct|"+
469
+ "totalstock|"+
470
+ "transfermoney|"+
471
+ "uniquebuyercount|"+
472
+ "uniqueproductsbought|"+
473
+ "validcompany|"+
474
+ "deletepicture|"+
475
+ "fbsave|"+
476
+ "getpicturesecurity|"+
477
+ "haspicture|"+
478
+ "listpictures|"+
479
+ "picturesize|"+
480
+ "replacecolor|"+
481
+ "rgbtocolor|"+
482
+ "savepicture|"+
483
+ "setpicturesecurity|"+
484
+ "showpicture|"+
485
+ "piechart|"+
486
+ "piechartlabel|"+
487
+ "createmaze|"+
488
+ "drawmaze|"+
489
+ "drawwireframe"
490
+    );
491
+    var keywordMapper = this.createKeywordMapper({
492
+        "invalid.deprecated": "debugger",
493
+        "support.function": builtinFunctions,
494
+        "constant.language": builtinConstants,
495
+        "keyword": keywords
496
+    }, "identifier");
497
+
498
+    var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
499
+
500
+    var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
501
+    var octInteger = "(?:0[oO]?[0-7]+)";
502
+    var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
503
+    var binInteger = "(?:0[bB][01]+)";
504
+    var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
505
+
506
+    var exponent = "(?:[eE][+-]?\\d+)";
507
+    var fraction = "(?:\\.\\d+)";
508
+    var intPart = "(?:\\d+)";
509
+    var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
510
+    var exponentFloat = "(?:(?:" + pointFloat + "|" +  intPart + ")" + exponent + ")";
511
+    var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
512
+
513
+    this.$rules = {
514
+        "start" : [
515
+         {
516
+                token : "variable", // mush substitution register
517
+                regex : "%[0-9]{1}"
518
+         },
519
+         {
520
+                token : "variable", // mush substitution register
521
+                regex : "%q[0-9A-Za-z]{1}"
522
+         },
523
+         {
524
+                token : "variable", // mush special character register
525
+                regex : "%[a-zA-Z]{1}"
526
+         },
527
+         {
528
+                token: "variable.language",
529
+                regex: "%[a-z0-9-_]+"
530
+         },
531
+        {
532
+            token : "constant.numeric", // imaginary
533
+            regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
534
+        }, {
535
+            token : "constant.numeric", // float
536
+            regex : floatNumber
537
+        }, {
538
+            token : "constant.numeric", // long integer
539
+            regex : integer + "[lL]\\b"
540
+        }, {
541
+            token : "constant.numeric", // integer
542
+            regex : integer + "\\b"
543
+        }, {
544
+            token : keywordMapper,
545
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
546
+        }, {
547
+            token : "keyword.operator",
548
+            regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|#|%|<<|>>|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
549
+        }, {
550
+            token : "paren.lparen",
551
+            regex : "[\\[\\(\\{]"
552
+        }, {
553
+            token : "paren.rparen",
554
+            regex : "[\\]\\)\\}]"
555
+        }, {
556
+            token : "text",
557
+            regex : "\\s+"
558
+        } ]
559
+    };
560
+};
561
+
562
+oop.inherits(MushCodeRules, TextHighlightRules);
563
+
564
+exports.MushCodeRules = MushCodeRules;
565
+});
566
+
567
+ace.define("ace/mode/folding/pythonic",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
568
+"use strict";
569
+
570
+var oop = require("../../lib/oop");
571
+var BaseFoldMode = require("./fold_mode").FoldMode;
572
+
573
+var FoldMode = exports.FoldMode = function(markers) {
574
+    this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + markers + ")(?:\\s*)(?:#.*)?$");
575
+};
576
+oop.inherits(FoldMode, BaseFoldMode);
577
+
578
+(function() {
579
+
580
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
581
+        var line = session.getLine(row);
582
+        var match = line.match(this.foldingStartMarker);
583
+        if (match) {
584
+            if (match[1])
585
+                return this.openingBracketBlock(session, match[1], row, match.index);
586
+            if (match[2])
587
+                return this.indentationBlock(session, row, match.index + match[2].length);
588
+            return this.indentationBlock(session, row);
589
+        }
590
+    }
591
+
592
+}).call(FoldMode.prototype);
593
+
594
+});
595
+
596
+ace.define("ace/mode/mushcode",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mushcode_highlight_rules","ace/mode/folding/pythonic","ace/range"], function(require, exports, module) {
597
+"use strict";
598
+
599
+var oop = require("../lib/oop");
600
+var TextMode = require("./text").Mode;
601
+var MushCodeRules = require("./mushcode_highlight_rules").MushCodeRules;
602
+var PythonFoldMode = require("./folding/pythonic").FoldMode;
603
+var Range = require("../range").Range;
604
+
605
+var Mode = function() {
606
+    this.HighlightRules = MushCodeRules;
607
+    this.foldingRules = new PythonFoldMode("\\:");
608
+};
609
+oop.inherits(Mode, TextMode);
610
+
611
+(function() {
612
+
613
+    this.lineCommentStart = "#";
614
+
615
+    this.getNextLineIndent = function(state, line, tab) {
616
+        var indent = this.$getIndent(line);
617
+
618
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
619
+        var tokens = tokenizedLine.tokens;
620
+
621
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
622
+            return indent;
623
+        }
624
+
625
+        if (state == "start") {
626
+            var match = line.match(/^.*[\{\(\[\:]\s*$/);
627
+            if (match) {
628
+                indent += tab;
629
+            }
630
+        }
631
+
632
+        return indent;
633
+    };
634
+
635
+   var outdents = {
636
+        "pass": 1,
637
+        "return": 1,
638
+        "raise": 1,
639
+        "break": 1,
640
+        "continue": 1
641
+    };
642
+
643
+    this.checkOutdent = function(state, line, input) {
644
+        if (input !== "\r\n" && input !== "\r" && input !== "\n")
645
+            return false;
646
+
647
+        var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
648
+
649
+        if (!tokens)
650
+            return false;
651
+        do {
652
+            var last = tokens.pop();
653
+        } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
654
+
655
+        if (!last)
656
+            return false;
657
+
658
+        return (last.type == "keyword" && outdents[last.value]);
659
+    };
660
+
661
+    this.autoOutdent = function(state, doc, row) {
662
+
663
+        row += 1;
664
+        var indent = this.$getIndent(doc.getLine(row));
665
+        var tab = doc.getTabString();
666
+        if (indent.slice(-tab.length) == tab)
667
+            doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
668
+    };
669
+
670
+    this.$id = "ace/mode/mushcode";
671
+}).call(Mode.prototype);
672
+
673
+exports.Mode = Mode;
674
+});

+ 160
- 0
generator/lib/ace/mode-mysql.js Parādīt failu

@@ -0,0 +1,160 @@
1
+ace.define("ace/mode/doc_comment_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 DocCommentHighlightRules = function() {
8
+    this.$rules = {
9
+        "start" : [ {
10
+            token : "comment.doc.tag",
11
+            regex : "@[\\w\\d_]+" // TODO: fix email addresses
12
+        }, 
13
+        DocCommentHighlightRules.getTagRule(),
14
+        {
15
+            defaultToken : "comment.doc",
16
+            caseInsensitive: true
17
+        }]
18
+    };
19
+};
20
+
21
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22
+
23
+DocCommentHighlightRules.getTagRule = function(start) {
24
+    return {
25
+        token : "comment.doc.tag.storage.type",
26
+        regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+    };
28
+}
29
+
30
+DocCommentHighlightRules.getStartRule = function(start) {
31
+    return {
32
+        token : "comment.doc", // doc comment
33
+        regex : "\\/\\*(?=\\*)",
34
+        next  : start
35
+    };
36
+};
37
+
38
+DocCommentHighlightRules.getEndRule = function (start) {
39
+    return {
40
+        token : "comment.doc", // closing comment
41
+        regex : "\\*\\/",
42
+        next  : start
43
+    };
44
+};
45
+
46
+
47
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
48
+
49
+});
50
+
51
+ace.define("ace/mode/mysql_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52
+
53
+var oop = require("../lib/oop");
54
+var lang = require("../lib/lang");
55
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57
+
58
+var MysqlHighlightRules = function() {
59
+
60
+    var mySqlKeywords = /*sql*/ "alter|and|as|asc|between|count|create|delete|desc|distinct|drop|from|having|in|insert|into|is|join|like|not|on|or|order|select|set|table|union|update|values|where" + "|accessible|action|add|after|algorithm|all|analyze|asensitive|at|authors|auto_increment|autocommit|avg|avg_row_length|before|binary|binlog|both|btree|cache|call|cascade|cascaded|case|catalog_name|chain|change|changed|character|check|checkpoint|checksum|class_origin|client_statistics|close|coalesce|code|collate|collation|collations|column|columns|comment|commit|committed|completion|concurrent|condition|connection|consistent|constraint|contains|continue|contributors|convert|cross|current_date|current_time|current_timestamp|current_user|cursor|data|database|databases|day_hour|day_microsecond|day_minute|day_second|deallocate|dec|declare|default|delay_key_write|delayed|delimiter|des_key_file|describe|deterministic|dev_pop|dev_samp|deviance|directory|disable|discard|distinctrow|div|dual|dumpfile|each|elseif|enable|enclosed|end|ends|engine|engines|enum|errors|escape|escaped|even|event|events|every|execute|exists|exit|explain|extended|fast|fetch|field|fields|first|flush|for|force|foreign|found_rows|full|fulltext|function|general|global|grant|grants|group|groupby_concat|handler|hash|help|high_priority|hosts|hour_microsecond|hour_minute|hour_second|if|ignore|ignore_server_ids|import|index|index_statistics|infile|inner|innodb|inout|insensitive|insert_method|install|interval|invoker|isolation|iterate|key|keys|kill|language|last|leading|leave|left|level|limit|linear|lines|list|load|local|localtime|localtimestamp|lock|logs|low_priority|master|master_heartbeat_period|master_ssl_verify_server_cert|masters|match|max|max_rows|maxvalue|message_text|middleint|migrate|min|min_rows|minute_microsecond|minute_second|mod|mode|modifies|modify|mutex|mysql_errno|natural|next|no|no_write_to_binlog|offline|offset|one|online|open|optimize|option|optionally|out|outer|outfile|pack_keys|parser|partition|partitions|password|phase|plugin|plugins|prepare|preserve|prev|primary|privileges|procedure|processlist|profile|profiles|purge|query|quick|range|read|read_write|reads|real|rebuild|recover|references|regexp|relaylog|release|remove|rename|reorganize|repair|repeatable|replace|require|resignal|restrict|resume|return|returns|revoke|right|rlike|rollback|rollup|row|row_format|rtree|savepoint|schedule|schema|schema_name|schemas|second_microsecond|security|sensitive|separator|serializable|server|session|share|show|signal|slave|slow|smallint|snapshot|soname|spatial|specific|sql|sql_big_result|sql_buffer_result|sql_cache|sql_calc_found_rows|sql_no_cache|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|start|starting|starts|status|std|stddev|stddev_pop|stddev_samp|storage|straight_join|subclass_origin|sum|suspend|table_name|table_statistics|tables|tablespace|temporary|terminated|to|trailing|transaction|trigger|triggers|truncate|uncommitted|undo|uninstall|unique|unlock|upgrade|usage|use|use_frm|user|user_resources|user_statistics|using|utc_date|utc_time|utc_timestamp|value|variables|varying|view|views|warnings|when|while|with|work|write|xa|xor|year_month|zerofill|begin|do|then|else|loop|repeat";
61
+    var builtins = "by|bool|boolean|bit|blob|decimal|double|enum|float|long|longblob|longtext|medium|mediumblob|mediumint|mediumtext|time|timestamp|tinyblob|tinyint|tinytext|text|bigint|int|int1|int2|int3|int4|int8|integer|float|float4|float8|double|char|varbinary|varchar|varcharacter|precision|date|datetime|year|unsigned|signed|numeric"
62
+    var variable = "charset|clear|connect|edit|ego|exit|go|help|nopager|notee|nowarning|pager|print|prompt|quit|rehash|source|status|system|tee"
63
+
64
+    var keywordMapper = this.createKeywordMapper({
65
+        "support.function": builtins,
66
+        "keyword": mySqlKeywords,
67
+        "constant": "false|true|null|unknown|date|time|timestamp|ODBCdotTable|zerolessFloat",
68
+        "variable.language": variable
69
+    }, "identifier", true);
70
+
71
+    
72
+    function string(rule) {
73
+        var start = rule.start;
74
+        var escapeSeq = rule.escape;
75
+        return {
76
+            token: "string.start",
77
+            regex: start,
78
+            next: [
79
+                {token: "constant.language.escape", regex: escapeSeq},
80
+                {token: "string.end", next: "start", regex: start},
81
+                {defaultToken: "string"}
82
+            ]
83
+        };
84
+    }
85
+
86
+    this.$rules = {
87
+        "start" : [ {
88
+            token : "comment", regex : "(?:-- |#).*$"
89
+        },  
90
+        string({start: '"', escape: /\\[0'"bnrtZ\\%_]?/}),
91
+        string({start: "'", escape: /\\[0'"bnrtZ\\%_]?/}),
92
+        DocCommentHighlightRules.getStartRule("doc-start"),
93
+        {
94
+            token : "comment", // multi line comment
95
+            regex : /\/\*/,
96
+            next : "comment"
97
+        }, {
98
+            token : "constant.numeric", // hex
99
+            regex : /0[xX][0-9a-fA-F]+|[xX]'[0-9a-fA-F]+'|0[bB][01]+|[bB]'[01]+'/
100
+        }, {
101
+            token : "constant.numeric", // float
102
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
103
+        }, {
104
+            token : keywordMapper,
105
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
106
+        }, {
107
+            token : "constant.class",
108
+            regex : "@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
109
+        }, {
110
+            token : "constant.buildin",
111
+            regex : "`[^`]*`"
112
+        }, {
113
+            token : "keyword.operator",
114
+            regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
115
+        }, {
116
+            token : "paren.lparen",
117
+            regex : "[\\(]"
118
+        }, {
119
+            token : "paren.rparen",
120
+            regex : "[\\)]"
121
+        }, {
122
+            token : "text",
123
+            regex : "\\s+"
124
+        } ],
125
+        "comment" : [
126
+            {token : "comment", regex : "\\*\\/", next : "start"},
127
+            {defaultToken : "comment"}
128
+        ]
129
+    };
130
+
131
+    this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);
132
+    this.normalizeRules();
133
+};
134
+
135
+oop.inherits(MysqlHighlightRules, TextHighlightRules);
136
+
137
+exports.MysqlHighlightRules = MysqlHighlightRules;
138
+});
139
+
140
+ace.define("ace/mode/mysql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mysql_highlight_rules","ace/range"], function(require, exports, module) {
141
+
142
+var oop = require("../lib/oop");
143
+var TextMode = require("../mode/text").Mode;
144
+var MysqlHighlightRules = require("./mysql_highlight_rules").MysqlHighlightRules;
145
+var Range = require("../range").Range;
146
+
147
+var Mode = function() {
148
+    this.HighlightRules = MysqlHighlightRules;
149
+};
150
+oop.inherits(Mode, TextMode);
151
+
152
+(function() {       
153
+    this.lineCommentStart = ["--", "#"]; // todo space
154
+    this.blockComment = {start: "/*", end: "*/"};
155
+
156
+    this.$id = "ace/mode/mysql";
157
+}).call(Mode.prototype);
158
+
159
+exports.Mode = Mode;
160
+});

+ 993
- 0
generator/lib/ace/mode-nix.js Parādīt failu

@@ -0,0 +1,993 @@
1
+ace.define("ace/mode/doc_comment_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 DocCommentHighlightRules = function() {
8
+    this.$rules = {
9
+        "start" : [ {
10
+            token : "comment.doc.tag",
11
+            regex : "@[\\w\\d_]+" // TODO: fix email addresses
12
+        }, 
13
+        DocCommentHighlightRules.getTagRule(),
14
+        {
15
+            defaultToken : "comment.doc",
16
+            caseInsensitive: true
17
+        }]
18
+    };
19
+};
20
+
21
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22
+
23
+DocCommentHighlightRules.getTagRule = function(start) {
24
+    return {
25
+        token : "comment.doc.tag.storage.type",
26
+        regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+    };
28
+}
29
+
30
+DocCommentHighlightRules.getStartRule = function(start) {
31
+    return {
32
+        token : "comment.doc", // doc comment
33
+        regex : "\\/\\*(?=\\*)",
34
+        next  : start
35
+    };
36
+};
37
+
38
+DocCommentHighlightRules.getEndRule = function (start) {
39
+    return {
40
+        token : "comment.doc", // closing comment
41
+        regex : "\\*\\/",
42
+        next  : start
43
+    };
44
+};
45
+
46
+
47
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
48
+
49
+});
50
+
51
+ace.define("ace/mode/c_cpp_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52
+"use strict";
53
+
54
+var oop = require("../lib/oop");
55
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57
+var cFunctions = exports.cFunctions = "\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\b"
58
+
59
+var c_cppHighlightRules = function() {
60
+
61
+    var keywordControls = (
62
+        "break|case|continue|default|do|else|for|goto|if|_Pragma|" +
63
+        "return|switch|while|catch|operator|try|throw|using"
64
+    );
65
+    
66
+    var storageType = (
67
+        "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" +
68
+        "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" +
69
+        "class|wchar_t|template"
70
+    );
71
+
72
+    var storageModifiers = (
73
+        "const|extern|register|restrict|static|volatile|inline|private|" +
74
+        "protected|public|friend|explicit|virtual|export|mutable|typename|" +
75
+        "constexpr|new|delete"
76
+    );
77
+
78
+    var keywordOperators = (
79
+        "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" +
80
+        "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace"
81
+    );
82
+
83
+    var builtinConstants = (
84
+        "NULL|true|false|TRUE|FALSE"
85
+    );
86
+
87
+    var keywordMapper = this.$keywords = this.createKeywordMapper({
88
+        "keyword.control" : keywordControls,
89
+        "storage.type" : storageType,
90
+        "storage.modifier" : storageModifiers,
91
+        "keyword.operator" : keywordOperators,
92
+        "variable.language": "this",
93
+        "constant.language": builtinConstants
94
+    }, "identifier");
95
+
96
+    var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
97
+
98
+    this.$rules = { 
99
+        "start" : [
100
+            {
101
+                token : "comment",
102
+                regex : "//",
103
+                next : "singleLineComment"
104
+            },
105
+            DocCommentHighlightRules.getStartRule("doc-start"),
106
+            {
107
+                token : "comment", // multi line comment
108
+                regex : "\\/\\*",
109
+                next : "comment"
110
+            }, {
111
+                token : "string", // single line
112
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
113
+            }, {
114
+                token : "string", // multi line string start
115
+                regex : '["].*\\\\$',
116
+                next : "qqstring"
117
+            }, {
118
+                token : "string", // single line
119
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
120
+            }, {
121
+                token : "string", // multi line string start
122
+                regex : "['].*\\\\$",
123
+                next : "qstring"
124
+            }, {
125
+                token : "constant.numeric", // hex
126
+                regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
127
+            }, {
128
+                token : "constant.numeric", // float
129
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
130
+            }, {
131
+                token : "keyword", // pre-compiler directives
132
+                regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b",
133
+                next  : "directive"
134
+            }, {
135
+                token : "keyword", // special case pre-compiler directive
136
+                regex : "(?:#\\s*endif)\\b"
137
+            }, {
138
+                token : "support.function.C99.c",
139
+                regex : cFunctions
140
+            }, {
141
+                token : keywordMapper,
142
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
143
+            }, {
144
+                token : "keyword.operator",
145
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
146
+            }, {
147
+              token : "punctuation.operator",
148
+              regex : "\\?|\\:|\\,|\\;|\\."
149
+            }, {
150
+                token : "paren.lparen",
151
+                regex : "[[({]"
152
+            }, {
153
+                token : "paren.rparen",
154
+                regex : "[\\])}]"
155
+            }, {
156
+                token : "text",
157
+                regex : "\\s+"
158
+            }
159
+        ],
160
+        "comment" : [
161
+            {
162
+                token : "comment", // closing comment
163
+                regex : ".*?\\*\\/",
164
+                next : "start"
165
+            }, {
166
+                token : "comment", // comment spanning whole line
167
+                regex : ".+"
168
+            }
169
+        ],
170
+        "singleLineComment" : [
171
+            {
172
+                token : "comment",
173
+                regex : /\\$/,
174
+                next : "singleLineComment"
175
+            }, {
176
+                token : "comment",
177
+                regex : /$/,
178
+                next : "start"
179
+            }, {
180
+                defaultToken: "comment"
181
+            }
182
+        ],
183
+        "qqstring" : [
184
+            {
185
+                token : "string",
186
+                regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
187
+                next : "start"
188
+            }, {
189
+                defaultToken : "string"
190
+            }
191
+        ],
192
+        "qstring" : [
193
+            {
194
+                token : "string",
195
+                regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
196
+                next : "start"
197
+            }, {
198
+                defaultToken : "string"
199
+            }
200
+        ],
201
+        "directive" : [
202
+            {
203
+                token : "constant.other.multiline",
204
+                regex : /\\/
205
+            },
206
+            {
207
+                token : "constant.other.multiline",
208
+                regex : /.*\\/
209
+            },
210
+            {
211
+                token : "constant.other",
212
+                regex : "\\s*<.+?>",
213
+                next : "start"
214
+            },
215
+            {
216
+                token : "constant.other", // single line
217
+                regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',
218
+                next : "start"
219
+            }, 
220
+            {
221
+                token : "constant.other", // single line
222
+                regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
223
+                next : "start"
224
+            },
225
+            {
226
+                token : "constant.other",
227
+                regex : /[^\\\/]+/,
228
+                next : "start"
229
+            }
230
+        ]
231
+    };
232
+
233
+    this.embedRules(DocCommentHighlightRules, "doc-",
234
+        [ DocCommentHighlightRules.getEndRule("start") ]);
235
+};
236
+
237
+oop.inherits(c_cppHighlightRules, TextHighlightRules);
238
+
239
+exports.c_cppHighlightRules = c_cppHighlightRules;
240
+});
241
+
242
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
243
+"use strict";
244
+
245
+var Range = require("../range").Range;
246
+
247
+var MatchingBraceOutdent = function() {};
248
+
249
+(function() {
250
+
251
+    this.checkOutdent = function(line, input) {
252
+        if (! /^\s+$/.test(line))
253
+            return false;
254
+
255
+        return /^\s*\}/.test(input);
256
+    };
257
+
258
+    this.autoOutdent = function(doc, row) {
259
+        var line = doc.getLine(row);
260
+        var match = line.match(/^(\s*\})/);
261
+
262
+        if (!match) return 0;
263
+
264
+        var column = match[1].length;
265
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
266
+
267
+        if (!openBracePos || openBracePos.row == row) return 0;
268
+
269
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
270
+        doc.replace(new Range(row, 0, row, column-1), indent);
271
+    };
272
+
273
+    this.$getIndent = function(line) {
274
+        return line.match(/^\s*/)[0];
275
+    };
276
+
277
+}).call(MatchingBraceOutdent.prototype);
278
+
279
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
280
+});
281
+
282
+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) {
283
+"use strict";
284
+
285
+var oop = require("../../lib/oop");
286
+var Behaviour = require("../behaviour").Behaviour;
287
+var TokenIterator = require("../../token_iterator").TokenIterator;
288
+var lang = require("../../lib/lang");
289
+
290
+var SAFE_INSERT_IN_TOKENS =
291
+    ["text", "paren.rparen", "punctuation.operator"];
292
+var SAFE_INSERT_BEFORE_TOKENS =
293
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
294
+
295
+var context;
296
+var contextCache = {};
297
+var initContext = function(editor) {
298
+    var id = -1;
299
+    if (editor.multiSelect) {
300
+        id = editor.selection.index;
301
+        if (contextCache.rangeCount != editor.multiSelect.rangeCount)
302
+            contextCache = {rangeCount: editor.multiSelect.rangeCount};
303
+    }
304
+    if (contextCache[id])
305
+        return context = contextCache[id];
306
+    context = contextCache[id] = {
307
+        autoInsertedBrackets: 0,
308
+        autoInsertedRow: -1,
309
+        autoInsertedLineEnd: "",
310
+        maybeInsertedBrackets: 0,
311
+        maybeInsertedRow: -1,
312
+        maybeInsertedLineStart: "",
313
+        maybeInsertedLineEnd: ""
314
+    };
315
+};
316
+
317
+var CstyleBehaviour = function() {
318
+    this.add("braces", "insertion", function(state, action, editor, session, text) {
319
+        var cursor = editor.getCursorPosition();
320
+        var line = session.doc.getLine(cursor.row);
321
+        if (text == '{') {
322
+            initContext(editor);
323
+            var selection = editor.getSelectionRange();
324
+            var selected = session.doc.getTextRange(selection);
325
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
326
+                return {
327
+                    text: '{' + selected + '}',
328
+                    selection: false
329
+                };
330
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
331
+                if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
332
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
333
+                    return {
334
+                        text: '{}',
335
+                        selection: [1, 1]
336
+                    };
337
+                } else {
338
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
339
+                    return {
340
+                        text: '{',
341
+                        selection: [1, 1]
342
+                    };
343
+                }
344
+            }
345
+        } else if (text == '}') {
346
+            initContext(editor);
347
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
348
+            if (rightChar == '}') {
349
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
350
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
351
+                    CstyleBehaviour.popAutoInsertedClosing();
352
+                    return {
353
+                        text: '',
354
+                        selection: [1, 1]
355
+                    };
356
+                }
357
+            }
358
+        } else if (text == "\n" || text == "\r\n") {
359
+            initContext(editor);
360
+            var closing = "";
361
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
362
+                closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
363
+                CstyleBehaviour.clearMaybeInsertedClosing();
364
+            }
365
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
366
+            if (rightChar === '}') {
367
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
368
+                if (!openBracePos)
369
+                     return null;
370
+                var next_indent = this.$getIndent(session.getLine(openBracePos.row));
371
+            } else if (closing) {
372
+                var next_indent = this.$getIndent(line);
373
+            } else {
374
+                CstyleBehaviour.clearMaybeInsertedClosing();
375
+                return;
376
+            }
377
+            var indent = next_indent + session.getTabString();
378
+
379
+            return {
380
+                text: '\n' + indent + '\n' + next_indent + closing,
381
+                selection: [1, indent.length, 1, indent.length]
382
+            };
383
+        } else {
384
+            CstyleBehaviour.clearMaybeInsertedClosing();
385
+        }
386
+    });
387
+
388
+    this.add("braces", "deletion", function(state, action, editor, session, range) {
389
+        var selected = session.doc.getTextRange(range);
390
+        if (!range.isMultiLine() && selected == '{') {
391
+            initContext(editor);
392
+            var line = session.doc.getLine(range.start.row);
393
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
394
+            if (rightChar == '}') {
395
+                range.end.column++;
396
+                return range;
397
+            } else {
398
+                context.maybeInsertedBrackets--;
399
+            }
400
+        }
401
+    });
402
+
403
+    this.add("parens", "insertion", function(state, action, editor, session, text) {
404
+        if (text == '(') {
405
+            initContext(editor);
406
+            var selection = editor.getSelectionRange();
407
+            var selected = session.doc.getTextRange(selection);
408
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
409
+                return {
410
+                    text: '(' + selected + ')',
411
+                    selection: false
412
+                };
413
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
414
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
415
+                return {
416
+                    text: '()',
417
+                    selection: [1, 1]
418
+                };
419
+            }
420
+        } else if (text == ')') {
421
+            initContext(editor);
422
+            var cursor = editor.getCursorPosition();
423
+            var line = session.doc.getLine(cursor.row);
424
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
425
+            if (rightChar == ')') {
426
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
427
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
428
+                    CstyleBehaviour.popAutoInsertedClosing();
429
+                    return {
430
+                        text: '',
431
+                        selection: [1, 1]
432
+                    };
433
+                }
434
+            }
435
+        }
436
+    });
437
+
438
+    this.add("parens", "deletion", function(state, action, editor, session, range) {
439
+        var selected = session.doc.getTextRange(range);
440
+        if (!range.isMultiLine() && selected == '(') {
441
+            initContext(editor);
442
+            var line = session.doc.getLine(range.start.row);
443
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
444
+            if (rightChar == ')') {
445
+                range.end.column++;
446
+                return range;
447
+            }
448
+        }
449
+    });
450
+
451
+    this.add("brackets", "insertion", function(state, action, editor, session, text) {
452
+        if (text == '[') {
453
+            initContext(editor);
454
+            var selection = editor.getSelectionRange();
455
+            var selected = session.doc.getTextRange(selection);
456
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
457
+                return {
458
+                    text: '[' + selected + ']',
459
+                    selection: false
460
+                };
461
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
462
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
463
+                return {
464
+                    text: '[]',
465
+                    selection: [1, 1]
466
+                };
467
+            }
468
+        } else if (text == ']') {
469
+            initContext(editor);
470
+            var cursor = editor.getCursorPosition();
471
+            var line = session.doc.getLine(cursor.row);
472
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
473
+            if (rightChar == ']') {
474
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
475
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
476
+                    CstyleBehaviour.popAutoInsertedClosing();
477
+                    return {
478
+                        text: '',
479
+                        selection: [1, 1]
480
+                    };
481
+                }
482
+            }
483
+        }
484
+    });
485
+
486
+    this.add("brackets", "deletion", function(state, action, editor, session, range) {
487
+        var selected = session.doc.getTextRange(range);
488
+        if (!range.isMultiLine() && selected == '[') {
489
+            initContext(editor);
490
+            var line = session.doc.getLine(range.start.row);
491
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
492
+            if (rightChar == ']') {
493
+                range.end.column++;
494
+                return range;
495
+            }
496
+        }
497
+    });
498
+
499
+    this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
500
+        if (text == '"' || text == "'") {
501
+            initContext(editor);
502
+            var quote = text;
503
+            var selection = editor.getSelectionRange();
504
+            var selected = session.doc.getTextRange(selection);
505
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
506
+                return {
507
+                    text: quote + selected + quote,
508
+                    selection: false
509
+                };
510
+            } else {
511
+                var cursor = editor.getCursorPosition();
512
+                var line = session.doc.getLine(cursor.row);
513
+                var leftChar = line.substring(cursor.column-1, cursor.column);
514
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
515
+                
516
+                var token = session.getTokenAt(cursor.row, cursor.column);
517
+                var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
518
+                if (leftChar == "\\" && token && /escape/.test(token.type))
519
+                    return null;
520
+                
521
+                var stringBefore = token && /string/.test(token.type);
522
+                var stringAfter = !rightToken || /string/.test(rightToken.type);
523
+                
524
+                var pair;
525
+                if (rightChar == quote) {
526
+                    pair = stringBefore !== stringAfter;
527
+                } else {
528
+                    if (stringBefore && !stringAfter)
529
+                        return null; // wrap string with different quote
530
+                    if (stringBefore && stringAfter)
531
+                        return null; // do not pair quotes inside strings 
532
+                    var wordRe = session.$mode.tokenRe;
533
+                    wordRe.lastIndex = 0;
534
+                    var isWordBefore = wordRe.test(leftChar);
535
+                    wordRe.lastIndex = 0;
536
+                    var isWordAfter = wordRe.test(leftChar);
537
+                    if (isWordBefore || isWordAfter)
538
+                        return null; // before or after alphanumeric
539
+                    if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
540
+                        return null; // there is rightChar and it isn't closing
541
+                    pair = true;
542
+                }
543
+                return {
544
+                    text: pair ? quote + quote : "",
545
+                    selection: [1,1]
546
+                };
547
+            }
548
+        }
549
+    });
550
+
551
+    this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
552
+        var selected = session.doc.getTextRange(range);
553
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
554
+            initContext(editor);
555
+            var line = session.doc.getLine(range.start.row);
556
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
557
+            if (rightChar == selected) {
558
+                range.end.column++;
559
+                return range;
560
+            }
561
+        }
562
+    });
563
+
564
+};
565
+
566
+    
567
+CstyleBehaviour.isSaneInsertion = function(editor, session) {
568
+    var cursor = editor.getCursorPosition();
569
+    var iterator = new TokenIterator(session, cursor.row, cursor.column);
570
+    if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
571
+        var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
572
+        if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
573
+            return false;
574
+    }
575
+    iterator.stepForward();
576
+    return iterator.getCurrentTokenRow() !== cursor.row ||
577
+        this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
578
+};
579
+
580
+CstyleBehaviour.$matchTokenType = function(token, types) {
581
+    return types.indexOf(token.type || token) > -1;
582
+};
583
+
584
+CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
585
+    var cursor = editor.getCursorPosition();
586
+    var line = session.doc.getLine(cursor.row);
587
+    if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
588
+        context.autoInsertedBrackets = 0;
589
+    context.autoInsertedRow = cursor.row;
590
+    context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
591
+    context.autoInsertedBrackets++;
592
+};
593
+
594
+CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
595
+    var cursor = editor.getCursorPosition();
596
+    var line = session.doc.getLine(cursor.row);
597
+    if (!this.isMaybeInsertedClosing(cursor, line))
598
+        context.maybeInsertedBrackets = 0;
599
+    context.maybeInsertedRow = cursor.row;
600
+    context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
601
+    context.maybeInsertedLineEnd = line.substr(cursor.column);
602
+    context.maybeInsertedBrackets++;
603
+};
604
+
605
+CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
606
+    return context.autoInsertedBrackets > 0 &&
607
+        cursor.row === context.autoInsertedRow &&
608
+        bracket === context.autoInsertedLineEnd[0] &&
609
+        line.substr(cursor.column) === context.autoInsertedLineEnd;
610
+};
611
+
612
+CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
613
+    return context.maybeInsertedBrackets > 0 &&
614
+        cursor.row === context.maybeInsertedRow &&
615
+        line.substr(cursor.column) === context.maybeInsertedLineEnd &&
616
+        line.substr(0, cursor.column) == context.maybeInsertedLineStart;
617
+};
618
+
619
+CstyleBehaviour.popAutoInsertedClosing = function() {
620
+    context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
621
+    context.autoInsertedBrackets--;
622
+};
623
+
624
+CstyleBehaviour.clearMaybeInsertedClosing = function() {
625
+    if (context) {
626
+        context.maybeInsertedBrackets = 0;
627
+        context.maybeInsertedRow = -1;
628
+    }
629
+};
630
+
631
+
632
+
633
+oop.inherits(CstyleBehaviour, Behaviour);
634
+
635
+exports.CstyleBehaviour = CstyleBehaviour;
636
+});
637
+
638
+ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
639
+"use strict";
640
+
641
+var oop = require("../../lib/oop");
642
+var Range = require("../../range").Range;
643
+var BaseFoldMode = require("./fold_mode").FoldMode;
644
+
645
+var FoldMode = exports.FoldMode = function(commentRegex) {
646
+    if (commentRegex) {
647
+        this.foldingStartMarker = new RegExp(
648
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
649
+        );
650
+        this.foldingStopMarker = new RegExp(
651
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
652
+        );
653
+    }
654
+};
655
+oop.inherits(FoldMode, BaseFoldMode);
656
+
657
+(function() {
658
+    
659
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
660
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
661
+    this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
662
+    this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
663
+    this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
664
+    this._getFoldWidgetBase = this.getFoldWidget;
665
+    this.getFoldWidget = function(session, foldStyle, row) {
666
+        var line = session.getLine(row);
667
+    
668
+        if (this.singleLineBlockCommentRe.test(line)) {
669
+            if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
670
+                return "";
671
+        }
672
+    
673
+        var fw = this._getFoldWidgetBase(session, foldStyle, row);
674
+    
675
+        if (!fw && this.startRegionRe.test(line))
676
+            return "start"; // lineCommentRegionStart
677
+    
678
+        return fw;
679
+    };
680
+
681
+    this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
682
+        var line = session.getLine(row);
683
+        
684
+        if (this.startRegionRe.test(line))
685
+            return this.getCommentRegionBlock(session, line, row);
686
+        
687
+        var match = line.match(this.foldingStartMarker);
688
+        if (match) {
689
+            var i = match.index;
690
+
691
+            if (match[1])
692
+                return this.openingBracketBlock(session, match[1], row, i);
693
+                
694
+            var range = session.getCommentFoldRange(row, i + match[0].length, 1);
695
+            
696
+            if (range && !range.isMultiLine()) {
697
+                if (forceMultiline) {
698
+                    range = this.getSectionRange(session, row);
699
+                } else if (foldStyle != "all")
700
+                    range = null;
701
+            }
702
+            
703
+            return range;
704
+        }
705
+
706
+        if (foldStyle === "markbegin")
707
+            return;
708
+
709
+        var match = line.match(this.foldingStopMarker);
710
+        if (match) {
711
+            var i = match.index + match[0].length;
712
+
713
+            if (match[1])
714
+                return this.closingBracketBlock(session, match[1], row, i);
715
+
716
+            return session.getCommentFoldRange(row, i, -1);
717
+        }
718
+    };
719
+    
720
+    this.getSectionRange = function(session, row) {
721
+        var line = session.getLine(row);
722
+        var startIndent = line.search(/\S/);
723
+        var startRow = row;
724
+        var startColumn = line.length;
725
+        row = row + 1;
726
+        var endRow = row;
727
+        var maxRow = session.getLength();
728
+        while (++row < maxRow) {
729
+            line = session.getLine(row);
730
+            var indent = line.search(/\S/);
731
+            if (indent === -1)
732
+                continue;
733
+            if  (startIndent > indent)
734
+                break;
735
+            var subRange = this.getFoldWidgetRange(session, "all", row);
736
+            
737
+            if (subRange) {
738
+                if (subRange.start.row <= startRow) {
739
+                    break;
740
+                } else if (subRange.isMultiLine()) {
741
+                    row = subRange.end.row;
742
+                } else if (startIndent == indent) {
743
+                    break;
744
+                }
745
+            }
746
+            endRow = row;
747
+        }
748
+        
749
+        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
750
+    };
751
+    
752
+    this.getCommentRegionBlock = function(session, line, row) {
753
+        var startColumn = line.search(/\s*$/);
754
+        var maxRow = session.getLength();
755
+        var startRow = row;
756
+        
757
+        var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
758
+        var depth = 1;
759
+        while (++row < maxRow) {
760
+            line = session.getLine(row);
761
+            var m = re.exec(line);
762
+            if (!m) continue;
763
+            if (m[1]) depth--;
764
+            else depth++;
765
+
766
+            if (!depth) break;
767
+        }
768
+
769
+        var endRow = row;
770
+        if (endRow > startRow) {
771
+            return new Range(startRow, startColumn, endRow, line.length);
772
+        }
773
+    };
774
+
775
+}).call(FoldMode.prototype);
776
+
777
+});
778
+
779
+ace.define("ace/mode/c_cpp",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/c_cpp_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
780
+"use strict";
781
+
782
+var oop = require("../lib/oop");
783
+var TextMode = require("./text").Mode;
784
+var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
785
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
786
+var Range = require("../range").Range;
787
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
788
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
789
+
790
+var Mode = function() {
791
+    this.HighlightRules = c_cppHighlightRules;
792
+
793
+    this.$outdent = new MatchingBraceOutdent();
794
+    this.$behaviour = new CstyleBehaviour();
795
+
796
+    this.foldingRules = new CStyleFoldMode();
797
+};
798
+oop.inherits(Mode, TextMode);
799
+
800
+(function() {
801
+
802
+    this.lineCommentStart = "//";
803
+    this.blockComment = {start: "/*", end: "*/"};
804
+
805
+    this.getNextLineIndent = function(state, line, tab) {
806
+        var indent = this.$getIndent(line);
807
+
808
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
809
+        var tokens = tokenizedLine.tokens;
810
+        var endState = tokenizedLine.state;
811
+
812
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
813
+            return indent;
814
+        }
815
+
816
+        if (state == "start") {
817
+            var match = line.match(/^.*[\{\(\[]\s*$/);
818
+            if (match) {
819
+                indent += tab;
820
+            }
821
+        } else if (state == "doc-start") {
822
+            if (endState == "start") {
823
+                return "";
824
+            }
825
+            var match = line.match(/^\s*(\/?)\*/);
826
+            if (match) {
827
+                if (match[1]) {
828
+                    indent += " ";
829
+                }
830
+                indent += "* ";
831
+            }
832
+        }
833
+
834
+        return indent;
835
+    };
836
+
837
+    this.checkOutdent = function(state, line, input) {
838
+        return this.$outdent.checkOutdent(line, input);
839
+    };
840
+
841
+    this.autoOutdent = function(state, doc, row) {
842
+        this.$outdent.autoOutdent(doc, row);
843
+    };
844
+
845
+    this.$id = "ace/mode/c_cpp";
846
+}).call(Mode.prototype);
847
+
848
+exports.Mode = Mode;
849
+});
850
+
851
+ace.define("ace/mode/nix_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
852
+    "use strict";
853
+
854
+    var oop = require("../lib/oop");
855
+    var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
856
+
857
+    var NixHighlightRules = function() {
858
+
859
+        var constantLanguage = "true|false";
860
+        var keywordControl = "with|import|if|else|then|inherit";
861
+        var keywordDeclaration = "let|in|rec";
862
+
863
+        var keywordMapper = this.createKeywordMapper({
864
+            "constant.language.nix": constantLanguage,
865
+            "keyword.control.nix": keywordControl,
866
+            "keyword.declaration.nix": keywordDeclaration
867
+        }, "identifier");
868
+
869
+        this.$rules = {
870
+            "start": [{
871
+                    token: "comment",
872
+                    regex: /#.*$/
873
+                }, {
874
+                    token: "comment",
875
+                    regex: /\/\*/,
876
+                    next: "comment"
877
+                }, {
878
+                    token: "constant",
879
+                    regex: "<[^>]+>"
880
+                }, {
881
+                    regex: "(==|!=|<=?|>=?)",
882
+                    token: ["keyword.operator.comparison.nix"]
883
+                }, {
884
+                    regex: "((?:[+*/%-]|\\~)=)",
885
+                    token: ["keyword.operator.assignment.arithmetic.nix"]
886
+                }, {
887
+                    regex: "=",
888
+                    token: "keyword.operator.assignment.nix"
889
+                }, {
890
+                    token: "string",
891
+                    regex: "''",
892
+                    next: "qqdoc"
893
+                }, {
894
+                    token: "string",
895
+                    regex: "'",
896
+                    next: "qstring"
897
+                }, {
898
+                    token: "string",
899
+                    regex: '"',
900
+                    push: "qqstring"
901
+                }, {
902
+                    token: "constant.numeric", // hex
903
+                    regex: "0[xX][0-9a-fA-F]+\\b"
904
+                }, {
905
+                    token: "constant.numeric", // float
906
+                    regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
907
+                }, {
908
+                    token: keywordMapper,
909
+                    regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
910
+                }, {
911
+                    regex: "}",
912
+                    token: function(val, start, stack) {
913
+                        return stack[1] && stack[1].charAt(0) == "q" ? "constant.language.escape" : "text";
914
+                    },
915
+                    next: "pop"
916
+                }],
917
+            "comment": [{
918
+                token: "comment", // closing comment
919
+                regex: ".*?\\*\\/",
920
+                next: "start"
921
+            }, {
922
+                token: "comment", // comment spanning whole line
923
+                regex: ".+"
924
+            }],
925
+            "qqdoc": [
926
+                {
927
+                    token: "constant.language.escape",
928
+                    regex: /\$\{/,
929
+                    push: "start"
930
+                }, {
931
+                    token: "string",
932
+                    regex: "''",
933
+                    next: "pop"
934
+                }, {
935
+                    defaultToken: "string"
936
+                }],
937
+            "qqstring": [
938
+                {
939
+                    token: "constant.language.escape",
940
+                    regex: /\$\{/,
941
+                    push: "start"
942
+                }, {
943
+                    token: "string",
944
+                    regex: '"',
945
+                    next: "pop"
946
+                }, {
947
+                    defaultToken: "string"
948
+                }],
949
+            "qstring": [
950
+                {
951
+                    token: "constant.language.escape",
952
+                    regex: /\$\{/,
953
+                    push: "start"
954
+                }, {
955
+                    token: "string",
956
+                    regex: "'",
957
+                    next: "pop"
958
+                }, {
959
+                    defaultToken: "string"
960
+                }]
961
+        };
962
+
963
+        this.normalizeRules();
964
+    };
965
+
966
+    oop.inherits(NixHighlightRules, TextHighlightRules);
967
+
968
+    exports.NixHighlightRules = NixHighlightRules;
969
+});
970
+
971
+ace.define("ace/mode/nix",["require","exports","module","ace/lib/oop","ace/mode/c_cpp","ace/mode/nix_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
972
+"use strict";
973
+
974
+var oop = require("../lib/oop");
975
+var CMode = require("./c_cpp").Mode;
976
+var NixHighlightRules = require("./nix_highlight_rules").NixHighlightRules;
977
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
978
+
979
+var Mode = function() {
980
+    CMode.call(this);
981
+    this.HighlightRules = NixHighlightRules;
982
+    this.foldingRules = new CStyleFoldMode();
983
+};
984
+oop.inherits(Mode, CMode);
985
+
986
+(function() { 
987
+    this.lineCommentStart = "#";
988
+    this.blockComment = {start: "/*", end: "*/"};
989
+    this.$id = "ace/mode/nix";
990
+}).call(Mode.prototype);
991
+
992
+exports.Mode = Mode;
993
+});

+ 731
- 0
generator/lib/ace/mode-objectivec.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 414
- 0
generator/lib/ace/mode-ocaml.js Parādīt failu

@@ -0,0 +1,414 @@
1
+ace.define("ace/mode/ocaml_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 OcamlHighlightRules = function() {
8
+
9
+    var keywords = (
10
+        "and|as|assert|begin|class|constraint|do|done|downto|else|end|"  +
11
+        "exception|external|for|fun|function|functor|if|in|include|"     +
12
+        "inherit|initializer|lazy|let|match|method|module|mutable|new|"  +
13
+        "object|of|open|or|private|rec|sig|struct|then|to|try|type|val|" +
14
+        "virtual|when|while|with"
15
+    );
16
+
17
+    var builtinConstants = ("true|false");
18
+
19
+    var builtinFunctions = (
20
+        "abs|abs_big_int|abs_float|abs_num|abstract_tag|accept|access|acos|add|" +
21
+        "add_available_units|add_big_int|add_buffer|add_channel|add_char|" +
22
+        "add_initializer|add_int_big_int|add_interfaces|add_num|add_string|" +
23
+        "add_substitute|add_substring|alarm|allocated_bytes|allow_only|" +
24
+        "allow_unsafe_modules|always|append|appname_get|appname_set|" +
25
+        "approx_num_exp|approx_num_fix|arg|argv|arith_status|array|" +
26
+        "array1_of_genarray|array2_of_genarray|array3_of_genarray|asin|asr|" +
27
+        "assoc|assq|at_exit|atan|atan2|auto_synchronize|background|basename|" +
28
+        "beginning_of_input|big_int_of_int|big_int_of_num|big_int_of_string|bind|" +
29
+        "bind_class|bind_tag|bits|bits_of_float|black|blit|blit_image|blue|bool|" +
30
+        "bool_of_string|bounded_full_split|bounded_split|bounded_split_delim|" +
31
+        "bprintf|break|broadcast|bscanf|button_down|c_layout|capitalize|cardinal|" +
32
+        "cardinal|catch|catch_break|ceil|ceiling_num|channel|char|char_of_int|" +
33
+        "chdir|check|check_suffix|chmod|choose|chop_extension|chop_suffix|chown|" +
34
+        "chown|chr|chroot|classify_float|clear|clear_available_units|" +
35
+        "clear_close_on_exec|clear_graph|clear_nonblock|clear_parser|" +
36
+        "close|close|closeTk|close_box|close_graph|close_in|close_in_noerr|" +
37
+        "close_out|close_out_noerr|close_process|close_process|" +
38
+        "close_process_full|close_process_in|close_process_out|close_subwindow|" +
39
+        "close_tag|close_tbox|closedir|closedir|closure_tag|code|combine|" +
40
+        "combine|combine|command|compact|compare|compare_big_int|compare_num|" +
41
+        "complex32|complex64|concat|conj|connect|contains|contains_from|contents|" +
42
+        "copy|cos|cosh|count|count|counters|create|create_alarm|create_image|" +
43
+        "create_matrix|create_matrix|create_matrix|create_object|" +
44
+        "create_object_and_run_initializers|create_object_opt|create_process|" +
45
+        "create_process|create_process_env|create_process_env|create_table|" +
46
+        "current|current_dir_name|current_point|current_x|current_y|curveto|" +
47
+        "custom_tag|cyan|data_size|decr|decr_num|default_available_units|delay|" +
48
+        "delete_alarm|descr_of_in_channel|descr_of_out_channel|destroy|diff|dim|" +
49
+        "dim1|dim2|dim3|dims|dirname|display_mode|div|div_big_int|div_num|" +
50
+        "double_array_tag|double_tag|draw_arc|draw_char|draw_circle|draw_ellipse|" +
51
+        "draw_image|draw_poly|draw_poly_line|draw_rect|draw_segments|draw_string|" +
52
+        "dummy_pos|dummy_table|dump_image|dup|dup2|elements|empty|end_of_input|" +
53
+        "environment|eprintf|epsilon_float|eq_big_int|eq_num|equal|err_formatter|" +
54
+        "error_message|escaped|establish_server|executable_name|execv|execve|execvp|" +
55
+        "execvpe|exists|exists2|exit|exp|failwith|fast_sort|fchmod|fchown|field|" +
56
+        "file|file_exists|fill|fill_arc|fill_circle|fill_ellipse|fill_poly|fill_rect|" +
57
+        "filter|final_tag|finalise|find|find_all|first_chars|firstkey|flatten|" +
58
+        "float|float32|float64|float_of_big_int|float_of_bits|float_of_int|" +
59
+        "float_of_num|float_of_string|floor|floor_num|flush|flush_all|flush_input|" +
60
+        "flush_str_formatter|fold|fold_left|fold_left2|fold_right|fold_right2|" +
61
+        "for_all|for_all2|force|force_newline|force_val|foreground|fork|" +
62
+        "format_of_string|formatter_of_buffer|formatter_of_out_channel|" +
63
+        "fortran_layout|forward_tag|fprintf|frexp|from|from_channel|from_file|" +
64
+        "from_file_bin|from_function|from_string|fscanf|fst|fstat|ftruncate|" +
65
+        "full_init|full_major|full_split|gcd_big_int|ge_big_int|ge_num|" +
66
+        "genarray_of_array1|genarray_of_array2|genarray_of_array3|get|" +
67
+        "get_all_formatter_output_functions|get_approx_printing|get_copy|" +
68
+        "get_ellipsis_text|get_error_when_null_denominator|get_floating_precision|" +
69
+        "get_formatter_output_functions|get_formatter_tag_functions|get_image|" +
70
+        "get_margin|get_mark_tags|get_max_boxes|get_max_indent|get_method|" +
71
+        "get_method_label|get_normalize_ratio|get_normalize_ratio_when_printing|" +
72
+        "get_print_tags|get_state|get_variable|getcwd|getegid|getegid|getenv|" +
73
+        "getenv|getenv|geteuid|geteuid|getgid|getgid|getgrgid|getgrgid|getgrnam|" +
74
+        "getgrnam|getgroups|gethostbyaddr|gethostbyname|gethostname|getitimer|" +
75
+        "getlogin|getpeername|getpid|getppid|getprotobyname|getprotobynumber|" +
76
+        "getpwnam|getpwuid|getservbyname|getservbyport|getsockname|getsockopt|" +
77
+        "getsockopt_float|getsockopt_int|getsockopt_optint|gettimeofday|getuid|" +
78
+        "global_replace|global_substitute|gmtime|green|grid|group_beginning|" +
79
+        "group_end|gt_big_int|gt_num|guard|handle_unix_error|hash|hash_param|" +
80
+        "hd|header_size|i|id|ignore|in_channel_length|in_channel_of_descr|incr|" +
81
+        "incr_num|index|index_from|inet_addr_any|inet_addr_of_string|infinity|" +
82
+        "infix_tag|init|init_class|input|input_binary_int|input_byte|input_char|" +
83
+        "input_line|input_value|int|int16_signed|int16_unsigned|int32|int64|" +
84
+        "int8_signed|int8_unsigned|int_of_big_int|int_of_char|int_of_float|" +
85
+        "int_of_num|int_of_string|integer_num|inter|interactive|inv|invalid_arg|" +
86
+        "is_block|is_empty|is_implicit|is_int|is_int_big_int|is_integer_num|" +
87
+        "is_relative|iter|iter2|iteri|join|junk|key_pressed|kill|kind|kprintf|" +
88
+        "kscanf|land|last_chars|layout|lazy_from_fun|lazy_from_val|lazy_is_val|" +
89
+        "lazy_tag|ldexp|le_big_int|le_num|length|lexeme|lexeme_char|lexeme_end|" +
90
+        "lexeme_end_p|lexeme_start|lexeme_start_p|lineto|link|list|listen|lnot|" +
91
+        "loadfile|loadfile_private|localtime|lock|lockf|log|log10|logand|lognot|" +
92
+        "logor|logxor|lor|lower_window|lowercase|lseek|lsl|lsr|lstat|lt_big_int|" +
93
+        "lt_num|lxor|magenta|magic|mainLoop|major|major_slice|make|make_formatter|" +
94
+        "make_image|make_lexer|make_matrix|make_self_init|map|map2|map_file|mapi|" +
95
+        "marshal|match_beginning|match_end|matched_group|matched_string|max|" +
96
+        "max_array_length|max_big_int|max_elt|max_float|max_int|max_num|" +
97
+        "max_string_length|mem|mem_assoc|mem_assq|memq|merge|min|min_big_int|" +
98
+        "min_elt|min_float|min_int|min_num|minor|minus_big_int|minus_num|" +
99
+        "minus_one|mkdir|mkfifo|mktime|mod|mod_big_int|mod_float|mod_num|modf|" +
100
+        "mouse_pos|moveto|mul|mult_big_int|mult_int_big_int|mult_num|nan|narrow|" +
101
+        "nat_of_num|nativeint|neg|neg_infinity|new_block|new_channel|new_method|" +
102
+        "new_variable|next|nextkey|nice|nice|no_scan_tag|norm|norm2|not|npeek|" +
103
+        "nth|nth_dim|num_digits_big_int|num_dims|num_of_big_int|num_of_int|" +
104
+        "num_of_nat|num_of_ratio|num_of_string|O|obj|object_tag|ocaml_version|" +
105
+        "of_array|of_channel|of_float|of_int|of_int32|of_list|of_nativeint|" +
106
+        "of_string|one|openTk|open_box|open_connection|open_graph|open_hbox|" +
107
+        "open_hovbox|open_hvbox|open_in|open_in_bin|open_in_gen|open_out|" +
108
+        "open_out_bin|open_out_gen|open_process|open_process_full|open_process_in|" +
109
+        "open_process_out|open_subwindow|open_tag|open_tbox|open_temp_file|" +
110
+        "open_vbox|opendbm|opendir|openfile|or|os_type|out_channel_length|" +
111
+        "out_channel_of_descr|output|output_binary_int|output_buffer|output_byte|" +
112
+        "output_char|output_string|output_value|over_max_boxes|pack|params|" +
113
+        "parent_dir_name|parse|parse_argv|partition|pause|peek|pipe|pixels|" +
114
+        "place|plot|plots|point_color|polar|poll|pop|pos_in|pos_out|pow|" +
115
+        "power_big_int_positive_big_int|power_big_int_positive_int|" +
116
+        "power_int_positive_big_int|power_int_positive_int|power_num|" +
117
+        "pp_close_box|pp_close_tag|pp_close_tbox|pp_force_newline|" +
118
+        "pp_get_all_formatter_output_functions|pp_get_ellipsis_text|" +
119
+        "pp_get_formatter_output_functions|pp_get_formatter_tag_functions|" +
120
+        "pp_get_margin|pp_get_mark_tags|pp_get_max_boxes|pp_get_max_indent|" +
121
+        "pp_get_print_tags|pp_open_box|pp_open_hbox|pp_open_hovbox|pp_open_hvbox|" +
122
+        "pp_open_tag|pp_open_tbox|pp_open_vbox|pp_over_max_boxes|pp_print_as|" +
123
+        "pp_print_bool|pp_print_break|pp_print_char|pp_print_cut|pp_print_float|" +
124
+        "pp_print_flush|pp_print_if_newline|pp_print_int|pp_print_newline|" +
125
+        "pp_print_space|pp_print_string|pp_print_tab|pp_print_tbreak|" +
126
+        "pp_set_all_formatter_output_functions|pp_set_ellipsis_text|" +
127
+        "pp_set_formatter_out_channel|pp_set_formatter_output_functions|" +
128
+        "pp_set_formatter_tag_functions|pp_set_margin|pp_set_mark_tags|" +
129
+        "pp_set_max_boxes|pp_set_max_indent|pp_set_print_tags|pp_set_tab|" +
130
+        "pp_set_tags|pred|pred_big_int|pred_num|prerr_char|prerr_endline|" +
131
+        "prerr_float|prerr_int|prerr_newline|prerr_string|print|print_as|" +
132
+        "print_bool|print_break|print_char|print_cut|print_endline|print_float|" +
133
+        "print_flush|print_if_newline|print_int|print_newline|print_space|" +
134
+        "print_stat|print_string|print_tab|print_tbreak|printf|prohibit|" +
135
+        "public_method_label|push|putenv|quo_num|quomod_big_int|quote|raise|" +
136
+        "raise_window|ratio_of_num|rcontains_from|read|read_float|read_int|" +
137
+        "read_key|read_line|readdir|readdir|readlink|really_input|receive|recv|" +
138
+        "recvfrom|red|ref|regexp|regexp_case_fold|regexp_string|" +
139
+        "regexp_string_case_fold|register|register_exception|rem|remember_mode|" +
140
+        "remove|remove_assoc|remove_assq|rename|replace|replace_first|" +
141
+        "replace_matched|repr|reset|reshape|reshape_1|reshape_2|reshape_3|rev|" +
142
+        "rev_append|rev_map|rev_map2|rewinddir|rgb|rhs_end|rhs_end_pos|rhs_start|" +
143
+        "rhs_start_pos|rindex|rindex_from|rlineto|rmdir|rmoveto|round_num|" +
144
+        "run_initializers|run_initializers_opt|scanf|search_backward|" +
145
+        "search_forward|seek_in|seek_out|select|self|self_init|send|sendto|set|" +
146
+        "set_all_formatter_output_functions|set_approx_printing|" +
147
+        "set_binary_mode_in|set_binary_mode_out|set_close_on_exec|" +
148
+        "set_close_on_exec|set_color|set_ellipsis_text|" +
149
+        "set_error_when_null_denominator|set_field|set_floating_precision|" +
150
+        "set_font|set_formatter_out_channel|set_formatter_output_functions|" +
151
+        "set_formatter_tag_functions|set_line_width|set_margin|set_mark_tags|" +
152
+        "set_max_boxes|set_max_indent|set_method|set_nonblock|set_nonblock|" +
153
+        "set_normalize_ratio|set_normalize_ratio_when_printing|set_print_tags|" +
154
+        "set_signal|set_state|set_tab|set_tag|set_tags|set_text_size|" +
155
+        "set_window_title|setgid|setgid|setitimer|setitimer|setsid|setsid|" +
156
+        "setsockopt|setsockopt|setsockopt_float|setsockopt_float|setsockopt_int|" +
157
+        "setsockopt_int|setsockopt_optint|setsockopt_optint|setuid|setuid|" +
158
+        "shift_left|shift_left|shift_left|shift_right|shift_right|shift_right|" +
159
+        "shift_right_logical|shift_right_logical|shift_right_logical|show_buckets|" +
160
+        "shutdown|shutdown|shutdown_connection|shutdown_connection|sigabrt|" +
161
+        "sigalrm|sigchld|sigcont|sigfpe|sighup|sigill|sigint|sigkill|sign_big_int|" +
162
+        "sign_num|signal|signal|sigpending|sigpending|sigpipe|sigprocmask|" +
163
+        "sigprocmask|sigprof|sigquit|sigsegv|sigstop|sigsuspend|sigsuspend|" +
164
+        "sigterm|sigtstp|sigttin|sigttou|sigusr1|sigusr2|sigvtalrm|sin|singleton|" +
165
+        "sinh|size|size|size_x|size_y|sleep|sleep|sleep|slice_left|slice_left|" +
166
+        "slice_left_1|slice_left_2|slice_right|slice_right|slice_right_1|" +
167
+        "slice_right_2|snd|socket|socket|socket|socketpair|socketpair|sort|sound|" +
168
+        "split|split_delim|sprintf|sprintf|sqrt|sqrt|sqrt_big_int|square_big_int|" +
169
+        "square_num|sscanf|stable_sort|stable_sort|stable_sort|stable_sort|stable_sort|" +
170
+        "stable_sort|stat|stat|stat|stat|stat|stats|stats|std_formatter|stdbuf|" +
171
+        "stderr|stderr|stderr|stdib|stdin|stdin|stdin|stdout|stdout|stdout|" +
172
+        "str_formatter|string|string_after|string_before|string_match|" +
173
+        "string_of_big_int|string_of_bool|string_of_float|string_of_format|" +
174
+        "string_of_inet_addr|string_of_inet_addr|string_of_int|string_of_num|" +
175
+        "string_partial_match|string_tag|sub|sub|sub_big_int|sub_left|sub_num|" +
176
+        "sub_right|subset|subset|substitute_first|substring|succ|succ|" +
177
+        "succ|succ|succ_big_int|succ_num|symbol_end|symbol_end_pos|symbol_start|" +
178
+        "symbol_start_pos|symlink|symlink|sync|synchronize|system|system|system|" +
179
+        "tag|take|tan|tanh|tcdrain|tcdrain|tcflow|tcflow|tcflush|tcflush|" +
180
+        "tcgetattr|tcgetattr|tcsendbreak|tcsendbreak|tcsetattr|tcsetattr|" +
181
+        "temp_file|text_size|time|time|time|timed_read|timed_write|times|times|" +
182
+        "tl|tl|tl|to_buffer|to_channel|to_float|to_hex|to_int|to_int32|to_list|" +
183
+        "to_list|to_list|to_nativeint|to_string|to_string|to_string|to_string|" +
184
+        "to_string|top|top|total_size|transfer|transp|truncate|truncate|truncate|" +
185
+        "truncate|truncate|truncate|try_lock|umask|umask|uncapitalize|uncapitalize|" +
186
+        "uncapitalize|union|union|unit_big_int|unlink|unlink|unlock|unmarshal|" +
187
+        "unsafe_blit|unsafe_fill|unsafe_get|unsafe_get|unsafe_set|unsafe_set|" +
188
+        "update|uppercase|uppercase|uppercase|uppercase|usage|utimes|utimes|wait|" +
189
+        "wait|wait|wait|wait_next_event|wait_pid|wait_read|wait_signal|" +
190
+        "wait_timed_read|wait_timed_write|wait_write|waitpid|white|" +
191
+        "widen|window_id|word_size|wrap|wrap_abort|write|yellow|yield|zero|zero_big_int|" +
192
+
193
+        "Arg|Arith_status|Array|Array1|Array2|Array3|ArrayLabels|Big_int|Bigarray|" +
194
+        "Buffer|Callback|CamlinternalOO|Char|Complex|Condition|Dbm|Digest|Dynlink|" +
195
+        "Event|Filename|Format|Gc|Genarray|Genlex|Graphics|GraphicsX11|Hashtbl|" +
196
+        "Int32|Int64|LargeFile|Lazy|Lexing|List|ListLabels|Make|Map|Marshal|" +
197
+        "MoreLabels|Mutex|Nativeint|Num|Obj|Oo|Parsing|Pervasives|Printexc|" +
198
+        "Printf|Queue|Random|Scanf|Scanning|Set|Sort|Stack|State|StdLabels|Str|" +
199
+        "Stream|String|StringLabels|Sys|Thread|ThreadUnix|Tk|Unix|UnixLabels|Weak"
200
+    );
201
+
202
+    var keywordMapper = this.createKeywordMapper({
203
+        "variable.language": "this",
204
+        "keyword": keywords,
205
+        "constant.language": builtinConstants,
206
+        "support.function": builtinFunctions
207
+    }, "identifier");
208
+
209
+    var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
210
+    var octInteger = "(?:0[oO]?[0-7]+)";
211
+    var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
212
+    var binInteger = "(?:0[bB][01]+)";
213
+    var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
214
+
215
+    var exponent = "(?:[eE][+-]?\\d+)";
216
+    var fraction = "(?:\\.\\d+)";
217
+    var intPart = "(?:\\d+)";
218
+    var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
219
+    var exponentFloat = "(?:(?:" + pointFloat + "|" +  intPart + ")" + exponent + ")";
220
+    var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
221
+
222
+    this.$rules = {
223
+        "start" : [
224
+            {
225
+                token : "comment",
226
+                regex : '\\(\\*.*?\\*\\)\\s*?$'
227
+            },
228
+            {
229
+                token : "comment",
230
+                regex : '\\(\\*.*',
231
+                next : "comment"
232
+            },
233
+            {
234
+                token : "string", // single line
235
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
236
+            },
237
+            {
238
+                token : "string", // single char
239
+                regex : "'.'"
240
+            },
241
+            {
242
+                token : "string", // " string
243
+                regex : '"',
244
+                next  : "qstring"
245
+            },
246
+            {
247
+                token : "constant.numeric", // imaginary
248
+                regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
249
+            },
250
+            {
251
+                token : "constant.numeric", // float
252
+                regex : floatNumber
253
+            },
254
+            {
255
+                token : "constant.numeric", // integer
256
+                regex : integer + "\\b"
257
+            },
258
+            {
259
+                token : keywordMapper,
260
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
261
+            },
262
+            {
263
+                token : "keyword.operator",
264
+                regex : "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|="
265
+            },
266
+            {
267
+                token : "paren.lparen",
268
+                regex : "[[({]"
269
+            },
270
+            {
271
+                token : "paren.rparen",
272
+                regex : "[\\])}]"
273
+            },
274
+            {
275
+                token : "text",
276
+                regex : "\\s+"
277
+            }
278
+        ],
279
+        "comment" : [
280
+            {
281
+                token : "comment", // closing comment
282
+                regex : ".*?\\*\\)",
283
+                next : "start"
284
+            },
285
+            {
286
+                token : "comment", // comment spanning whole line
287
+                regex : ".+"
288
+            }
289
+        ],
290
+
291
+        "qstring" : [
292
+            {
293
+                token : "string",
294
+                regex : '"',
295
+                next : "start"
296
+            }, {
297
+                token : "string",
298
+                regex : '.+'
299
+            }
300
+        ]
301
+    };
302
+};
303
+
304
+oop.inherits(OcamlHighlightRules, TextHighlightRules);
305
+
306
+exports.OcamlHighlightRules = OcamlHighlightRules;
307
+});
308
+
309
+ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
310
+"use strict";
311
+
312
+var Range = require("../range").Range;
313
+
314
+var MatchingBraceOutdent = function() {};
315
+
316
+(function() {
317
+
318
+    this.checkOutdent = function(line, input) {
319
+        if (! /^\s+$/.test(line))
320
+            return false;
321
+
322
+        return /^\s*\}/.test(input);
323
+    };
324
+
325
+    this.autoOutdent = function(doc, row) {
326
+        var line = doc.getLine(row);
327
+        var match = line.match(/^(\s*\})/);
328
+
329
+        if (!match) return 0;
330
+
331
+        var column = match[1].length;
332
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
333
+
334
+        if (!openBracePos || openBracePos.row == row) return 0;
335
+
336
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
337
+        doc.replace(new Range(row, 0, row, column-1), indent);
338
+    };
339
+
340
+    this.$getIndent = function(line) {
341
+        return line.match(/^\s*/)[0];
342
+    };
343
+
344
+}).call(MatchingBraceOutdent.prototype);
345
+
346
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
347
+});
348
+
349
+ace.define("ace/mode/ocaml",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ocaml_highlight_rules","ace/mode/matching_brace_outdent","ace/range"], function(require, exports, module) {
350
+"use strict";
351
+
352
+var oop = require("../lib/oop");
353
+var TextMode = require("./text").Mode;
354
+var OcamlHighlightRules = require("./ocaml_highlight_rules").OcamlHighlightRules;
355
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
356
+var Range = require("../range").Range;
357
+
358
+var Mode = function() {
359
+    this.HighlightRules = OcamlHighlightRules;
360
+    
361
+    this.$outdent   = new MatchingBraceOutdent();
362
+};
363
+oop.inherits(Mode, TextMode);
364
+
365
+var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|with))\s*$/;
366
+
367
+(function() {
368
+
369
+    this.toggleCommentLines = function(state, doc, startRow, endRow) {
370
+        var i, line;
371
+        var outdent = true;
372
+        var re = /^\s*\(\*(.*)\*\)/;
373
+
374
+        for (i=startRow; i<= endRow; i++) {
375
+            if (!re.test(doc.getLine(i))) {
376
+                outdent = false;
377
+                break;
378
+            }
379
+        }
380
+
381
+        var range = new Range(0, 0, 0, 0);
382
+        for (i=startRow; i<= endRow; i++) {
383
+            line = doc.getLine(i);
384
+            range.start.row  = i;
385
+            range.end.row    = i;
386
+            range.end.column = line.length;
387
+
388
+            doc.replace(range, outdent ? line.match(re)[1] : "(*" + line + "*)");
389
+        }
390
+    };
391
+
392
+    this.getNextLineIndent = function(state, line, tab) {
393
+        var indent = this.$getIndent(line);
394
+        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
395
+
396
+        if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
397
+            state === 'start' && indenter.test(line))
398
+            indent += tab;
399
+        return indent;
400
+    };
401
+
402
+    this.checkOutdent = function(state, line, input) {
403
+        return this.$outdent.checkOutdent(line, input);
404
+    };
405
+
406
+    this.autoOutdent = function(state, doc, row) {
407
+        this.$outdent.autoOutdent(doc, row);
408
+    };
409
+
410
+    this.$id = "ace/mode/ocaml";
411
+}).call(Mode.prototype);
412
+
413
+exports.Mode = Mode;
414
+});

+ 197
- 0
generator/lib/ace/mode-pascal.js Parādīt failu

@@ -0,0 +1,197 @@
1
+ace.define("ace/mode/pascal_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 PascalHighlightRules = function() {
8
+
9
+    this.$rules = { start: 
10
+       [ { caseInsensitive: true,
11
+           token: 'keyword.control.pascal',
12
+           regex: '\\b(?:(absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class|const|constructor|destructor|div|do|do|else|end|except|export|exports|external|far|file|finalization|finally|for|forward|goto|if|implementation|import|in|inherited|initialization|interface|interrupt|is|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|shl|shr|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor))\\b' },
13
+         { caseInsensitive: true,           
14
+           token: 
15
+            [ 'variable.pascal', "text",
16
+              'storage.type.prototype.pascal',
17
+              'entity.name.function.prototype.pascal' ],
18
+           regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?(?=(?:\\(.*?\\))?;\\s*(?:attribute|forward|external))' },
19
+         { caseInsensitive: true,
20
+           token: 
21
+            [ 'variable.pascal', "text",
22
+              'storage.type.function.pascal',
23
+              'entity.name.function.pascal' ],
24
+           regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?' },
25
+         { token: 'constant.numeric.pascal',
26
+           regex: '\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b' },
27
+         { token: 'punctuation.definition.comment.pascal',
28
+           regex: '--.*$',
29
+           push_: 
30
+            [ { token: 'comment.line.double-dash.pascal.one',
31
+                regex: '$',
32
+                next: 'pop' },
33
+              { defaultToken: 'comment.line.double-dash.pascal.one' } ] },
34
+         { token: 'punctuation.definition.comment.pascal',
35
+           regex: '//.*$',
36
+           push_: 
37
+            [ { token: 'comment.line.double-slash.pascal.two',
38
+                regex: '$',
39
+                next: 'pop' },
40
+              { defaultToken: 'comment.line.double-slash.pascal.two' } ] },
41
+         { token: 'punctuation.definition.comment.pascal',
42
+           regex: '\\(\\*',
43
+           push: 
44
+            [ { token: 'punctuation.definition.comment.pascal',
45
+                regex: '\\*\\)',
46
+                next: 'pop' },
47
+              { defaultToken: 'comment.block.pascal.one' } ] },
48
+         { token: 'punctuation.definition.comment.pascal',
49
+           regex: '\\{',
50
+           push: 
51
+            [ { token: 'punctuation.definition.comment.pascal',
52
+                regex: '\\}',
53
+                next: 'pop' },
54
+              { defaultToken: 'comment.block.pascal.two' } ] },
55
+         { token: 'punctuation.definition.string.begin.pascal',
56
+           regex: '"',
57
+           push: 
58
+            [ { token: 'constant.character.escape.pascal', regex: '\\\\.' },
59
+              { token: 'punctuation.definition.string.end.pascal',
60
+                regex: '"',
61
+                next: 'pop' },
62
+              { defaultToken: 'string.quoted.double.pascal' } ],
63
+            },
64
+         { token: 'punctuation.definition.string.begin.pascal',
65
+           regex: '\'',
66
+           push: 
67
+            [ { token: 'constant.character.escape.apostrophe.pascal',
68
+                regex: '\'\'' },
69
+              { token: 'punctuation.definition.string.end.pascal',
70
+                regex: '\'',
71
+                next: 'pop' },
72
+              { defaultToken: 'string.quoted.single.pascal' } ] },
73
+          { token: 'keyword.operator',
74
+           regex: '[+\\-;,/*%]|:=|=' } ] }
75
+    
76
+    this.normalizeRules();
77
+};
78
+
79
+oop.inherits(PascalHighlightRules, TextHighlightRules);
80
+
81
+exports.PascalHighlightRules = PascalHighlightRules;
82
+});
83
+
84
+ace.define("ace/mode/folding/coffee",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode","ace/range"], function(require, exports, module) {
85
+"use strict";
86
+
87
+var oop = require("../../lib/oop");
88
+var BaseFoldMode = require("./fold_mode").FoldMode;
89
+var Range = require("../../range").Range;
90
+
91
+var FoldMode = exports.FoldMode = function() {};
92
+oop.inherits(FoldMode, BaseFoldMode);
93
+
94
+(function() {
95
+
96
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
97
+        var range = this.indentationBlock(session, row);
98
+        if (range)
99
+            return range;
100
+
101
+        var re = /\S/;
102
+        var line = session.getLine(row);
103
+        var startLevel = line.search(re);
104
+        if (startLevel == -1 || line[startLevel] != "#")
105
+            return;
106
+
107
+        var startColumn = line.length;
108
+        var maxRow = session.getLength();
109
+        var startRow = row;
110
+        var endRow = row;
111
+
112
+        while (++row < maxRow) {
113
+            line = session.getLine(row);
114
+            var level = line.search(re);
115
+
116
+            if (level == -1)
117
+                continue;
118
+
119
+            if (line[level] != "#")
120
+                break;
121
+
122
+            endRow = row;
123
+        }
124
+
125
+        if (endRow > startRow) {
126
+            var endColumn = session.getLine(endRow).length;
127
+            return new Range(startRow, startColumn, endRow, endColumn);
128
+        }
129
+    };
130
+    this.getFoldWidget = function(session, foldStyle, row) {
131
+        var line = session.getLine(row);
132
+        var indent = line.search(/\S/);
133
+        var next = session.getLine(row + 1);
134
+        var prev = session.getLine(row - 1);
135
+        var prevIndent = prev.search(/\S/);
136
+        var nextIndent = next.search(/\S/);
137
+
138
+        if (indent == -1) {
139
+            session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
140
+            return "";
141
+        }
142
+        if (prevIndent == -1) {
143
+            if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
144
+                session.foldWidgets[row - 1] = "";
145
+                session.foldWidgets[row + 1] = "";
146
+                return "start";
147
+            }
148
+        } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
149
+            if (session.getLine(row - 2).search(/\S/) == -1) {
150
+                session.foldWidgets[row - 1] = "start";
151
+                session.foldWidgets[row + 1] = "";
152
+                return "";
153
+            }
154
+        }
155
+
156
+        if (prevIndent!= -1 && prevIndent < indent)
157
+            session.foldWidgets[row - 1] = "start";
158
+        else
159
+            session.foldWidgets[row - 1] = "";
160
+
161
+        if (indent < nextIndent)
162
+            return "start";
163
+        else
164
+            return "";
165
+    };
166
+
167
+}).call(FoldMode.prototype);
168
+
169
+});
170
+
171
+ace.define("ace/mode/pascal",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/pascal_highlight_rules","ace/mode/folding/coffee"], function(require, exports, module) {
172
+"use strict";
173
+
174
+var oop = require("../lib/oop");
175
+var TextMode = require("./text").Mode;
176
+var PascalHighlightRules = require("./pascal_highlight_rules").PascalHighlightRules;
177
+var FoldMode = require("./folding/coffee").FoldMode;
178
+
179
+var Mode = function() {
180
+    this.HighlightRules = PascalHighlightRules;
181
+    this.foldingRules = new FoldMode();
182
+};
183
+oop.inherits(Mode, TextMode);
184
+
185
+(function() {
186
+       
187
+    this.lineCommentStart = ["--", "//"];
188
+    this.blockComment = [
189
+        {start: "(*", end: "*)"},
190
+        {start: "{", end: "}"}
191
+    ];
192
+    
193
+    this.$id = "ace/mode/pascal";
194
+}).call(Mode.prototype);
195
+
196
+exports.Mode = Mode;
197
+});

+ 0
- 0
generator/lib/ace/mode-perl.js Parādīt failu


Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels

Notiek ielāde…
Atcelt
Saglabāt