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
@@ -8,7 +8,7 @@ var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|al
8
8
  var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
9
9
  var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
10
10
  var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
11
- var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
11
+ var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
12
12
 
13
13
  var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
14
14
  var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
@@ -320,7 +320,7 @@ var JavaScriptHighlightRules = function(options) {
320
320
  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(?=\()/
321
321
  }, {
322
322
  token : ["punctuation.operator", "support.function.dom"],
323
- 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(?=\()/
323
+ 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(?=\()/
324
324
  }, {
325
325
  token : ["punctuation.operator", "support.constant"],
326
326
  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/
@@ -551,6 +551,9 @@ var oop = require("../lib/oop");
551
551
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
552
552
 
553
553
  var XmlHighlightRules = function(normalize) {
554
+
555
+ var tagRegex = "[a-zA-Z][-_a-zA-Z0-9]*";
556
+
554
557
  this.$rules = {
555
558
  start : [
556
559
  {token : "string.cdata.xml", regex : "<\\!\\[CDATA\\[", next : "cdata"},
@@ -560,7 +563,7 @@ var XmlHighlightRules = function(normalize) {
560
563
  },
561
564
  {
562
565
  token : ["punctuation.instruction.xml", "keyword.instruction.xml"],
563
- regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "processing_instruction",
566
+ regex : "(<\\?)(" + tagRegex + ")", next : "processing_instruction",
564
567
  },
565
568
  {token : "comment.xml", regex : "<\\!--", next : "comment"},
566
569
  {
@@ -576,7 +579,7 @@ var XmlHighlightRules = function(normalize) {
576
579
 
577
580
  xml_decl : [{
578
581
  token : "entity.other.attribute-name.decl-attribute-name.xml",
579
- regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
582
+ regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
580
583
  }, {
581
584
  token : "keyword.operator.decl-attribute-equals.xml",
582
585
  regex : "="
@@ -612,7 +615,7 @@ var XmlHighlightRules = function(normalize) {
612
615
  next: "pop"
613
616
  }, {
614
617
  token : ["punctuation.markup-decl.xml", "keyword.markup-decl.xml"],
615
- regex : "(<\\!)([-_a-zA-Z0-9]+)",
618
+ regex : "(<\\!)(" + tagRegex + ")",
616
619
  push : [{
617
620
  token : "text",
618
621
  regex : "\\s+"
@@ -648,7 +651,7 @@ var XmlHighlightRules = function(normalize) {
648
651
 
649
652
  tag : [{
650
653
  token : ["meta.tag.punctuation.tag-open.xml", "meta.tag.punctuation.end-tag-open.xml", "meta.tag.tag-name.xml"],
651
- regex : "(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
654
+ regex : "(?:(<)|(</))((?:" + tagRegex + ":)?" + tagRegex + ")",
652
655
  next: [
653
656
  {include : "attributes"},
654
657
  {token : "meta.tag.punctuation.tag-close.xml", regex : "/?>", next : "start"}
@@ -679,7 +682,7 @@ var XmlHighlightRules = function(normalize) {
679
682
 
680
683
  attributes: [{
681
684
  token : "entity.other.attribute-name.xml",
682
- regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
685
+ regex : "(?:" + tagRegex + ":)?" + tagRegex + ""
683
686
  }, {
684
687
  token : "keyword.operator.attribute-equals.xml",
685
688
  regex : "="
@@ -1088,6 +1091,9 @@ var RubyHighlightRules = function() {
1088
1091
  return stack[0];
1089
1092
  return currentState;
1090
1093
  }
1094
+ }, {
1095
+ token : "string.character",
1096
+ regex : "\\B\\?."
1091
1097
  }, {
1092
1098
  token : "keyword.operator",
1093
1099
  regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
@@ -1252,6 +1258,19 @@ var initContext = function(editor) {
1252
1258
  };
1253
1259
  };
1254
1260
 
1261
+ var getWrapped = function(selection, selected, opening, closing) {
1262
+ var rowDiff = selection.end.row - selection.start.row;
1263
+ return {
1264
+ text: opening + selected + closing,
1265
+ selection: [
1266
+ 0,
1267
+ selection.start.column + 1,
1268
+ rowDiff,
1269
+ selection.end.column + (rowDiff ? 0 : 1)
1270
+ ]
1271
+ };
1272
+ };
1273
+
1255
1274
  var CstyleBehaviour = function() {
1256
1275
  this.add("braces", "insertion", function(state, action, editor, session, text) {
1257
1276
  var cursor = editor.getCursorPosition();
@@ -1261,10 +1280,7 @@ var CstyleBehaviour = function() {
1261
1280
  var selection = editor.getSelectionRange();
1262
1281
  var selected = session.doc.getTextRange(selection);
1263
1282
  if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
1264
- return {
1265
- text: '{' + selected + '}',
1266
- selection: false
1267
- };
1283
+ return getWrapped(selection, selected, '{', '}');
1268
1284
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
1269
1285
  if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
1270
1286
  CstyleBehaviour.recordAutoInsert(editor, session, "}");
@@ -1344,10 +1360,7 @@ var CstyleBehaviour = function() {
1344
1360
  var selection = editor.getSelectionRange();
1345
1361
  var selected = session.doc.getTextRange(selection);
1346
1362
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
1347
- return {
1348
- text: '(' + selected + ')',
1349
- selection: false
1350
- };
1363
+ return getWrapped(selection, selected, '(', ')');
1351
1364
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
1352
1365
  CstyleBehaviour.recordAutoInsert(editor, session, ")");
1353
1366
  return {
@@ -1392,10 +1405,7 @@ var CstyleBehaviour = function() {
1392
1405
  var selection = editor.getSelectionRange();
1393
1406
  var selected = session.doc.getTextRange(selection);
1394
1407
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
1395
- return {
1396
- text: '[' + selected + ']',
1397
- selection: false
1398
- };
1408
+ return getWrapped(selection, selected, '[', ']');
1399
1409
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
1400
1410
  CstyleBehaviour.recordAutoInsert(editor, session, "]");
1401
1411
  return {
@@ -1441,49 +1451,44 @@ var CstyleBehaviour = function() {
1441
1451
  var selection = editor.getSelectionRange();
1442
1452
  var selected = session.doc.getTextRange(selection);
1443
1453
  if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
1444
- return {
1445
- text: quote + selected + quote,
1446
- selection: false
1447
- };
1448
- } else {
1454
+ return getWrapped(selection, selected, quote, quote);
1455
+ } else if (!selected) {
1449
1456
  var cursor = editor.getCursorPosition();
1450
1457
  var line = session.doc.getLine(cursor.row);
1451
1458
  var leftChar = line.substring(cursor.column-1, cursor.column);
1452
- if (leftChar == '\\') {
1459
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
1460
+
1461
+ var token = session.getTokenAt(cursor.row, cursor.column);
1462
+ var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
1463
+ if (leftChar == "\\" && token && /escape/.test(token.type))
1453
1464
  return null;
1465
+
1466
+ var stringBefore = token && /string/.test(token.type);
1467
+ var stringAfter = !rightToken || /string/.test(rightToken.type);
1468
+
1469
+ var pair;
1470
+ if (rightChar == quote) {
1471
+ pair = stringBefore !== stringAfter;
1472
+ } else {
1473
+ if (stringBefore && !stringAfter)
1474
+ return null; // wrap string with different quote
1475
+ if (stringBefore && stringAfter)
1476
+ return null; // do not pair quotes inside strings
1477
+ var wordRe = session.$mode.tokenRe;
1478
+ wordRe.lastIndex = 0;
1479
+ var isWordBefore = wordRe.test(leftChar);
1480
+ wordRe.lastIndex = 0;
1481
+ var isWordAfter = wordRe.test(leftChar);
1482
+ if (isWordBefore || isWordAfter)
1483
+ return null; // before or after alphanumeric
1484
+ if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
1485
+ return null; // there is rightChar and it isn't closing
1486
+ pair = true;
1454
1487
  }
1455
- var tokens = session.getTokens(selection.start.row);
1456
- var col = 0, token;
1457
- var quotepos = -1; // Track whether we're inside an open quote.
1458
-
1459
- for (var x = 0; x < tokens.length; x++) {
1460
- token = tokens[x];
1461
- if (token.type == "string") {
1462
- quotepos = -1;
1463
- } else if (quotepos < 0) {
1464
- quotepos = token.value.indexOf(quote);
1465
- }
1466
- if ((token.value.length + col) > selection.start.column) {
1467
- break;
1468
- }
1469
- col += tokens[x].value.length;
1470
- }
1471
- 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)))) {
1472
- if (!CstyleBehaviour.isSaneInsertion(editor, session))
1473
- return;
1474
- return {
1475
- text: quote + quote,
1476
- selection: [1,1]
1477
- };
1478
- } else if (token && token.type === "string") {
1479
- var rightChar = line.substring(cursor.column, cursor.column + 1);
1480
- if (rightChar == quote) {
1481
- return {
1482
- text: '',
1483
- selection: [1, 1]
1484
- };
1485
- }
1486
- }
1488
+ return {
1489
+ text: pair ? quote + quote : "",
1490
+ selection: [1,1]
1491
+ };
1487
1492
  }
1488
1493
  }
1489
1494
  });
@@ -1595,12 +1600,35 @@ var FoldMode = exports.FoldMode = function(commentRegex) {
1595
1600
  oop.inherits(FoldMode, BaseFoldMode);
1596
1601
 
1597
1602
  (function() {
1598
-
1603
+
1599
1604
  this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
1600
1605
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
1606
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
1607
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
1608
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
1609
+ this._getFoldWidgetBase = this.getFoldWidget;
1610
+ this.getFoldWidget = function(session, foldStyle, row) {
1611
+ var line = session.getLine(row);
1612
+
1613
+ if (this.singleLineBlockCommentRe.test(line)) {
1614
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
1615
+ return "";
1616
+ }
1617
+
1618
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
1619
+
1620
+ if (!fw && this.startRegionRe.test(line))
1621
+ return "start"; // lineCommentRegionStart
1622
+
1623
+ return fw;
1624
+ };
1601
1625
 
1602
1626
  this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
1603
1627
  var line = session.getLine(row);
1628
+
1629
+ if (this.startRegionRe.test(line))
1630
+ return this.getCommentRegionBlock(session, line, row);
1631
+
1604
1632
  var match = line.match(this.foldingStartMarker);
1605
1633
  if (match) {
1606
1634
  var i = match.index;
@@ -1665,6 +1693,29 @@ oop.inherits(FoldMode, BaseFoldMode);
1665
1693
 
1666
1694
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
1667
1695
  };
1696
+
1697
+ this.getCommentRegionBlock = function(session, line, row) {
1698
+ var startColumn = line.search(/\s*$/);
1699
+ var maxRow = session.getLength();
1700
+ var startRow = row;
1701
+
1702
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
1703
+ var depth = 1;
1704
+ while (++row < maxRow) {
1705
+ line = session.getLine(row);
1706
+ var m = re.exec(line);
1707
+ if (!m) continue;
1708
+ if (m[1]) depth--;
1709
+ else depth++;
1710
+
1711
+ if (!depth) break;
1712
+ }
1713
+
1714
+ var endRow = row;
1715
+ if (endRow > startRow) {
1716
+ return new Range(startRow, startColumn, endRow, line.length);
1717
+ }
1718
+ };
1668
1719
 
1669
1720
  }).call(FoldMode.prototype);
1670
1721
 
@@ -1740,7 +1791,7 @@ oop.inherits(Mode, TextMode);
1740
1791
  var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
1741
1792
  worker.attachToDocument(session.getDocument());
1742
1793
 
1743
- worker.on("jslint", function(results) {
1794
+ worker.on("annotate", function(results) {
1744
1795
  session.setAnnotations(results.data);
1745
1796
  });
1746
1797
 
@@ -1887,7 +1938,7 @@ oop.inherits(Mode, TextMode);
1887
1938
  var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1888
1939
  worker.attachToDocument(session.getDocument());
1889
1940
 
1890
- worker.on("csslint", function(e) {
1941
+ worker.on("annotate", function(e) {
1891
1942
  session.setAnnotations(e.data);
1892
1943
  });
1893
1944
 
@@ -2023,6 +2074,8 @@ var XmlBehaviour = function () {
2023
2074
  var token = iterator.getCurrentToken();
2024
2075
 
2025
2076
  if (token && token.type.indexOf("tag-close") !== -1) {
2077
+ if (token.value == "/>")
2078
+ return;
2026
2079
  while (token && token.type.indexOf("tag-name") === -1) {
2027
2080
  token = iterator.stepBackward();
2028
2081
  }
@@ -2276,9 +2329,6 @@ function is(token, type) {
2276
2329
  if (!tag || top.tagName == tag.tagName) {
2277
2330
  return stack.pop();
2278
2331
  }
2279
- else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
2280
- return;
2281
- }
2282
2332
  else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
2283
2333
  stack.pop();
2284
2334
  continue;
@@ -2304,6 +2354,8 @@ function is(token, type) {
2304
2354
  row: row,
2305
2355
  column: firstTag.start.column + firstTag.tagName.length + 2
2306
2356
  };
2357
+ if (firstTag.start.row == firstTag.end.row)
2358
+ start.column = firstTag.end.column;
2307
2359
  while (tag = this._readTagForward(iterator)) {
2308
2360
  if (tag.selfClosing) {
2309
2361
  if (!stack.length) {
@@ -2345,6 +2397,8 @@ function is(token, type) {
2345
2397
  this._pop(stack, tag);
2346
2398
  if (stack.length == 0) {
2347
2399
  tag.start.column += tag.tagName.length + 2;
2400
+ if (tag.start.row == tag.end.row && tag.start.column < tag.end.column)
2401
+ tag.start.column = tag.end.column;
2348
2402
  return Range.fromPoints(tag.start, end);
2349
2403
  }
2350
2404
  }
@@ -101,12 +101,35 @@ var FoldMode = exports.FoldMode = function(commentRegex) {
101
101
  oop.inherits(FoldMode, BaseFoldMode);
102
102
 
103
103
  (function() {
104
-
104
+
105
105
  this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
106
106
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
107
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
108
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
109
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
110
+ this._getFoldWidgetBase = this.getFoldWidget;
111
+ this.getFoldWidget = function(session, foldStyle, row) {
112
+ var line = session.getLine(row);
113
+
114
+ if (this.singleLineBlockCommentRe.test(line)) {
115
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
116
+ return "";
117
+ }
118
+
119
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
120
+
121
+ if (!fw && this.startRegionRe.test(line))
122
+ return "start"; // lineCommentRegionStart
123
+
124
+ return fw;
125
+ };
107
126
 
108
127
  this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
109
128
  var line = session.getLine(row);
129
+
130
+ if (this.startRegionRe.test(line))
131
+ return this.getCommentRegionBlock(session, line, row);
132
+
110
133
  var match = line.match(this.foldingStartMarker);
111
134
  if (match) {
112
135
  var i = match.index;
@@ -171,6 +194,29 @@ oop.inherits(FoldMode, BaseFoldMode);
171
194
 
172
195
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
173
196
  };
197
+
198
+ this.getCommentRegionBlock = function(session, line, row) {
199
+ var startColumn = line.search(/\s*$/);
200
+ var maxRow = session.getLength();
201
+ var startRow = row;
202
+
203
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
204
+ var depth = 1;
205
+ while (++row < maxRow) {
206
+ line = session.getLine(row);
207
+ var m = re.exec(line);
208
+ if (!m) continue;
209
+ if (m[1]) depth--;
210
+ else depth++;
211
+
212
+ if (!depth) break;
213
+ }
214
+
215
+ var endRow = row;
216
+ if (endRow > startRow) {
217
+ return new Range(startRow, startColumn, endRow, line.length);
218
+ }
219
+ };
174
220
 
175
221
  }).call(FoldMode.prototype);
176
222
 
@@ -183,6 +183,19 @@ var initContext = function(editor) {
183
183
  };
184
184
  };
185
185
 
186
+ var getWrapped = function(selection, selected, opening, closing) {
187
+ var rowDiff = selection.end.row - selection.start.row;
188
+ return {
189
+ text: opening + selected + closing,
190
+ selection: [
191
+ 0,
192
+ selection.start.column + 1,
193
+ rowDiff,
194
+ selection.end.column + (rowDiff ? 0 : 1)
195
+ ]
196
+ };
197
+ };
198
+
186
199
  var CstyleBehaviour = function() {
187
200
  this.add("braces", "insertion", function(state, action, editor, session, text) {
188
201
  var cursor = editor.getCursorPosition();
@@ -192,10 +205,7 @@ var CstyleBehaviour = function() {
192
205
  var selection = editor.getSelectionRange();
193
206
  var selected = session.doc.getTextRange(selection);
194
207
  if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
195
- return {
196
- text: '{' + selected + '}',
197
- selection: false
198
- };
208
+ return getWrapped(selection, selected, '{', '}');
199
209
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
200
210
  if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
201
211
  CstyleBehaviour.recordAutoInsert(editor, session, "}");
@@ -275,10 +285,7 @@ var CstyleBehaviour = function() {
275
285
  var selection = editor.getSelectionRange();
276
286
  var selected = session.doc.getTextRange(selection);
277
287
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
278
- return {
279
- text: '(' + selected + ')',
280
- selection: false
281
- };
288
+ return getWrapped(selection, selected, '(', ')');
282
289
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
283
290
  CstyleBehaviour.recordAutoInsert(editor, session, ")");
284
291
  return {
@@ -323,10 +330,7 @@ var CstyleBehaviour = function() {
323
330
  var selection = editor.getSelectionRange();
324
331
  var selected = session.doc.getTextRange(selection);
325
332
  if (selected !== "" && editor.getWrapBehavioursEnabled()) {
326
- return {
327
- text: '[' + selected + ']',
328
- selection: false
329
- };
333
+ return getWrapped(selection, selected, '[', ']');
330
334
  } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
331
335
  CstyleBehaviour.recordAutoInsert(editor, session, "]");
332
336
  return {
@@ -372,49 +376,44 @@ var CstyleBehaviour = function() {
372
376
  var selection = editor.getSelectionRange();
373
377
  var selected = session.doc.getTextRange(selection);
374
378
  if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
375
- return {
376
- text: quote + selected + quote,
377
- selection: false
378
- };
379
- } else {
379
+ return getWrapped(selection, selected, quote, quote);
380
+ } else if (!selected) {
380
381
  var cursor = editor.getCursorPosition();
381
382
  var line = session.doc.getLine(cursor.row);
382
383
  var leftChar = line.substring(cursor.column-1, cursor.column);
383
- if (leftChar == '\\') {
384
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
385
+
386
+ var token = session.getTokenAt(cursor.row, cursor.column);
387
+ var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
388
+ if (leftChar == "\\" && token && /escape/.test(token.type))
384
389
  return null;
390
+
391
+ var stringBefore = token && /string/.test(token.type);
392
+ var stringAfter = !rightToken || /string/.test(rightToken.type);
393
+
394
+ var pair;
395
+ if (rightChar == quote) {
396
+ pair = stringBefore !== stringAfter;
397
+ } else {
398
+ if (stringBefore && !stringAfter)
399
+ return null; // wrap string with different quote
400
+ if (stringBefore && stringAfter)
401
+ return null; // do not pair quotes inside strings
402
+ var wordRe = session.$mode.tokenRe;
403
+ wordRe.lastIndex = 0;
404
+ var isWordBefore = wordRe.test(leftChar);
405
+ wordRe.lastIndex = 0;
406
+ var isWordAfter = wordRe.test(leftChar);
407
+ if (isWordBefore || isWordAfter)
408
+ return null; // before or after alphanumeric
409
+ if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
410
+ return null; // there is rightChar and it isn't closing
411
+ pair = true;
385
412
  }
386
- var tokens = session.getTokens(selection.start.row);
387
- var col = 0, token;
388
- var quotepos = -1; // Track whether we're inside an open quote.
389
-
390
- for (var x = 0; x < tokens.length; x++) {
391
- token = tokens[x];
392
- if (token.type == "string") {
393
- quotepos = -1;
394
- } else if (quotepos < 0) {
395
- quotepos = token.value.indexOf(quote);
396
- }
397
- if ((token.value.length + col) > selection.start.column) {
398
- break;
399
- }
400
- col += tokens[x].value.length;
401
- }
402
- 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)))) {
403
- if (!CstyleBehaviour.isSaneInsertion(editor, session))
404
- return;
405
- return {
406
- text: quote + quote,
407
- selection: [1,1]
408
- };
409
- } else if (token && token.type === "string") {
410
- var rightChar = line.substring(cursor.column, cursor.column + 1);
411
- if (rightChar == quote) {
412
- return {
413
- text: '',
414
- selection: [1, 1]
415
- };
416
- }
417
- }
413
+ return {
414
+ text: pair ? quote + quote : "",
415
+ selection: [1,1]
416
+ };
418
417
  }
419
418
  }
420
419
  });
@@ -526,12 +525,35 @@ var FoldMode = exports.FoldMode = function(commentRegex) {
526
525
  oop.inherits(FoldMode, BaseFoldMode);
527
526
 
528
527
  (function() {
529
-
528
+
530
529
  this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
531
530
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
531
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
532
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
533
+ this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
534
+ this._getFoldWidgetBase = this.getFoldWidget;
535
+ this.getFoldWidget = function(session, foldStyle, row) {
536
+ var line = session.getLine(row);
537
+
538
+ if (this.singleLineBlockCommentRe.test(line)) {
539
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
540
+ return "";
541
+ }
542
+
543
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
544
+
545
+ if (!fw && this.startRegionRe.test(line))
546
+ return "start"; // lineCommentRegionStart
547
+
548
+ return fw;
549
+ };
532
550
 
533
551
  this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
534
552
  var line = session.getLine(row);
553
+
554
+ if (this.startRegionRe.test(line))
555
+ return this.getCommentRegionBlock(session, line, row);
556
+
535
557
  var match = line.match(this.foldingStartMarker);
536
558
  if (match) {
537
559
  var i = match.index;
@@ -596,6 +618,29 @@ oop.inherits(FoldMode, BaseFoldMode);
596
618
 
597
619
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
598
620
  };
621
+
622
+ this.getCommentRegionBlock = function(session, line, row) {
623
+ var startColumn = line.search(/\s*$/);
624
+ var maxRow = session.getLength();
625
+ var startRow = row;
626
+
627
+ var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
628
+ var depth = 1;
629
+ while (++row < maxRow) {
630
+ line = session.getLine(row);
631
+ var m = re.exec(line);
632
+ if (!m) continue;
633
+ if (m[1]) depth--;
634
+ else depth++;
635
+
636
+ if (!depth) break;
637
+ }
638
+
639
+ var endRow = row;
640
+ if (endRow > startRow) {
641
+ return new Range(startRow, startColumn, endRow, line.length);
642
+ }
643
+ };
599
644
 
600
645
  }).call(FoldMode.prototype);
601
646