ace-rails-ap 4.0.1 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ace/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/ace/ace.js +187 -175
  4. data/vendor/assets/javascripts/ace/ext-chromevox.js +5 -5
  5. data/vendor/assets/javascripts/ace/ext-emmet.js +4 -5
  6. data/vendor/assets/javascripts/ace/ext-keybinding_menu.js +1 -1
  7. data/vendor/assets/javascripts/ace/ext-language_tools.js +23 -22
  8. data/vendor/assets/javascripts/ace/ext-modelist.js +11 -5
  9. data/vendor/assets/javascripts/ace/ext-settings_menu.js +13 -7
  10. data/vendor/assets/javascripts/ace/ext-textarea.js +0 -72
  11. data/vendor/assets/javascripts/ace/keybinding-emacs.js +3 -2
  12. data/vendor/assets/javascripts/ace/keybinding-vim.js +23 -18
  13. data/vendor/assets/javascripts/ace/mode-abap.js +3 -19
  14. data/vendor/assets/javascripts/ace/mode-c_cpp.js +21 -29
  15. data/vendor/assets/javascripts/ace/mode-cirru.js +15 -15
  16. data/vendor/assets/javascripts/ace/mode-coffee.js +3 -22
  17. data/vendor/assets/javascripts/ace/mode-coldfusion.js +40 -54
  18. data/vendor/assets/javascripts/ace/mode-csharp.js +6 -0
  19. data/vendor/assets/javascripts/ace/mode-css.js +3 -3
  20. data/vendor/assets/javascripts/ace/mode-curly.js +40 -54
  21. data/vendor/assets/javascripts/ace/mode-dart.js +21 -29
  22. data/vendor/assets/javascripts/ace/mode-django.js +40 -54
  23. data/vendor/assets/javascripts/ace/mode-eiffel.js +2 -2
  24. data/vendor/assets/javascripts/ace/mode-ejs.js +41 -55
  25. data/vendor/assets/javascripts/ace/mode-elm.js +3 -3
  26. data/vendor/assets/javascripts/ace/mode-ftl.js +36 -50
  27. data/vendor/assets/javascripts/ace/mode-gherkin.js +6 -6
  28. data/vendor/assets/javascripts/ace/mode-glsl.js +21 -29
  29. data/vendor/assets/javascripts/ace/mode-gobstones.js +1273 -0
  30. data/vendor/assets/javascripts/ace/mode-golang.js +2 -2
  31. data/vendor/assets/javascripts/ace/mode-groovy.js +33 -47
  32. data/vendor/assets/javascripts/ace/mode-haml.js +981 -27
  33. data/vendor/assets/javascripts/ace/mode-handlebars.js +40 -54
  34. data/vendor/assets/javascripts/ace/mode-html.js +40 -54
  35. data/vendor/assets/javascripts/ace/mode-html_elixir.js +40 -54
  36. data/vendor/assets/javascripts/ace/mode-html_ruby.js +41 -55
  37. data/vendor/assets/javascripts/ace/mode-jade.js +83 -189
  38. data/vendor/assets/javascripts/ace/mode-java.js +35 -49
  39. data/vendor/assets/javascripts/ace/mode-javascript.js +33 -47
  40. data/vendor/assets/javascripts/ace/mode-jsp.js +38 -52
  41. data/vendor/assets/javascripts/ace/mode-lean.js +1 -1
  42. data/vendor/assets/javascripts/ace/mode-less.js +368 -136
  43. data/vendor/assets/javascripts/ace/mode-liquid.js +36 -50
  44. data/vendor/assets/javascripts/ace/mode-livescript.js +3 -18
  45. data/vendor/assets/javascripts/ace/mode-logiql.js +11 -11
  46. data/vendor/assets/javascripts/ace/mode-lua.js +1 -4
  47. data/vendor/assets/javascripts/ace/mode-luapage.js +41 -58
  48. data/vendor/assets/javascripts/ace/mode-markdown.js +40 -54
  49. data/vendor/assets/javascripts/ace/mode-mask.js +36 -50
  50. data/vendor/assets/javascripts/ace/mode-matlab.js +1 -1
  51. data/vendor/assets/javascripts/ace/mode-mel.js +1 -1
  52. data/vendor/assets/javascripts/ace/mode-nix.js +21 -29
  53. data/vendor/assets/javascripts/ace/mode-nsis.js +304 -0
  54. data/vendor/assets/javascripts/ace/mode-objectivec.js +21 -29
  55. data/vendor/assets/javascripts/ace/mode-pascal.js +1 -1
  56. data/vendor/assets/javascripts/ace/mode-pgsql.js +33 -47
  57. data/vendor/assets/javascripts/ace/mode-php.js +42 -57
  58. data/vendor/assets/javascripts/ace/mode-powershell.js +86 -57
  59. data/vendor/assets/javascripts/ace/mode-praat.js +1 -1
  60. data/vendor/assets/javascripts/ace/mode-protobuf.js +21 -29
  61. data/vendor/assets/javascripts/ace/mode-r.js +20 -20
  62. data/vendor/assets/javascripts/ace/mode-razor.js +3136 -0
  63. data/vendor/assets/javascripts/ace/mode-rdoc.js +20 -20
  64. data/vendor/assets/javascripts/ace/mode-rhtml.js +60 -74
  65. data/vendor/assets/javascripts/ace/mode-rst.js +249 -0
  66. data/vendor/assets/javascripts/ace/mode-ruby.js +1 -1
  67. data/vendor/assets/javascripts/ace/mode-rust.js +4 -8
  68. data/vendor/assets/javascripts/ace/mode-scala.js +33 -47
  69. data/vendor/assets/javascripts/ace/mode-sjs.js +42 -56
  70. data/vendor/assets/javascripts/ace/mode-smarty.js +40 -54
  71. data/vendor/assets/javascripts/ace/mode-soy_template.js +41 -55
  72. data/vendor/assets/javascripts/ace/mode-sqlserver.js +3 -3
  73. data/vendor/assets/javascripts/ace/mode-stylus.js +1 -1
  74. data/vendor/assets/javascripts/ace/mode-svg.js +34 -48
  75. data/vendor/assets/javascripts/ace/mode-swift.js +5 -5
  76. data/vendor/assets/javascripts/ace/mode-tex.js +24 -24
  77. data/vendor/assets/javascripts/ace/mode-twig.js +40 -54
  78. data/vendor/assets/javascripts/ace/mode-typescript.js +33 -47
  79. data/vendor/assets/javascripts/ace/mode-velocity.js +40 -54
  80. data/vendor/assets/javascripts/ace/mode-vhdl.js +2 -2
  81. data/vendor/assets/javascripts/ace/mode-wollok.js +1256 -0
  82. data/vendor/assets/javascripts/ace/mode-xml.js +1 -1
  83. data/vendor/assets/javascripts/ace/worker-coffee.js +1 -1
  84. data/vendor/assets/javascripts/ace/worker-css.js +1 -1
  85. data/vendor/assets/javascripts/ace/worker-html.js +2 -2
  86. data/vendor/assets/javascripts/ace/worker-javascript.js +1 -1
  87. data/vendor/assets/javascripts/ace/worker-json.js +1 -1
  88. data/vendor/assets/javascripts/ace/worker-lua.js +1 -1
  89. data/vendor/assets/javascripts/ace/worker-php.js +2 -4
  90. data/vendor/assets/javascripts/ace/worker-xml.js +1 -1
  91. data/vendor/assets/javascripts/ace/worker-xquery.js +1 -1
  92. metadata +8 -3
@@ -55,7 +55,7 @@ var VHDLHighlightRules = function() {
55
55
  regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
56
56
  }, {
57
57
  token : "keyword", // pre-compiler directives
58
- regex : "\\s*(?:library|package|use)\\b",
58
+ regex : "\\s*(?:library|package|use)\\b"
59
59
  }, {
60
60
  token : keywordMapper,
61
61
  regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
@@ -74,7 +74,7 @@ var VHDLHighlightRules = function() {
74
74
  }, {
75
75
  token : "text",
76
76
  regex : "\\s+"
77
- } ],
77
+ } ]
78
78
 
79
79
 
80
80
  };
@@ -0,0 +1,1256 @@
1
+ define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
2
+ "use strict";
3
+
4
+ var oop = require("../lib/oop");
5
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
6
+
7
+ var DocCommentHighlightRules = function() {
8
+ this.$rules = {
9
+ "start" : [ {
10
+ token : "comment.doc.tag",
11
+ regex : "@[\\w\\d_]+" // TODO: fix email addresses
12
+ },
13
+ DocCommentHighlightRules.getTagRule(),
14
+ {
15
+ defaultToken : "comment.doc",
16
+ caseInsensitive: true
17
+ }]
18
+ };
19
+ };
20
+
21
+ oop.inherits(DocCommentHighlightRules, TextHighlightRules);
22
+
23
+ DocCommentHighlightRules.getTagRule = function(start) {
24
+ return {
25
+ token : "comment.doc.tag.storage.type",
26
+ regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
27
+ };
28
+ }
29
+
30
+ DocCommentHighlightRules.getStartRule = function(start) {
31
+ return {
32
+ token : "comment.doc", // doc comment
33
+ regex : "\\/\\*(?=\\*)",
34
+ next : start
35
+ };
36
+ };
37
+
38
+ DocCommentHighlightRules.getEndRule = function (start) {
39
+ return {
40
+ token : "comment.doc", // closing comment
41
+ regex : "\\*\\/",
42
+ next : start
43
+ };
44
+ };
45
+
46
+
47
+ exports.DocCommentHighlightRules = DocCommentHighlightRules;
48
+
49
+ });
50
+
51
+ define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
52
+ "use strict";
53
+
54
+ var oop = require("../lib/oop");
55
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
56
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
57
+ var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
58
+
59
+ var JavaScriptHighlightRules = function(options) {
60
+ var keywordMapper = this.createKeywordMapper({
61
+ "variable.language":
62
+ "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
63
+ "Namespace|QName|XML|XMLList|" + // E4X
64
+ "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
65
+ "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
66
+ "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
67
+ "SyntaxError|TypeError|URIError|" +
68
+ "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
69
+ "isNaN|parseFloat|parseInt|" +
70
+ "JSON|Math|" + // Other
71
+ "this|arguments|prototype|window|document" , // Pseudo
72
+ "keyword":
73
+ "const|yield|import|get|set|" +
74
+ "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
75
+ "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
76
+ "__parent__|__count__|escape|unescape|with|__proto__|" +
77
+ "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
78
+ "storage.type":
79
+ "const|let|var|function",
80
+ "constant.language":
81
+ "null|Infinity|NaN|undefined",
82
+ "support.function":
83
+ "alert",
84
+ "constant.language.boolean": "true|false"
85
+ }, "identifier");
86
+ var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
87
+
88
+ var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
89
+ "u[0-9a-fA-F]{4}|" + // unicode
90
+ "u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
91
+ "[0-2][0-7]{0,2}|" + // oct
92
+ "3[0-7][0-7]?|" + // oct
93
+ "[4-7][0-7]?|" + //oct
94
+ ".)";
95
+
96
+ this.$rules = {
97
+ "no_regex" : [
98
+ DocCommentHighlightRules.getStartRule("doc-start"),
99
+ comments("no_regex"),
100
+ {
101
+ token : "string",
102
+ regex : "'(?=.)",
103
+ next : "qstring"
104
+ }, {
105
+ token : "string",
106
+ regex : '"(?=.)',
107
+ next : "qqstring"
108
+ }, {
109
+ token : "constant.numeric", // hex
110
+ regex : /0(?:[xX][0-9a-fA-F]+|[bB][01]+)\b/
111
+ }, {
112
+ token : "constant.numeric", // float
113
+ regex : /[+-]?\d[\d_]*(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
114
+ }, {
115
+ token : [
116
+ "storage.type", "punctuation.operator", "support.function",
117
+ "punctuation.operator", "entity.name.function", "text","keyword.operator"
118
+ ],
119
+ regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
120
+ next: "function_arguments"
121
+ }, {
122
+ token : [
123
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
124
+ "keyword.operator", "text", "storage.type", "text", "paren.lparen"
125
+ ],
126
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
127
+ next: "function_arguments"
128
+ }, {
129
+ token : [
130
+ "entity.name.function", "text", "keyword.operator", "text", "storage.type",
131
+ "text", "paren.lparen"
132
+ ],
133
+ regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
134
+ next: "function_arguments"
135
+ }, {
136
+ token : [
137
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
138
+ "keyword.operator", "text",
139
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
140
+ ],
141
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
142
+ next: "function_arguments"
143
+ }, {
144
+ token : [
145
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
146
+ ],
147
+ regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
148
+ next: "function_arguments"
149
+ }, {
150
+ token : [
151
+ "entity.name.function", "text", "punctuation.operator",
152
+ "text", "storage.type", "text", "paren.lparen"
153
+ ],
154
+ regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
155
+ next: "function_arguments"
156
+ }, {
157
+ token : [
158
+ "text", "text", "storage.type", "text", "paren.lparen"
159
+ ],
160
+ regex : "(:)(\\s*)(function)(\\s*)(\\()",
161
+ next: "function_arguments"
162
+ }, {
163
+ token : "keyword",
164
+ regex : "(?:" + kwBeforeRe + ")\\b",
165
+ next : "start"
166
+ }, {
167
+ token : ["support.constant"],
168
+ regex : /that\b/
169
+ }, {
170
+ token : ["storage.type", "punctuation.operator", "support.function.firebug"],
171
+ regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
172
+ }, {
173
+ token : keywordMapper,
174
+ regex : identifierRe
175
+ }, {
176
+ token : "punctuation.operator",
177
+ regex : /[.](?![.])/,
178
+ next : "property"
179
+ }, {
180
+ token : "keyword.operator",
181
+ regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,
182
+ next : "start"
183
+ }, {
184
+ token : "punctuation.operator",
185
+ regex : /[?:,;.]/,
186
+ next : "start"
187
+ }, {
188
+ token : "paren.lparen",
189
+ regex : /[\[({]/,
190
+ next : "start"
191
+ }, {
192
+ token : "paren.rparen",
193
+ regex : /[\])}]/
194
+ }, {
195
+ token: "comment",
196
+ regex: /^#!.*$/
197
+ }
198
+ ],
199
+ property: [{
200
+ token : "text",
201
+ regex : "\\s+"
202
+ }, {
203
+ token : [
204
+ "storage.type", "punctuation.operator", "entity.name.function", "text",
205
+ "keyword.operator", "text",
206
+ "storage.type", "text", "entity.name.function", "text", "paren.lparen"
207
+ ],
208
+ regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
209
+ next: "function_arguments"
210
+ }, {
211
+ token : "punctuation.operator",
212
+ regex : /[.](?![.])/
213
+ }, {
214
+ token : "support.function",
215
+ 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(?=\()/
216
+ }, {
217
+ token : "support.function.dom",
218
+ 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(?=\()/
219
+ }, {
220
+ token : "support.constant",
221
+ 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/
222
+ }, {
223
+ token : "identifier",
224
+ regex : identifierRe
225
+ }, {
226
+ regex: "",
227
+ token: "empty",
228
+ next: "no_regex"
229
+ }
230
+ ],
231
+ "start": [
232
+ DocCommentHighlightRules.getStartRule("doc-start"),
233
+ comments("start"),
234
+ {
235
+ token: "string.regexp",
236
+ regex: "\\/",
237
+ next: "regex"
238
+ }, {
239
+ token : "text",
240
+ regex : "\\s+|^$",
241
+ next : "start"
242
+ }, {
243
+ token: "empty",
244
+ regex: "",
245
+ next: "no_regex"
246
+ }
247
+ ],
248
+ "regex": [
249
+ {
250
+ token: "regexp.keyword.operator",
251
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
252
+ }, {
253
+ token: "string.regexp",
254
+ regex: "/[sxngimy]*",
255
+ next: "no_regex"
256
+ }, {
257
+ token : "invalid",
258
+ regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
259
+ }, {
260
+ token : "constant.language.escape",
261
+ regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
262
+ }, {
263
+ token : "constant.language.delimiter",
264
+ regex: /\|/
265
+ }, {
266
+ token: "constant.language.escape",
267
+ regex: /\[\^?/,
268
+ next: "regex_character_class"
269
+ }, {
270
+ token: "empty",
271
+ regex: "$",
272
+ next: "no_regex"
273
+ }, {
274
+ defaultToken: "string.regexp"
275
+ }
276
+ ],
277
+ "regex_character_class": [
278
+ {
279
+ token: "regexp.charclass.keyword.operator",
280
+ regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
281
+ }, {
282
+ token: "constant.language.escape",
283
+ regex: "]",
284
+ next: "regex"
285
+ }, {
286
+ token: "constant.language.escape",
287
+ regex: "-"
288
+ }, {
289
+ token: "empty",
290
+ regex: "$",
291
+ next: "no_regex"
292
+ }, {
293
+ defaultToken: "string.regexp.charachterclass"
294
+ }
295
+ ],
296
+ "function_arguments": [
297
+ {
298
+ token: "variable.parameter",
299
+ regex: identifierRe
300
+ }, {
301
+ token: "punctuation.operator",
302
+ regex: "[, ]+"
303
+ }, {
304
+ token: "punctuation.operator",
305
+ regex: "$"
306
+ }, {
307
+ token: "empty",
308
+ regex: "",
309
+ next: "no_regex"
310
+ }
311
+ ],
312
+ "qqstring" : [
313
+ {
314
+ token : "constant.language.escape",
315
+ regex : escapedRe
316
+ }, {
317
+ token : "string",
318
+ regex : "\\\\$",
319
+ next : "qqstring"
320
+ }, {
321
+ token : "string",
322
+ regex : '"|$',
323
+ next : "no_regex"
324
+ }, {
325
+ defaultToken: "string"
326
+ }
327
+ ],
328
+ "qstring" : [
329
+ {
330
+ token : "constant.language.escape",
331
+ regex : escapedRe
332
+ }, {
333
+ token : "string",
334
+ regex : "\\\\$",
335
+ next : "qstring"
336
+ }, {
337
+ token : "string",
338
+ regex : "'|$",
339
+ next : "no_regex"
340
+ }, {
341
+ defaultToken: "string"
342
+ }
343
+ ]
344
+ };
345
+
346
+
347
+ if (!options || !options.noES6) {
348
+ this.$rules.no_regex.unshift({
349
+ regex: "[{}]", onMatch: function(val, state, stack) {
350
+ this.next = val == "{" ? this.nextState : "";
351
+ if (val == "{" && stack.length) {
352
+ stack.unshift("start", state);
353
+ }
354
+ else if (val == "}" && stack.length) {
355
+ stack.shift();
356
+ this.next = stack.shift();
357
+ if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
358
+ return "paren.quasi.end";
359
+ }
360
+ return val == "{" ? "paren.lparen" : "paren.rparen";
361
+ },
362
+ nextState: "start"
363
+ }, {
364
+ token : "string.quasi.start",
365
+ regex : /`/,
366
+ push : [{
367
+ token : "constant.language.escape",
368
+ regex : escapedRe
369
+ }, {
370
+ token : "paren.quasi.start",
371
+ regex : /\${/,
372
+ push : "start"
373
+ }, {
374
+ token : "string.quasi.end",
375
+ regex : /`/,
376
+ next : "pop"
377
+ }, {
378
+ defaultToken: "string.quasi"
379
+ }]
380
+ });
381
+
382
+ if (!options || !options.noJSX)
383
+ JSX.call(this);
384
+ }
385
+
386
+ this.embedRules(DocCommentHighlightRules, "doc-",
387
+ [ DocCommentHighlightRules.getEndRule("no_regex") ]);
388
+
389
+ this.normalizeRules();
390
+ };
391
+
392
+ oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
393
+
394
+ function JSX() {
395
+ var tagRegex = identifierRe.replace("\\d", "\\d\\-");
396
+ var jsxTag = {
397
+ onMatch : function(val, state, stack) {
398
+ var offset = val.charAt(1) == "/" ? 2 : 1;
399
+ if (offset == 1) {
400
+ if (state != this.nextState)
401
+ stack.unshift(this.next, this.nextState, 0);
402
+ else
403
+ stack.unshift(this.next);
404
+ stack[2]++;
405
+ } else if (offset == 2) {
406
+ if (state == this.nextState) {
407
+ stack[1]--;
408
+ if (!stack[1] || stack[1] < 0) {
409
+ stack.shift();
410
+ stack.shift();
411
+ }
412
+ }
413
+ }
414
+ return [{
415
+ type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
416
+ value: val.slice(0, offset)
417
+ }, {
418
+ type: "meta.tag.tag-name.xml",
419
+ value: val.substr(offset)
420
+ }];
421
+ },
422
+ regex : "</?" + tagRegex + "",
423
+ next: "jsxAttributes",
424
+ nextState: "jsx"
425
+ };
426
+ this.$rules.start.unshift(jsxTag);
427
+ var jsxJsRule = {
428
+ regex: "{",
429
+ token: "paren.quasi.start",
430
+ push: "start"
431
+ };
432
+ this.$rules.jsx = [
433
+ jsxJsRule,
434
+ jsxTag,
435
+ {include : "reference"},
436
+ {defaultToken: "string"}
437
+ ];
438
+ this.$rules.jsxAttributes = [{
439
+ token : "meta.tag.punctuation.tag-close.xml",
440
+ regex : "/?>",
441
+ onMatch : function(value, currentState, stack) {
442
+ if (currentState == stack[0])
443
+ stack.shift();
444
+ if (value.length == 2) {
445
+ if (stack[0] == this.nextState)
446
+ stack[1]--;
447
+ if (!stack[1] || stack[1] < 0) {
448
+ stack.splice(0, 2);
449
+ }
450
+ }
451
+ this.next = stack[0] || "start";
452
+ return [{type: this.token, value: value}];
453
+ },
454
+ nextState: "jsx"
455
+ },
456
+ jsxJsRule,
457
+ comments("jsxAttributes"),
458
+ {
459
+ token : "entity.other.attribute-name.xml",
460
+ regex : tagRegex
461
+ }, {
462
+ token : "keyword.operator.attribute-equals.xml",
463
+ regex : "="
464
+ }, {
465
+ token : "text.tag-whitespace.xml",
466
+ regex : "\\s+"
467
+ }, {
468
+ token : "string.attribute-value.xml",
469
+ regex : "'",
470
+ stateName : "jsx_attr_q",
471
+ push : [
472
+ {token : "string.attribute-value.xml", regex: "'", next: "pop"},
473
+ {include : "reference"},
474
+ {defaultToken : "string.attribute-value.xml"}
475
+ ]
476
+ }, {
477
+ token : "string.attribute-value.xml",
478
+ regex : '"',
479
+ stateName : "jsx_attr_qq",
480
+ push : [
481
+ {token : "string.attribute-value.xml", regex: '"', next: "pop"},
482
+ {include : "reference"},
483
+ {defaultToken : "string.attribute-value.xml"}
484
+ ]
485
+ },
486
+ jsxTag
487
+ ];
488
+ this.$rules.reference = [{
489
+ token : "constant.language.escape.reference.xml",
490
+ regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
491
+ }];
492
+ }
493
+
494
+ function comments(next) {
495
+ return [
496
+ {
497
+ token : "comment", // multi line comment
498
+ regex : /\/\*/,
499
+ next: [
500
+ DocCommentHighlightRules.getTagRule(),
501
+ {token : "comment", regex : "\\*\\/", next : next || "pop"},
502
+ {defaultToken : "comment", caseInsensitive: true}
503
+ ]
504
+ }, {
505
+ token : "comment",
506
+ regex : "\\/\\/",
507
+ next: [
508
+ DocCommentHighlightRules.getTagRule(),
509
+ {token : "comment", regex : "$|^", next : next || "pop"},
510
+ {defaultToken : "comment", caseInsensitive: true}
511
+ ]
512
+ }
513
+ ];
514
+ }
515
+ exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
516
+ });
517
+
518
+ define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
519
+ "use strict";
520
+
521
+ var Range = require("../range").Range;
522
+
523
+ var MatchingBraceOutdent = function() {};
524
+
525
+ (function() {
526
+
527
+ this.checkOutdent = function(line, input) {
528
+ if (! /^\s+$/.test(line))
529
+ return false;
530
+
531
+ return /^\s*\}/.test(input);
532
+ };
533
+
534
+ this.autoOutdent = function(doc, row) {
535
+ var line = doc.getLine(row);
536
+ var match = line.match(/^(\s*\})/);
537
+
538
+ if (!match) return 0;
539
+
540
+ var column = match[1].length;
541
+ var openBracePos = doc.findMatchingBracket({row: row, column: column});
542
+
543
+ if (!openBracePos || openBracePos.row == row) return 0;
544
+
545
+ var indent = this.$getIndent(doc.getLine(openBracePos.row));
546
+ doc.replace(new Range(row, 0, row, column-1), indent);
547
+ };
548
+
549
+ this.$getIndent = function(line) {
550
+ return line.match(/^\s*/)[0];
551
+ };
552
+
553
+ }).call(MatchingBraceOutdent.prototype);
554
+
555
+ exports.MatchingBraceOutdent = MatchingBraceOutdent;
556
+ });
557
+
558
+ define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"], function(require, exports, module) {
559
+ "use strict";
560
+
561
+ var oop = require("../../lib/oop");
562
+ var Behaviour = require("../behaviour").Behaviour;
563
+ var TokenIterator = require("../../token_iterator").TokenIterator;
564
+ var lang = require("../../lib/lang");
565
+
566
+ var SAFE_INSERT_IN_TOKENS =
567
+ ["text", "paren.rparen", "punctuation.operator"];
568
+ var SAFE_INSERT_BEFORE_TOKENS =
569
+ ["text", "paren.rparen", "punctuation.operator", "comment"];
570
+
571
+ var context;
572
+ var contextCache = {};
573
+ var initContext = function(editor) {
574
+ var id = -1;
575
+ if (editor.multiSelect) {
576
+ id = editor.selection.index;
577
+ if (contextCache.rangeCount != editor.multiSelect.rangeCount)
578
+ contextCache = {rangeCount: editor.multiSelect.rangeCount};
579
+ }
580
+ if (contextCache[id])
581
+ return context = contextCache[id];
582
+ context = contextCache[id] = {
583
+ autoInsertedBrackets: 0,
584
+ autoInsertedRow: -1,
585
+ autoInsertedLineEnd: "",
586
+ maybeInsertedBrackets: 0,
587
+ maybeInsertedRow: -1,
588
+ maybeInsertedLineStart: "",
589
+ maybeInsertedLineEnd: ""
590
+ };
591
+ };
592
+
593
+ var getWrapped = function(selection, selected, opening, closing) {
594
+ var rowDiff = selection.end.row - selection.start.row;
595
+ return {
596
+ text: opening + selected + closing,
597
+ selection: [
598
+ 0,
599
+ selection.start.column + 1,
600
+ rowDiff,
601
+ selection.end.column + (rowDiff ? 0 : 1)
602
+ ]
603
+ };
604
+ };
605
+
606
+ var CstyleBehaviour = function() {
607
+ this.add("braces", "insertion", function(state, action, editor, session, text) {
608
+ var cursor = editor.getCursorPosition();
609
+ var line = session.doc.getLine(cursor.row);
610
+ if (text == '{') {
611
+ initContext(editor);
612
+ var selection = editor.getSelectionRange();
613
+ var selected = session.doc.getTextRange(selection);
614
+ if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
615
+ return getWrapped(selection, selected, '{', '}');
616
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
617
+ if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode) {
618
+ CstyleBehaviour.recordAutoInsert(editor, session, "}");
619
+ return {
620
+ text: '{}',
621
+ selection: [1, 1]
622
+ };
623
+ } else {
624
+ CstyleBehaviour.recordMaybeInsert(editor, session, "{");
625
+ return {
626
+ text: '{',
627
+ selection: [1, 1]
628
+ };
629
+ }
630
+ }
631
+ } else if (text == '}') {
632
+ initContext(editor);
633
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
634
+ if (rightChar == '}') {
635
+ var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
636
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
637
+ CstyleBehaviour.popAutoInsertedClosing();
638
+ return {
639
+ text: '',
640
+ selection: [1, 1]
641
+ };
642
+ }
643
+ }
644
+ } else if (text == "\n" || text == "\r\n") {
645
+ initContext(editor);
646
+ var closing = "";
647
+ if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
648
+ closing = lang.stringRepeat("}", context.maybeInsertedBrackets);
649
+ CstyleBehaviour.clearMaybeInsertedClosing();
650
+ }
651
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
652
+ if (rightChar === '}') {
653
+ var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}');
654
+ if (!openBracePos)
655
+ return null;
656
+ var next_indent = this.$getIndent(session.getLine(openBracePos.row));
657
+ } else if (closing) {
658
+ var next_indent = this.$getIndent(line);
659
+ } else {
660
+ CstyleBehaviour.clearMaybeInsertedClosing();
661
+ return;
662
+ }
663
+ var indent = next_indent + session.getTabString();
664
+
665
+ return {
666
+ text: '\n' + indent + '\n' + next_indent + closing,
667
+ selection: [1, indent.length, 1, indent.length]
668
+ };
669
+ } else {
670
+ CstyleBehaviour.clearMaybeInsertedClosing();
671
+ }
672
+ });
673
+
674
+ this.add("braces", "deletion", function(state, action, editor, session, range) {
675
+ var selected = session.doc.getTextRange(range);
676
+ if (!range.isMultiLine() && selected == '{') {
677
+ initContext(editor);
678
+ var line = session.doc.getLine(range.start.row);
679
+ var rightChar = line.substring(range.end.column, range.end.column + 1);
680
+ if (rightChar == '}') {
681
+ range.end.column++;
682
+ return range;
683
+ } else {
684
+ context.maybeInsertedBrackets--;
685
+ }
686
+ }
687
+ });
688
+
689
+ this.add("parens", "insertion", function(state, action, editor, session, text) {
690
+ if (text == '(') {
691
+ initContext(editor);
692
+ var selection = editor.getSelectionRange();
693
+ var selected = session.doc.getTextRange(selection);
694
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
695
+ return getWrapped(selection, selected, '(', ')');
696
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
697
+ CstyleBehaviour.recordAutoInsert(editor, session, ")");
698
+ return {
699
+ text: '()',
700
+ selection: [1, 1]
701
+ };
702
+ }
703
+ } else if (text == ')') {
704
+ initContext(editor);
705
+ var cursor = editor.getCursorPosition();
706
+ var line = session.doc.getLine(cursor.row);
707
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
708
+ if (rightChar == ')') {
709
+ var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
710
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
711
+ CstyleBehaviour.popAutoInsertedClosing();
712
+ return {
713
+ text: '',
714
+ selection: [1, 1]
715
+ };
716
+ }
717
+ }
718
+ }
719
+ });
720
+
721
+ this.add("parens", "deletion", function(state, action, editor, session, range) {
722
+ var selected = session.doc.getTextRange(range);
723
+ if (!range.isMultiLine() && selected == '(') {
724
+ initContext(editor);
725
+ var line = session.doc.getLine(range.start.row);
726
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
727
+ if (rightChar == ')') {
728
+ range.end.column++;
729
+ return range;
730
+ }
731
+ }
732
+ });
733
+
734
+ this.add("brackets", "insertion", function(state, action, editor, session, text) {
735
+ if (text == '[') {
736
+ initContext(editor);
737
+ var selection = editor.getSelectionRange();
738
+ var selected = session.doc.getTextRange(selection);
739
+ if (selected !== "" && editor.getWrapBehavioursEnabled()) {
740
+ return getWrapped(selection, selected, '[', ']');
741
+ } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
742
+ CstyleBehaviour.recordAutoInsert(editor, session, "]");
743
+ return {
744
+ text: '[]',
745
+ selection: [1, 1]
746
+ };
747
+ }
748
+ } else if (text == ']') {
749
+ initContext(editor);
750
+ var cursor = editor.getCursorPosition();
751
+ var line = session.doc.getLine(cursor.row);
752
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
753
+ if (rightChar == ']') {
754
+ var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
755
+ if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
756
+ CstyleBehaviour.popAutoInsertedClosing();
757
+ return {
758
+ text: '',
759
+ selection: [1, 1]
760
+ };
761
+ }
762
+ }
763
+ }
764
+ });
765
+
766
+ this.add("brackets", "deletion", function(state, action, editor, session, range) {
767
+ var selected = session.doc.getTextRange(range);
768
+ if (!range.isMultiLine() && selected == '[') {
769
+ initContext(editor);
770
+ var line = session.doc.getLine(range.start.row);
771
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
772
+ if (rightChar == ']') {
773
+ range.end.column++;
774
+ return range;
775
+ }
776
+ }
777
+ });
778
+
779
+ this.add("string_dquotes", "insertion", function(state, action, editor, session, text) {
780
+ if (text == '"' || text == "'") {
781
+ initContext(editor);
782
+ var quote = text;
783
+ var selection = editor.getSelectionRange();
784
+ var selected = session.doc.getTextRange(selection);
785
+ if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
786
+ return getWrapped(selection, selected, quote, quote);
787
+ } else if (!selected) {
788
+ var cursor = editor.getCursorPosition();
789
+ var line = session.doc.getLine(cursor.row);
790
+ var leftChar = line.substring(cursor.column-1, cursor.column);
791
+ var rightChar = line.substring(cursor.column, cursor.column + 1);
792
+
793
+ var token = session.getTokenAt(cursor.row, cursor.column);
794
+ var rightToken = session.getTokenAt(cursor.row, cursor.column + 1);
795
+ if (leftChar == "\\" && token && /escape/.test(token.type))
796
+ return null;
797
+
798
+ var stringBefore = token && /string|escape/.test(token.type);
799
+ var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
800
+
801
+ var pair;
802
+ if (rightChar == quote) {
803
+ pair = stringBefore !== stringAfter;
804
+ } else {
805
+ if (stringBefore && !stringAfter)
806
+ return null; // wrap string with different quote
807
+ if (stringBefore && stringAfter)
808
+ return null; // do not pair quotes inside strings
809
+ var wordRe = session.$mode.tokenRe;
810
+ wordRe.lastIndex = 0;
811
+ var isWordBefore = wordRe.test(leftChar);
812
+ wordRe.lastIndex = 0;
813
+ var isWordAfter = wordRe.test(leftChar);
814
+ if (isWordBefore || isWordAfter)
815
+ return null; // before or after alphanumeric
816
+ if (rightChar && !/[\s;,.})\]\\]/.test(rightChar))
817
+ return null; // there is rightChar and it isn't closing
818
+ pair = true;
819
+ }
820
+ return {
821
+ text: pair ? quote + quote : "",
822
+ selection: [1,1]
823
+ };
824
+ }
825
+ }
826
+ });
827
+
828
+ this.add("string_dquotes", "deletion", function(state, action, editor, session, range) {
829
+ var selected = session.doc.getTextRange(range);
830
+ if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
831
+ initContext(editor);
832
+ var line = session.doc.getLine(range.start.row);
833
+ var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
834
+ if (rightChar == selected) {
835
+ range.end.column++;
836
+ return range;
837
+ }
838
+ }
839
+ });
840
+
841
+ };
842
+
843
+
844
+ CstyleBehaviour.isSaneInsertion = function(editor, session) {
845
+ var cursor = editor.getCursorPosition();
846
+ var iterator = new TokenIterator(session, cursor.row, cursor.column);
847
+ if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
848
+ var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
849
+ if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
850
+ return false;
851
+ }
852
+ iterator.stepForward();
853
+ return iterator.getCurrentTokenRow() !== cursor.row ||
854
+ this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
855
+ };
856
+
857
+ CstyleBehaviour.$matchTokenType = function(token, types) {
858
+ return types.indexOf(token.type || token) > -1;
859
+ };
860
+
861
+ CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
862
+ var cursor = editor.getCursorPosition();
863
+ var line = session.doc.getLine(cursor.row);
864
+ if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0]))
865
+ context.autoInsertedBrackets = 0;
866
+ context.autoInsertedRow = cursor.row;
867
+ context.autoInsertedLineEnd = bracket + line.substr(cursor.column);
868
+ context.autoInsertedBrackets++;
869
+ };
870
+
871
+ CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
872
+ var cursor = editor.getCursorPosition();
873
+ var line = session.doc.getLine(cursor.row);
874
+ if (!this.isMaybeInsertedClosing(cursor, line))
875
+ context.maybeInsertedBrackets = 0;
876
+ context.maybeInsertedRow = cursor.row;
877
+ context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
878
+ context.maybeInsertedLineEnd = line.substr(cursor.column);
879
+ context.maybeInsertedBrackets++;
880
+ };
881
+
882
+ CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
883
+ return context.autoInsertedBrackets > 0 &&
884
+ cursor.row === context.autoInsertedRow &&
885
+ bracket === context.autoInsertedLineEnd[0] &&
886
+ line.substr(cursor.column) === context.autoInsertedLineEnd;
887
+ };
888
+
889
+ CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
890
+ return context.maybeInsertedBrackets > 0 &&
891
+ cursor.row === context.maybeInsertedRow &&
892
+ line.substr(cursor.column) === context.maybeInsertedLineEnd &&
893
+ line.substr(0, cursor.column) == context.maybeInsertedLineStart;
894
+ };
895
+
896
+ CstyleBehaviour.popAutoInsertedClosing = function() {
897
+ context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1);
898
+ context.autoInsertedBrackets--;
899
+ };
900
+
901
+ CstyleBehaviour.clearMaybeInsertedClosing = function() {
902
+ if (context) {
903
+ context.maybeInsertedBrackets = 0;
904
+ context.maybeInsertedRow = -1;
905
+ }
906
+ };
907
+
908
+
909
+
910
+ oop.inherits(CstyleBehaviour, Behaviour);
911
+
912
+ exports.CstyleBehaviour = CstyleBehaviour;
913
+ });
914
+
915
+ define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
916
+ "use strict";
917
+
918
+ var oop = require("../../lib/oop");
919
+ var Range = require("../../range").Range;
920
+ var BaseFoldMode = require("./fold_mode").FoldMode;
921
+
922
+ var FoldMode = exports.FoldMode = function(commentRegex) {
923
+ if (commentRegex) {
924
+ this.foldingStartMarker = new RegExp(
925
+ this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
926
+ );
927
+ this.foldingStopMarker = new RegExp(
928
+ this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
929
+ );
930
+ }
931
+ };
932
+ oop.inherits(FoldMode, BaseFoldMode);
933
+
934
+ (function() {
935
+
936
+ this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
937
+ this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
938
+ this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
939
+ this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
940
+ this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
941
+ this._getFoldWidgetBase = this.getFoldWidget;
942
+ this.getFoldWidget = function(session, foldStyle, row) {
943
+ var line = session.getLine(row);
944
+
945
+ if (this.singleLineBlockCommentRe.test(line)) {
946
+ if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
947
+ return "";
948
+ }
949
+
950
+ var fw = this._getFoldWidgetBase(session, foldStyle, row);
951
+
952
+ if (!fw && this.startRegionRe.test(line))
953
+ return "start"; // lineCommentRegionStart
954
+
955
+ return fw;
956
+ };
957
+
958
+ this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
959
+ var line = session.getLine(row);
960
+
961
+ if (this.startRegionRe.test(line))
962
+ return this.getCommentRegionBlock(session, line, row);
963
+
964
+ var match = line.match(this.foldingStartMarker);
965
+ if (match) {
966
+ var i = match.index;
967
+
968
+ if (match[1])
969
+ return this.openingBracketBlock(session, match[1], row, i);
970
+
971
+ var range = session.getCommentFoldRange(row, i + match[0].length, 1);
972
+
973
+ if (range && !range.isMultiLine()) {
974
+ if (forceMultiline) {
975
+ range = this.getSectionRange(session, row);
976
+ } else if (foldStyle != "all")
977
+ range = null;
978
+ }
979
+
980
+ return range;
981
+ }
982
+
983
+ if (foldStyle === "markbegin")
984
+ return;
985
+
986
+ var match = line.match(this.foldingStopMarker);
987
+ if (match) {
988
+ var i = match.index + match[0].length;
989
+
990
+ if (match[1])
991
+ return this.closingBracketBlock(session, match[1], row, i);
992
+
993
+ return session.getCommentFoldRange(row, i, -1);
994
+ }
995
+ };
996
+
997
+ this.getSectionRange = function(session, row) {
998
+ var line = session.getLine(row);
999
+ var startIndent = line.search(/\S/);
1000
+ var startRow = row;
1001
+ var startColumn = line.length;
1002
+ row = row + 1;
1003
+ var endRow = row;
1004
+ var maxRow = session.getLength();
1005
+ while (++row < maxRow) {
1006
+ line = session.getLine(row);
1007
+ var indent = line.search(/\S/);
1008
+ if (indent === -1)
1009
+ continue;
1010
+ if (startIndent > indent)
1011
+ break;
1012
+ var subRange = this.getFoldWidgetRange(session, "all", row);
1013
+
1014
+ if (subRange) {
1015
+ if (subRange.start.row <= startRow) {
1016
+ break;
1017
+ } else if (subRange.isMultiLine()) {
1018
+ row = subRange.end.row;
1019
+ } else if (startIndent == indent) {
1020
+ break;
1021
+ }
1022
+ }
1023
+ endRow = row;
1024
+ }
1025
+
1026
+ return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
1027
+ };
1028
+ this.getCommentRegionBlock = function(session, line, row) {
1029
+ var startColumn = line.search(/\s*$/);
1030
+ var maxRow = session.getLength();
1031
+ var startRow = row;
1032
+
1033
+ var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
1034
+ var depth = 1;
1035
+ while (++row < maxRow) {
1036
+ line = session.getLine(row);
1037
+ var m = re.exec(line);
1038
+ if (!m) continue;
1039
+ if (m[1]) depth--;
1040
+ else depth++;
1041
+
1042
+ if (!depth) break;
1043
+ }
1044
+
1045
+ var endRow = row;
1046
+ if (endRow > startRow) {
1047
+ return new Range(startRow, startColumn, endRow, line.length);
1048
+ }
1049
+ };
1050
+
1051
+ }).call(FoldMode.prototype);
1052
+
1053
+ });
1054
+
1055
+ define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
1056
+ "use strict";
1057
+
1058
+ var oop = require("../lib/oop");
1059
+ var TextMode = require("./text").Mode;
1060
+ var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
1061
+ var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
1062
+ var Range = require("../range").Range;
1063
+ var WorkerClient = require("../worker/worker_client").WorkerClient;
1064
+ var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
1065
+ var CStyleFoldMode = require("./folding/cstyle").FoldMode;
1066
+
1067
+ var Mode = function() {
1068
+ this.HighlightRules = JavaScriptHighlightRules;
1069
+
1070
+ this.$outdent = new MatchingBraceOutdent();
1071
+ this.$behaviour = new CstyleBehaviour();
1072
+ this.foldingRules = new CStyleFoldMode();
1073
+ };
1074
+ oop.inherits(Mode, TextMode);
1075
+
1076
+ (function() {
1077
+
1078
+ this.lineCommentStart = "//";
1079
+ this.blockComment = {start: "/*", end: "*/"};
1080
+
1081
+ this.getNextLineIndent = function(state, line, tab) {
1082
+ var indent = this.$getIndent(line);
1083
+
1084
+ var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
1085
+ var tokens = tokenizedLine.tokens;
1086
+ var endState = tokenizedLine.state;
1087
+
1088
+ if (tokens.length && tokens[tokens.length-1].type == "comment") {
1089
+ return indent;
1090
+ }
1091
+
1092
+ if (state == "start" || state == "no_regex") {
1093
+ var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
1094
+ if (match) {
1095
+ indent += tab;
1096
+ }
1097
+ } else if (state == "doc-start") {
1098
+ if (endState == "start" || endState == "no_regex") {
1099
+ return "";
1100
+ }
1101
+ var match = line.match(/^\s*(\/?)\*/);
1102
+ if (match) {
1103
+ if (match[1]) {
1104
+ indent += " ";
1105
+ }
1106
+ indent += "* ";
1107
+ }
1108
+ }
1109
+
1110
+ return indent;
1111
+ };
1112
+
1113
+ this.checkOutdent = function(state, line, input) {
1114
+ return this.$outdent.checkOutdent(line, input);
1115
+ };
1116
+
1117
+ this.autoOutdent = function(state, doc, row) {
1118
+ this.$outdent.autoOutdent(doc, row);
1119
+ };
1120
+
1121
+ this.createWorker = function(session) {
1122
+ var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
1123
+ worker.attachToDocument(session.getDocument());
1124
+
1125
+ worker.on("annotate", function(results) {
1126
+ session.setAnnotations(results.data);
1127
+ });
1128
+
1129
+ worker.on("terminate", function() {
1130
+ session.clearAnnotations();
1131
+ });
1132
+
1133
+ return worker;
1134
+ };
1135
+
1136
+ this.$id = "ace/mode/javascript";
1137
+ }).call(Mode.prototype);
1138
+
1139
+ exports.Mode = Mode;
1140
+ });
1141
+
1142
+ define("ace/mode/wollok_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
1143
+ "use strict";
1144
+
1145
+ var oop = require("../lib/oop");
1146
+ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
1147
+ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
1148
+
1149
+ var WollokHighlightRules = function() {
1150
+ var keywords = (
1151
+ "test|package|inherits|false|import|else|or|class|and|not|native|override|program|this|try|val|var|catch|object|super|throw|if|null|return|true|new|method"
1152
+ );
1153
+
1154
+ var buildinConstants = ("null|assert|console");
1155
+
1156
+
1157
+ var langClasses = (
1158
+ "Object|Pair|String|Boolean|Number|Integer|Double|Collection|Set|List|Exception|Range" +
1159
+ "|StackTraceElement"
1160
+ );
1161
+
1162
+ var keywordMapper = this.createKeywordMapper({
1163
+ "variable.language": "this",
1164
+ "keyword": keywords,
1165
+ "constant.language": buildinConstants,
1166
+ "support.function": langClasses
1167
+ }, "identifier");
1168
+
1169
+ this.$rules = {
1170
+ "start" : [
1171
+ {
1172
+ token : "comment",
1173
+ regex : "\\/\\/.*$"
1174
+ },
1175
+ DocCommentHighlightRules.getStartRule("doc-start"),
1176
+ {
1177
+ token : "comment", // multi line comment
1178
+ regex : "\\/\\*",
1179
+ next : "comment"
1180
+ }, {
1181
+ token : "string", // single line
1182
+ regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
1183
+ }, {
1184
+ token : "string", // single line
1185
+ regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
1186
+ }, {
1187
+ token : "constant.numeric", // hex
1188
+ regex : /0(?:[xX][0-9a-fA-F][0-9a-fA-F_]*|[bB][01][01_]*)[LlSsDdFfYy]?\b/
1189
+ }, {
1190
+ token : "constant.numeric", // float
1191
+ regex : /[+-]?\d[\d_]*(?:(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?)?[LlSsDdFfYy]?\b/
1192
+ }, {
1193
+ token : "constant.language.boolean",
1194
+ regex : "(?:true|false)\\b"
1195
+ }, {
1196
+ token : keywordMapper,
1197
+ regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
1198
+ }, {
1199
+ token : "keyword.operator",
1200
+ regex : "===|&&|\\*=|\\.\\.|\\*\\*|#|!|%|\\*|\\?:|\\+|\\/|,|\\+=|\\-|\\.\\.<|!==|:|\\/=|\\?\\.|\\+\\+|>|=|<|>=|=>|==|\\]|\\[|\\-=|\\->|\\||\\-\\-|<>|!=|%=|\\|"
1201
+ }, {
1202
+ token : "lparen",
1203
+ regex : "[[({]"
1204
+ }, {
1205
+ token : "rparen",
1206
+ regex : "[\\])}]"
1207
+ }, {
1208
+ token : "text",
1209
+ regex : "\\s+"
1210
+ }
1211
+ ],
1212
+ "comment" : [
1213
+ {
1214
+ token : "comment", // closing comment
1215
+ regex : ".*?\\*\\/",
1216
+ next : "start"
1217
+ }, {
1218
+ token : "comment", // comment spanning whole line
1219
+ regex : ".+"
1220
+ }
1221
+ ]
1222
+ };
1223
+
1224
+ this.embedRules(DocCommentHighlightRules, "doc-",
1225
+ [ DocCommentHighlightRules.getEndRule("start") ]);
1226
+ };
1227
+
1228
+ oop.inherits(WollokHighlightRules, TextHighlightRules);
1229
+
1230
+ exports.WollokHighlightRules = WollokHighlightRules;
1231
+ });
1232
+
1233
+ define("ace/mode/wollok",["require","exports","module","ace/lib/oop","ace/mode/javascript","ace/mode/wollok_highlight_rules"], function(require, exports, module) {
1234
+ "use strict";
1235
+
1236
+ var oop = require("../lib/oop");
1237
+ var JavaScriptMode = require("./javascript").Mode;
1238
+ var WollokHighlightRules = require("./wollok_highlight_rules").WollokHighlightRules;
1239
+
1240
+ var Mode = function() {
1241
+ JavaScriptMode.call(this);
1242
+ this.HighlightRules = WollokHighlightRules;
1243
+ };
1244
+ oop.inherits(Mode, JavaScriptMode);
1245
+
1246
+ (function() {
1247
+
1248
+ this.createWorker = function(session) {
1249
+ return null;
1250
+ };
1251
+
1252
+ this.$id = "ace/mode/wollok";
1253
+ }).call(Mode.prototype);
1254
+
1255
+ exports.Mode = Mode;
1256
+ });