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
@@ -73,7 +73,7 @@ var ShHighlightRules = function() {
73
73
  token : "keyword.operator"
74
74
  }, {
75
75
  stateName: "heredoc",
76
- regex : "(<<)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
76
+ regex : "(<<-?)(\\s*)(['\"`]?)([\\w\\-]+)(['\"`]?)",
77
77
  onMatch : function(value, currentState, stack) {
78
78
  var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
79
79
  var tokens = value.split(this.splitRegex);
@@ -176,7 +176,7 @@ var JavaScriptHighlightRules = function(options) {
176
176
  regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
177
177
  }, {
178
178
  token : ["punctuation.operator", "support.function.dom"],
179
- regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
179
+ regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
180
180
  }, {
181
181
  token : ["punctuation.operator", "support.constant"],
182
182
  regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
@@ -475,6 +475,19 @@ var initContext = function(editor) {
475
475
  };
476
476
  };
477
477
 
478
+ var getWrapped = function(selection, selected, opening, closing) {
479
+ var rowDiff = selection.end.row - selection.start.row;
480
+ return {
481
+ text: opening + selected + closing,
482
+ selection: [
483
+ 0,
484
+ selection.start.column + 1,
485
+ rowDiff,
486
+ selection.end.column + (rowDiff ? 0 : 1)
487
+ ]
488
+ };
489
+ };
490
+
478
491
  var CstyleBehaviour = function() {
479
492
  this.add("braces", "insertion", function(state, action, editor, session, text) {
480
493
  var cursor = editor.getCursorPosition();
@@ -484,10 +497,7 @@ var CstyleBehaviour = function() {
484
497
  var selection = editor.getSelectionRange();
485
498
  var selected = session.doc.getTextRange(selection);
486
499
  if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
487
- return {
488
- text: '{' + selected + '}',
489
- selection: false
490
- };
500
+ return getWrapped(selection, selected, '{', '}');
491
501
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
492
502
  if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
493
503
  CstyleBehaviour.recordAutoInsert(editor, session, "}");
@@ -567,10 +577,7 @@ var CstyleBehaviour = function() {
567
577
  var selection = editor.getSelectionRange();
568
578
  var selected = session.doc.getTextRange(selection);
569
579
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
570
- return {
571
- text: '(' + selected + ')',
572
- selection: false
573
- };
580
+ return getWrapped(selection, selected, '(', ')');
574
581
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
575
582
  CstyleBehaviour.recordAutoInsert(editor, session, ")");
576
583
  return {
@@ -615,10 +622,7 @@ var CstyleBehaviour = function() {
615
622
  var selection = editor.getSelectionRange();
616
623
  var selected = session.doc.getTextRange(selection);
617
624
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
618
- return {
619
- text: '[' + selected + ']',
620
- selection: false
621
- };
625
+ return getWrapped(selection, selected, '[', ']');
622
626
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
623
627
  CstyleBehaviour.recordAutoInsert(editor, session, "]");
624
628
  return {
@@ -664,49 +668,44 @@ var CstyleBehaviour = function() {
664
668
  var selection = editor.getSelectionRange();
665
669
  var selected = session.doc.getTextRange(selection);
666
670
  if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
667
- return {
668
- text: quote + selected + quote,
669
- selection: false
670
- };
671
- } else {
671
+ return getWrapped(selection, selected, quote, quote);
672
+ } else if (!selected) {
672
673
  var cursor = editor.getCursorPosition();
673
674
  var line = session.doc.getLine(cursor.row);
674
675
  var leftChar = line.substring(cursor.column-1, cursor.column);
675
- if (leftChar == '\\') {
676
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
677
+
678
+ var token = session.getTokenAt(cursor.row, cursor.column);
679
+ var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
680
+ if (leftChar == "\\" && token && /escape/.test(token.type))
676
681
  return null;
682
+
683
+ var stringBefore = token && /string/.test(token.type);
684
+ var stringAfter = !rightToken || /string/.test(rightToken.type);
685
+
686
+ var pair;
687
+ if (rightChar == quote) {
688
+ pair = stringBefore !== stringAfter;
689
+ } else {
690
+ if (stringBefore && !stringAfter)
691
+ return null; // wrap string with different quote
692
+ if (stringBefore && stringAfter)
693
+ return null; // do not pair quotes inside strings
694
+ var wordRe = session.$mode.tokenRe;
695
+ wordRe.lastIndex = 0;
696
+ var isWordBefore = wordRe.test(leftChar);
697
+ wordRe.lastIndex = 0;
698
+ var isWordAfter = wordRe.test(leftChar);
699
+ if (isWordBefore || isWordAfter)
700
+ return null; // before or after alphanumeric
701
+ if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
702
+ return null; // there is rightChar and it isn't closing
703
+ pair = true;
677
704
  }
678
- var tokens = session.getTokens(selection.start.row);
679
- var col = 0, token;
680
- var quotepos = -1; // Track whether we're inside an open quote.
681
-
682
- for (var x = 0; x < tokens.length; x++) {
683
- token = tokens[x];
684
- if (token.type == "string") {
685
- quotepos = -1;
686
- } else if (quotepos < 0) {
687
- quotepos = token.value.indexOf(quote);
688
- }
689
- if ((token.value.length + col) > selection.start.column) {
690
- break;
691
- }
692
- col += tokens[x].value.length;
693
- }
694
- 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)))) {
695
- if (!CstyleBehaviour.isSaneInsertion(editor, session))
696
- return;
697
- return {
698
- text: quote + quote,
699
- selection: [1,1]
700
- };
701
- } else if (token && token.type === "string") {
702
- var rightChar = line.substring(cursor.column, cursor.column + 1);
703
- if (rightChar == quote) {
704
- return {
705
- text: '',
706
- selection: [1, 1]
707
- };
708
- }
709
- }
705
+ return {
706
+ text: pair ? quote + quote : "",
707
+ selection: [1,1]
708
+ };
710
709
  }
711
710
  }
712
711
  });
@@ -818,12 +817,35 @@ var FoldMode = exports.FoldMode = function(commentRegex) {
818
817
  oop.inherits(FoldMode, BaseFoldMode);
819
818
 
820
819
  (function() {
821
-
820
+
822
821
  this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
823
822
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
823
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
824
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
825
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
826
+ this._getFoldWidgetBase = this.getFoldWidget;
827
+ this.getFoldWidget = function(session, foldStyle, row) {
828
+ var line = session.getLine(row);
829
+
830
+ if (this.singleLineBlockCommentRe.test(line)) {
831
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
832
+ return "";
833
+ }
834
+
835
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
836
+
837
+ if (!fw && this.startRegionRe.test(line))
838
+ return "start"; // lineCommentRegionStart
839
+
840
+ return fw;
841
+ };
824
842
 
825
843
  this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
826
844
  var line = session.getLine(row);
845
+
846
+ if (this.startRegionRe.test(line))
847
+ return this.getCommentRegionBlock(session, line, row);
848
+
827
849
  var match = line.match(this.foldingStartMarker);
828
850
  if (match) {
829
851
  var i = match.index;
@@ -888,6 +910,29 @@ oop.inherits(FoldMode, BaseFoldMode);
888
910
 
889
911
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
890
912
  };
913
+
914
+ this.getCommentRegionBlock = function(session, line, row) {
915
+ var startColumn = line.search(/\s*$/);
916
+ var maxRow = session.getLength();
917
+ var startRow = row;
918
+
919
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
920
+ var depth = 1;
921
+ while (++row < maxRow) {
922
+ line = session.getLine(row);
923
+ var m = re.exec(line);
924
+ if (!m) continue;
925
+ if (m[1]) depth--;
926
+ else depth++;
927
+
928
+ if (!depth) break;
929
+ }
930
+
931
+ var endRow = row;
932
+ if (endRow > startRow) {
933
+ return new Range(startRow, startColumn, endRow, line.length);
934
+ }
935
+ };
891
936
 
892
937
  }).call(FoldMode.prototype);
893
938
 
@@ -963,7 +1008,7 @@ oop.inherits(Mode, TextMode);
963
1008
  var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
964
1009
  worker.attachToDocument(session.getDocument());
965
1010
 
966
- worker.on("jslint", function(results) {
1011
+ worker.on("annotate", function(results) {
967
1012
  session.setAnnotations(results.data);
968
1013
  });
969
1014
 
@@ -987,6 +1032,9 @@ var oop = require("../lib/oop");
987
1032
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
988
1033
 
989
1034
  var XmlHighlightRules = function(normalize) {
1035
+
1036
+ var tagRegex = "[a-zA-Z][-_a-zA-Z0-9]*";
1037
+
990
1038
  this.$rules = {
991
1039
  start : [
992
1040
  {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
@@ -996,7 +1044,7 @@ var XmlHighlightRules = function(normalize) {
996
1044
  },
997
1045
  {
998
1046
  token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
999
- regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "processing_instruction",
1047
+ regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction",
1000
1048
  },
1001
1049
  {token : "comment.xml", regex : "<\\!--", next : "comment"},
1002
1050
  {
@@ -1012,7 +1060,7 @@ var XmlHighlightRules = function(normalize) {
1012
1060
 
1013
1061
  xml_decl : [{
1014
1062
  token : "entity.other.attribute-name.decl-attribute-name.xml",
1015
- regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
1063
+ regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
1016
1064
  }, {
1017
1065
  token : "keyword.operator.decl-attribute-equals.xml",
1018
1066
  regex : "="
@@ -1048,7 +1096,7 @@ var XmlHighlightRules = function(normalize) {
1048
1096
  next: "pop"
1049
1097
  }, {
1050
1098
  token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
1051
- regex : "(<\\!)([-_a-zA-Z0-9]+)",
1099
+ regex : "(<\\!)(" + tagRegex + ")",
1052
1100
  push : [{
1053
1101
  token : "text",
1054
1102
  regex : "\\s+"
@@ -1084,7 +1132,7 @@ var XmlHighlightRules = function(normalize) {
1084
1132
 
1085
1133
  tag : [{
1086
1134
  token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
1087
- regex : "(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
1135
+ regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
1088
1136
  next: [
1089
1137
  {include : "attributes"},
1090
1138
  {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
@@ -1115,7 +1163,7 @@ var XmlHighlightRules = function(normalize) {
1115
1163
 
1116
1164
  attributes: [{
1117
1165
  token : "entity.other.attribute-name.xml",
1118
- regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
1166
+ regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
1119
1167
  }, {
1120
1168
  token : "keyword.operator.attribute-equals.xml",
1121
1169
  regex : "="
@@ -1308,6 +1356,8 @@ var XmlBehaviour = function () {
1308
1356
  var token = iterator.getCurrentToken();
1309
1357
 
1310
1358
  if (token && token.type.indexOf("tag-close") !== -1) {
1359
+ if (token.value == "/>")
1360
+ return;
1311
1361
  while (token && token.type.indexOf("tag-name") === -1) {
1312
1362
  token = iterator.stepBackward();
1313
1363
  }
@@ -1507,9 +1557,6 @@ function is(token, type) {
1507
1557
  if (!tag || top.tagName == tag.tagName) {
1508
1558
  return stack.pop();
1509
1559
  }
1510
- else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
1511
- return;
1512
- }
1513
1560
  else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
1514
1561
  stack.pop();
1515
1562
  continue;
@@ -1535,6 +1582,8 @@ function is(token, type) {
1535
1582
  row: row,
1536
1583
  column: firstTag.start.column + firstTag.tagName.length + 2
1537
1584
  };
1585
+ if (firstTag.start.row == firstTag.end.row)
1586
+ start.column = firstTag.end.column;
1538
1587
  while (tag = this._readTagForward(iterator)) {
1539
1588
  if (tag.selfClosing) {
1540
1589
  if (!stack.length) {
@@ -1576,6 +1625,8 @@ function is(token, type) {
1576
1625
  this._pop(stack, tag);
1577
1626
  if (stack.length == 0) {
1578
1627
  tag.start.column += tag.tagName.length + 2;
1628
+ if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
1629
+ tag.start.column = tag.end.column;
1579
1630
  return Range.fromPoints(tag.start, end);
1580
1631
  }
1581
1632
  }
@@ -1591,7 +1642,7 @@ function is(token, type) {
1591
1642
 
1592
1643
  });
1593
1644
 
1594
- define("ace/mode/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/xml_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/xml"], function(require, exports, module) {
1645
+ define("ace/mode/xml",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/xml_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/xml","ace/worker/worker_client"], function(require, exports, module) {
1595
1646
  "use strict";
1596
1647
 
1597
1648
  var oop = require("../lib/oop");
@@ -1600,11 +1651,12 @@ var TextMode = require("./text").Mode;
1600
1651
  var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
1601
1652
  var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
1602
1653
  var XmlFoldMode = require("./folding/xml").FoldMode;
1654
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
1603
1655
 
1604
1656
  var Mode = function() {
1605
- this.HighlightRules = XmlHighlightRules;
1606
- this.$behaviour = new XmlBehaviour();
1607
- this.foldingRules = new XmlFoldMode();
1657
+ this.HighlightRules = XmlHighlightRules;
1658
+ this.$behaviour = new XmlBehaviour();
1659
+ this.foldingRules = new XmlFoldMode();
1608
1660
  };
1609
1661
 
1610
1662
  oop.inherits(Mode, TextMode);
@@ -1615,6 +1667,21 @@ oop.inherits(Mode, TextMode);
1615
1667
 
1616
1668
  this.blockComment = {start: "<!--", end: "-->"};
1617
1669
 
1670
+ this.createWorker = function(session) {
1671
+ var worker = new WorkerClient(["ace"], "ace/mode/xml_worker", "Worker");
1672
+ worker.attachToDocument(session.getDocument());
1673
+
1674
+ worker.on("error", function(e) {
1675
+ session.setAnnotations(e.data);
1676
+ });
1677
+
1678
+ worker.on("terminate", function() {
1679
+ session.clearAnnotations();
1680
+ });
1681
+
1682
+ return worker;
1683
+ };
1684
+
1618
1685
  this.$id = "ace/mode/xml";
1619
1686
  }).call(Mode.prototype);
1620
1687
 
@@ -1631,7 +1698,7 @@ var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|al
1631
1698
  var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
1632
1699
  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";
1633
1700
  var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
1634
- 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";
1701
+ var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
1635
1702
 
1636
1703
  var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
1637
1704
  var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
@@ -1895,7 +1962,7 @@ oop.inherits(Mode, TextMode);
1895
1962
  var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1896
1963
  worker.attachToDocument(session.getDocument());
1897
1964
 
1898
- worker.on("csslint", function(e) {
1965
+ worker.on("annotate", function(e) {
1899
1966
  session.setAnnotations(e.data);
1900
1967
  });
1901
1968
 
@@ -0,0 +1,1985 @@
1
+ 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
+ define("ace/mode/javascript_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 JavaScriptHighlightRules = function(options) {
59
+ var keywordMapper = this.createKeywordMapper({
60
+ "variable.language":
61
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
62
+ "Namespace|QName|XML|XMLList|" + // E4X
63
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
64
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
65
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
66
+ "SyntaxError|TypeError|URIError|" +
67
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
68
+ "isNaN|parseFloat|parseInt|" +
69
+ "JSON|Math|" + // Other
70
+ "this|arguments|prototype|window|document" , // Pseudo
71
+ "keyword":
72
+ "const|yield|import|get|set|" +
73
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
74
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
75
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
76
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
77
+ "storage.type":
78
+ "const|let|var|function",
79
+ "constant.language":
80
+ "null|Infinity|NaN|undefined",
81
+ "support.function":
82
+ "alert",
83
+ "constant.language.boolean": "true|false"
84
+ }, "identifier");
85
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
86
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
87
+
88
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
89
+ "u[0-9a-fA-F]{4}|" + // unicode
90
+ "[0-2][0-7]{0,2}|" + // oct
91
+ "3[0-6][0-7]?|" + // oct
92
+ "37[0-7]?|" + // oct
93
+ "[4-7][0-7]?|" + //oct
94
+ ".)";
95
+
96
+ this.$rules = {
97
+ "no_regex" : [
98
+ {
99
+ token : "comment",
100
+ regex : "\\/\\/",
101
+ next : "line_comment"
102
+ },
103
+ DocCommentHighlightRules.getStartRule("doc-start"),
104
+ {
105
+ token : "comment", // multi line comment
106
+ regex : /\/\*/,
107
+ next : "comment"
108
+ }, {
109
+ token : "string",
110
+ regex : "'(?=.)",
111
+ next : "qstring"
112
+ }, {
113
+ token : "string",
114
+ regex : '"(?=.)',
115
+ next : "qqstring"
116
+ }, {
117
+ token : "constant.numeric", // hex
118
+ regex : /0[xX][0-9a-fA-F]+\b/
119
+ }, {
120
+ token : "constant.numeric", // float
121
+ regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
122
+ }, {
123
+ token : [
124
+ "storage.type", "punctuation.operator", "support.function",
125
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
126
+ ],
127
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
128
+ next: "function_arguments"
129
+ }, {
130
+ token : [
131
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
132
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
133
+ ],
134
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
135
+ next: "function_arguments"
136
+ }, {
137
+ token : [
138
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
139
+ "text", "paren.lparen"
140
+ ],
141
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
142
+ next: "function_arguments"
143
+ }, {
144
+ token : [
145
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
146
+ "keyword.operator", "text",
147
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
148
+ ],
149
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
150
+ next: "function_arguments"
151
+ }, {
152
+ token : [
153
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
154
+ ],
155
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
156
+ next: "function_arguments"
157
+ }, {
158
+ token : [
159
+ "entity.name.function", "text", "punctuation.operator",
160
+ "text", "storage.type", "text", "paren.lparen"
161
+ ],
162
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
163
+ next: "function_arguments"
164
+ }, {
165
+ token : [
166
+ "text", "text", "storage.type", "text", "paren.lparen"
167
+ ],
168
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
169
+ next: "function_arguments"
170
+ }, {
171
+ token : "keyword",
172
+ regex : "(?:" + kwBeforeRe + ")\\b",
173
+ next : "start"
174
+ }, {
175
+ token : ["punctuation.operator", "support.function"],
176
+ regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
177
+ }, {
178
+ token : ["punctuation.operator", "support.function.dom"],
179
+ regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
180
+ }, {
181
+ token : ["punctuation.operator", "support.constant"],
182
+ regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
183
+ }, {
184
+ token : ["support.constant"],
185
+ regex : /that\b/
186
+ }, {
187
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
188
+ regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
189
+ }, {
190
+ token : keywordMapper,
191
+ regex : identifierRe
192
+ }, {
193
+ token : "keyword.operator",
194
+ regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
195
+ next : "start"
196
+ }, {
197
+ token : "punctuation.operator",
198
+ regex : /[?:,;.]/,
199
+ next : "start"
200
+ }, {
201
+ token : "paren.lparen",
202
+ regex : /[\[({]/,
203
+ next : "start"
204
+ }, {
205
+ token : "paren.rparen",
206
+ regex : /[\])}]/
207
+ }, {
208
+ token: "comment",
209
+ regex: /^#!.*$/
210
+ }
211
+ ],
212
+ "start": [
213
+ DocCommentHighlightRules.getStartRule("doc-start"),
214
+ {
215
+ token : "comment", // multi line comment
216
+ regex : "\\/\\*",
217
+ next : "comment_regex_allowed"
218
+ }, {
219
+ token : "comment",
220
+ regex : "\\/\\/",
221
+ next : "line_comment_regex_allowed"
222
+ }, {
223
+ token: "string.regexp",
224
+ regex: "\\/",
225
+ next: "regex"
226
+ }, {
227
+ token : "text",
228
+ regex : "\\s+|^$",
229
+ next : "start"
230
+ }, {
231
+ token: "empty",
232
+ regex: "",
233
+ next: "no_regex"
234
+ }
235
+ ],
236
+ "regex": [
237
+ {
238
+ token: "regexp.keyword.operator",
239
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
240
+ }, {
241
+ token: "string.regexp",
242
+ regex: "/[sxngimy]*",
243
+ next: "no_regex"
244
+ }, {
245
+ token : "invalid",
246
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
247
+ }, {
248
+ token : "constant.language.escape",
249
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
250
+ }, {
251
+ token : "constant.language.delimiter",
252
+ regex: /\|/
253
+ }, {
254
+ token: "constant.language.escape",
255
+ regex: /\[\^?/,
256
+ next: "regex_character_class"
257
+ }, {
258
+ token: "empty",
259
+ regex: "$",
260
+ next: "no_regex"
261
+ }, {
262
+ defaultToken: "string.regexp"
263
+ }
264
+ ],
265
+ "regex_character_class": [
266
+ {
267
+ token: "regexp.charclass.keyword.operator",
268
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
269
+ }, {
270
+ token: "constant.language.escape",
271
+ regex: "]",
272
+ next: "regex"
273
+ }, {
274
+ token: "constant.language.escape",
275
+ regex: "-"
276
+ }, {
277
+ token: "empty",
278
+ regex: "$",
279
+ next: "no_regex"
280
+ }, {
281
+ defaultToken: "string.regexp.charachterclass"
282
+ }
283
+ ],
284
+ "function_arguments": [
285
+ {
286
+ token: "variable.parameter",
287
+ regex: identifierRe
288
+ }, {
289
+ token: "punctuation.operator",
290
+ regex: "[, ]+"
291
+ }, {
292
+ token: "punctuation.operator",
293
+ regex: "$"
294
+ }, {
295
+ token: "empty",
296
+ regex: "",
297
+ next: "no_regex"
298
+ }
299
+ ],
300
+ "comment_regex_allowed" : [
301
+ DocCommentHighlightRules.getTagRule(),
302
+ {token : "comment", regex : "\\*\\/", next : "start"},
303
+ {defaultToken : "comment", caseInsensitive: true}
304
+ ],
305
+ "comment" : [
306
+ DocCommentHighlightRules.getTagRule(),
307
+ {token : "comment", regex : "\\*\\/", next : "no_regex"},
308
+ {defaultToken : "comment", caseInsensitive: true}
309
+ ],
310
+ "line_comment_regex_allowed" : [
311
+ DocCommentHighlightRules.getTagRule(),
312
+ {token : "comment", regex : "$|^", next : "start"},
313
+ {defaultToken : "comment", caseInsensitive: true}
314
+ ],
315
+ "line_comment" : [
316
+ DocCommentHighlightRules.getTagRule(),
317
+ {token : "comment", regex : "$|^", next : "no_regex"},
318
+ {defaultToken : "comment", caseInsensitive: true}
319
+ ],
320
+ "qqstring" : [
321
+ {
322
+ token : "constant.language.escape",
323
+ regex : escapedRe
324
+ }, {
325
+ token : "string",
326
+ regex : "\\\\$",
327
+ next : "qqstring"
328
+ }, {
329
+ token : "string",
330
+ regex : '"|$',
331
+ next : "no_regex"
332
+ }, {
333
+ defaultToken: "string"
334
+ }
335
+ ],
336
+ "qstring" : [
337
+ {
338
+ token : "constant.language.escape",
339
+ regex : escapedRe
340
+ }, {
341
+ token : "string",
342
+ regex : "\\\\$",
343
+ next : "qstring"
344
+ }, {
345
+ token : "string",
346
+ regex : "'|$",
347
+ next : "no_regex"
348
+ }, {
349
+ defaultToken: "string"
350
+ }
351
+ ]
352
+ };
353
+
354
+
355
+ if (!options || !options.noES6) {
356
+ this.$rules.no_regex.unshift({
357
+ regex: "[{}]", onMatch: function(val, state, stack) {
358
+ this.next = val == "{" ? this.nextState : "";
359
+ if (val == "{" && stack.length) {
360
+ stack.unshift("start", state);
361
+ return "paren";
362
+ }
363
+ if (val == "}" && stack.length) {
364
+ stack.shift();
365
+ this.next = stack.shift();
366
+ if (this.next.indexOf("string") != -1)
367
+ return "paren.quasi.end";
368
+ }
369
+ return val == "{" ? "paren.lparen" : "paren.rparen";
370
+ },
371
+ nextState: "start"
372
+ }, {
373
+ token : "string.quasi.start",
374
+ regex : /`/,
375
+ push : [{
376
+ token : "constant.language.escape",
377
+ regex : escapedRe
378
+ }, {
379
+ token : "paren.quasi.start",
380
+ regex : /\${/,
381
+ push : "start"
382
+ }, {
383
+ token : "string.quasi.end",
384
+ regex : /`/,
385
+ next : "pop"
386
+ }, {
387
+ defaultToken: "string.quasi"
388
+ }]
389
+ });
390
+ }
391
+
392
+ this.embedRules(DocCommentHighlightRules, "doc-",
393
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
394
+
395
+ this.normalizeRules();
396
+ };
397
+
398
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
399
+
400
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
401
+ });
402
+
403
+ define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"], function(require, exports, module) {
404
+ "use strict";
405
+
406
+ var oop = require("../lib/oop");
407
+ var lang = require("../lib/lang");
408
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
409
+ 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";
410
+ var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
411
+ 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";
412
+ var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
413
+ var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
414
+
415
+ var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
416
+ var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
417
+ 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";
418
+
419
+ var CssHighlightRules = function() {
420
+
421
+ var keywordMapper = this.createKeywordMapper({
422
+ "support.function": supportFunction,
423
+ "support.constant": supportConstant,
424
+ "support.type": supportType,
425
+ "support.constant.color": supportConstantColor,
426
+ "support.constant.fonts": supportConstantFonts
427
+ }, "text", true);
428
+
429
+ this.$rules = {
430
+ "start" : [{
431
+ token : "comment", // multi line comment
432
+ regex : "\\/\\*",
433
+ push : "comment"
434
+ }, {
435
+ token: "paren.lparen",
436
+ regex: "\\{",
437
+ push: "ruleset"
438
+ }, {
439
+ token: "string",
440
+ regex: "@.*?{",
441
+ push: "media"
442
+ }, {
443
+ token: "keyword",
444
+ regex: "#[a-z0-9-_]+"
445
+ }, {
446
+ token: "variable",
447
+ regex: "\\.[a-z0-9-_]+"
448
+ }, {
449
+ token: "string",
450
+ regex: ":[a-z0-9-_]+"
451
+ }, {
452
+ token: "constant",
453
+ regex: "[a-z0-9-_]+"
454
+ }, {
455
+ caseInsensitive: true
456
+ }],
457
+
458
+ "media" : [{
459
+ token : "comment", // multi line comment
460
+ regex : "\\/\\*",
461
+ push : "comment"
462
+ }, {
463
+ token: "paren.lparen",
464
+ regex: "\\{",
465
+ push: "ruleset"
466
+ }, {
467
+ token: "string",
468
+ regex: "\\}",
469
+ next: "pop"
470
+ }, {
471
+ token: "keyword",
472
+ regex: "#[a-z0-9-_]+"
473
+ }, {
474
+ token: "variable",
475
+ regex: "\\.[a-z0-9-_]+"
476
+ }, {
477
+ token: "string",
478
+ regex: ":[a-z0-9-_]+"
479
+ }, {
480
+ token: "constant",
481
+ regex: "[a-z0-9-_]+"
482
+ }, {
483
+ caseInsensitive: true
484
+ }],
485
+
486
+ "comment" : [{
487
+ token : "comment",
488
+ regex : "\\*\\/",
489
+ next : "pop"
490
+ }, {
491
+ defaultToken : "comment"
492
+ }],
493
+
494
+ "ruleset" : [
495
+ {
496
+ token : "paren.rparen",
497
+ regex : "\\}",
498
+ next: "pop"
499
+ }, {
500
+ token : "comment", // multi line comment
501
+ regex : "\\/\\*",
502
+ push : "comment"
503
+ }, {
504
+ token : "string", // single line
505
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
506
+ }, {
507
+ token : "string", // single line
508
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
509
+ }, {
510
+ token : ["constant.numeric", "keyword"],
511
+ 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|%)"
512
+ }, {
513
+ token : "constant.numeric",
514
+ regex : numRe
515
+ }, {
516
+ token : "constant.numeric", // hex6 color
517
+ regex : "#[a-f0-9]{6}"
518
+ }, {
519
+ token : "constant.numeric", // hex3 color
520
+ regex : "#[a-f0-9]{3}"
521
+ }, {
522
+ token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
523
+ regex : pseudoElements
524
+ }, {
525
+ token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
526
+ regex : pseudoClasses
527
+ }, {
528
+ token : ["support.function", "string", "support.function"],
529
+ regex : "(url\\()(.*)(\\))"
530
+ }, {
531
+ token : keywordMapper,
532
+ regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
533
+ }, {
534
+ caseInsensitive: true
535
+ }]
536
+ };
537
+
538
+ this.normalizeRules();
539
+ };
540
+
541
+ oop.inherits(CssHighlightRules, TextHighlightRules);
542
+
543
+ exports.CssHighlightRules = CssHighlightRules;
544
+
545
+ });
546
+
547
+ define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
548
+ "use strict";
549
+
550
+ var oop = require("../lib/oop");
551
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
552
+
553
+ var XmlHighlightRules = function(normalize) {
554
+
555
+ var tagRegex = "[a-zA-Z][-_a-zA-Z0-9]*";
556
+
557
+ this.$rules = {
558
+ start : [
559
+ {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
560
+ {
561
+ token : ["punctuation.xml-decl.xml", "keyword.xml-decl.xml"],
562
+ regex : "(<\\?)(xml)(?=[\\s])", next : "xml_decl", caseInsensitive: true
563
+ },
564
+ {
565
+ token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
566
+ regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction",
567
+ },
568
+ {token : "comment.xml", regex : "<\\!--", next : "comment"},
569
+ {
570
+ token : ["xml-pe.doctype.xml", "xml-pe.doctype.xml"],
571
+ regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype", caseInsensitive: true
572
+ },
573
+ {include : "tag"},
574
+ {token : "text.end-tag-open.xml", regex: "</"},
575
+ {token : "text.tag-open.xml", regex: "<"},
576
+ {include : "reference"},
577
+ {defaultToken : "text.xml"}
578
+ ],
579
+
580
+ xml_decl : [{
581
+ token : "entity.other.attribute-name.decl-attribute-name.xml",
582
+ regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
583
+ }, {
584
+ token : "keyword.operator.decl-attribute-equals.xml",
585
+ regex : "="
586
+ }, {
587
+ include: "whitespace"
588
+ }, {
589
+ include: "string"
590
+ }, {
591
+ token : "punctuation.xml-decl.xml",
592
+ regex : "\\?>",
593
+ next : "start"
594
+ }],
595
+
596
+ processing_instruction : [
597
+ {token : "punctuation.instruction.xml", regex : "\\?>", next : "start"},
598
+ {defaultToken : "instruction.xml"}
599
+ ],
600
+
601
+ doctype : [
602
+ {include : "whitespace"},
603
+ {include : "string"},
604
+ {token : "xml-pe.doctype.xml", regex : ">", next : "start"},
605
+ {token : "xml-pe.xml", regex : "[-_a-zA-Z0-9:]+"},
606
+ {token : "punctuation.int-subset", regex : "\\[", push : "int_subset"}
607
+ ],
608
+
609
+ int_subset : [{
610
+ token : "text.xml",
611
+ regex : "\\s+"
612
+ }, {
613
+ token: "punctuation.int-subset.xml",
614
+ regex: "]",
615
+ next: "pop"
616
+ }, {
617
+ token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
618
+ regex : "(<\\!)(" + tagRegex + ")",
619
+ push : [{
620
+ token : "text",
621
+ regex : "\\s+"
622
+ },
623
+ {
624
+ token : "punctuation.markup-decl.xml",
625
+ regex : ">",
626
+ next : "pop"
627
+ },
628
+ {include : "string"}]
629
+ }],
630
+
631
+ cdata : [
632
+ {token : "string.cdata.xml", regex : "\\]\\]>", next : "start"},
633
+ {token : "text.xml", regex : "\\s+"},
634
+ {token : "text.xml", regex : "(?:[^\\]]|\\](?!\\]>))+"}
635
+ ],
636
+
637
+ comment : [
638
+ {token : "comment.xml", regex : "-->", next : "start"},
639
+ {defaultToken : "comment.xml"}
640
+ ],
641
+
642
+ reference : [{
643
+ token : "constant.language.escape.reference.xml",
644
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
645
+ }],
646
+
647
+ attr_reference : [{
648
+ token : "constant.language.escape.reference.attribute-value.xml",
649
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
650
+ }],
651
+
652
+ tag : [{
653
+ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
654
+ regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
655
+ next: [
656
+ {include : "attributes"},
657
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
658
+ ]
659
+ }],
660
+
661
+ tag_whitespace : [
662
+ {token : "text.tag-whitespace.xml", regex : "\\s+"}
663
+ ],
664
+ whitespace : [
665
+ {token : "text.whitespace.xml", regex : "\\s+"}
666
+ ],
667
+ string: [{
668
+ token : "string.xml",
669
+ regex : "'",
670
+ push : [
671
+ {token : "string.xml", regex: "'", next: "pop"},
672
+ {defaultToken : "string.xml"}
673
+ ]
674
+ }, {
675
+ token : "string.xml",
676
+ regex : '"',
677
+ push : [
678
+ {token : "string.xml", regex: '"', next: "pop"},
679
+ {defaultToken : "string.xml"}
680
+ ]
681
+ }],
682
+
683
+ attributes: [{
684
+ token : "entity.other.attribute-name.xml",
685
+ regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
686
+ }, {
687
+ token : "keyword.operator.attribute-equals.xml",
688
+ regex : "="
689
+ }, {
690
+ include: "tag_whitespace"
691
+ }, {
692
+ include: "attribute_value"
693
+ }],
694
+
695
+ attribute_value: [{
696
+ token : "string.attribute-value.xml",
697
+ regex : "'",
698
+ push : [
699
+ {token : "string.attribute-value.xml", regex: "'", next: "pop"},
700
+ {include : "attr_reference"},
701
+ {defaultToken : "string.attribute-value.xml"}
702
+ ]
703
+ }, {
704
+ token : "string.attribute-value.xml",
705
+ regex : '"',
706
+ push : [
707
+ {token : "string.attribute-value.xml", regex: '"', next: "pop"},
708
+ {include : "attr_reference"},
709
+ {defaultToken : "string.attribute-value.xml"}
710
+ ]
711
+ }]
712
+ };
713
+
714
+ if (this.constructor === XmlHighlightRules)
715
+ this.normalizeRules();
716
+ };
717
+
718
+
719
+ (function() {
720
+
721
+ this.embedTagRules = function(HighlightRules, prefix, tag){
722
+ this.$rules.tag.unshift({
723
+ token : ["meta.tag.punctuation.tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
724
+ regex : "(<)(" + tag + "(?=\\s|>|$))",
725
+ next: [
726
+ {include : "attributes"},
727
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : prefix + "start"}
728
+ ]
729
+ });
730
+
731
+ this.$rules[tag + "-end"] = [
732
+ {include : "attributes"},
733
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next: "start",
734
+ onMatch : function(value, currentState, stack) {
735
+ stack.splice(0);
736
+ return this.token;
737
+ }}
738
+ ]
739
+
740
+ this.embedRules(HighlightRules, prefix, [{
741
+ token: ["meta.tag.punctuation.end-tag-open.xml", "meta.tag." + tag + ".tag-name.xml"],
742
+ regex : "(</)(" + tag + "(?=\\s|>|$))",
743
+ next: tag + "-end"
744
+ }, {
745
+ token: "string.cdata.xml",
746
+ regex : "<\\!\\[CDATA\\["
747
+ }, {
748
+ token: "string.cdata.xml",
749
+ regex : "\\]\\]>"
750
+ }]);
751
+ };
752
+
753
+ }).call(TextHighlightRules.prototype);
754
+
755
+ oop.inherits(XmlHighlightRules, TextHighlightRules);
756
+
757
+ exports.XmlHighlightRules = XmlHighlightRules;
758
+ });
759
+
760
+ define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"], function(require, exports, module) {
761
+ "use strict";
762
+
763
+ var oop = require("../lib/oop");
764
+ var lang = require("../lib/lang");
765
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
766
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
767
+ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
768
+
769
+ var tagMap = lang.createMap({
770
+ a : 'anchor',
771
+ button : 'form',
772
+ form : 'form',
773
+ img : 'image',
774
+ input : 'form',
775
+ label : 'form',
776
+ option : 'form',
777
+ script : 'script',
778
+ select : 'form',
779
+ textarea : 'form',
780
+ style : 'style',
781
+ table : 'table',
782
+ tbody : 'table',
783
+ td : 'table',
784
+ tfoot : 'table',
785
+ th : 'table',
786
+ tr : 'table'
787
+ });
788
+
789
+ var HtmlHighlightRules = function() {
790
+ XmlHighlightRules.call(this);
791
+
792
+ this.addRules({
793
+ attributes: [{
794
+ include : "tag_whitespace"
795
+ }, {
796
+ token : "entity.other.attribute-name.xml",
797
+ regex : "[-_a-zA-Z0-9:]+"
798
+ }, {
799
+ token : "keyword.operator.attribute-equals.xml",
800
+ regex : "=",
801
+ push : [{
802
+ include: "tag_whitespace"
803
+ }, {
804
+ token : "string.unquoted.attribute-value.html",
805
+ regex : "[^<>='\"`\\s]+",
806
+ next : "pop"
807
+ }, {
808
+ token : "empty",
809
+ regex : "",
810
+ next : "pop"
811
+ }]
812
+ }, {
813
+ include : "attribute_value"
814
+ }],
815
+ tag: [{
816
+ token : function(start, tag) {
817
+ var group = tagMap[tag];
818
+ return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
819
+ "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
820
+ },
821
+ regex : "(</?)([-_a-zA-Z0-9:]+)",
822
+ next: "tag_stuff"
823
+ }],
824
+ tag_stuff: [
825
+ {include : "attributes"},
826
+ {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
827
+ ],
828
+ });
829
+
830
+ this.embedTagRules(CssHighlightRules, "css-", "style");
831
+ this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
832
+
833
+ if (this.constructor === HtmlHighlightRules)
834
+ this.normalizeRules();
835
+ };
836
+
837
+ oop.inherits(HtmlHighlightRules, XmlHighlightRules);
838
+
839
+ exports.HtmlHighlightRules = HtmlHighlightRules;
840
+ });
841
+
842
+ define("ace/mode/markdown_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules","ace/mode/html_highlight_rules","ace/mode/css_highlight_rules"], function(require, exports, module) {
843
+ "use strict";
844
+
845
+ var oop = require("../lib/oop");
846
+ var lang = require("../lib/lang");
847
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
848
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
849
+ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
850
+ var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
851
+ var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
852
+
853
+ var escaped = function(ch) {
854
+ return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
855
+ }
856
+
857
+ function github_embed(tag, prefix) {
858
+ return { // Github style block
859
+ token : "support.function",
860
+ regex : "^\\s*```" + tag + "\\s*$",
861
+ push : prefix + "start"
862
+ };
863
+ }
864
+
865
+ var MarkdownHighlightRules = function() {
866
+ HtmlHighlightRules.call(this);
867
+
868
+ this.$rules["start"].unshift({
869
+ token : "empty_line",
870
+ regex : '^$',
871
+ next: "allowBlock"
872
+ }, { // h1
873
+ token: "markup.heading.1",
874
+ regex: "^=+(?=\\s*$)"
875
+ }, { // h2
876
+ token: "markup.heading.2",
877
+ regex: "^\\-+(?=\\s*$)"
878
+ }, {
879
+ token : function(value) {
880
+ return "markup.heading." + value.length;
881
+ },
882
+ regex : /^#{1,6}(?=\s*[^ #]|\s+#.)/,
883
+ next : "header"
884
+ },
885
+ github_embed("(?:javascript|js)", "jscode-"),
886
+ github_embed("xml", "xmlcode-"),
887
+ github_embed("html", "htmlcode-"),
888
+ github_embed("css", "csscode-"),
889
+ { // Github style block
890
+ token : "support.function",
891
+ regex : "^\\s*```\\s*\\S*(?:{.*?\\})?\\s*$",
892
+ next : "githubblock"
893
+ }, { // block quote
894
+ token : "string.blockquote",
895
+ regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
896
+ next : "blockquote"
897
+ }, { // HR * - _
898
+ token : "constant",
899
+ regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$",
900
+ next: "allowBlock"
901
+ }, { // list
902
+ token : "markup.list",
903
+ regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
904
+ next : "listblock-start"
905
+ }, {
906
+ include : "basic"
907
+ });
908
+
909
+ this.addRules({
910
+ "basic" : [{
911
+ token : "constant.language.escape",
912
+ regex : /\\[\\`*_{}\[\]()#+\-.!]/
913
+ }, { // code span `
914
+ token : "support.function",
915
+ regex : "(`+)(.*?[^`])(\\1)"
916
+ }, { // reference
917
+ token : ["text", "constant", "text", "url", "string", "text"],
918
+ regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
919
+ }, { // link by reference
920
+ token : ["text", "string", "text", "constant", "text"],
921
+ regex : "(\\[)(" + escaped("]") + ")(\\]\s*\\[)("+ escaped("]") + ")(\\])"
922
+ }, { // link by url
923
+ token : ["text", "string", "text", "markup.underline", "string", "text"],
924
+ regex : "(\\[)(" + // [
925
+ escaped("]") + // link text
926
+ ")(\\]\\()"+ // ](
927
+ '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' + // href
928
+ '(\\s*"' + escaped('"') + '"\\s*)?' + // "title"
929
+ "(\\))" // )
930
+ }, { // strong ** __
931
+ token : "string.strong",
932
+ regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
933
+ }, { // emphasis * _
934
+ token : "string.emphasis",
935
+ regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
936
+ }, { //
937
+ token : ["text", "url", "text"],
938
+ regex : "(<)("+
939
+ "(?:https?|ftp|dict):[^'\">\\s]+"+
940
+ "|"+
941
+ "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
942
+ ")(>)"
943
+ }],
944
+ "allowBlock": [
945
+ {token : "support.function", regex : "^ {4}.+", next : "allowBlock"},
946
+ {token : "empty", regex : "", next : "start"}
947
+ ],
948
+
949
+ "header" : [{
950
+ regex: "$",
951
+ next : "start"
952
+ }, {
953
+ include: "basic"
954
+ }, {
955
+ defaultToken : "heading"
956
+ } ],
957
+
958
+ "listblock-start" : [{
959
+ token : "support.variable",
960
+ regex : /(?:\[[ x]\])?/,
961
+ next : "listblock"
962
+ }],
963
+
964
+ "listblock" : [ { // Lists only escape on completely blank lines.
965
+ token : "empty_line",
966
+ regex : "^$",
967
+ next : "start"
968
+ }, { // list
969
+ token : "markup.list",
970
+ regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
971
+ next : "listblock-start"
972
+ }, {
973
+ include : "basic", noEscape: true
974
+ }, { // Github style block
975
+ token : "support.function",
976
+ regex : "^\\s*```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$",
977
+ next : "githubblock"
978
+ }, {
979
+ defaultToken : "list" //do not use markup.list to allow stling leading `*` differntly
980
+ } ],
981
+
982
+ "blockquote" : [ { // Blockquotes only escape on blank lines.
983
+ token : "empty_line",
984
+ regex : "^\\s*$",
985
+ next : "start"
986
+ }, { // block quote
987
+ token : "string.blockquote",
988
+ regex : "^\\s*>\\s*(?:[*+-]|\\d+\\.)?\\s+",
989
+ next : "blockquote"
990
+ }, {
991
+ include : "basic", noEscape: true
992
+ }, {
993
+ defaultToken : "string.blockquote"
994
+ } ],
995
+
996
+ "githubblock" : [ {
997
+ token : "support.function",
998
+ regex : "^\\s*```",
999
+ next : "start"
1000
+ }, {
1001
+ token : "support.function",
1002
+ regex : ".+"
1003
+ } ]
1004
+ });
1005
+
1006
+ this.embedRules(JavaScriptHighlightRules, "jscode-", [{
1007
+ token : "support.function",
1008
+ regex : "^\\s*```",
1009
+ next : "pop"
1010
+ }]);
1011
+
1012
+ this.embedRules(HtmlHighlightRules, "htmlcode-", [{
1013
+ token : "support.function",
1014
+ regex : "^\\s*```",
1015
+ next : "pop"
1016
+ }]);
1017
+
1018
+ this.embedRules(CssHighlightRules, "csscode-", [{
1019
+ token : "support.function",
1020
+ regex : "^\\s*```",
1021
+ next : "pop"
1022
+ }]);
1023
+
1024
+ this.embedRules(XmlHighlightRules, "xmlcode-", [{
1025
+ token : "support.function",
1026
+ regex : "^\\s*```",
1027
+ next : "pop"
1028
+ }]);
1029
+
1030
+ this.normalizeRules();
1031
+ };
1032
+ oop.inherits(MarkdownHighlightRules, TextHighlightRules);
1033
+
1034
+ exports.MarkdownHighlightRules = MarkdownHighlightRules;
1035
+ });
1036
+
1037
+ define("ace/mode/mask_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/css_highlight_rules","ace/mode/markdown_highlight_rules","ace/mode/html_highlight_rules"], function(require, exports, module) {
1038
+ "use strict";
1039
+
1040
+ exports.MaskHighlightRules = MaskHighlightRules;
1041
+
1042
+ var oop = require("../lib/oop");
1043
+ var lang = require("../lib/lang");
1044
+ var TextRules = require("./text_highlight_rules").TextHighlightRules;
1045
+ var JSRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1046
+ var CssRules = require("./css_highlight_rules").CssHighlightRules;
1047
+ var MDRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
1048
+ var HTMLRules = require("./html_highlight_rules").HtmlHighlightRules;
1049
+
1050
+ var token_TAG = "keyword.support.constant.language",
1051
+ token_COMPO = "support.function.markup.bold",
1052
+ token_KEYWORD = "keyword",
1053
+ token_LANG = "constant.language",
1054
+ token_UTIL = "keyword.control.markup.italic",
1055
+ token_ATTR = "support.variable.class",
1056
+ token_PUNKT = "keyword.operator",
1057
+ token_ITALIC = "markup.italic",
1058
+ token_BOLD = "markup.bold",
1059
+ token_LPARE = "paren.lparen",
1060
+ token_RPARE = "paren.rparen";
1061
+
1062
+ var const_FUNCTIONS,
1063
+ const_KEYWORDS,
1064
+ const_CONST,
1065
+ const_TAGS;
1066
+ (function(){
1067
+ const_FUNCTIONS = lang.arrayToMap(
1068
+ ("log").split("|")
1069
+ );
1070
+ const_CONST = lang.arrayToMap(
1071
+ (":dualbind|:bind|:import|slot|event|style|html|markdown|md").split("|")
1072
+ );
1073
+ const_KEYWORDS = lang.arrayToMap(
1074
+ ("debugger|define|var|if|each|for|of|else|switch|case|with|visible|+if|+each|+for|+switch|+with|+visible|include|import").split("|")
1075
+ );
1076
+ const_TAGS = lang.arrayToMap(
1077
+ ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
1078
+ "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
1079
+ "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
1080
+ "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
1081
+ "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
1082
+ "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
1083
+ "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
1084
+ "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
1085
+ "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
1086
+ );
1087
+ }());
1088
+
1089
+ function MaskHighlightRules () {
1090
+
1091
+ this.$rules = {
1092
+ "start" : [
1093
+ Token("comment", "\\/\\/.*$"),
1094
+ Token("comment", "\\/\\*", [
1095
+ Token("comment", ".*?\\*\\/", "start"),
1096
+ Token("comment", ".+")
1097
+ ]),
1098
+
1099
+ Blocks.string("'''"),
1100
+ Blocks.string('"""'),
1101
+ Blocks.string('"'),
1102
+ Blocks.string("'"),
1103
+
1104
+ Blocks.syntax(/(markdown|md)\b/, "md-multiline", "multiline"),
1105
+ Blocks.syntax(/html\b/, "html-multiline", "multiline"),
1106
+ Blocks.syntax(/(slot|event)\b/, "js-block", "block"),
1107
+ Blocks.syntax(/style\b/, "css-block", "block"),
1108
+ Blocks.syntax(/var\b/, "js-statement", "attr"),
1109
+
1110
+ Blocks.tag(),
1111
+
1112
+ Token(token_LPARE, "[[({>]"),
1113
+ Token(token_RPARE, "[\\])};]", "start"),
1114
+ {
1115
+ caseInsensitive: true
1116
+ }
1117
+ ]
1118
+ };
1119
+ var rules = this;
1120
+
1121
+ addJavaScript("interpolation", /\]/, token_RPARE + "." + token_ITALIC);
1122
+ addJavaScript("statement", /\)|}|;/);
1123
+ addJavaScript("block", /\}/);
1124
+ addCss();
1125
+ addMarkdown();
1126
+ addHtml();
1127
+
1128
+ function addJavaScript(name, escape, closeType) {
1129
+ var prfx = "js-" + name + "-",
1130
+ rootTokens = name === "block" ? ["start"] : ["start", "no_regex"];
1131
+ add(
1132
+ JSRules
1133
+ , prfx
1134
+ , escape
1135
+ , rootTokens
1136
+ , closeType
1137
+ );
1138
+ }
1139
+ function addCss() {
1140
+ add(CssRules, "css-block-", /\}/);
1141
+ }
1142
+ function addMarkdown() {
1143
+ add(MDRules, "md-multiline-", /("""|''')/, []);
1144
+ }
1145
+ function addHtml() {
1146
+ add(HTMLRules, "html-multiline-", /("""|''')/);
1147
+ }
1148
+ function add(Rules, strPrfx, rgxEnd, rootTokens, closeType) {
1149
+ var next = "pop";
1150
+ var tokens = rootTokens || [ "start" ];
1151
+ if (tokens.length === 0) {
1152
+ tokens = null;
1153
+ }
1154
+ if (/block|multiline/.test(strPrfx)) {
1155
+ next = strPrfx + "end";
1156
+ rules.$rules[next] = [
1157
+ Token("empty", "", "start")
1158
+ ];
1159
+ }
1160
+ rules.embedRules(
1161
+ Rules
1162
+ , strPrfx
1163
+ , [ Token(closeType || token_RPARE, rgxEnd, next) ]
1164
+ , tokens
1165
+ , tokens == null ? true : false
1166
+ );
1167
+ }
1168
+
1169
+ this.normalizeRules();
1170
+ }
1171
+ oop.inherits(MaskHighlightRules, TextRules);
1172
+
1173
+ var Blocks = {
1174
+ string: function(str, next){
1175
+ var token = Token(
1176
+ "string.start"
1177
+ , str
1178
+ , [
1179
+ Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
1180
+ Token("string.end", str, "pop"),
1181
+ {
1182
+ defaultToken: "string"
1183
+ }
1184
+ ]
1185
+ , next
1186
+ );
1187
+ if (str.length === 1){
1188
+ var escaped = Token("string.escape", "\\\\" + str);
1189
+ token.push.unshift(escaped);
1190
+ }
1191
+ return token;
1192
+ },
1193
+ interpolation: function(){
1194
+ return [
1195
+ Token(token_UTIL, /\s*\w*\s*:/),
1196
+ "js-interpolation-start"
1197
+ ];
1198
+ },
1199
+ tagHead: function (rgx) {
1200
+ return Token(token_ATTR, rgx, [
1201
+ Token(token_ATTR, /[\w\-_]+/),
1202
+ Token(token_LPARE + "." + token_ITALIC, /~\[/, Blocks.interpolation()),
1203
+ Blocks.goUp()
1204
+ ]);
1205
+ },
1206
+ tag: function () {
1207
+ return {
1208
+ token: 'tag',
1209
+ onMatch : function(value) {
1210
+ if (void 0 !== const_KEYWORDS[value])
1211
+ return token_KEYWORD;
1212
+ if (void 0 !== const_CONST[value])
1213
+ return token_LANG;
1214
+ if (void 0 !== const_FUNCTIONS[value])
1215
+ return "support.function";
1216
+ if (void 0 !== const_TAGS[value.toLowerCase()])
1217
+ return token_TAG;
1218
+
1219
+ return token_COMPO;
1220
+ },
1221
+ regex : /([@\w\-_:+]+)|((^|\s)(?=\s*(\.|#)))/,
1222
+ push: [
1223
+ Blocks.tagHead(/\./) ,
1224
+ Blocks.tagHead(/\#/) ,
1225
+ Blocks.expression(),
1226
+ Blocks.attribute(),
1227
+
1228
+ Token(token_LPARE, /[;>{]/, "pop")
1229
+ ]
1230
+ };
1231
+ },
1232
+ syntax: function(rgx, next, type){
1233
+ return {
1234
+ token: token_LANG,
1235
+ regex : rgx,
1236
+ push: ({
1237
+ "attr": [
1238
+ next + "-start",
1239
+ Token(token_PUNKT, /;/, "start")
1240
+ ],
1241
+ "multiline": [
1242
+ Blocks.tagHead(/\./) ,
1243
+ Blocks.tagHead(/\#/) ,
1244
+ Blocks.attribute(),
1245
+ Blocks.expression(),
1246
+ Token(token_LPARE, /[>\{]/),
1247
+ Token(token_PUNKT, /;/, "start"),
1248
+ Token(token_LPARE, /'''|"""/, [ next + "-start" ])
1249
+ ],
1250
+ "block": [
1251
+ Blocks.tagHead(/\./) ,
1252
+ Blocks.tagHead(/\#/) ,
1253
+ Blocks.attribute(),
1254
+ Blocks.expression(),
1255
+ Token(token_LPARE, /\{/, [ next + "-start" ])
1256
+ ]
1257
+ })[type]
1258
+ };
1259
+ },
1260
+ attribute: function(){
1261
+ return Token(function(value){
1262
+ return /^x\-/.test(value)
1263
+ ? token_ATTR + "." + token_BOLD
1264
+ : token_ATTR;
1265
+ }, /[\w_-]+/, [
1266
+ Token(token_PUNKT, /\s*=\s*/, [
1267
+ Blocks.string('"'),
1268
+ Blocks.string("'"),
1269
+ Blocks.word(),
1270
+ Blocks.goUp()
1271
+ ]),
1272
+ Blocks.goUp()
1273
+ ]);
1274
+ },
1275
+ expression: function(){
1276
+ return Token(token_LPARE, /\(/, [ "js-statement-start" ]);
1277
+ },
1278
+ word: function(){
1279
+ return Token("string", /[\w-_]+/);
1280
+ },
1281
+ goUp: function(){
1282
+ return Token("text", "", "pop");
1283
+ },
1284
+ goStart: function(){
1285
+ return Token("text", "", "start");
1286
+ }
1287
+ };
1288
+
1289
+
1290
+ function Token(token, rgx, mix) {
1291
+ var push, next, onMatch;
1292
+ if (arguments.length === 4) {
1293
+ push = mix;
1294
+ next = arguments[3];
1295
+ }
1296
+ else if (typeof mix === "string") {
1297
+ next = mix;
1298
+ }
1299
+ else {
1300
+ push = mix;
1301
+ }
1302
+ if (typeof token === "function") {
1303
+ onMatch = token;
1304
+ token = "empty";
1305
+ }
1306
+ return {
1307
+ token: token,
1308
+ regex: rgx,
1309
+ push: push,
1310
+ next: next,
1311
+ onMatch: onMatch
1312
+ };
1313
+ }
1314
+
1315
+ });
1316
+
1317
+ define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
1318
+ "use strict";
1319
+
1320
+ var Range = require("../range").Range;
1321
+
1322
+ var MatchingBraceOutdent = function() {};
1323
+
1324
+ (function() {
1325
+
1326
+ this.checkOutdent = function(line, input) {
1327
+ if (! /^\s+$/.test(line))
1328
+ return false;
1329
+
1330
+ return /^\s*\}/.test(input);
1331
+ };
1332
+
1333
+ this.autoOutdent = function(doc, row) {
1334
+ var line = doc.getLine(row);
1335
+ var match = line.match(/^(\s*\})/);
1336
+
1337
+ if (!match) return 0;
1338
+
1339
+ var column = match[1].length;
1340
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
1341
+
1342
+ if (!openBracePos || openBracePos.row == row) return 0;
1343
+
1344
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
1345
+ doc.replace(new Range(row, 0, row, column-1), indent);
1346
+ };
1347
+
1348
+ this.$getIndent = function(line) {
1349
+ return line.match(/^\s*/)[0];
1350
+ };
1351
+
1352
+ }).call(MatchingBraceOutdent.prototype);
1353
+
1354
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
1355
+ });
1356
+
1357
+ define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
1358
+ "use strict";
1359
+
1360
+ var oop = require("../../lib/oop");
1361
+ var Behaviour = require("../behaviour").Behaviour;
1362
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1363
+ var lang = require("../../lib/lang");
1364
+
1365
+ var SAFE_INSERT_IN_TOKENS =
1366
+ ["text", "paren.rparen", "punctuation.operator"];
1367
+ var SAFE_INSERT_BEFORE_TOKENS =
1368
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
1369
+
1370
+ var context;
1371
+ var contextCache = {};
1372
+ var initContext = function(editor) {
1373
+ var id = -1;
1374
+ if (editor.multiSelect) {
1375
+ id = editor.selection.index;
1376
+ if (contextCache.rangeCount != editor.multiSelect.rangeCount)
1377
+ contextCache = {rangeCount: editor.multiSelect.rangeCount};
1378
+ }
1379
+ if (contextCache[id])
1380
+ return context = contextCache[id];
1381
+ context = contextCache[id] = {
1382
+ autoInsertedBrackets: 0,
1383
+ autoInsertedRow: -1,
1384
+ autoInsertedLineEnd: "",
1385
+ maybeInsertedBrackets: 0,
1386
+ maybeInsertedRow: -1,
1387
+ maybeInsertedLineStart: "",
1388
+ maybeInsertedLineEnd: ""
1389
+ };
1390
+ };
1391
+
1392
+ var getWrapped = function(selection, selected, opening, closing) {
1393
+ var rowDiff = selection.end.row - selection.start.row;
1394
+ return {
1395
+ text: opening + selected + closing,
1396
+ selection: [
1397
+ 0,
1398
+ selection.start.column + 1,
1399
+ rowDiff,
1400
+ selection.end.column + (rowDiff ? 0 : 1)
1401
+ ]
1402
+ };
1403
+ };
1404
+
1405
+ var CstyleBehaviour = function() {
1406
+ this.add("braces", "insertion", function(state, action, editor, session, text) {
1407
+ var cursor = editor.getCursorPosition();
1408
+ var line = session.doc.getLine(cursor.row);
1409
+ if (text == '{') {
1410
+ initContext(editor);
1411
+ var selection = editor.getSelectionRange();
1412
+ var selected = session.doc.getTextRange(selection);
1413
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
1414
+ return getWrapped(selection, selected, '{', '}');
1415
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
1416
+ if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
1417
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
1418
+ return {
1419
+ text: '{}',
1420
+ selection: [1, 1]
1421
+ };
1422
+ } else {
1423
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
1424
+ return {
1425
+ text: '{',
1426
+ selection: [1, 1]
1427
+ };
1428
+ }
1429
+ }
1430
+ } else if (text == '}') {
1431
+ initContext(editor);
1432
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1433
+ if (rightChar == '}') {
1434
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
1435
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
1436
+ CstyleBehaviour.popAutoInsertedClosing();
1437
+ return {
1438
+ text: '',
1439
+ selection: [1, 1]
1440
+ };
1441
+ }
1442
+ }
1443
+ } else if (text == "\n" || text == "\r\n") {
1444
+ initContext(editor);
1445
+ var closing = "";
1446
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
1447
+ closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
1448
+ CstyleBehaviour.clearMaybeInsertedClosing();
1449
+ }
1450
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1451
+ if (rightChar === '}') {
1452
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
1453
+ if (!openBracePos)
1454
+ return null;
1455
+ var next_indent = this.$getIndent(session.getLine(openBracePos.row));
1456
+ } else if (closing) {
1457
+ var next_indent = this.$getIndent(line);
1458
+ } else {
1459
+ CstyleBehaviour.clearMaybeInsertedClosing();
1460
+ return;
1461
+ }
1462
+ var indent = next_indent + session.getTabString();
1463
+
1464
+ return {
1465
+ text: '\n' + indent + '\n' + next_indent + closing,
1466
+ selection: [1, indent.length, 1, indent.length]
1467
+ };
1468
+ } else {
1469
+ CstyleBehaviour.clearMaybeInsertedClosing();
1470
+ }
1471
+ });
1472
+
1473
+ this.add("braces", "deletion", function(state, action, editor, session, range) {
1474
+ var selected = session.doc.getTextRange(range);
1475
+ if (!range.isMultiLine() && selected == '{') {
1476
+ initContext(editor);
1477
+ var line = session.doc.getLine(range.start.row);
1478
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
1479
+ if (rightChar == '}') {
1480
+ range.end.column++;
1481
+ return range;
1482
+ } else {
1483
+ context.maybeInsertedBrackets--;
1484
+ }
1485
+ }
1486
+ });
1487
+
1488
+ this.add("parens", "insertion", function(state, action, editor, session, text) {
1489
+ if (text == '(') {
1490
+ initContext(editor);
1491
+ var selection = editor.getSelectionRange();
1492
+ var selected = session.doc.getTextRange(selection);
1493
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
1494
+ return getWrapped(selection, selected, '(', ')');
1495
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
1496
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
1497
+ return {
1498
+ text: '()',
1499
+ selection: [1, 1]
1500
+ };
1501
+ }
1502
+ } else if (text == ')') {
1503
+ initContext(editor);
1504
+ var cursor = editor.getCursorPosition();
1505
+ var line = session.doc.getLine(cursor.row);
1506
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1507
+ if (rightChar == ')') {
1508
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
1509
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
1510
+ CstyleBehaviour.popAutoInsertedClosing();
1511
+ return {
1512
+ text: '',
1513
+ selection: [1, 1]
1514
+ };
1515
+ }
1516
+ }
1517
+ }
1518
+ });
1519
+
1520
+ this.add("parens", "deletion", function(state, action, editor, session, range) {
1521
+ var selected = session.doc.getTextRange(range);
1522
+ if (!range.isMultiLine() && selected == '(') {
1523
+ initContext(editor);
1524
+ var line = session.doc.getLine(range.start.row);
1525
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1526
+ if (rightChar == ')') {
1527
+ range.end.column++;
1528
+ return range;
1529
+ }
1530
+ }
1531
+ });
1532
+
1533
+ this.add("brackets", "insertion", function(state, action, editor, session, text) {
1534
+ if (text == '[') {
1535
+ initContext(editor);
1536
+ var selection = editor.getSelectionRange();
1537
+ var selected = session.doc.getTextRange(selection);
1538
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
1539
+ return getWrapped(selection, selected, '[', ']');
1540
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
1541
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
1542
+ return {
1543
+ text: '[]',
1544
+ selection: [1, 1]
1545
+ };
1546
+ }
1547
+ } else if (text == ']') {
1548
+ initContext(editor);
1549
+ var cursor = editor.getCursorPosition();
1550
+ var line = session.doc.getLine(cursor.row);
1551
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1552
+ if (rightChar == ']') {
1553
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
1554
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
1555
+ CstyleBehaviour.popAutoInsertedClosing();
1556
+ return {
1557
+ text: '',
1558
+ selection: [1, 1]
1559
+ };
1560
+ }
1561
+ }
1562
+ }
1563
+ });
1564
+
1565
+ this.add("brackets", "deletion", function(state, action, editor, session, range) {
1566
+ var selected = session.doc.getTextRange(range);
1567
+ if (!range.isMultiLine() && selected == '[') {
1568
+ initContext(editor);
1569
+ var line = session.doc.getLine(range.start.row);
1570
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1571
+ if (rightChar == ']') {
1572
+ range.end.column++;
1573
+ return range;
1574
+ }
1575
+ }
1576
+ });
1577
+
1578
+ this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
1579
+ if (text == '"' || text == "'") {
1580
+ initContext(editor);
1581
+ var quote = text;
1582
+ var selection = editor.getSelectionRange();
1583
+ var selected = session.doc.getTextRange(selection);
1584
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
1585
+ return getWrapped(selection, selected, quote, quote);
1586
+ } else if (!selected) {
1587
+ var cursor = editor.getCursorPosition();
1588
+ var line = session.doc.getLine(cursor.row);
1589
+ var leftChar = line.substring(cursor.column-1, cursor.column);
1590
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1591
+
1592
+ var token = session.getTokenAt(cursor.row, cursor.column);
1593
+ var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
1594
+ if (leftChar == "\\" && token && /escape/.test(token.type))
1595
+ return null;
1596
+
1597
+ var stringBefore = token && /string/.test(token.type);
1598
+ var stringAfter = !rightToken || /string/.test(rightToken.type);
1599
+
1600
+ var pair;
1601
+ if (rightChar == quote) {
1602
+ pair = stringBefore !== stringAfter;
1603
+ } else {
1604
+ if (stringBefore && !stringAfter)
1605
+ return null; // wrap string with different quote
1606
+ if (stringBefore && stringAfter)
1607
+ return null; // do not pair quotes inside strings
1608
+ var wordRe = session.$mode.tokenRe;
1609
+ wordRe.lastIndex = 0;
1610
+ var isWordBefore = wordRe.test(leftChar);
1611
+ wordRe.lastIndex = 0;
1612
+ var isWordAfter = wordRe.test(leftChar);
1613
+ if (isWordBefore || isWordAfter)
1614
+ return null; // before or after alphanumeric
1615
+ if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
1616
+ return null; // there is rightChar and it isn't closing
1617
+ pair = true;
1618
+ }
1619
+ return {
1620
+ text: pair ? quote + quote : "",
1621
+ selection: [1,1]
1622
+ };
1623
+ }
1624
+ }
1625
+ });
1626
+
1627
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
1628
+ var selected = session.doc.getTextRange(range);
1629
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
1630
+ initContext(editor);
1631
+ var line = session.doc.getLine(range.start.row);
1632
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
1633
+ if (rightChar == selected) {
1634
+ range.end.column++;
1635
+ return range;
1636
+ }
1637
+ }
1638
+ });
1639
+
1640
+ };
1641
+
1642
+
1643
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
1644
+ var cursor = editor.getCursorPosition();
1645
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1646
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
1647
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
1648
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
1649
+ return false;
1650
+ }
1651
+ iterator.stepForward();
1652
+ return iterator.getCurrentTokenRow() !== cursor.row ||
1653
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
1654
+ };
1655
+
1656
+ CstyleBehaviour.$matchTokenType = function(token, types) {
1657
+ return types.indexOf(token.type || token) > -1;
1658
+ };
1659
+
1660
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
1661
+ var cursor = editor.getCursorPosition();
1662
+ var line = session.doc.getLine(cursor.row);
1663
+ if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
1664
+ context.autoInsertedBrackets = 0;
1665
+ context.autoInsertedRow = cursor.row;
1666
+ context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
1667
+ context.autoInsertedBrackets++;
1668
+ };
1669
+
1670
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
1671
+ var cursor = editor.getCursorPosition();
1672
+ var line = session.doc.getLine(cursor.row);
1673
+ if (!this.isMaybeInsertedClosing(cursor, line))
1674
+ context.maybeInsertedBrackets = 0;
1675
+ context.maybeInsertedRow = cursor.row;
1676
+ context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
1677
+ context.maybeInsertedLineEnd = line.substr(cursor.column);
1678
+ context.maybeInsertedBrackets++;
1679
+ };
1680
+
1681
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
1682
+ return context.autoInsertedBrackets > 0 &&
1683
+ cursor.row === context.autoInsertedRow &&
1684
+ bracket === context.autoInsertedLineEnd[0] &&
1685
+ line.substr(cursor.column) === context.autoInsertedLineEnd;
1686
+ };
1687
+
1688
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
1689
+ return context.maybeInsertedBrackets > 0 &&
1690
+ cursor.row === context.maybeInsertedRow &&
1691
+ line.substr(cursor.column) === context.maybeInsertedLineEnd &&
1692
+ line.substr(0, cursor.column) == context.maybeInsertedLineStart;
1693
+ };
1694
+
1695
+ CstyleBehaviour.popAutoInsertedClosing = function() {
1696
+ context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
1697
+ context.autoInsertedBrackets--;
1698
+ };
1699
+
1700
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
1701
+ if (context) {
1702
+ context.maybeInsertedBrackets = 0;
1703
+ context.maybeInsertedRow = -1;
1704
+ }
1705
+ };
1706
+
1707
+
1708
+
1709
+ oop.inherits(CstyleBehaviour, Behaviour);
1710
+
1711
+ exports.CstyleBehaviour = CstyleBehaviour;
1712
+ });
1713
+
1714
+ 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) {
1715
+ "use strict";
1716
+
1717
+ var oop = require("../../lib/oop");
1718
+ var Behaviour = require("../behaviour").Behaviour;
1719
+ var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
1720
+ var TokenIterator = require("../../token_iterator").TokenIterator;
1721
+
1722
+ var CssBehaviour = function () {
1723
+
1724
+ this.inherit(CstyleBehaviour);
1725
+
1726
+ this.add("colon", "insertion", function (state, action, editor, session, text) {
1727
+ if (text === ':') {
1728
+ var cursor = editor.getCursorPosition();
1729
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1730
+ var token = iterator.getCurrentToken();
1731
+ if (token && token.value.match(/\s+/)) {
1732
+ token = iterator.stepBackward();
1733
+ }
1734
+ if (token && token.type === 'support.type') {
1735
+ var line = session.doc.getLine(cursor.row);
1736
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1737
+ if (rightChar === ':') {
1738
+ return {
1739
+ text: '',
1740
+ selection: [1, 1]
1741
+ }
1742
+ }
1743
+ if (!line.substring(cursor.column).match(/^\s*;/)) {
1744
+ return {
1745
+ text: ':;',
1746
+ selection: [1, 1]
1747
+ }
1748
+ }
1749
+ }
1750
+ }
1751
+ });
1752
+
1753
+ this.add("colon", "deletion", function (state, action, editor, session, range) {
1754
+ var selected = session.doc.getTextRange(range);
1755
+ if (!range.isMultiLine() && selected === ':') {
1756
+ var cursor = editor.getCursorPosition();
1757
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
1758
+ var token = iterator.getCurrentToken();
1759
+ if (token && token.value.match(/\s+/)) {
1760
+ token = iterator.stepBackward();
1761
+ }
1762
+ if (token && token.type === 'support.type') {
1763
+ var line = session.doc.getLine(range.start.row);
1764
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
1765
+ if (rightChar === ';') {
1766
+ range.end.column ++;
1767
+ return range;
1768
+ }
1769
+ }
1770
+ }
1771
+ });
1772
+
1773
+ this.add("semicolon", "insertion", function (state, action, editor, session, text) {
1774
+ if (text === ';') {
1775
+ var cursor = editor.getCursorPosition();
1776
+ var line = session.doc.getLine(cursor.row);
1777
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1778
+ if (rightChar === ';') {
1779
+ return {
1780
+ text: '',
1781
+ selection: [1, 1]
1782
+ }
1783
+ }
1784
+ }
1785
+ });
1786
+
1787
+ }
1788
+ oop.inherits(CssBehaviour, CstyleBehaviour);
1789
+
1790
+ exports.CssBehaviour = CssBehaviour;
1791
+ });
1792
+
1793
+ define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
1794
+ "use strict";
1795
+
1796
+ var oop = require("../../lib/oop");
1797
+ var Range = require("../../range").Range;
1798
+ var BaseFoldMode = require("./fold_mode").FoldMode;
1799
+
1800
+ var FoldMode = exports.FoldMode = function(commentRegex) {
1801
+ if (commentRegex) {
1802
+ this.foldingStartMarker = new RegExp(
1803
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
1804
+ );
1805
+ this.foldingStopMarker = new RegExp(
1806
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
1807
+ );
1808
+ }
1809
+ };
1810
+ oop.inherits(FoldMode, BaseFoldMode);
1811
+
1812
+ (function() {
1813
+
1814
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1815
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1816
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
1817
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
1818
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
1819
+ this._getFoldWidgetBase = this.getFoldWidget;
1820
+ this.getFoldWidget = function(session, foldStyle, row) {
1821
+ var line = session.getLine(row);
1822
+
1823
+ if (this.singleLineBlockCommentRe.test(line)) {
1824
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
1825
+ return "";
1826
+ }
1827
+
1828
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
1829
+
1830
+ if (!fw && this.startRegionRe.test(line))
1831
+ return "start"; // lineCommentRegionStart
1832
+
1833
+ return fw;
1834
+ };
1835
+
1836
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
1837
+ var line = session.getLine(row);
1838
+
1839
+ if (this.startRegionRe.test(line))
1840
+ return this.getCommentRegionBlock(session, line, row);
1841
+
1842
+ var match = line.match(this.foldingStartMarker);
1843
+ if (match) {
1844
+ var i = match.index;
1845
+
1846
+ if (match[1])
1847
+ return this.openingBracketBlock(session, match[1], row, i);
1848
+
1849
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
1850
+
1851
+ if (range && !range.isMultiLine()) {
1852
+ if (forceMultiline) {
1853
+ range = this.getSectionRange(session, row);
1854
+ } else if (foldStyle != "all")
1855
+ range = null;
1856
+ }
1857
+
1858
+ return range;
1859
+ }
1860
+
1861
+ if (foldStyle === "markbegin")
1862
+ return;
1863
+
1864
+ var match = line.match(this.foldingStopMarker);
1865
+ if (match) {
1866
+ var i = match.index + match[0].length;
1867
+
1868
+ if (match[1])
1869
+ return this.closingBracketBlock(session, match[1], row, i);
1870
+
1871
+ return session.getCommentFoldRange(row, i, -1);
1872
+ }
1873
+ };
1874
+
1875
+ this.getSectionRange = function(session, row) {
1876
+ var line = session.getLine(row);
1877
+ var startIndent = line.search(/\S/);
1878
+ var startRow = row;
1879
+ var startColumn = line.length;
1880
+ row = row + 1;
1881
+ var endRow = row;
1882
+ var maxRow = session.getLength();
1883
+ while (++row < maxRow) {
1884
+ line = session.getLine(row);
1885
+ var indent = line.search(/\S/);
1886
+ if (indent === -1)
1887
+ continue;
1888
+ if (startIndent > indent)
1889
+ break;
1890
+ var subRange = this.getFoldWidgetRange(session, "all", row);
1891
+
1892
+ if (subRange) {
1893
+ if (subRange.start.row <= startRow) {
1894
+ break;
1895
+ } else if (subRange.isMultiLine()) {
1896
+ row = subRange.end.row;
1897
+ } else if (startIndent == indent) {
1898
+ break;
1899
+ }
1900
+ }
1901
+ endRow = row;
1902
+ }
1903
+
1904
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
1905
+ };
1906
+
1907
+ this.getCommentRegionBlock = function(session, line, row) {
1908
+ var startColumn = line.search(/\s*$/);
1909
+ var maxRow = session.getLength();
1910
+ var startRow = row;
1911
+
1912
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
1913
+ var depth = 1;
1914
+ while (++row < maxRow) {
1915
+ line = session.getLine(row);
1916
+ var m = re.exec(line);
1917
+ if (!m) continue;
1918
+ if (m[1]) depth--;
1919
+ else depth++;
1920
+
1921
+ if (!depth) break;
1922
+ }
1923
+
1924
+ var endRow = row;
1925
+ if (endRow > startRow) {
1926
+ return new Range(startRow, startColumn, endRow, line.length);
1927
+ }
1928
+ };
1929
+
1930
+ }).call(FoldMode.prototype);
1931
+
1932
+ });
1933
+
1934
+ define("ace/mode/mask",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mask_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
1935
+ "use strict";
1936
+
1937
+ var oop = require("../lib/oop");
1938
+ var TextMode = require("./text").Mode;
1939
+ var MaskHighlightRules = require("./mask_highlight_rules").MaskHighlightRules;
1940
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1941
+ var CssBehaviour = require("./behaviour/css").CssBehaviour;
1942
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1943
+
1944
+ var Mode = function() {
1945
+ this.HighlightRules = MaskHighlightRules;
1946
+ this.$outdent = new MatchingBraceOutdent();
1947
+ this.$behaviour = new CssBehaviour();
1948
+ this.foldingRules = new CStyleFoldMode();
1949
+ };
1950
+ oop.inherits(Mode, TextMode);
1951
+
1952
+ (function() {
1953
+
1954
+ this.lineCommentStart = "//";
1955
+ this.blockComment = {start: "/*", end: "*/"};
1956
+
1957
+ this.getNextLineIndent = function(state, line, tab) {
1958
+ var indent = this.$getIndent(line);
1959
+ var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
1960
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
1961
+ return indent;
1962
+ }
1963
+
1964
+ var match = line.match(/^.*\{\s*$/);
1965
+ if (match) {
1966
+ indent += tab;
1967
+ }
1968
+
1969
+ return indent;
1970
+ };
1971
+
1972
+ this.checkOutdent = function(state, line, input) {
1973
+ return this.$outdent.checkOutdent(line, input);
1974
+ };
1975
+
1976
+ this.autoOutdent = function(state, doc, row) {
1977
+ this.$outdent.autoOutdent(doc, row);
1978
+ };
1979
+
1980
+ this.$id = "ace/mode/mask";
1981
+ }).call(Mode.prototype);
1982
+
1983
+ exports.Mode = Mode;
1984
+
1985
+ });