ace-rails-ap 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ace/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/ace/ace.js +403 -326
  4. data/vendor/assets/javascripts/ace/ext-language_tools.js +56 -40
  5. data/vendor/assets/javascripts/ace/ext-modelist.js +7 -3
  6. data/vendor/assets/javascripts/ace/ext-settings_menu.js +8 -4
  7. data/vendor/assets/javascripts/ace/ext-static_highlight.js +12 -5
  8. data/vendor/assets/javascripts/ace/keybinding-vim.js +5234 -1558
  9. data/vendor/assets/javascripts/ace/mode-abap.js +1 -1
  10. data/vendor/assets/javascripts/ace/mode-abc.js +261 -0
  11. data/vendor/assets/javascripts/ace/mode-actionscript.js +47 -1
  12. data/vendor/assets/javascripts/ace/mode-apache_conf.js +47 -1
  13. data/vendor/assets/javascripts/ace/mode-applescript.js +47 -1
  14. data/vendor/assets/javascripts/ace/mode-autohotkey.js +47 -1
  15. data/vendor/assets/javascripts/ace/mode-batchfile.js +47 -1
  16. data/vendor/assets/javascripts/ace/mode-c_cpp.js +101 -56
  17. data/vendor/assets/javascripts/ace/mode-coffee.js +3 -3
  18. data/vendor/assets/javascripts/ace/mode-coldfusion.js +114 -63
  19. data/vendor/assets/javascripts/ace/mode-csharp.js +99 -55
  20. data/vendor/assets/javascripts/ace/mode-css.js +98 -53
  21. data/vendor/assets/javascripts/ace/mode-curly.js +114 -63
  22. data/vendor/assets/javascripts/ace/mode-d.js +47 -1
  23. data/vendor/assets/javascripts/ace/mode-dart.js +103 -58
  24. data/vendor/assets/javascripts/ace/mode-diff.js +85 -85
  25. data/vendor/assets/javascripts/ace/mode-django.js +114 -63
  26. data/vendor/assets/javascripts/ace/mode-dockerfile.js +97 -52
  27. data/vendor/assets/javascripts/ace/mode-dot.js +47 -1
  28. data/vendor/assets/javascripts/ace/mode-eiffel.js +30 -37
  29. data/vendor/assets/javascripts/ace/mode-ejs.js +117 -63
  30. data/vendor/assets/javascripts/ace/mode-elm.js +47 -1
  31. data/vendor/assets/javascripts/ace/mode-erlang.js +47 -1
  32. data/vendor/assets/javascripts/ace/mode-forth.js +47 -1
  33. data/vendor/assets/javascripts/ace/mode-ftl.js +10 -7
  34. data/vendor/assets/javascripts/ace/mode-glsl.js +101 -56
  35. data/vendor/assets/javascripts/ace/mode-golang.js +96 -51
  36. data/vendor/assets/javascripts/ace/mode-groovy.js +98 -53
  37. data/vendor/assets/javascripts/ace/mode-haml.js +3 -0
  38. data/vendor/assets/javascripts/ace/mode-handlebars.js +114 -63
  39. data/vendor/assets/javascripts/ace/mode-haskell.js +49 -3
  40. data/vendor/assets/javascripts/ace/mode-haxe.js +96 -51
  41. data/vendor/assets/javascripts/ace/mode-html.js +114 -63
  42. data/vendor/assets/javascripts/ace/mode-html_ruby.js +117 -63
  43. data/vendor/assets/javascripts/ace/mode-io.js +47 -1
  44. data/vendor/assets/javascripts/ace/mode-jack.js +96 -51
  45. data/vendor/assets/javascripts/ace/mode-jade.js +10 -7
  46. data/vendor/assets/javascripts/ace/mode-java.js +98 -53
  47. data/vendor/assets/javascripts/ace/mode-javascript.js +98 -53
  48. data/vendor/assets/javascripts/ace/mode-json.js +99 -54
  49. data/vendor/assets/javascripts/ace/mode-jsoniq.js +98 -51
  50. data/vendor/assets/javascripts/ace/mode-jsp.js +106 -58
  51. data/vendor/assets/javascripts/ace/mode-jsx.js +96 -51
  52. data/vendor/assets/javascripts/ace/mode-julia.js +47 -1
  53. data/vendor/assets/javascripts/ace/mode-latex.js +1 -1
  54. data/vendor/assets/javascripts/ace/mode-lean.js +281 -0
  55. data/vendor/assets/javascripts/ace/mode-less.js +96 -51
  56. data/vendor/assets/javascripts/ace/mode-liquid.js +10 -7
  57. data/vendor/assets/javascripts/ace/mode-live_script.js +481 -0
  58. data/vendor/assets/javascripts/ace/mode-livescript.js +5 -8
  59. data/vendor/assets/javascripts/ace/mode-logiql.js +49 -50
  60. data/vendor/assets/javascripts/ace/mode-lsl.js +96 -51
  61. data/vendor/assets/javascripts/ace/mode-lua.js +3 -3
  62. data/vendor/assets/javascripts/ace/mode-luapage.js +117 -66
  63. data/vendor/assets/javascripts/ace/mode-makefile.js +1 -1
  64. data/vendor/assets/javascripts/ace/mode-markdown.js +134 -67
  65. data/vendor/assets/javascripts/ace/mode-mask.js +1985 -0
  66. data/vendor/assets/javascripts/ace/mode-mel.js +96 -51
  67. data/vendor/assets/javascripts/ace/mode-mips_assembler.js +235 -0
  68. data/vendor/assets/javascripts/ace/mode-mipsassembler.js +196 -0
  69. data/vendor/assets/javascripts/ace/mode-nix.js +101 -56
  70. data/vendor/assets/javascripts/ace/mode-objectivec.js +52 -6
  71. data/vendor/assets/javascripts/ace/mode-perl.js +47 -1
  72. data/vendor/assets/javascripts/ace/mode-pgsql.js +1 -1
  73. data/vendor/assets/javascripts/ace/mode-php.js +139 -85
  74. data/vendor/assets/javascripts/ace/mode-powershell.js +96 -51
  75. data/vendor/assets/javascripts/ace/mode-praat.js +47 -1
  76. data/vendor/assets/javascripts/ace/mode-prolog.js +47 -1
  77. data/vendor/assets/javascripts/ace/mode-protobuf.js +101 -56
  78. data/vendor/assets/javascripts/ace/mode-rdoc.js +1 -1
  79. data/vendor/assets/javascripts/ace/mode-rhtml.js +114 -63
  80. data/vendor/assets/javascripts/ace/mode-ruby.js +52 -50
  81. data/vendor/assets/javascripts/ace/mode-rust.js +57 -18
  82. data/vendor/assets/javascripts/ace/mode-scad.js +96 -51
  83. data/vendor/assets/javascripts/ace/mode-scala.js +98 -53
  84. data/vendor/assets/javascripts/ace/mode-scss.js +96 -51
  85. data/vendor/assets/javascripts/ace/mode-sh.js +97 -52
  86. data/vendor/assets/javascripts/ace/mode-sjs.js +98 -53
  87. data/vendor/assets/javascripts/ace/mode-smarty.js +114 -63
  88. data/vendor/assets/javascripts/ace/mode-soy_template.js +114 -63
  89. data/vendor/assets/javascripts/ace/mode-stylus.js +1 -1
  90. data/vendor/assets/javascripts/ace/mode-svg.js +132 -65
  91. data/vendor/assets/javascripts/ace/mode-tcl.js +47 -1
  92. data/vendor/assets/javascripts/ace/mode-twig.js +114 -63
  93. data/vendor/assets/javascripts/ace/mode-typescript.js +98 -53
  94. data/vendor/assets/javascripts/ace/mode-vala.js +96 -51
  95. data/vendor/assets/javascripts/ace/mode-velocity.js +114 -63
  96. data/vendor/assets/javascripts/ace/mode-vhdl.js +21 -21
  97. data/vendor/assets/javascripts/ace/mode-xml.js +34 -12
  98. data/vendor/assets/javascripts/ace/mode-xquery.js +98 -51
  99. data/vendor/assets/javascripts/ace/snippets/abc.js +38 -0
  100. data/vendor/assets/javascripts/ace/snippets/elixir.js +7 -0
  101. data/vendor/assets/javascripts/ace/snippets/elm.js +7 -0
  102. data/vendor/assets/javascripts/ace/snippets/lean.js +7 -0
  103. data/vendor/assets/javascripts/ace/snippets/live_script.js +7 -0
  104. data/vendor/assets/javascripts/ace/snippets/mask.js +7 -0
  105. data/vendor/assets/javascripts/ace/snippets/mips_assembler.js +7 -0
  106. data/vendor/assets/javascripts/ace/snippets/mipsassembler.js +7 -0
  107. data/vendor/assets/javascripts/ace/snippets/r.js +1 -1
  108. data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +1 -1
  109. data/vendor/assets/javascripts/ace/theme-github.js +7 -1
  110. data/vendor/assets/javascripts/ace/theme-katzenmilch.js +3 -0
  111. data/vendor/assets/javascripts/ace/theme-kuroir.js +3 -0
  112. data/vendor/assets/javascripts/ace/worker-coffee.js +6 -7
  113. data/vendor/assets/javascripts/ace/worker-css.js +5 -5
  114. data/vendor/assets/javascripts/ace/worker-html.js +4354 -4354
  115. data/vendor/assets/javascripts/ace/worker-javascript.js +2435 -1397
  116. data/vendor/assets/javascripts/ace/worker-json.js +6 -7
  117. data/vendor/assets/javascripts/ace/worker-lua.js +11 -11
  118. data/vendor/assets/javascripts/ace/worker-php.js +4 -8
  119. data/vendor/assets/javascripts/ace/worker-xml.js +3809 -0
  120. data/vendor/assets/javascripts/ace/worker-xquery.js +38 -47
  121. metadata +18 -9
  122. data/vendor/assets/javascripts/ace/ext-options.js +0 -252
  123. data/vendor/assets/javascripts/ace/mode-html_completions.js +0 -309
  124. data/vendor/assets/javascripts/ace/mode-luahtml.js +0 -2415
  125. data/vendor/assets/javascripts/ace/mode-mushcode_high_rules.js +0 -569
  126. data/vendor/assets/javascripts/ace/mode-tmsnippet.js +0 -200
  127. data/vendor/assets/javascripts/ace/theme-kr.js +0 -105
@@ -123,6 +123,19 @@ var initContext = function(editor) {
123
123
  };
124
124
  };
125
125
 
126
+ var getWrapped = function(selection, selected, opening, closing) {
127
+ var rowDiff = selection.end.row - selection.start.row;
128
+ return {
129
+ text: opening + selected + closing,
130
+ selection: [
131
+ 0,
132
+ selection.start.column + 1,
133
+ rowDiff,
134
+ selection.end.column + (rowDiff ? 0 : 1)
135
+ ]
136
+ };
137
+ };
138
+
126
139
  var CstyleBehaviour = function() {
127
140
  this.add("braces", "insertion", function(state, action, editor, session, text) {
128
141
  var cursor = editor.getCursorPosition();
@@ -132,10 +145,7 @@ var CstyleBehaviour = function() {
132
145
  var selection = editor.getSelectionRange();
133
146
  var selected = session.doc.getTextRange(selection);
134
147
  if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
135
- return {
136
- text: '{' + selected + '}',
137
- selection: false
138
- };
148
+ return getWrapped(selection, selected, '{', '}');
139
149
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
140
150
  if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
141
151
  CstyleBehaviour.recordAutoInsert(editor, session, "}");
@@ -215,10 +225,7 @@ var CstyleBehaviour = function() {
215
225
  var selection = editor.getSelectionRange();
216
226
  var selected = session.doc.getTextRange(selection);
217
227
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
218
- return {
219
- text: '(' + selected + ')',
220
- selection: false
221
- };
228
+ return getWrapped(selection, selected, '(', ')');
222
229
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
223
230
  CstyleBehaviour.recordAutoInsert(editor, session, ")");
224
231
  return {
@@ -263,10 +270,7 @@ var CstyleBehaviour = function() {
263
270
  var selection = editor.getSelectionRange();
264
271
  var selected = session.doc.getTextRange(selection);
265
272
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
266
- return {
267
- text: '[' + selected + ']',
268
- selection: false
269
- };
273
+ return getWrapped(selection, selected, '[', ']');
270
274
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
271
275
  CstyleBehaviour.recordAutoInsert(editor, session, "]");
272
276
  return {
@@ -312,49 +316,44 @@ var CstyleBehaviour = function() {
312
316
  var selection = editor.getSelectionRange();
313
317
  var selected = session.doc.getTextRange(selection);
314
318
  if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
315
- return {
316
- text: quote + selected + quote,
317
- selection: false
318
- };
319
- } else {
319
+ return getWrapped(selection, selected, quote, quote);
320
+ } else if (!selected) {
320
321
  var cursor = editor.getCursorPosition();
321
322
  var line = session.doc.getLine(cursor.row);
322
323
  var leftChar = line.substring(cursor.column-1, cursor.column);
323
- if (leftChar == '\\') {
324
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
325
+
326
+ var token = session.getTokenAt(cursor.row, cursor.column);
327
+ var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
328
+ if (leftChar == "\\" && token && /escape/.test(token.type))
324
329
  return null;
330
+
331
+ var stringBefore = token && /string/.test(token.type);
332
+ var stringAfter = !rightToken || /string/.test(rightToken.type);
333
+
334
+ var pair;
335
+ if (rightChar == quote) {
336
+ pair = stringBefore !== stringAfter;
337
+ } else {
338
+ if (stringBefore && !stringAfter)
339
+ return null; // wrap string with different quote
340
+ if (stringBefore && stringAfter)
341
+ return null; // do not pair quotes inside strings
342
+ var wordRe = session.$mode.tokenRe;
343
+ wordRe.lastIndex = 0;
344
+ var isWordBefore = wordRe.test(leftChar);
345
+ wordRe.lastIndex = 0;
346
+ var isWordAfter = wordRe.test(leftChar);
347
+ if (isWordBefore || isWordAfter)
348
+ return null; // before or after alphanumeric
349
+ if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
350
+ return null; // there is rightChar and it isn't closing
351
+ pair = true;
325
352
  }
326
- var tokens = session.getTokens(selection.start.row);
327
- var col = 0, token;
328
- var quotepos = -1; // Track whether we're inside an open quote.
329
-
330
- for (var x = 0; x < tokens.length; x++) {
331
- token = tokens[x];
332
- if (token.type == "string") {
333
- quotepos = -1;
334
- } else if (quotepos < 0) {
335
- quotepos = token.value.indexOf(quote);
336
- }
337
- if ((token.value.length + col) > selection.start.column) {
338
- break;
339
- }
340
- col += tokens[x].value.length;
341
- }
342
- if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
343
- if (!CstyleBehaviour.isSaneInsertion(editor, session))
344
- return;
345
- return {
346
- text: quote + quote,
347
- selection: [1,1]
348
- };
349
- } else if (token && token.type === "string") {
350
- var rightChar = line.substring(cursor.column, cursor.column + 1);
351
- if (rightChar == quote) {
352
- return {
353
- text: '',
354
- selection: [1, 1]
355
- };
356
- }
357
- }
353
+ return {
354
+ text: pair ? quote + quote : "",
355
+ selection: [1,1]
356
+ };
358
357
  }
359
358
  }
360
359
  });
@@ -466,12 +465,35 @@ var FoldMode = exports.FoldMode = function(commentRegex) {
466
465
  oop.inherits(FoldMode, BaseFoldMode);
467
466
 
468
467
  (function() {
469
-
468
+
470
469
  this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
471
470
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
471
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
472
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
473
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
474
+ this._getFoldWidgetBase = this.getFoldWidget;
475
+ this.getFoldWidget = function(session, foldStyle, row) {
476
+ var line = session.getLine(row);
477
+
478
+ if (this.singleLineBlockCommentRe.test(line)) {
479
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
480
+ return "";
481
+ }
482
+
483
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
484
+
485
+ if (!fw && this.startRegionRe.test(line))
486
+ return "start"; // lineCommentRegionStart
487
+
488
+ return fw;
489
+ };
472
490
 
473
491
  this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
474
492
  var line = session.getLine(row);
493
+
494
+ if (this.startRegionRe.test(line))
495
+ return this.getCommentRegionBlock(session, line, row);
496
+
475
497
  var match = line.match(this.foldingStartMarker);
476
498
  if (match) {
477
499
  var i = match.index;
@@ -536,6 +558,29 @@ oop.inherits(FoldMode, BaseFoldMode);
536
558
 
537
559
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
538
560
  };
561
+
562
+ this.getCommentRegionBlock = function(session, line, row) {
563
+ var startColumn = line.search(/\s*$/);
564
+ var maxRow = session.getLength();
565
+ var startRow = row;
566
+
567
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
568
+ var depth = 1;
569
+ while (++row < maxRow) {
570
+ line = session.getLine(row);
571
+ var m = re.exec(line);
572
+ if (!m) continue;
573
+ if (m[1]) depth--;
574
+ else depth++;
575
+
576
+ if (!depth) break;
577
+ }
578
+
579
+ var endRow = row;
580
+ if (endRow > startRow) {
581
+ return new Range(startRow, startColumn, endRow, line.length);
582
+ }
583
+ };
539
584
 
540
585
  }).call(FoldMode.prototype);
541
586
 
@@ -0,0 +1,235 @@
1
+ define("ace/mode/mips_assembler_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 MIPSAssemblerHighlightRules = function() {
8
+
9
+ this.$rules = { start:
10
+ [ { token: 'support.function.pseudo.mips',
11
+ regex: '\\b(?:mul|abs|div|divu|mulo|mulou|neg|negu|not|rem|remu|rol|ror|li|seq|sge|sgeu|sgt|sgtu|sle|sleu|sne|b|beqz|bge|bgeu|bgt|bgtu|ble|bleu|blt|bltu|bnez|la|ld|ulh|ulhu|ulw|sd|ush|usw|move|mfc1\\.d|l\\.d|l\\.s|s\\.d|s\\.s)\\b',
12
+ comment: 'ok actually this are instructions, but one also could call them funtions…' },
13
+ { token: 'support.function.mips',
14
+ regex: '\\b(?:abs\\.d|abs\\.s|add|add\\.d|add\\.s|addi|addiu|addu|and|andi|bc1f|bc1t|beq|bgez|bgezal|bgtz|blez|bltz|bltzal|bne|break|c\\.eq\\.d|c\\.eq\\.s|c\\.le\\.d|c\\.le\\.s|c\\.lt\\.d|c\\.lt\\.s|ceil\\.w\\.d|ceil\\.w\\.s|clo|clz|cvt\\.d\\.s|cvt\\.d\\.w|cvt\\.s\\.d|cvt\\.s\\.w|cvt\\.w\\.d|cvt\\.w\\.s|div|div\\.d|div\\.s|divu|eret|floor\\.w\\.d|floor\\.w\\.s|j|jal|jalr|jr|lb|lbu|lh|lhu|ll|lui|lw|lwc1|lwl|lwr|madd|maddu|mfc0|mfc1|mfhi|mflo|mov\\.d|mov\\.s|movf|movf\\.d|movf\\.s|movn|movn\\.d|movn\\.s|movt|movt\\.d|movt\\.s|movz|movz\\.d|movz\\.s|msub|mtc0|mtc1|mthi|mtlo|mul|mul\\.d|mul\\.s|mult|multu|neg\\.d|neg\\.s|nop|nor|or|ori|round\\.w\\.d|round\\.w\\.s|sb|sc|sdc1|sh|sll|sllv|slt|slti|sltiu|sltu|sqrt\\.d|sqrt\\.s|sra|srav|srl|srlv|sub|sub\\.d|sub\\.s|subu|sw|swc1|swl|swr|syscall|teq|teqi|tge|tgei|tgeiu|tgeu|tlt|tlti|tltiu|tltu|trunc\\.w\\.d|trunc\\.w\\.s|xor|xori)\\b' },
15
+ { token: 'storage.type.mips',
16
+ regex: '\\.(?:ascii|asciiz|byte|data|double|float|half|kdata|ktext|space|text|word|set\\s*(?:noat|at))\\b' },
17
+ { token: 'storage.modifier.mips',
18
+ regex: '\\.(?:align|extern||globl)\\b' },
19
+ { token:
20
+ [ 'entity.name.function.label.mips',
21
+ 'meta.function.label.mips' ],
22
+ regex: '\\b([A-Za-z0-9_]+)(:)' },
23
+ { token:
24
+ [ 'punctuation.definition.variable.mips',
25
+ 'variable.other.register.usable.by-number.mips' ],
26
+ regex: '(\\$)(0|[2-9]|1[0-9]|2[0-5]|2[89]|3[0-1])\\b' },
27
+ { token:
28
+ [ 'punctuation.definition.variable.mips',
29
+ 'variable.other.register.usable.by-name.mips' ],
30
+ regex: '(\\$)(zero|v[01]|a[0-3]|t[0-9]|s[0-7]|gp|sp|fp|ra)\\b' },
31
+ { token:
32
+ [ 'punctuation.definition.variable.mips',
33
+ 'variable.other.register.reserved.mips' ],
34
+ regex: '(\\$)(at|k[01]|1|2[67])\\b' },
35
+ { token:
36
+ [ 'punctuation.definition.variable.mips',
37
+ 'variable.other.register.usable.floating-point.mips',
38
+ 'variable.other.register.usable.floating-point.mips' ],
39
+ regex: '(\\$)(f)([0-9]|1[0-9]|2[0-9]|3[0-1])\\b' },
40
+ { token: 'constant.numeric.float.mips',
41
+ regex: '\\b\\d+\\.\\d+\\b' },
42
+ { token: 'constant.numeric.integer.mips',
43
+ regex: '\\b(?:\\d+|0(?:x|X)[a-fA-F0-9]+)\\b' },
44
+ { token: 'punctuation.definition.string.begin.mips',
45
+ regex: '"',
46
+ push:
47
+ [ { token: 'punctuation.definition.string.end.mips',
48
+ regex: '"',
49
+ next: 'pop' },
50
+ { token: 'constant.character.escape.mips',
51
+ regex: '\\\\[rnt\\\\"]' },
52
+ { defaultToken: 'string.quoted.double.mips' } ] },
53
+ { token: 'punctuation.definition.comment.mips',
54
+ regex: '#',
55
+ push:
56
+ [ { token: 'comment.line.number-sign.mips',
57
+ regex: '$',
58
+ next: 'pop' },
59
+ { defaultToken: 'comment.line.number-sign.mips' } ] } ] }
60
+
61
+ this.normalizeRules();
62
+ };
63
+
64
+ MIPSAssemblerHighlightRules.metaData = { fileTypes: [ 's', 'mips', 'spim', 'asm' ],
65
+ keyEquivalent: '^~M',
66
+ name: 'MIPS Assembler',
67
+ scopeName: 'source.mips' }
68
+
69
+
70
+ oop.inherits(MIPSAssemblerHighlightRules, TextHighlightRules);
71
+
72
+ exports.MIPSAssemblerHighlightRules = MIPSAssemblerHighlightRules;
73
+ });
74
+
75
+ define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
76
+ "use strict";
77
+
78
+ var oop = require("../../lib/oop");
79
+ var Range = require("../../range").Range;
80
+ var BaseFoldMode = require("./fold_mode").FoldMode;
81
+
82
+ var FoldMode = exports.FoldMode = function(commentRegex) {
83
+ if (commentRegex) {
84
+ this.foldingStartMarker = new RegExp(
85
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
86
+ );
87
+ this.foldingStopMarker = new RegExp(
88
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
89
+ );
90
+ }
91
+ };
92
+ oop.inherits(FoldMode, BaseFoldMode);
93
+
94
+ (function() {
95
+
96
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
97
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
98
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
99
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
100
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
101
+ this._getFoldWidgetBase = this.getFoldWidget;
102
+ this.getFoldWidget = function(session, foldStyle, row) {
103
+ var line = session.getLine(row);
104
+
105
+ if (this.singleLineBlockCommentRe.test(line)) {
106
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
107
+ return "";
108
+ }
109
+
110
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
111
+
112
+ if (!fw && this.startRegionRe.test(line))
113
+ return "start"; // lineCommentRegionStart
114
+
115
+ return fw;
116
+ };
117
+
118
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
119
+ var line = session.getLine(row);
120
+
121
+ if (this.startRegionRe.test(line))
122
+ return this.getCommentRegionBlock(session, line, row);
123
+
124
+ var match = line.match(this.foldingStartMarker);
125
+ if (match) {
126
+ var i = match.index;
127
+
128
+ if (match[1])
129
+ return this.openingBracketBlock(session, match[1], row, i);
130
+
131
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
132
+
133
+ if (range && !range.isMultiLine()) {
134
+ if (forceMultiline) {
135
+ range = this.getSectionRange(session, row);
136
+ } else if (foldStyle != "all")
137
+ range = null;
138
+ }
139
+
140
+ return range;
141
+ }
142
+
143
+ if (foldStyle === "markbegin")
144
+ return;
145
+
146
+ var match = line.match(this.foldingStopMarker);
147
+ if (match) {
148
+ var i = match.index + match[0].length;
149
+
150
+ if (match[1])
151
+ return this.closingBracketBlock(session, match[1], row, i);
152
+
153
+ return session.getCommentFoldRange(row, i, -1);
154
+ }
155
+ };
156
+
157
+ this.getSectionRange = function(session, row) {
158
+ var line = session.getLine(row);
159
+ var startIndent = line.search(/\S/);
160
+ var startRow = row;
161
+ var startColumn = line.length;
162
+ row = row + 1;
163
+ var endRow = row;
164
+ var maxRow = session.getLength();
165
+ while (++row < maxRow) {
166
+ line = session.getLine(row);
167
+ var indent = line.search(/\S/);
168
+ if (indent === -1)
169
+ continue;
170
+ if (startIndent > indent)
171
+ break;
172
+ var subRange = this.getFoldWidgetRange(session, "all", row);
173
+
174
+ if (subRange) {
175
+ if (subRange.start.row <= startRow) {
176
+ break;
177
+ } else if (subRange.isMultiLine()) {
178
+ row = subRange.end.row;
179
+ } else if (startIndent == indent) {
180
+ break;
181
+ }
182
+ }
183
+ endRow = row;
184
+ }
185
+
186
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
187
+ };
188
+
189
+ this.getCommentRegionBlock = function(session, line, row) {
190
+ var startColumn = line.search(/\s*$/);
191
+ var maxRow = session.getLength();
192
+ var startRow = row;
193
+
194
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
195
+ var depth = 1;
196
+ while (++row < maxRow) {
197
+ line = session.getLine(row);
198
+ var m = re.exec(line);
199
+ if (!m) continue;
200
+ if (m[1]) depth--;
201
+ else depth++;
202
+
203
+ if (!depth) break;
204
+ }
205
+
206
+ var endRow = row;
207
+ if (endRow > startRow) {
208
+ return new Range(startRow, startColumn, endRow, line.length);
209
+ }
210
+ };
211
+
212
+ }).call(FoldMode.prototype);
213
+
214
+ });
215
+
216
+ define("ace/mode/mips_assembler",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mips_assembler_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
217
+ "use strict";
218
+
219
+ var oop = require("../lib/oop");
220
+ var TextMode = require("./text").Mode;
221
+ var MIPSAssemblerHighlightRules = require("./mips_assembler_highlight_rules").MIPSAssemblerHighlightRules;
222
+ var FoldMode = require("./folding/cstyle").FoldMode;
223
+
224
+ var Mode = function() {
225
+ this.HighlightRules = MIPSAssemblerHighlightRules;
226
+ this.foldingRules = new FoldMode();
227
+ };
228
+ oop.inherits(Mode, TextMode);
229
+
230
+ (function() {
231
+ this.$id = "ace/mode/mips_assembler"
232
+ }).call(Mode.prototype);
233
+
234
+ exports.Mode = Mode;
235
+ });
@@ -0,0 +1,196 @@
1
+ define("ace/mode/mipsassembler_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 mipsassemblerHighlightRules = function() {
8
+
9
+ this.$rules = {
10
+ start: [{
11
+ token: "string.start",
12
+ regex: '"',
13
+ next: "qstring"
14
+ }],
15
+ qstring: [{
16
+ token: "escape",
17
+ regex: /\\./,
18
+ }, {
19
+ token: "string.end",
20
+ regex: '"',
21
+ next: "start"
22
+ }],
23
+ }
24
+
25
+ this.normalizeRules();
26
+ };
27
+
28
+ mipsassemblerHighlightRules.metaData =
29
+
30
+
31
+ oop.inherits(mipsassemblerHighlightRules, TextHighlightRules);
32
+
33
+ exports.mipsassemblerHighlightRules = mipsassemblerHighlightRules;
34
+ });
35
+
36
+ define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
37
+ "use strict";
38
+
39
+ var oop = require("../../lib/oop");
40
+ var Range = require("../../range").Range;
41
+ var BaseFoldMode = require("./fold_mode").FoldMode;
42
+
43
+ var FoldMode = exports.FoldMode = function(commentRegex) {
44
+ if (commentRegex) {
45
+ this.foldingStartMarker = new RegExp(
46
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
47
+ );
48
+ this.foldingStopMarker = new RegExp(
49
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
50
+ );
51
+ }
52
+ };
53
+ oop.inherits(FoldMode, BaseFoldMode);
54
+
55
+ (function() {
56
+
57
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
58
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
59
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
60
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
61
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
62
+ this._getFoldWidgetBase = this.getFoldWidget;
63
+ this.getFoldWidget = function(session, foldStyle, row) {
64
+ var line = session.getLine(row);
65
+
66
+ if (this.singleLineBlockCommentRe.test(line)) {
67
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
68
+ return "";
69
+ }
70
+
71
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
72
+
73
+ if (!fw && this.startRegionRe.test(line))
74
+ return "start"; // lineCommentRegionStart
75
+
76
+ return fw;
77
+ };
78
+
79
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
80
+ var line = session.getLine(row);
81
+
82
+ if (this.startRegionRe.test(line))
83
+ return this.getCommentRegionBlock(session, line, row);
84
+
85
+ var match = line.match(this.foldingStartMarker);
86
+ if (match) {
87
+ var i = match.index;
88
+
89
+ if (match[1])
90
+ return this.openingBracketBlock(session, match[1], row, i);
91
+
92
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
93
+
94
+ if (range && !range.isMultiLine()) {
95
+ if (forceMultiline) {
96
+ range = this.getSectionRange(session, row);
97
+ } else if (foldStyle != "all")
98
+ range = null;
99
+ }
100
+
101
+ return range;
102
+ }
103
+
104
+ if (foldStyle === "markbegin")
105
+ return;
106
+
107
+ var match = line.match(this.foldingStopMarker);
108
+ if (match) {
109
+ var i = match.index + match[0].length;
110
+
111
+ if (match[1])
112
+ return this.closingBracketBlock(session, match[1], row, i);
113
+
114
+ return session.getCommentFoldRange(row, i, -1);
115
+ }
116
+ };
117
+
118
+ this.getSectionRange = function(session, row) {
119
+ var line = session.getLine(row);
120
+ var startIndent = line.search(/\S/);
121
+ var startRow = row;
122
+ var startColumn = line.length;
123
+ row = row + 1;
124
+ var endRow = row;
125
+ var maxRow = session.getLength();
126
+ while (++row < maxRow) {
127
+ line = session.getLine(row);
128
+ var indent = line.search(/\S/);
129
+ if (indent === -1)
130
+ continue;
131
+ if (startIndent > indent)
132
+ break;
133
+ var subRange = this.getFoldWidgetRange(session, "all", row);
134
+
135
+ if (subRange) {
136
+ if (subRange.start.row <= startRow) {
137
+ break;
138
+ } else if (subRange.isMultiLine()) {
139
+ row = subRange.end.row;
140
+ } else if (startIndent == indent) {
141
+ break;
142
+ }
143
+ }
144
+ endRow = row;
145
+ }
146
+
147
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
148
+ };
149
+
150
+ this.getCommentRegionBlock = function(session, line, row) {
151
+ var startColumn = line.search(/\s*$/);
152
+ var maxRow = session.getLength();
153
+ var startRow = row;
154
+
155
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
156
+ var depth = 1;
157
+ while (++row < maxRow) {
158
+ line = session.getLine(row);
159
+ var m = re.exec(line);
160
+ if (!m) continue;
161
+ if (m[1]) depth--;
162
+ else depth++;
163
+
164
+ if (!depth) break;
165
+ }
166
+
167
+ var endRow = row;
168
+ if (endRow > startRow) {
169
+ return new Range(startRow, startColumn, endRow, line.length);
170
+ }
171
+ };
172
+
173
+ }).call(FoldMode.prototype);
174
+
175
+ });
176
+
177
+ define("ace/mode/mipsassembler",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mipsassembler_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module) {
178
+ "use strict";
179
+
180
+ var oop = require("../lib/oop");
181
+ var TextMode = require("./text").Mode;
182
+ var HighlightRules = require("./mipsassembler_highlight_rules").HighlightRules;
183
+ var FoldMode = require("./folding/cstyle").FoldMode;
184
+
185
+ var Mode = function() {
186
+ this.HighlightRules = HighlightRules;
187
+ this.foldingRules = new FoldMode();
188
+ };
189
+ oop.inherits(Mode, TextMode);
190
+
191
+ (function() {
192
+ this.$id = "ace/mode/mipsassembler"
193
+ }).call(Mode.prototype);
194
+
195
+ exports.Mode = Mode;
196
+ });