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
@@ -567,8 +567,8 @@ var CstyleBehaviour = function() {
567
567
  if (leftChar == "\\" && token && /escape/.test(token.type))
568
568
  return null;
569
569
 
570
- var stringBefore = token && /string/.test(token.type);
571
- var stringAfter = !rightToken || /string/.test(rightToken.type);
570
+ var stringBefore = token && /string|escape/.test(token.type);
571
+ var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
572
572
 
573
573
  var pair;
574
574
  if (rightChar == quote) {
@@ -7,9 +7,9 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
7
7
  var stringEscape = /\\(?:[nrt0'"]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\})/.source;
8
8
  var RustHighlightRules = function() {
9
9
 
10
- this.$rules = { start:
10
+ this.$rules = { start:
11
11
  [ { token: 'variable.other.source.rust',
12
- regex: '\'[a-zA-Z_][a-zA-Z0-9_]*[^\\\']' },
12
+ regex: '\'[a-zA-Z_][a-zA-Z0-9_]*(?![\\\'])' },
13
13
  { token: 'string.quoted.single.source.rust',
14
14
  regex: "'(?:[^'\\\\]|" + stringEscape + ")'" },
15
15
  {
@@ -50,19 +50,38 @@ var RustHighlightRules = function() {
50
50
  { token: 'constant.character.escape.source.rust',
51
51
  regex: stringEscape },
52
52
  { defaultToken: 'string.quoted.double.source.rust' } ] },
53
- { token: [ 'keyword.source.rust', 'meta.function.source.rust',
54
- 'entity.name.function.source.rust', 'meta.function.source.rust' ],
55
- regex: '\\b(fn)(\\s+)([a-zA-Z_][a-zA-Z0-9_][\\w\\:,+ \\\'<>]*)(\\s*\\()' },
53
+ { token: [ 'keyword.source.rust', 'text', 'entity.name.function.source.rust' ],
54
+ regex: '\\b(fn)(\\s+)([a-zA-Z_][a-zA-Z0-9_]*)' },
56
55
  { token: 'support.constant', regex: '\\b[a-zA-Z_][\\w\\d]*::' },
57
56
  { token: 'keyword.source.rust',
58
- regex: '\\b(?:as|assert|break|claim|const|do|drop|else|extern|fail|for|if|impl|in|let|log|loop|match|mod|module|move|mut|Owned|priv|pub|pure|ref|return|unchecked|unsafe|use|while|mod|Send|static|trait|class|struct|enum|type)\\b' },
57
+ regex: '\\b(?:abstract|alignof|as|box|break|continue|const|crate|do|else|enum|extern|for|final|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\\b' },
59
58
  { token: 'storage.type.source.rust',
60
- regex: '\\b(?:Self|m32|m64|m128|f80|f16|f128|int|uint|isize|usize|float|char|bool|u8|u16|u32|u64|f32|f64|i8|i16|i32|i64|str|option|either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b' },
59
+ regex: '\\b(?:Self|isize|usize|char|bool|u8|u16|u32|u64|f16|f32|f64|i8|i16|i32|i64|str|option|either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b' },
61
60
  { token: 'variable.language.source.rust', regex: '\\bself\\b' },
61
+
62
+ { token: 'comment.line.doc.source.rust',
63
+ regex: '//!.*$' },
64
+ { token: 'comment.line.double-dash.source.rust',
65
+ regex: '//.*$' },
66
+ { token: 'comment.start.block.source.rust',
67
+ regex: '/\\*',
68
+ stateName: 'comment',
69
+ push:
70
+ [ { token: 'comment.start.block.source.rust',
71
+ regex: '/\\*',
72
+ push: 'comment' },
73
+ { token: 'comment.end.block.source.rust',
74
+ regex: '\\*/',
75
+ next: 'pop' },
76
+ { defaultToken: 'comment.block.source.rust' } ] },
77
+
62
78
  { token: 'keyword.operator',
63
- regex: '!|\\$|\\*|\\-\\-|\\-|\\+\\+|\\+|-->|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|&=|\\^=|,|;' },
79
+ regex: /\$|[-=]>|[-+%^=!&|<>]=?|[*/](?![*/])=?/ },
80
+ { token : "punctuation.operator", regex : /[?:,;.]/ },
81
+ { token : "paren.lparen", regex : /[\[({]/ },
82
+ { token : "paren.rparen", regex : /[\])}]/ },
64
83
  { token: 'constant.language.source.rust',
65
- regex: '\\b(?:true|false|Some|None|Left|Right|Ok|Err)\\b' },
84
+ regex: '\\b(?:true|false|Some|None|Ok|Err)\\b' },
66
85
  { token: 'support.constant.source.rust',
67
86
  regex: '\\b(?:EXIT_FAILURE|EXIT_SUCCESS|RAND_MAX|EOF|SEEK_SET|SEEK_CUR|SEEK_END|_IOFBF|_IONBF|_IOLBF|BUFSIZ|FOPEN_MAX|FILENAME_MAX|L_tmpnam|TMP_MAX|O_RDONLY|O_WRONLY|O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC|S_IFIFO|S_IFCHR|S_IFBLK|S_IFDIR|S_IFREG|S_IFMT|S_IEXEC|S_IWRITE|S_IREAD|S_IRWXU|S_IXUSR|S_IWUSR|S_IRUSR|F_OK|R_OK|W_OK|X_OK|STDIN_FILENO|STDOUT_FILENO|STDERR_FILENO)\\b' },
68
87
  { token: 'meta.preprocessor.source.rust',
@@ -74,32 +93,7 @@ var RustHighlightRules = function() {
74
93
  { token: 'constant.numeric.binary.source.rust',
75
94
  regex: '\\b(?:0b[01_]+|0b[01_]+(?:u|us|u8|u16|u32|u64)|0b[01_]+(?:i|is|i8|i16|i32|i64))\\b' },
76
95
  { token: 'constant.numeric.float.source.rust',
77
- regex: '[0-9][0-9_]*(?:f32|f64|f)|[0-9][0-9_]*[eE][+-]=[0-9_]+|[0-9][0-9_]*[eE][+-]=[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\.[0-9_]+|[0-9][0-9_]*\\.[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\.[0-9_]+%[eE][+-]=[0-9_]+|[0-9][0-9_]*\\.[0-9_]+%[eE][+-]=[0-9_]+(?:f32|f64|f)' },
78
- { token: 'comment.line.documentation.source.rust',
79
- regex: '//!.*$',
80
- push_:
81
- [ { token: 'comment.line.documentation.source.rust',
82
- regex: '$',
83
- next: 'pop' },
84
- { defaultToken: 'comment.line.documentation.source.rust' } ] },
85
- { token: 'comment.line.double-dash.source.rust',
86
- regex: '//.*$',
87
- push_:
88
- [ { token: 'comment.line.double-dash.source.rust',
89
- regex: '$',
90
- next: 'pop' },
91
- { defaultToken: 'comment.line.double-dash.source.rust' } ] },
92
- { token: 'comment.start.block.source.rust',
93
- regex: '/\\*',
94
- stateName: 'comment',
95
- push:
96
- [ { token: 'comment.start.block.source.rust',
97
- regex: '/\\*',
98
- push: 'comment' },
99
- { token: 'comment.end.block.source.rust',
100
- regex: '\\*/',
101
- next: 'pop' },
102
- { defaultToken: 'comment.block.source.rust' } ] } ] }
96
+ regex: '[0-9][0-9_]*(?:f32|f64|f)|[0-9][0-9_]*[eE][+-]=[0-9_]+|[0-9][0-9_]*[eE][+-]=[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\.[0-9_]+|[0-9][0-9_]*\\.[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\.[0-9_]+%[eE][+-]=[0-9_]+|[0-9][0-9_]*\\.[0-9_]+%[eE][+-]=[0-9_]+(?:f32|f64|f)' } ] }
103
97
 
104
98
  this.normalizeRules();
105
99
  };
@@ -141,7 +135,7 @@ oop.inherits(FoldMode, BaseFoldMode);
141
135
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
142
136
  this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
143
137
  this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
144
- this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
138
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
145
139
  this._getFoldWidgetBase = this.getFoldWidget;
146
140
  this.getFoldWidget = function(session, foldStyle, row) {
147
141
  var line = session.getLine(row);
@@ -229,13 +223,12 @@ oop.inherits(FoldMode, BaseFoldMode);
229
223
 
230
224
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
231
225
  };
232
-
233
226
  this.getCommentRegionBlock = function(session, line, row) {
234
227
  var startColumn = line.search(/\s*$/);
235
228
  var maxRow = session.getLength();
236
229
  var startRow = row;
237
230
 
238
- var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
231
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
239
232
  var depth = 1;
240
233
  while (++row < maxRow) {
241
234
  line = session.getLine(row);
@@ -273,7 +266,7 @@ oop.inherits(Mode, TextMode);
273
266
 
274
267
  (function() {
275
268
  this.lineCommentStart = "//";
276
- this.blockComment = {start: "/*", end: "*/"};
269
+ this.blockComment = {start: "/*", end: "*/", nestable: true};
277
270
  this.$id = "ace/mode/rust";
278
271
  }).call(Mode.prototype);
279
272
 
@@ -438,8 +438,8 @@ var CstyleBehaviour = function() {
438
438
  if (leftChar == "\\" && token && /escape/.test(token.type))
439
439
  return null;
440
440
 
441
- var stringBefore = token && /string/.test(token.type);
442
- var stringAfter = !rightToken || /string/.test(rightToken.type);
441
+ var stringBefore = token && /string|escape/.test(token.type);
442
+ var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
443
443
 
444
444
  var pair;
445
445
  if (rightChar == quote) {
@@ -580,7 +580,7 @@ oop.inherits(FoldMode, BaseFoldMode);
580
580
  this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
581
581
  this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
582
582
  this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
583
- this.startRegionRe = /^\s*(\/\*|\/\/)#region\b/;
583
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
584
584
  this._getFoldWidgetBase = this.getFoldWidget;
585
585
  this.getFoldWidget = function(session, foldStyle, row) {
586
586
  var line = session.getLine(row);
@@ -668,13 +668,12 @@ oop.inherits(FoldMode, BaseFoldMode);
668
668
 
669
669
  return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
670
670
  };
671
-
672
671
  this.getCommentRegionBlock = function(session, line, row) {
673
672
  var startColumn = line.search(/\s*$/);
674
673
  var maxRow = session.getLength();
675
674
  var startRow = row;
676
675
 
677
- var re = /^\s*(?:\/\*|\/\/)#(end)?region\b/;
676
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
678
677
  var depth = 1;
679
678
  while (++row < maxRow) {
680
679
  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);
@@ -1033,10 +1161,13 @@ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocComme
1033
1161
  var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1034
1162
 
1035
1163
  var ScalaHighlightRules = function() {
1164
+
1036
1165
  var keywords = (
1037
- "case|default|do|else|for|if|match|while|throw|return|try|catch|finally|yield|" +
1038
- "abstract|class|def|extends|final|forSome|implicit|implicits|import|lazy|new|object|" +
1039
- "override|package|private|protected|sealed|super|this|trait|type|val|var|with"
1166
+ "case|default|do|else|for|if|match|while|throw|return|try|trye|catch|finally|yield|" +
1167
+ "abstract|class|def|extends|final|forSome|implicit|implicits|import|lazy|new|object|null|" +
1168
+ "override|package|private|protected|sealed|super|this|trait|type|val|var|with|" +
1169
+ "assert|assume|require|print|println|printf|readLine|readBoolean|readByte|readShort|" + // package scala
1170
+ "readChar|readInt|readLong|readFloat|readDouble" // package scala
1040
1171
  );
1041
1172
 
1042
1173
  var buildinConstants = ("true|false");
@@ -1068,7 +1199,13 @@ var ScalaHighlightRules = function() {
1068
1199
  "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
1069
1200
  "Cloneable|Class|CharSequence|Comparable|String|Object|" +
1070
1201
  "Unit|Any|AnyVal|AnyRef|Null|ScalaObject|Singleton|Seq|Iterable|List|" +
1071
- "Option|Array|Char|Byte|Short|Int|Long|Nothing"
1202
+ "Option|Array|Char|Byte|Int|Long|Nothing|" +
1203
+
1204
+ "App|Application|BufferedIterator|BigDecimal|BigInt|Console|Either|" +
1205
+ "Enumeration|Equiv|Fractional|Function|IndexedSeq|Integral|Iterator|" +
1206
+ "Map|Numeric|Nil|NotNull|Ordered|Ordering|PartialFunction|PartialOrdering|" +
1207
+ "Product|Proxy|Range|Responder|Seq|Serializable|Set|Specializable|Stream|" +
1208
+ "StringContext|Symbol|Traversable|TraversableOnce|Tuple|Vector|Pair|Triple"
1072
1209
 
1073
1210
 
1074
1211
  );
@@ -84,21 +84,138 @@ oop.inherits(SchemeHighlightRules, TextHighlightRules);
84
84
  exports.SchemeHighlightRules = SchemeHighlightRules;
85
85
  });
86
86
 
87
- define("ace/mode/scheme",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/scheme_highlight_rules"], function(require, exports, module) {
87
+ define("ace/mode/matching_parens_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
88
+ "use strict";
89
+
90
+ var Range = require("../range").Range;
91
+
92
+ var MatchingParensOutdent = function() {};
93
+
94
+ (function() {
95
+
96
+ this.checkOutdent = function(line, input) {
97
+ if (! /^\s+$/.test(line))
98
+ return false;
99
+
100
+ return /^\s*\)/.test(input);
101
+ };
102
+
103
+ this.autoOutdent = function(doc, row) {
104
+ var line = doc.getLine(row);
105
+ var match = line.match(/^(\s*\))/);
106
+
107
+ if (!match) return 0;
108
+
109
+ var column = match[1].length;
110
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
111
+
112
+ if (!openBracePos || openBracePos.row == row) return 0;
113
+
114
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
115
+ doc.replace(new Range(row, 0, row, column-1), indent);
116
+ };
117
+
118
+ this.$getIndent = function(line) {
119
+ var match = line.match(/^(\s+)/);
120
+ if (match) {
121
+ return match[1];
122
+ }
123
+
124
+ return "";
125
+ };
126
+
127
+ }).call(MatchingParensOutdent.prototype);
128
+
129
+ exports.MatchingParensOutdent = MatchingParensOutdent;
130
+ });
131
+
132
+ define("ace/mode/scheme",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/scheme_highlight_rules","ace/mode/matching_parens_outdent"], function(require, exports, module) {
88
133
  "use strict";
89
134
 
90
135
  var oop = require("../lib/oop");
91
136
  var TextMode = require("./text").Mode;
92
137
  var SchemeHighlightRules = require("./scheme_highlight_rules").SchemeHighlightRules;
138
+ var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent;
93
139
 
94
140
  var Mode = function() {
95
141
  this.HighlightRules = SchemeHighlightRules;
142
+ this.$outdent = new MatchingParensOutdent();
96
143
  };
97
144
  oop.inherits(Mode, TextMode);
98
145
 
99
146
  (function() {
100
147
 
101
148
  this.lineCommentStart = ";";
149
+ this.minorIndentFunctions = ["define", "lambda", "define-macro", "define-syntax", "syntax-rules", "define-record-type", "define-structure"];
150
+
151
+ this.$toIndent = function(str) {
152
+ return str.split('').map(function(ch) {
153
+ if (/\s/.exec(ch)) {
154
+ return ch;
155
+ } else {
156
+ return ' ';
157
+ }
158
+ }).join('');
159
+ };
160
+
161
+ this.$calculateIndent = function(line, tab) {
162
+ var baseIndent = this.$getIndent(line);
163
+ var delta = 0;
164
+ var isParen, ch;
165
+ for (var i = line.length - 1; i >= 0; i--) {
166
+ ch = line[i];
167
+ if (ch === '(') {
168
+ delta--;
169
+ isParen = true;
170
+ } else if (ch === '(' || ch === '[' || ch === '{') {
171
+ delta--;
172
+ isParen = false;
173
+ } else if (ch === ')' || ch === ']' || ch === '}') {
174
+ delta++;
175
+ }
176
+ if (delta < 0) {
177
+ break;
178
+ }
179
+ }
180
+ if (delta < 0 && isParen) {
181
+ i += 1;
182
+ var iBefore = i;
183
+ var fn = '';
184
+ while (true) {
185
+ ch = line[i];
186
+ if (ch === ' ' || ch === '\t') {
187
+ if(this.minorIndentFunctions.indexOf(fn) !== -1) {
188
+ return this.$toIndent(line.substring(0, iBefore - 1) + tab);
189
+ } else {
190
+ return this.$toIndent(line.substring(0, i + 1));
191
+ }
192
+ } else if (ch === undefined) {
193
+ return this.$toIndent(line.substring(0, iBefore - 1) + tab);
194
+ }
195
+ fn += line[i];
196
+ i++;
197
+ }
198
+ } else if(delta < 0 && !isParen) {
199
+ return this.$toIndent(line.substring(0, i+1));
200
+ } else if(delta > 0) {
201
+ baseIndent = baseIndent.substring(0, baseIndent.length - tab.length);
202
+ return baseIndent;
203
+ } else {
204
+ return baseIndent;
205
+ }
206
+ };
207
+
208
+ this.getNextLineIndent = function(state, line, tab) {
209
+ return this.$calculateIndent(line, tab);
210
+ };
211
+
212
+ this.checkOutdent = function(state, line, input) {
213
+ return this.$outdent.checkOutdent(line, input);
214
+ };
215
+
216
+ this.autoOutdent = function(state, doc, row) {
217
+ this.$outdent.autoOutdent(doc, row);
218
+ };
102
219
 
103
220
  this.$id = "ace/mode/scheme";
104
221
  }).call(Mode.prototype);