ace-rails-ap 4.0.0 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ace/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/ace/ace.js +993 -613
  4. data/vendor/assets/javascripts/ace/ext-chromevox.js +3 -4
  5. data/vendor/assets/javascripts/ace/ext-elastic_tabstops_lite.js +5 -6
  6. data/vendor/assets/javascripts/ace/ext-emmet.js +50 -21
  7. data/vendor/assets/javascripts/ace/ext-language_tools.js +21 -19
  8. data/vendor/assets/javascripts/ace/ext-modelist.js +11 -6
  9. data/vendor/assets/javascripts/ace/ext-old_ie.js +12 -5
  10. data/vendor/assets/javascripts/ace/ext-searchbox.js +12 -5
  11. data/vendor/assets/javascripts/ace/ext-settings_menu.js +14 -7
  12. data/vendor/assets/javascripts/ace/ext-static_highlight.js +5 -5
  13. data/vendor/assets/javascripts/ace/ext-statusbar.js +14 -12
  14. data/vendor/assets/javascripts/ace/ext-textarea.js +1 -2
  15. data/vendor/assets/javascripts/ace/ext-themelist.js +2 -0
  16. data/vendor/assets/javascripts/ace/ext-whitespace.js +17 -13
  17. data/vendor/assets/javascripts/ace/keybinding-emacs.js +76 -78
  18. data/vendor/assets/javascripts/ace/keybinding-vim.js +221 -80
  19. data/vendor/assets/javascripts/ace/mode-abc.js +2 -3
  20. data/vendor/assets/javascripts/ace/mode-actionscript.js +2 -3
  21. data/vendor/assets/javascripts/ace/mode-apache_conf.js +2 -3
  22. data/vendor/assets/javascripts/ace/mode-applescript.js +2 -3
  23. data/vendor/assets/javascripts/ace/mode-autohotkey.js +2 -3
  24. data/vendor/assets/javascripts/ace/mode-batchfile.js +2 -3
  25. data/vendor/assets/javascripts/ace/mode-c_cpp.js +8 -5
  26. data/vendor/assets/javascripts/ace/mode-coffee.js +1 -1
  27. data/vendor/assets/javascripts/ace/mode-coldfusion.js +533 -139
  28. data/vendor/assets/javascripts/ace/mode-csharp.js +4 -5
  29. data/vendor/assets/javascripts/ace/mode-css.js +185 -6
  30. data/vendor/assets/javascripts/ace/mode-curly.js +495 -138
  31. data/vendor/assets/javascripts/ace/mode-d.js +2 -3
  32. data/vendor/assets/javascripts/ace/mode-dart.js +8 -5
  33. data/vendor/assets/javascripts/ace/mode-django.js +495 -138
  34. data/vendor/assets/javascripts/ace/mode-dockerfile.js +59 -14
  35. data/vendor/assets/javascripts/ace/mode-dot.js +2 -3
  36. data/vendor/assets/javascripts/ace/mode-ejs.js +497 -152
  37. data/vendor/assets/javascripts/ace/mode-elm.js +6 -4
  38. data/vendor/assets/javascripts/ace/mode-erlang.js +3 -4
  39. data/vendor/assets/javascripts/ace/mode-forth.js +3 -4
  40. data/vendor/assets/javascripts/ace/mode-ftl.js +145 -17
  41. data/vendor/assets/javascripts/ace/mode-gherkin.js +58 -25
  42. data/vendor/assets/javascripts/ace/mode-glsl.js +8 -5
  43. data/vendor/assets/javascripts/ace/mode-golang.js +36 -25
  44. data/vendor/assets/javascripts/ace/mode-groovy.js +145 -17
  45. data/vendor/assets/javascripts/ace/mode-handlebars.js +496 -140
  46. data/vendor/assets/javascripts/ace/mode-haskell.js +3 -4
  47. data/vendor/assets/javascripts/ace/mode-haxe.js +4 -5
  48. data/vendor/assets/javascripts/ace/mode-html.js +495 -138
  49. data/vendor/assets/javascripts/ace/mode-html_elixir.js +3372 -0
  50. data/vendor/assets/javascripts/ace/mode-html_ruby.js +495 -138
  51. data/vendor/assets/javascripts/ace/mode-ini.js +1 -1
  52. data/vendor/assets/javascripts/ace/mode-io.js +2 -3
  53. data/vendor/assets/javascripts/ace/mode-jack.js +4 -5
  54. data/vendor/assets/javascripts/ace/mode-jade.js +155 -25
  55. data/vendor/assets/javascripts/ace/mode-java.js +145 -17
  56. data/vendor/assets/javascripts/ace/mode-javascript.js +145 -17
  57. data/vendor/assets/javascripts/ace/mode-json.js +4 -5
  58. data/vendor/assets/javascripts/ace/mode-jsoniq.js +4 -5
  59. data/vendor/assets/javascripts/ace/mode-jsp.js +150 -23
  60. data/vendor/assets/javascripts/ace/mode-jsx.js +4 -5
  61. data/vendor/assets/javascripts/ace/mode-julia.js +2 -3
  62. data/vendor/assets/javascripts/ace/mode-less.js +5 -6
  63. data/vendor/assets/javascripts/ace/mode-liquid.js +145 -17
  64. data/vendor/assets/javascripts/ace/mode-logiql.js +2 -2
  65. data/vendor/assets/javascripts/ace/mode-lsl.js +8 -10
  66. data/vendor/assets/javascripts/ace/mode-lua.js +2 -2
  67. data/vendor/assets/javascripts/ace/mode-luapage.js +497 -140
  68. data/vendor/assets/javascripts/ace/mode-makefile.js +54 -8
  69. data/vendor/assets/javascripts/ace/mode-markdown.js +497 -139
  70. data/vendor/assets/javascripts/ace/mode-mask.js +150 -22
  71. data/vendor/assets/javascripts/ace/mode-maze.js +283 -0
  72. data/vendor/assets/javascripts/ace/mode-mel.js +4 -5
  73. data/vendor/assets/javascripts/ace/mode-mushcode.js +0 -1
  74. data/vendor/assets/javascripts/ace/mode-mysql.js +1 -1
  75. data/vendor/assets/javascripts/ace/mode-nix.js +8 -5
  76. data/vendor/assets/javascripts/ace/mode-objectivec.js +6 -3
  77. data/vendor/assets/javascripts/ace/mode-perl.js +4 -5
  78. data/vendor/assets/javascripts/ace/mode-pgsql.js +141 -12
  79. data/vendor/assets/javascripts/ace/mode-php.js +9872 -143
  80. data/vendor/assets/javascripts/ace/mode-powershell.js +4 -5
  81. data/vendor/assets/javascripts/ace/mode-praat.js +18 -14
  82. data/vendor/assets/javascripts/ace/mode-prolog.js +2 -3
  83. data/vendor/assets/javascripts/ace/mode-protobuf.js +8 -5
  84. data/vendor/assets/javascripts/ace/mode-rhtml.js +495 -138
  85. data/vendor/assets/javascripts/ace/mode-ruby.js +2 -2
  86. data/vendor/assets/javascripts/ace/mode-rust.js +32 -39
  87. data/vendor/assets/javascripts/ace/mode-scad.js +4 -5
  88. data/vendor/assets/javascripts/ace/mode-scala.js +158 -21
  89. data/vendor/assets/javascripts/ace/mode-scheme.js +118 -1
  90. data/vendor/assets/javascripts/ace/mode-scss.js +4 -5
  91. data/vendor/assets/javascripts/ace/mode-sh.js +58 -13
  92. data/vendor/assets/javascripts/ace/mode-sjs.js +145 -17
  93. data/vendor/assets/javascripts/ace/mode-smarty.js +495 -138
  94. data/vendor/assets/javascripts/ace/mode-soy_template.js +496 -140
  95. data/vendor/assets/javascripts/ace/mode-sql.js +12 -4
  96. data/vendor/assets/javascripts/ace/mode-sqlserver.js +437 -0
  97. data/vendor/assets/javascripts/ace/mode-svg.js +147 -20
  98. data/vendor/assets/javascripts/ace/mode-swift.js +738 -0
  99. data/vendor/assets/javascripts/ace/mode-swig.js +1099 -0
  100. data/vendor/assets/javascripts/ace/mode-tcl.js +2 -3
  101. data/vendor/assets/javascripts/ace/mode-tex.js +1 -0
  102. data/vendor/assets/javascripts/ace/mode-toml.js +4 -0
  103. data/vendor/assets/javascripts/ace/mode-twig.js +495 -138
  104. data/vendor/assets/javascripts/ace/mode-typescript.js +147 -19
  105. data/vendor/assets/javascripts/ace/mode-vala.js +4 -5
  106. data/vendor/assets/javascripts/ace/mode-vbscript.js +26 -13
  107. data/vendor/assets/javascripts/ace/mode-velocity.js +495 -138
  108. data/vendor/assets/javascripts/ace/mode-verilog.js +8 -0
  109. data/vendor/assets/javascripts/ace/mode-xml.js +2 -3
  110. data/vendor/assets/javascripts/ace/mode-xquery.js +4 -5
  111. data/vendor/assets/javascripts/ace/snippets/actionscript.js +5 -0
  112. data/vendor/assets/javascripts/ace/snippets/html_elixir.js +7 -0
  113. data/vendor/assets/javascripts/ace/snippets/java.js +6 -0
  114. data/vendor/assets/javascripts/ace/snippets/javascript.js +13 -0
  115. data/vendor/assets/javascripts/ace/snippets/lsl.js +166 -0
  116. data/vendor/assets/javascripts/ace/snippets/maze.js +16 -0
  117. data/vendor/assets/javascripts/ace/snippets/php.js +105 -4
  118. data/vendor/assets/javascripts/ace/snippets/sqlserver.js +76 -0
  119. data/vendor/assets/javascripts/ace/snippets/swift.js +7 -0
  120. data/vendor/assets/javascripts/ace/snippets/swig.js +7 -0
  121. data/vendor/assets/javascripts/ace/theme-clouds.js +0 -1
  122. data/vendor/assets/javascripts/ace/theme-clouds_midnight.js +0 -1
  123. data/vendor/assets/javascripts/ace/theme-cobalt.js +3 -3
  124. data/vendor/assets/javascripts/ace/theme-dawn.js +0 -1
  125. data/vendor/assets/javascripts/ace/theme-github.js +0 -1
  126. data/vendor/assets/javascripts/ace/theme-idle_fingers.js +0 -1
  127. data/vendor/assets/javascripts/ace/theme-iplastic.js +121 -0
  128. data/vendor/assets/javascripts/ace/theme-katzenmilch.js +1 -2
  129. data/vendor/assets/javascripts/ace/theme-kr_theme.js +0 -1
  130. data/vendor/assets/javascripts/ace/theme-kuroir.js +0 -1
  131. data/vendor/assets/javascripts/ace/theme-merbivore.js +0 -1
  132. data/vendor/assets/javascripts/ace/theme-merbivore_soft.js +0 -1
  133. data/vendor/assets/javascripts/ace/theme-mono_industrial.js +0 -1
  134. data/vendor/assets/javascripts/ace/theme-monokai.js +0 -1
  135. data/vendor/assets/javascripts/ace/theme-pastel_on_dark.js +0 -1
  136. data/vendor/assets/javascripts/ace/theme-solarized_dark.js +0 -1
  137. data/vendor/assets/javascripts/ace/theme-solarized_light.js +0 -1
  138. data/vendor/assets/javascripts/ace/theme-sqlserver.js +138 -0
  139. data/vendor/assets/javascripts/ace/theme-terminal.js +0 -1
  140. data/vendor/assets/javascripts/ace/theme-textmate.js +0 -1
  141. data/vendor/assets/javascripts/ace/theme-tomorrow.js +0 -1
  142. data/vendor/assets/javascripts/ace/theme-tomorrow_night.js +0 -1
  143. data/vendor/assets/javascripts/ace/theme-tomorrow_night_blue.js +0 -1
  144. data/vendor/assets/javascripts/ace/theme-tomorrow_night_bright.js +0 -1
  145. data/vendor/assets/javascripts/ace/theme-tomorrow_night_eighties.js +0 -1
  146. data/vendor/assets/javascripts/ace/theme-twilight.js +0 -1
  147. data/vendor/assets/javascripts/ace/theme-vibrant_ink.js +0 -1
  148. data/vendor/assets/javascripts/ace/theme-xcode.js +0 -1
  149. data/vendor/assets/javascripts/ace/worker-coffee.js +576 -6015
  150. data/vendor/assets/javascripts/ace/worker-css.js +529 -449
  151. data/vendor/assets/javascripts/ace/worker-html.js +528 -448
  152. data/vendor/assets/javascripts/ace/worker-javascript.js +8719 -7656
  153. data/vendor/assets/javascripts/ace/worker-json.js +530 -450
  154. data/vendor/assets/javascripts/ace/worker-lua.js +530 -450
  155. data/vendor/assets/javascripts/ace/worker-php.js +530 -450
  156. data/vendor/assets/javascripts/ace/worker-xml.js +530 -450
  157. data/vendor/assets/javascripts/ace/worker-xquery.js +529 -449
  158. metadata +14 -2
@@ -419,8 +419,8 @@ var CstyleBehaviour = function() {
419
419
  if (leftChar == "\\" && token && /escape/.test(token.type))
420
420
  return null;
421
421
 
422
- var stringBefore = token && /string/.test(token.type);
423
- var stringAfter = !rightToken || /string/.test(rightToken.type);
422
+ var stringBefore = token && /string|escape/.test(token.type);
423
+ var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
424
424
 
425
425
  var pair;
426
426
  if (rightChar == quote) {
@@ -561,7 +561,7 @@ oop.inherits(FoldMode, BaseFoldMode);
561
561
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
562
562
  this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
563
563
  this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
564
- this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
564
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
565
565
  this._getFoldWidgetBase = this.getFoldWidget;
566
566
  this.getFoldWidget = function(session, foldStyle, row) {
567
567
  var line = session.getLine(row);
@@ -649,13 +649,12 @@ oop.inherits(FoldMode, BaseFoldMode);
649
649
 
650
650
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
651
651
  };
652
-
653
652
  this.getCommentRegionBlock = function(session, line, row) {
654
653
  var startColumn = line.search(/\s*$/);
655
654
  var maxRow = session.getLength();
656
655
  var startRow = row;
657
656
 
658
- var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
657
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
659
658
  var depth = 1;
660
659
  while (++row < maxRow) {
661
660
  line = session.getLine(row);
@@ -12,7 +12,7 @@ var PraatHighlightRules = function() {
12
12
  "while|endwhile|" +
13
13
  "repeat|until|" +
14
14
  "select|plus|minus|" +
15
- "assert"
15
+ "assert|asserterror"
16
16
  );
17
17
 
18
18
  var predefinedVariables = (
@@ -26,17 +26,17 @@ var PraatHighlightRules = function() {
26
26
  var directives = (
27
27
  "clearinfo|endSendPraat"
28
28
  );
29
-
29
+
30
30
  var functions = (
31
- "writeInfo|writeInfoLine|appendInfo|appendInfoLine|" +
31
+ "writeInfo|writeInfoLine|appendInfo|appendInfoLine|info\\$|" +
32
32
  "writeFile|writeFileLine|appendFile|appendFileLine|" +
33
33
  "abs|round|floor|ceiling|min|max|imin|imax|" +
34
34
  "sqrt|sin|cos|tan|arcsin|arccos|arctan|arctan2|sinc|sincpi|" +
35
- "exp|ln|log10|log2|" +
36
- "sinh|cosh|tanh|arcsinh|arccosh|actanh|" +
35
+ "exp|ln|lnBeta|lnGamma|log10|log2|" +
36
+ "sinh|cosh|tanh|arcsinh|arccosh|arctanh|" +
37
37
  "sigmoid|invSigmoid|erf|erfc|" +
38
- "randomUniform|randomInteger|randomGauss|randomPoisson|" +
39
- "lnGamma|gaussP|gaussQ|invGaussQ|" +
38
+ "random(?:Uniform|Integer|Gauss|Poisson|Binomial)|" +
39
+ "gaussP|gaussQ|invGaussQ|incompleteGammaP|incompleteBeta|" +
40
40
  "chiSquareP|chiSquareQ|invChiSquareQ|studentP|studentQ|invStudentQ|" +
41
41
  "fisherP|fisherQ|invFisherQ|" +
42
42
  "binomialP|binomialQ|invBinomialP|invBinomialQ|" +
@@ -45,12 +45,16 @@ var PraatHighlightRules = function() {
45
45
  "hertzToSemitones|semitonesToHerz|" +
46
46
  "erb|hertzToErb|erbToHertz|" +
47
47
  "phonToDifferenceLimens|differenceLimensToPhon|" +
48
- "beta|besselI|besselK|" +
48
+ "soundPressureToPhon|" +
49
+ "beta|beta2|besselI|besselK|" +
50
+ "numberOfColumns|numberOfRows|" +
49
51
  "selected|selected\\$|numberOfSelected|variableExists|"+
50
52
  "index|rindex|startsWith|endsWith|"+
51
53
  "index_regex|rindex_regex|replace_regex\\$|"+
52
54
  "length|extractWord\\$|extractLine\\$|extractNumber|" +
53
55
  "left\\$|right\\$|mid\\$|replace\\$|" +
56
+ "date\\$|fixed\\$|percent\\$|" +
57
+ "zero#|linear#|randomUniform#|randomInteger#|randomGauss#|" +
54
58
  "beginPause|endPause|" +
55
59
  "demoShow|demoWindowTitle|demoInput|demoWaitForInput|" +
56
60
  "demoClicked|demoClickedIn|demoX|demoY|" +
@@ -61,7 +65,8 @@ var PraatHighlightRules = function() {
61
65
  "chooseDirectory\\$|createDirectory|fileReadable|deleteFile|" +
62
66
  "selectObject|removeObject|plusObject|minusObject|" +
63
67
  "runScript|exitScript|" +
64
- "beginSendPraat|endSendPraat"
68
+ "beginSendPraat|endSendPraat|" +
69
+ "objectsAreIdentical"
65
70
  );
66
71
 
67
72
  var objectTypes = (
@@ -99,7 +104,7 @@ var PraatHighlightRules = function() {
99
104
  regex : /(^\s*)(?:([a-z][a-zA-Z0-9_]*\$?\s+)(=)(\s+))?(stopwatch)/
100
105
  }, {
101
106
  token : ["text", "keyword", "text", "string"],
102
- regex : /(^\s*)(print(?:line)?|echo|exit|pause|sendpraat|include|execute)(\s+)(.*)/
107
+ regex : /(^\s*)(print(?:line|tab)?|echo|exit|pause|send(?:praat|socket)|include|execute|system(?:_nocheck)?)(\s+)(.*)/
103
108
  }, {
104
109
  token : ["text", "keyword"],
105
110
  regex : "(^\\s*)(" + directives + ")$"
@@ -108,7 +113,7 @@ var PraatHighlightRules = function() {
108
113
  regex : /(\s+)((?:\+|-|\/|\*|<|>)=?|==?|!=|%|\^|\||and|or|not)(\s+)/
109
114
  }, {
110
115
  token : ["text", "text", "keyword.operator", "text", "keyword", "text", "keyword"],
111
- regex : /(^\s*)(?:([a-z][a-zA-Z0-9_]*\$?\s+)(=)(\s+))?(?:((?:no)?warn|nocheck|noprogress)(\s+))?((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/
116
+ regex : /(^\s*)(?:([a-z][a-zA-Z0-9_]*\$?\s+)(=)(\s+))?(?:((?:no)?warn|(?:unix_)?nocheck|noprogress)(\s+))?((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/
112
117
  }, {
113
118
  token : ["text", "keyword", "text", "keyword"],
114
119
  regex : /(^\s*)(?:(demo)?(\s+))((?:[A-Z][^.:"]+)(?:$|(?:\.{3}|:)))/
@@ -292,7 +297,7 @@ oop.inherits(FoldMode, BaseFoldMode);
292
297
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
293
298
  this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
294
299
  this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
295
- this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
300
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
296
301
  this._getFoldWidgetBase = this.getFoldWidget;
297
302
  this.getFoldWidget = function(session, foldStyle, row) {
298
303
  var line = session.getLine(row);
@@ -380,13 +385,12 @@ oop.inherits(FoldMode, BaseFoldMode);
380
385
 
381
386
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
382
387
  };
383
-
384
388
  this.getCommentRegionBlock = function(session, line, row) {
385
389
  var startColumn = line.search(/\s*$/);
386
390
  var maxRow = session.getLength();
387
391
  var startRow = row;
388
392
 
389
- var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
393
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
390
394
  var depth = 1;
391
395
  while (++row < maxRow) {
392
396
  line = session.getLine(row);
@@ -224,7 +224,7 @@ oop.inherits(FoldMode, BaseFoldMode);
224
224
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
225
225
  this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
226
226
  this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
227
- this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
227
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
228
228
  this._getFoldWidgetBase = this.getFoldWidget;
229
229
  this.getFoldWidget = function(session, foldStyle, row) {
230
230
  var line = session.getLine(row);
@@ -312,13 +312,12 @@ oop.inherits(FoldMode, BaseFoldMode);
312
312
 
313
313
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
314
314
  };
315
-
316
315
  this.getCommentRegionBlock = function(session, line, row) {
317
316
  var startColumn = line.search(/\s*$/);
318
317
  var maxRow = session.getLength();
319
318
  var startRow = row;
320
319
 
321
- var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
320
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
322
321
  var depth = 1;
323
322
  while (++row < maxRow) {
324
323
  line = session.getLine(row);
@@ -98,6 +98,10 @@ var c_cppHighlightRules = function() {
98
98
  this.$rules = {
99
99
  "start" : [
100
100
  {
101
+ token : "comment",
102
+ regex : "//$",
103
+ next : "start"
104
+ }, {
101
105
  token : "comment",
102
106
  regex : "//",
103
107
  next : "singleLineComment"
@@ -519,8 +523,8 @@ var CstyleBehaviour = function() {
519
523
  if (leftChar == "\\" && token && /escape/.test(token.type))
520
524
  return null;
521
525
 
522
- var stringBefore = token && /string/.test(token.type);
523
- var stringAfter = !rightToken || /string/.test(rightToken.type);
526
+ var stringBefore = token && /string|escape/.test(token.type);
527
+ var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
524
528
 
525
529
  var pair;
526
530
  if (rightChar == quote) {
@@ -661,7 +665,7 @@ oop.inherits(FoldMode, BaseFoldMode);
661
665
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
662
666
  this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
663
667
  this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
664
- this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
668
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
665
669
  this._getFoldWidgetBase = this.getFoldWidget;
666
670
  this.getFoldWidget = function(session, foldStyle, row) {
667
671
  var line = session.getLine(row);
@@ -749,13 +753,12 @@ oop.inherits(FoldMode, BaseFoldMode);
749
753
 
750
754
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
751
755
  };
752
-
753
756
  this.getCommentRegionBlock = function(session, line, row) {
754
757
  var startColumn = line.search(/\s*$/);
755
758
  var maxRow = session.getLength();
756
759
  var startRow = row;
757
760
 
758
- var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
761
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
759
762
  var depth = 1;
760
763
  while (++row < maxRow) {
761
764
  line = session.getLine(row);
@@ -54,6 +54,7 @@ define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/
54
54
  var oop = require("../lib/oop");
55
55
  var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56
56
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
57
58
 
58
59
  var JavaScriptHighlightRules = function(options) {
59
60
  var keywordMapper = this.createKeywordMapper({
@@ -83,7 +84,6 @@ var JavaScriptHighlightRules = function(options) {
83
84
  "constant.language.boolean": "true|false"
84
85
  }, "identifier");
85
86
  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
87
 
88
88
  var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
89
89
  "u[0-9a-fA-F]{4}|" + // unicode
@@ -171,15 +171,6 @@ var JavaScriptHighlightRules = function(options) {
171
171
  token : "keyword",
172
172
  regex : "(?:" + kwBeforeRe + ")\\b",
173
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
174
  }, {
184
175
  token : ["support.constant"],
185
176
  regex : /that\b/
@@ -189,9 +180,13 @@ var JavaScriptHighlightRules = function(options) {
189
180
  }, {
190
181
  token : keywordMapper,
191
182
  regex : identifierRe
183
+ }, {
184
+ token : "punctuation.operator",
185
+ regex : /[.](?![.])/,
186
+ next : "property"
192
187
  }, {
193
188
  token : "keyword.operator",
194
- regex : /--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
189
+ regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
195
190
  next : "start"
196
191
  }, {
197
192
  token : "punctuation.operator",
@@ -209,6 +204,38 @@ var JavaScriptHighlightRules = function(options) {
209
204
  regex: /^#!.*$/
210
205
  }
211
206
  ],
207
+ property: [{
208
+ token : "text",
209
+ regex : "\\s+"
210
+ }, {
211
+ token : [
212
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
213
+ "keyword.operator", "text",
214
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
215
+ ],
216
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
217
+ next: "function_arguments"
218
+ }, {
219
+ token : "punctuation.operator",
220
+ regex : /[.](?![.])/
221
+ }, {
222
+ token : "support.function",
223
+ 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(?=\()/
224
+ }, {
225
+ token : "support.function.dom",
226
+ 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(?=\()/
227
+ }, {
228
+ token : "support.constant",
229
+ 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/
230
+ }, {
231
+ token : "identifier",
232
+ regex : identifierRe
233
+ }, {
234
+ regex: "",
235
+ token: "empty",
236
+ next: "no_regex"
237
+ }
238
+ ],
212
239
  "start": [
213
240
  DocCommentHighlightRules.getStartRule("doc-start"),
214
241
  {
@@ -363,7 +390,7 @@ var JavaScriptHighlightRules = function(options) {
363
390
  if (val == "}" && stack.length) {
364
391
  stack.shift();
365
392
  this.next = stack.shift();
366
- if (this.next.indexOf("string") != -1)
393
+ if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
367
394
  return "paren.quasi.end";
368
395
  }
369
396
  return val == "{" ? "paren.lparen" : "paren.rparen";
@@ -387,6 +414,9 @@ var JavaScriptHighlightRules = function(options) {
387
414
  defaultToken: "string.quasi"
388
415
  }]
389
416
  });
417
+
418
+ if (!options || !options.noJSX)
419
+ JSX.call(this);
390
420
  }
391
421
 
392
422
  this.embedRules(DocCommentHighlightRules, "doc-",
@@ -397,6 +427,105 @@ var JavaScriptHighlightRules = function(options) {
397
427
 
398
428
  oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
399
429
 
430
+ function JSX() {
431
+ var tagRegex = identifierRe.replace("\\d", "\\d\\-");
432
+ var jsxTag = {
433
+ onMatch : function(val, state, stack) {
434
+ var offset = val.charAt(1) == "/" ? 2 : 1;
435
+ if (offset == 1) {
436
+ if (state != this.nextState)
437
+ stack.unshift(this.next, this.nextState, 0);
438
+ else
439
+ stack.unshift(this.next);
440
+ stack[2]++;
441
+ } else if (offset == 2) {
442
+ if (state == this.nextState) {
443
+ stack[1]--;
444
+ if (!stack[1] || stack[1] < 0) {
445
+ stack.shift();
446
+ stack.shift();
447
+ }
448
+ }
449
+ }
450
+ return [{
451
+ type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
452
+ value: val.slice(0, offset)
453
+ }, {
454
+ type: "meta.tag.tag-name.xml",
455
+ value: val.substr(offset)
456
+ }];
457
+ },
458
+ regex : "</?" + tagRegex + "",
459
+ next: "jsxAttributes",
460
+ nextState: "jsx"
461
+ };
462
+ this.$rules.start.unshift(jsxTag);
463
+ var jsxJsRule = {
464
+ regex: "{",
465
+ token: "paren.quasi.start",
466
+ push: "start"
467
+ };
468
+ this.$rules.jsx = [
469
+ jsxJsRule,
470
+ jsxTag,
471
+ {include : "reference"},
472
+ {defaultToken: "string"}
473
+ ];
474
+ this.$rules.jsxAttributes = [{
475
+ token : "meta.tag.punctuation.tag-close.xml",
476
+ regex : "/?>",
477
+ onMatch : function(value, currentState, stack) {
478
+ if (currentState == stack[0])
479
+ stack.shift();
480
+ if (value.length == 2) {
481
+ if (stack[0] == this.nextState)
482
+ stack[1]--;
483
+ if (!stack[1] || stack[1] < 0) {
484
+ stack.splice(0, 2);
485
+ }
486
+ }
487
+ this.next = stack[0] || "start";
488
+ return [{type: this.token, value: value}];
489
+ },
490
+ nextState: "jsx"
491
+ },
492
+ jsxJsRule,
493
+ {
494
+ token : "entity.other.attribute-name.xml",
495
+ regex : tagRegex
496
+ }, {
497
+ token : "keyword.operator.attribute-equals.xml",
498
+ regex : "="
499
+ }, {
500
+ token : "text.tag-whitespace.xml",
501
+ regex : "\\s+"
502
+ }, {
503
+ token : "string.attribute-value.xml",
504
+ regex : "'",
505
+ stateName : "jsx_attr_q",
506
+ push : [
507
+ {token : "string.attribute-value.xml", regex: "'", next: "pop"},
508
+ jsxJsRule,
509
+ {include : "reference"},
510
+ {defaultToken : "string.attribute-value.xml"}
511
+ ]
512
+ }, {
513
+ token : "string.attribute-value.xml",
514
+ regex : '"',
515
+ stateName : "jsx_attr_qq",
516
+ push : [
517
+ jsxJsRule,
518
+ {token : "string.attribute-value.xml", regex: '"', next: "pop"},
519
+ {include : "reference"},
520
+ {defaultToken : "string.attribute-value.xml"}
521
+ ]
522
+ }];
523
+ this.$rules.reference = [{
524
+ token : "constant.language.escape.reference.xml",
525
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
526
+ }];
527
+ }
528
+
400
529
  exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
401
530
  });
402
531
 
@@ -680,8 +809,8 @@ var CstyleBehaviour = function() {
680
809
  if (leftChar == "\\" && token && /escape/.test(token.type))
681
810
  return null;
682
811
 
683
- var stringBefore = token && /string/.test(token.type);
684
- var stringAfter = !rightToken || /string/.test(rightToken.type);
812
+ var stringBefore = token && /string|escape/.test(token.type);
813
+ var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
685
814
 
686
815
  var pair;
687
816
  if (rightChar == quote) {
@@ -822,7 +951,7 @@ oop.inherits(FoldMode, BaseFoldMode);
822
951
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
823
952
  this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
824
953
  this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
825
- this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
954
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
826
955
  this._getFoldWidgetBase = this.getFoldWidget;
827
956
  this.getFoldWidget = function(session, foldStyle, row) {
828
957
  var line = session.getLine(row);
@@ -910,13 +1039,12 @@ oop.inherits(FoldMode, BaseFoldMode);
910
1039
 
911
1040
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
912
1041
  };
913
-
914
1042
  this.getCommentRegionBlock = function(session, line, row) {
915
1043
  var startColumn = line.search(/\s*$/);
916
1044
  var maxRow = session.getLength();
917
1045
  var startRow = row;
918
1046
 
919
- var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
1047
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
920
1048
  var depth = 1;
921
1049
  while (++row < maxRow) {
922
1050
  line = session.getLine(row);
@@ -1169,6 +1297,180 @@ exports.CssHighlightRules = CssHighlightRules;
1169
1297
 
1170
1298
  });
1171
1299
 
1300
+ define("ace/mode/css_completions",["require","exports","module"], function(require, exports, module) {
1301
+ "use strict";
1302
+
1303
+ var propertyMap = {
1304
+ "background": {"#$0": 1},
1305
+ "background-color": {"#$0": 1, "transparent": 1, "fixed": 1},
1306
+ "background-image": {"url('/$0')": 1},
1307
+ "background-repeat": {"repeat": 1, "repeat-x": 1, "repeat-y": 1, "no-repeat": 1, "inherit": 1},
1308
+ "background-position": {"bottom":2, "center":2, "left":2, "right":2, "top":2, "inherit":2,},
1309
+ "background-attachment": {"scroll": 1, "fixed": 1},
1310
+ "background-size": {"cover": 1, "contain": 1},
1311
+ "background-clip": {"border-box": 1, "padding-box": 1, "content-box": 1},
1312
+ "background-origin": {"border-box": 1, "padding-box": 1, "content-box": 1},
1313
+ "border": {"solid $0": 1, "dashed $0": 1, "dotted $0": 1, "#$0": 1},
1314
+ "border-color": {"#$0": 1},
1315
+ "border-style": {"solid":2, "dashed":2, "dotted":2, "double":2, "groove":2, "hidden":2, "inherit":2, "inset":2, "none":2, "outset":2, "ridged":2,},
1316
+ "border-collapse": {"collapse": 1, "separate": 1},
1317
+ "bottom": {"px": 1, "em": 1, "%": 1},
1318
+ "clear": {"left": 1, "right": 1, "both": 1, "none": 1},
1319
+ "color": {"#$0": 1, "rgb(#$00,0,0)": 1},
1320
+ "cursor": {"default": 1, "pointer": 1, "move": 1, "text": 1, "wait": 1, "help": 1, "progress": 1, "n-resize": 1, "ne-resize": 1, "e-resize": 1, "se-resize": 1, "s-resize": 1, "sw-resize": 1, "w-resize": 1, "nw-resize": 1},
1321
+ "display": {"none": 1, "block": 1, "inline": 1, "inline-block": 1, "table-cell": 1},
1322
+ "empty-cells": {"show": 1, "hide": 1},
1323
+ "float": {"left": 1, "right": 1, "none": 1},
1324
+ "font-family": {"Arial":2,"Comic Sans MS":2,"Consolas":2,"Courier New":2,"Courier":2,"Georgia":2,"Monospace":2,"Sans-Serif":2, "Segoe UI":2,"Tahoma":2,"Times New Roman":2,"Trebuchet MS":2,"Verdana": 1},
1325
+ "font-size": {"px": 1, "em": 1, "%": 1},
1326
+ "font-weight": {"bold": 1, "normal": 1},
1327
+ "font-style": {"italic": 1, "normal": 1},
1328
+ "font-variant": {"normal": 1, "small-caps": 1},
1329
+ "height": {"px": 1, "em": 1, "%": 1},
1330
+ "left": {"px": 1, "em": 1, "%": 1},
1331
+ "letter-spacing": {"normal": 1},
1332
+ "line-height": {"normal": 1},
1333
+ "list-style-type": {"none": 1, "disc": 1, "circle": 1, "square": 1, "decimal": 1, "decimal-leading-zero": 1, "lower-roman": 1, "upper-roman": 1, "lower-greek": 1, "lower-latin": 1, "upper-latin": 1, "georgian": 1, "lower-alpha": 1, "upper-alpha": 1},
1334
+ "margin": {"px": 1, "em": 1, "%": 1},
1335
+ "margin-right": {"px": 1, "em": 1, "%": 1},
1336
+ "margin-left": {"px": 1, "em": 1, "%": 1},
1337
+ "margin-top": {"px": 1, "em": 1, "%": 1},
1338
+ "margin-bottom": {"px": 1, "em": 1, "%": 1},
1339
+ "max-height": {"px": 1, "em": 1, "%": 1},
1340
+ "max-width": {"px": 1, "em": 1, "%": 1},
1341
+ "min-height": {"px": 1, "em": 1, "%": 1},
1342
+ "min-width": {"px": 1, "em": 1, "%": 1},
1343
+ "overflow": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
1344
+ "overflow-x": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
1345
+ "overflow-y": {"hidden": 1, "visible": 1, "auto": 1, "scroll": 1},
1346
+ "padding": {"px": 1, "em": 1, "%": 1},
1347
+ "padding-top": {"px": 1, "em": 1, "%": 1},
1348
+ "padding-right": {"px": 1, "em": 1, "%": 1},
1349
+ "padding-bottom": {"px": 1, "em": 1, "%": 1},
1350
+ "padding-left": {"px": 1, "em": 1, "%": 1},
1351
+ "page-break-after": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
1352
+ "page-break-before": {"auto": 1, "always": 1, "avoid": 1, "left": 1, "right": 1},
1353
+ "position": {"absolute": 1, "relative": 1, "fixed": 1, "static": 1},
1354
+ "right": {"px": 1, "em": 1, "%": 1},
1355
+ "table-layout": {"fixed": 1, "auto": 1},
1356
+ "text-decoration": {"none": 1, "underline": 1, "line-through": 1, "blink": 1},
1357
+ "text-align": {"left": 1, "right": 1, "center": 1, "justify": 1},
1358
+ "text-transform": {"capitalize": 1, "uppercase": 1, "lowercase": 1, "none": 1},
1359
+ "top": {"px": 1, "em": 1, "%": 1},
1360
+ "vertical-align": {"top": 1, "bottom": 1},
1361
+ "visibility": {"hidden": 1, "visible": 1},
1362
+ "white-space": {"nowrap": 1, "normal": 1, "pre": 1, "pre-line": 1, "pre-wrap": 1},
1363
+ "width": {"px": 1, "em": 1, "%": 1},
1364
+ "word-spacing": {"normal": 1},
1365
+ "filter": {"alpha(opacity=$0100)": 1},
1366
+
1367
+ "text-shadow": {"$02px 2px 2px #777": 1},
1368
+ "text-overflow": {"ellipsis-word": 1, "clip": 1, "ellipsis": 1},
1369
+ "-moz-border-radius": 1,
1370
+ "-moz-border-radius-topright": 1,
1371
+ "-moz-border-radius-bottomright": 1,
1372
+ "-moz-border-radius-topleft": 1,
1373
+ "-moz-border-radius-bottomleft": 1,
1374
+ "-webkit-border-radius": 1,
1375
+ "-webkit-border-top-right-radius": 1,
1376
+ "-webkit-border-top-left-radius": 1,
1377
+ "-webkit-border-bottom-right-radius": 1,
1378
+ "-webkit-border-bottom-left-radius": 1,
1379
+ "-moz-box-shadow": 1,
1380
+ "-webkit-box-shadow": 1,
1381
+ "transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
1382
+ "-moz-transform": {"rotate($00deg)": 1, "skew($00deg)": 1},
1383
+ "-webkit-transform": {"rotate($00deg)": 1, "skew($00deg)": 1 }
1384
+ };
1385
+
1386
+ var CssCompletions = function() {
1387
+
1388
+ };
1389
+
1390
+ (function() {
1391
+
1392
+ this.completionsDefined = false;
1393
+
1394
+ this.defineCompletions = function() {
1395
+ if (document) {
1396
+ var style = document.createElement('c').style;
1397
+
1398
+ for (var i in style) {
1399
+ if (typeof style[i] !== 'string')
1400
+ continue;
1401
+
1402
+ var name = i.replace(/[A-Z]/g, function(x) {
1403
+ return '-' + x.toLowerCase();
1404
+ });
1405
+
1406
+ if (!propertyMap.hasOwnProperty(name))
1407
+ propertyMap[name] = 1;
1408
+ }
1409
+ }
1410
+
1411
+ this.completionsDefined = true;
1412
+ }
1413
+
1414
+ this.getCompletions = function(state, session, pos, prefix) {
1415
+ if (!this.completionsDefined) {
1416
+ this.defineCompletions();
1417
+ }
1418
+
1419
+ var token = session.getTokenAt(pos.row, pos.column);
1420
+
1421
+ if (!token)
1422
+ return [];
1423
+ if (state==='ruleset'){
1424
+ var line = session.getLine(pos.row).substr(0, pos.column);
1425
+ if (/:[^;]+$/.test(line)) {
1426
+ /([\w\-]+):[^:]*$/.test(line);
1427
+
1428
+ return this.getPropertyValueCompletions(state, session, pos, prefix);
1429
+ } else {
1430
+ return this.getPropertyCompletions(state, session, pos, prefix);
1431
+ }
1432
+ }
1433
+
1434
+ return [];
1435
+ };
1436
+
1437
+ this.getPropertyCompletions = function(state, session, pos, prefix) {
1438
+ var properties = Object.keys(propertyMap);
1439
+ return properties.map(function(property){
1440
+ return {
1441
+ caption: property,
1442
+ snippet: property + ': $0',
1443
+ meta: "property",
1444
+ score: Number.MAX_VALUE
1445
+ };
1446
+ });
1447
+ };
1448
+
1449
+ this.getPropertyValueCompletions = function(state, session, pos, prefix) {
1450
+ var line = session.getLine(pos.row).substr(0, pos.column);
1451
+ var property = (/([\w\-]+):[^:]*$/.exec(line) || {})[1];
1452
+
1453
+ if (!property)
1454
+ return [];
1455
+ var values = [];
1456
+ if (property in propertyMap && typeof propertyMap[property] === "object") {
1457
+ values = Object.keys(propertyMap[property]);
1458
+ }
1459
+ return values.map(function(value){
1460
+ return {
1461
+ caption: value,
1462
+ snippet: value,
1463
+ meta: "property value",
1464
+ score: Number.MAX_VALUE
1465
+ };
1466
+ });
1467
+ };
1468
+
1469
+ }).call(CssCompletions.prototype);
1470
+
1471
+ exports.CssCompletions = CssCompletions;
1472
+ });
1473
+
1172
1474
  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) {
1173
1475
  "use strict";
1174
1476
 
@@ -1248,7 +1550,7 @@ oop.inherits(CssBehaviour, CstyleBehaviour);
1248
1550
  exports.CssBehaviour = CssBehaviour;
1249
1551
  });
1250
1552
 
1251
- define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
1553
+ define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/css_completions","ace/mode/behaviour/css","ace/mode/folding/cstyle"], function(require, exports, module) {
1252
1554
  "use strict";
1253
1555
 
1254
1556
  var oop = require("../lib/oop");
@@ -1256,6 +1558,7 @@ var TextMode = require("./text").Mode;
1256
1558
  var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
1257
1559
  var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1258
1560
  var WorkerClient = require("../worker/worker_client").WorkerClient;
1561
+ var CssCompletions = require("./css_completions").CssCompletions;
1259
1562
  var CssBehaviour = require("./behaviour/css").CssBehaviour;
1260
1563
  var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1261
1564
 
@@ -1263,6 +1566,7 @@ var Mode = function() {
1263
1566
  this.HighlightRules = CssHighlightRules;
1264
1567
  this.$outdent = new MatchingBraceOutdent();
1265
1568
  this.$behaviour = new CssBehaviour();
1569
+ this.$completer = new CssCompletions();
1266
1570
  this.foldingRules = new CStyleFoldMode();
1267
1571
  };
1268
1572
  oop.inherits(Mode, TextMode);
@@ -1295,6 +1599,10 @@ oop.inherits(Mode, TextMode);
1295
1599
  this.$outdent.autoOutdent(doc, row);
1296
1600
  };
1297
1601
 
1602
+ this.getCompletions = function(state, session, pos, prefix) {
1603
+ return this.$completer.getCompletions(state, session, pos, prefix);
1604
+ };
1605
+
1298
1606
  this.createWorker = function(session) {
1299
1607
  var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
1300
1608
  worker.attachToDocument(session.getDocument());
@@ -1324,8 +1632,7 @@ var oop = require("../lib/oop");
1324
1632
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1325
1633
 
1326
1634
  var XmlHighlightRules = function(normalize) {
1327
-
1328
- var tagRegex = "[a-zA-Z][-_a-zA-Z0-9]*";
1635
+ var tagRegex = "[_:a-zA-Z\xc0-\uffff][-_:.a-zA-Z0-9\xc0-\uffff]*";
1329
1636
 
1330
1637
  this.$rules = {
1331
1638
  start : [
@@ -1567,7 +1874,7 @@ var HtmlHighlightRules = function() {
1567
1874
  include : "tag_whitespace"
1568
1875
  }, {
1569
1876
  token : "entity.other.attribute-name.xml",
1570
- regex : "[-_a-zA-Z0-9:]+"
1877
+ regex : "[-_a-zA-Z0-9:.]+"
1571
1878
  }, {
1572
1879
  token : "keyword.operator.attribute-equals.xml",
1573
1880
  regex : "=",
@@ -1591,7 +1898,7 @@ var HtmlHighlightRules = function() {
1591
1898
  return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml",
1592
1899
  "meta.tag" + (group ? "." + group : "") + ".tag-name.xml"];
1593
1900
  },
1594
- regex : "(</?)([-_a-zA-Z0-9:]+)",
1901
+ regex : "(</?)([-_a-zA-Z0-9:.]+)",
1595
1902
  next: "tag_stuff"
1596
1903
  }],
1597
1904
  tag_stuff: [
@@ -1601,7 +1908,7 @@ var HtmlHighlightRules = function() {
1601
1908
  });
1602
1909
 
1603
1910
  this.embedTagRules(CssHighlightRules, "css-", "style");
1604
- this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
1911
+ this.embedTagRules(new JavaScriptHighlightRules({noJSX: true}).getRules(), "js-", "script");
1605
1912
 
1606
1913
  if (this.constructor === HtmlHighlightRules)
1607
1914
  this.normalizeRules();
@@ -2179,118 +2486,120 @@ var eventAttributes = [
2179
2486
  var globalAttributes = commonAttributes.concat(eventAttributes);
2180
2487
 
2181
2488
  var attributeMap = {
2182
- "html": ["manifest"],
2183
- "head": [],
2184
- "title": [],
2185
- "base": ["href", "target"],
2186
- "link": ["href", "hreflang", "rel", "media", "type", "sizes"],
2187
- "meta": ["http-equiv", "name", "content", "charset"],
2188
- "style": ["type", "media", "scoped"],
2189
- "script": ["charset", "type", "src", "defer", "async"],
2190
- "noscript": ["href"],
2191
- "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"],
2192
- "section": [],
2193
- "nav": [],
2194
- "article": ["pubdate"],
2195
- "aside": [],
2196
- "h1": [],
2197
- "h2": [],
2198
- "h3": [],
2199
- "h4": [],
2200
- "h5": [],
2201
- "h6": [],
2202
- "header": [],
2203
- "footer": [],
2204
- "address": [],
2205
- "main": [],
2206
- "p": [],
2207
- "hr": [],
2208
- "pre": [],
2209
- "blockquote": ["cite"],
2210
- "ol": ["start", "reversed"],
2211
- "ul": [],
2212
- "li": ["value"],
2213
- "dl": [],
2214
- "dt": [],
2215
- "dd": [],
2216
- "figure": [],
2217
- "figcaption": [],
2218
- "div": [],
2219
- "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"],
2220
- "em": [],
2221
- "strong": [],
2222
- "small": [],
2223
- "s": [],
2224
- "cite": [],
2225
- "q": ["cite"],
2226
- "dfn": [],
2227
- "abbr": [],
2228
- "data": [],
2229
- "time": ["datetime"],
2230
- "code": [],
2231
- "var": [],
2232
- "samp": [],
2233
- "kbd": [],
2234
- "sub": [],
2235
- "sup": [],
2236
- "i": [],
2237
- "b": [],
2238
- "u": [],
2239
- "mark": [],
2240
- "ruby": [],
2241
- "rt": [],
2242
- "rp": [],
2243
- "bdi": [],
2244
- "bdo": [],
2245
- "span": [],
2246
- "br": [],
2247
- "wbr": [],
2248
- "ins": ["cite", "datetime"],
2249
- "del": ["cite", "datetime"],
2250
- "img": ["alt", "src", "height", "width", "usemap", "ismap"],
2251
- "iframe": ["name", "src", "height", "width", "sandbox", "seamless"],
2252
- "embed": ["src", "height", "width", "type"],
2253
- "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"],
2254
- "param": ["name", "value"],
2255
- "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"],
2256
- "audio": ["src", "autobuffer", "autoplay", "loop", "controls"],
2257
- "source": ["src", "type", "media"],
2258
- "track": ["kind", "src", "srclang", "label", "default"],
2259
- "canvas": ["width", "height"],
2260
- "map": ["name"],
2261
- "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"],
2262
- "svg": [],
2263
- "math": [],
2264
- "table": ["summary"],
2265
- "caption": [],
2266
- "colgroup": ["span"],
2267
- "col": ["span"],
2268
- "tbody": [],
2269
- "thead": [],
2270
- "tfoot": [],
2271
- "tr": [],
2272
- "td": ["headers", "rowspan", "colspan"],
2273
- "th": ["headers", "rowspan", "colspan", "scope"],
2274
- "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"],
2275
- "fieldset": ["disabled", "form", "name"],
2276
- "legend": [],
2277
- "label": ["form", "for"],
2278
- "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"],
2279
- "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"],
2280
- "select": ["autofocus", "disabled", "form", "multiple", "name", "size"],
2281
- "datalist": [],
2282
- "optgroup": ["disabled", "label"],
2283
- "option": ["disabled", "selected", "label", "value"],
2284
- "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"],
2285
- "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"],
2286
- "output": ["for", "form", "name"],
2287
- "progress": ["value", "max"],
2288
- "meter": ["value", "min", "max", "low", "high", "optimum"],
2289
- "details": ["open"],
2290
- "summary": [],
2291
- "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"],
2292
- "menu": ["type", "label"],
2293
- "dialog": ["open"]
2489
+ "html": {"manifest": 1},
2490
+ "head": {},
2491
+ "title": {},
2492
+ "base": {"href": 1, "target": 1},
2493
+ "link": {"href": 1, "hreflang": 1, "rel": {"stylesheet": 1, "icon": 1}, "media": {"all": 1, "screen": 1, "print": 1}, "type": {"text/css": 1, "image/png": 1, "image/jpeg": 1, "image/gif": 1}, "sizes": 1},
2494
+ "meta": {"http-equiv": {"content-type": 1}, "name": {"description": 1, "keywords": 1}, "content": {"text/html; charset=UTF-8": 1}, "charset": 1},
2495
+ "style": {"type": 1, "media": {"all": 1, "screen": 1, "print": 1}, "scoped": 1},
2496
+ "script": {"charset": 1, "type": {"text/javascript": 1}, "src": 1, "defer": 1, "async": 1},
2497
+ "noscript": {"href": 1},
2498
+ "body": {"onafterprint": 1, "onbeforeprint": 1, "onbeforeunload": 1, "onhashchange": 1, "onmessage": 1, "onoffline": 1, "onpopstate": 1, "onredo": 1, "onresize": 1, "onstorage": 1, "onundo": 1, "onunload": 1},
2499
+ "section": {},
2500
+ "nav": {},
2501
+ "article": {"pubdate": 1},
2502
+ "aside": {},
2503
+ "h1": {},
2504
+ "h2": {},
2505
+ "h3": {},
2506
+ "h4": {},
2507
+ "h5": {},
2508
+ "h6": {},
2509
+ "header": {},
2510
+ "footer": {},
2511
+ "address": {},
2512
+ "main": {},
2513
+ "p": {},
2514
+ "hr": {},
2515
+ "pre": {},
2516
+ "blockquote": {"cite": 1},
2517
+ "ol": {"start": 1, "reversed": 1},
2518
+ "ul": {},
2519
+ "li": {"value": 1},
2520
+ "dl": {},
2521
+ "dt": {},
2522
+ "dd": {},
2523
+ "figure": {},
2524
+ "figcaption": {},
2525
+ "div": {},
2526
+ "a": {"href": 1, "target": {"_blank": 1, "top": 1}, "ping": 1, "rel": {"nofollow": 1, "alternate": 1, "author": 1, "bookmark": 1, "help": 1, "license": 1, "next": 1, "noreferrer": 1, "prefetch": 1, "prev": 1, "search": 1, "tag": 1}, "media": 1, "hreflang": 1, "type": 1},
2527
+ "em": {},
2528
+ "strong": {},
2529
+ "small": {},
2530
+ "s": {},
2531
+ "cite": {},
2532
+ "q": {"cite": 1},
2533
+ "dfn": {},
2534
+ "abbr": {},
2535
+ "data": {},
2536
+ "time": {"datetime": 1},
2537
+ "code": {},
2538
+ "var": {},
2539
+ "samp": {},
2540
+ "kbd": {},
2541
+ "sub": {},
2542
+ "sup": {},
2543
+ "i": {},
2544
+ "b": {},
2545
+ "u": {},
2546
+ "mark": {},
2547
+ "ruby": {},
2548
+ "rt": {},
2549
+ "rp": {},
2550
+ "bdi": {},
2551
+ "bdo": {},
2552
+ "span": {},
2553
+ "br": {},
2554
+ "wbr": {},
2555
+ "ins": {"cite": 1, "datetime": 1},
2556
+ "del": {"cite": 1, "datetime": 1},
2557
+ "img": {"alt": 1, "src": 1, "height": 1, "width": 1, "usemap": 1, "ismap": 1},
2558
+ "iframe": {"name": 1, "src": 1, "height": 1, "width": 1, "sandbox": {"allow-same-origin": 1, "allow-top-navigation": 1, "allow-forms": 1, "allow-scripts": 1}, "seamless": {"seamless": 1}},
2559
+ "embed": {"src": 1, "height": 1, "width": 1, "type": 1},
2560
+ "object": {"param": 1, "data": 1, "type": 1, "height" : 1, "width": 1, "usemap": 1, "name": 1, "form": 1, "classid": 1},
2561
+ "param": {"name": 1, "value": 1},
2562
+ "video": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "width": 1, "height": 1, "poster": 1, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1}},
2563
+ "audio": {"src": 1, "autobuffer": 1, "autoplay": {"autoplay": 1}, "loop": {"loop": 1}, "controls": {"controls": 1}, "muted": {"muted": 1}, "preload": {"auto": 1, "metadata": 1, "none": 1 }},
2564
+ "source": {"src": 1, "type": 1, "media": 1},
2565
+ "track": {"kind": 1, "src": 1, "srclang": 1, "label": 1, "default": 1},
2566
+ "canvas": {"width": 1, "height": 1},
2567
+ "map": {"name": 1},
2568
+ "area": {"shape": 1, "coords": 1, "href": 1, "hreflang": 1, "alt": 1, "target": 1, "media": 1, "rel": 1, "ping": 1, "type": 1},
2569
+ "svg": {},
2570
+ "math": {},
2571
+ "table": {"summary": 1},
2572
+ "caption": {},
2573
+ "colgroup": {"span": 1},
2574
+ "col": {"span": 1},
2575
+ "tbody": {},
2576
+ "thead": {},
2577
+ "tfoot": {},
2578
+ "tr": {},
2579
+ "td": {"headers": 1, "rowspan": 1, "colspan": 1},
2580
+ "th": {"headers": 1, "rowspan": 1, "colspan": 1, "scope": 1},
2581
+ "form": {"accept-charset": 1, "action": 1, "autocomplete": 1, "enctype": {"multipart/form-data": 1, "application/x-www-form-urlencoded": 1}, "method": {"get": 1, "post": 1}, "name": 1, "novalidate": 1, "target": {"_blank": 1, "top": 1}},
2582
+ "fieldset": {"disabled": 1, "form": 1, "name": 1},
2583
+ "legend": {},
2584
+ "label": {"form": 1, "for": 1},
2585
+ "input": {
2586
+ "type": {"text": 1, "password": 1, "hidden": 1, "checkbox": 1, "submit": 1, "radio": 1, "file": 1, "button": 1, "reset": 1, "image": 31, "color": 1, "date": 1, "datetime": 1, "datetime-local": 1, "email": 1, "month": 1, "number": 1, "range": 1, "search": 1, "tel": 1, "time": 1, "url": 1, "week": 1},
2587
+ "accept": 1, "alt": 1, "autocomplete": {"on": 1, "off": 1}, "autofocus": {"autofocus": 1}, "checked": {"checked": 1}, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": {"application/x-www-form-urlencoded": 1, "multipart/form-data": 1, "text/plain": 1}, "formmethod": {"get": 1, "post": 1}, "formnovalidate": {"formnovalidate": 1}, "formtarget": {"_blank": 1, "_self": 1, "_parent": 1, "_top": 1}, "height": 1, "list": 1, "max": 1, "maxlength": 1, "min": 1, "multiple": {"multiple": 1}, "pattern": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "size": 1, "src": 1, "step": 1, "width": 1, "files": 1, "value": 1},
2588
+ "button": {"autofocus": 1, "disabled": {"disabled": 1}, "form": 1, "formaction": 1, "formenctype": 1, "formmethod": 1, "formnovalidate": 1, "formtarget": 1, "name": 1, "value": 1, "type": {"button": 1, "submit": 1}},
2589
+ "select": {"autofocus": 1, "disabled": 1, "form": 1, "multiple": {"multiple": 1}, "name": 1, "size": 1, "readonly":{"readonly": 1}},
2590
+ "datalist": {},
2591
+ "optgroup": {"disabled": 1, "label": 1},
2592
+ "option": {"disabled": 1, "selected": 1, "label": 1, "value": 1},
2593
+ "textarea": {"autofocus": {"autofocus": 1}, "disabled": {"disabled": 1}, "form": 1, "maxlength": 1, "name": 1, "placeholder": 1, "readonly": {"readonly": 1}, "required": {"required": 1}, "rows": 1, "cols": 1, "wrap": {"on": 1, "off": 1, "hard": 1, "soft": 1}},
2594
+ "keygen": {"autofocus": 1, "challenge": {"challenge": 1}, "disabled": {"disabled": 1}, "form": 1, "keytype": {"rsa": 1, "dsa": 1, "ec": 1}, "name": 1},
2595
+ "output": {"for": 1, "form": 1, "name": 1},
2596
+ "progress": {"value": 1, "max": 1},
2597
+ "meter": {"value": 1, "min": 1, "max": 1, "low": 1, "high": 1, "optimum": 1},
2598
+ "details": {"open": 1},
2599
+ "summary": {},
2600
+ "command": {"type": 1, "label": 1, "icon": 1, "disabled": 1, "checked": 1, "radiogroup": 1, "command": 1},
2601
+ "menu": {"type": 1, "label": 1},
2602
+ "dialog": {"open": 1}
2294
2603
  };
2295
2604
 
2296
2605
  var elements = Object.keys(attributeMap);
@@ -2309,6 +2618,16 @@ function findTagName(session, pos) {
2309
2618
  return token.value;
2310
2619
  }
2311
2620
 
2621
+ function findAttributeName(session, pos) {
2622
+ var iterator = new TokenIterator(session, pos.row, pos.column);
2623
+ var token = iterator.getCurrentToken();
2624
+ while (token && !is(token, "attribute-name")){
2625
+ token = iterator.stepBackward();
2626
+ }
2627
+ if (token)
2628
+ return token.value;
2629
+ }
2630
+
2312
2631
  var HtmlCompletions = function() {
2313
2632
 
2314
2633
  };
@@ -2323,7 +2642,12 @@ var HtmlCompletions = function() {
2323
2642
  if (is(token, "tag-name") || is(token, "tag-open") || is(token, "end-tag-open"))
2324
2643
  return this.getTagCompletions(state, session, pos, prefix);
2325
2644
  if (is(token, "tag-whitespace") || is(token, "attribute-name"))
2326
- return this.getAttributeCompetions(state, session, pos, prefix);
2645
+ return this.getAttributeCompletions(state, session, pos, prefix);
2646
+ if (is(token, "attribute-value"))
2647
+ return this.getAttributeValueCompletions(state, session, pos, prefix);
2648
+ var line = session.getLine(pos.row).substr(0, pos.column);
2649
+ if (/&[A-z]*$/i.test(line))
2650
+ return this.getHTMLEntityCompletions(state, session, pos, prefix);
2327
2651
 
2328
2652
  return [];
2329
2653
  };
@@ -2338,13 +2662,13 @@ var HtmlCompletions = function() {
2338
2662
  });
2339
2663
  };
2340
2664
 
2341
- this.getAttributeCompetions = function(state, session, pos, prefix) {
2665
+ this.getAttributeCompletions = function(state, session, pos, prefix) {
2342
2666
  var tagName = findTagName(session, pos);
2343
2667
  if (!tagName)
2344
2668
  return [];
2345
2669
  var attributes = globalAttributes;
2346
2670
  if (tagName in attributeMap) {
2347
- attributes = attributes.concat(attributeMap[tagName]);
2671
+ attributes = attributes.concat(Object.keys(attributeMap[tagName]));
2348
2672
  }
2349
2673
  return attributes.map(function(attribute){
2350
2674
  return {
@@ -2356,6 +2680,39 @@ var HtmlCompletions = function() {
2356
2680
  });
2357
2681
  };
2358
2682
 
2683
+ this.getAttributeValueCompletions = function(state, session, pos, prefix) {
2684
+ var tagName = findTagName(session, pos);
2685
+ var attributeName = findAttributeName(session, pos);
2686
+
2687
+ if (!tagName)
2688
+ return [];
2689
+ var values = [];
2690
+ if (tagName in attributeMap && attributeName in attributeMap[tagName] && typeof attributeMap[tagName][attributeName] === "object") {
2691
+ values = Object.keys(attributeMap[tagName][attributeName]);
2692
+ }
2693
+ return values.map(function(value){
2694
+ return {
2695
+ caption: value,
2696
+ snippet: value,
2697
+ meta: "attribute value",
2698
+ score: Number.MAX_VALUE
2699
+ };
2700
+ });
2701
+ };
2702
+
2703
+ this.getHTMLEntityCompletions = function(state, session, pos, prefix) {
2704
+ var values = ['&Aacute;', '&aacute;', '&Acirc;', '&acirc;', '&acute;', '&AElig;', '&aelig;', '&Agrave;', '&agrave;', '&alefsym;', '&Alpha;', '&alpha;', '&amp;', '&and;', '&ang;', '&Aring;', '&aring;', '&asymp;', '&Atilde;', '&atilde;', '&Auml;', '&auml;', '&bdquo;', '&Beta;', '&beta;', '&brvbar;', '&bull;', '&cap;', '&Ccedil;', '&ccedil;', '&cedil;', '&cent;', '&Chi;', '&chi;', '&circ;', '&clubs;', '&cong;', '&copy;', '&crarr;', '&cup;', '&curren;', '&Dagger;', '&dagger;', '&dArr;', '&darr;', '&deg;', '&Delta;', '&delta;', '&diams;', '&divide;', '&Eacute;', '&eacute;', '&Ecirc;', '&ecirc;', '&Egrave;', '&egrave;', '&empty;', '&emsp;', '&ensp;', '&Epsilon;', '&epsilon;', '&equiv;', '&Eta;', '&eta;', '&ETH;', '&eth;', '&Euml;', '&euml;', '&euro;', '&exist;', '&fnof;', '&forall;', '&frac12;', '&frac14;', '&frac34;', '&frasl;', '&Gamma;', '&gamma;', '&ge;', '&gt;', '&hArr;', '&harr;', '&hearts;', '&hellip;', '&Iacute;', '&iacute;', '&Icirc;', '&icirc;', '&iexcl;', '&Igrave;', '&igrave;', '&image;', '&infin;', '&int;', '&Iota;', '&iota;', '&iquest;', '&isin;', '&Iuml;', '&iuml;', '&Kappa;', '&kappa;', '&Lambda;', '&lambda;', '&lang;', '&laquo;', '&lArr;', '&larr;', '&lceil;', '&ldquo;', '&le;', '&lfloor;', '&lowast;', '&loz;', '&lrm;', '&lsaquo;', '&lsquo;', '&lt;', '&macr;', '&mdash;', '&micro;', '&middot;', '&minus;', '&Mu;', '&mu;', '&nabla;', '&nbsp;', '&ndash;', '&ne;', '&ni;', '&not;', '&notin;', '&nsub;', '&Ntilde;', '&ntilde;', '&Nu;', '&nu;', '&Oacute;', '&oacute;', '&Ocirc;', '&ocirc;', '&OElig;', '&oelig;', '&Ograve;', '&ograve;', '&oline;', '&Omega;', '&omega;', '&Omicron;', '&omicron;', '&oplus;', '&or;', '&ordf;', '&ordm;', '&Oslash;', '&oslash;', '&Otilde;', '&otilde;', '&otimes;', '&Ouml;', '&ouml;', '&para;', '&part;', '&permil;', '&perp;', '&Phi;', '&phi;', '&Pi;', '&pi;', '&piv;', '&plusmn;', '&pound;', '&Prime;', '&prime;', '&prod;', '&prop;', '&Psi;', '&psi;', '&quot;', '&radic;', '&rang;', '&raquo;', '&rArr;', '&rarr;', '&rceil;', '&rdquo;', '&real;', '&reg;', '&rfloor;', '&Rho;', '&rho;', '&rlm;', '&rsaquo;', '&rsquo;', '&sbquo;', '&Scaron;', '&scaron;', '&sdot;', '&sect;', '&shy;', '&Sigma;', '&sigma;', '&sigmaf;', '&sim;', '&spades;', '&sub;', '&sube;', '&sum;', '&sup;', '&sup1;', '&sup2;', '&sup3;', '&supe;', '&szlig;', '&Tau;', '&tau;', '&there4;', '&Theta;', '&theta;', '&thetasym;', '&thinsp;', '&THORN;', '&thorn;', '&tilde;', '&times;', '&trade;', '&Uacute;', '&uacute;', '&uArr;', '&uarr;', '&Ucirc;', '&ucirc;', '&Ugrave;', '&ugrave;', '&uml;', '&upsih;', '&Upsilon;', '&upsilon;', '&Uuml;', '&uuml;', '&weierp;', '&Xi;', '&xi;', '&Yacute;', '&yacute;', '&yen;', '&Yuml;', '&yuml;', '&Zeta;', '&zeta;', '&zwj;', '&zwnj;'];
2705
+
2706
+ return values.map(function(value){
2707
+ return {
2708
+ caption: value,
2709
+ snippet: value.substr(1),
2710
+ meta: "html entity",
2711
+ score: Number.MAX_VALUE
2712
+ };
2713
+ });
2714
+ };
2715
+
2359
2716
  }).call(HtmlCompletions.prototype);
2360
2717
 
2361
2718
  exports.HtmlCompletions = HtmlCompletions;