|  | 1 | +/* | 
|  | 2 | + * Copyright © 2016-2023 The Thingsboard Authors | 
|  | 3 | + * | 
|  | 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | + * you may not use this file except in compliance with the License. | 
|  | 6 | + * You may obtain a copy of the License at | 
|  | 7 | + * | 
|  | 8 | + *     http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 9 | + * | 
|  | 10 | + * Unless required by applicable law or agreed to in writing, software | 
|  | 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | + * See the License for the specific language governing permissions and | 
|  | 14 | + * limitations under the License. | 
|  | 15 | + */ | 
|  | 16 | +ace.define( | 
|  | 17 | +  'ace/mode/doc_comment_highlight_rules', | 
|  | 18 | +  ['require', 'exports', 'module', 'ace/lib/oop', 'ace/mode/text_highlight_rules'], | 
|  | 19 | +  function (require, exports, module) { | 
|  | 20 | +    'use strict'; | 
|  | 21 | + | 
|  | 22 | +    var oop = require('../lib/oop'); | 
|  | 23 | +    var TextHighlightRules = require('./text_highlight_rules').TextHighlightRules; | 
|  | 24 | + | 
|  | 25 | +    var DocCommentHighlightRules = function () { | 
|  | 26 | +      this.$rules = { | 
|  | 27 | +        start: [ | 
|  | 28 | +          { | 
|  | 29 | +            token: 'comment.doc.tag', | 
|  | 30 | +            regex: '@[\\w\\d_]+', // TODO: fix email addresses | 
|  | 31 | +          }, | 
|  | 32 | +          DocCommentHighlightRules.getTagRule(), | 
|  | 33 | +          { | 
|  | 34 | +            defaultToken: 'comment.doc', | 
|  | 35 | +            caseInsensitive: true, | 
|  | 36 | +          }, | 
|  | 37 | +        ], | 
|  | 38 | +      }; | 
|  | 39 | +    }; | 
|  | 40 | + | 
|  | 41 | +    oop.inherits(DocCommentHighlightRules, TextHighlightRules); | 
|  | 42 | + | 
|  | 43 | +    DocCommentHighlightRules.getTagRule = function (start) { | 
|  | 44 | +      return { | 
|  | 45 | +        token: 'comment.doc.tag.storage.type', | 
|  | 46 | +        regex: '\\b(?:TODO|FIXME|XXX|HACK)\\b', | 
|  | 47 | +      }; | 
|  | 48 | +    }; | 
|  | 49 | + | 
|  | 50 | +    DocCommentHighlightRules.getStartRule = function (start) { | 
|  | 51 | +      return { | 
|  | 52 | +        token: 'comment.doc', // doc comment | 
|  | 53 | +        regex: '\\/\\*(?=\\*)', | 
|  | 54 | +        next: start, | 
|  | 55 | +      }; | 
|  | 56 | +    }; | 
|  | 57 | + | 
|  | 58 | +    DocCommentHighlightRules.getEndRule = function (start) { | 
|  | 59 | +      return { | 
|  | 60 | +        token: 'comment.doc', // closing comment | 
|  | 61 | +        regex: '\\*\\/', | 
|  | 62 | +        next: start, | 
|  | 63 | +      }; | 
|  | 64 | +    }; | 
|  | 65 | + | 
|  | 66 | +    exports.DocCommentHighlightRules = DocCommentHighlightRules; | 
|  | 67 | +  } | 
|  | 68 | +); | 
|  | 69 | + | 
|  | 70 | +ace.define( | 
|  | 71 | +  'ace/mode/javascript_highlight_rules', | 
|  | 72 | +  [ | 
|  | 73 | +    'require', | 
|  | 74 | +    'exports', | 
|  | 75 | +    'module', | 
|  | 76 | +    'ace/lib/oop', | 
|  | 77 | +    'ace/mode/doc_comment_highlight_rules', | 
|  | 78 | +    'ace/mode/text_highlight_rules', | 
|  | 79 | +  ], | 
|  | 80 | +  function (require, exports, module) { | 
|  | 81 | +    'use strict'; | 
|  | 82 | + | 
|  | 83 | +    var oop = require('../lib/oop'); | 
|  | 84 | +    var DocCommentHighlightRules = | 
|  | 85 | +      require('./doc_comment_highlight_rules').DocCommentHighlightRules; | 
|  | 86 | +    var TextHighlightRules = require('./text_highlight_rules').TextHighlightRules; | 
|  | 87 | +    var identifierRe = '[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*'; | 
|  | 88 | + | 
|  | 89 | +    var JavaScriptHighlightRules = function (options) { | 
|  | 90 | +      var keywordMapper = this.createKeywordMapper( | 
|  | 91 | +        { | 
|  | 92 | +          'variable.language': | 
|  | 93 | +            'Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|' + // Constructors | 
|  | 94 | +            'Namespace|QName|XML|XMLList|' + // E4X | 
|  | 95 | +            'ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|' + | 
|  | 96 | +            'Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|' + | 
|  | 97 | +            'Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|' + // Errors | 
|  | 98 | +            'SyntaxError|TypeError|URIError|' + | 
|  | 99 | +            'decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|' + // Non-constructor functions | 
|  | 100 | +            'isNaN|parseFloat|parseInt|' + | 
|  | 101 | +            'JSON|Math|' + // Other | 
|  | 102 | +            'this|arguments|prototype|window|document', // Pseudo | 
|  | 103 | +          keyword: | 
|  | 104 | +            'const|yield|import|get|set|async|await|' + | 
|  | 105 | +            'break|case|catch|continue|default|delete|do|else|finally|for|function|' + | 
|  | 106 | +            'if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|' + | 
|  | 107 | +            '__parent__|__count__|escape|unescape|with|__proto__|' + | 
|  | 108 | +            'class|enum|extends|super|export|implements|private|public|interface|package|protected|static', | 
|  | 109 | +          'storage.type': 'const|let|var|function', | 
|  | 110 | +          'constant.language': 'null|Infinity|NaN|undefined', | 
|  | 111 | +          'support.function': 'alert', | 
|  | 112 | +          'constant.language.boolean': 'true|false', | 
|  | 113 | +        }, | 
|  | 114 | +        'identifier' | 
|  | 115 | +      ); | 
|  | 116 | +      var kwBeforeRe = 'case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void'; | 
|  | 117 | + | 
|  | 118 | +      var escapedRe = | 
|  | 119 | +        '\\\\(?:x[0-9a-fA-F]{2}|' + // hex | 
|  | 120 | +        'u[0-9a-fA-F]{4}|' + // unicode | 
|  | 121 | +        'u{[0-9a-fA-F]{1,6}}|' + // es6 unicode | 
|  | 122 | +        '[0-2][0-7]{0,2}|' + // oct | 
|  | 123 | +        '3[0-7][0-7]?|' + // oct | 
|  | 124 | +        '[4-7][0-7]?|' + //oct | 
|  | 125 | +        '.)'; | 
|  | 126 | + | 
|  | 127 | +      this.$rules = { | 
|  | 128 | +        no_regex: [ | 
|  | 129 | +          DocCommentHighlightRules.getStartRule('doc-start'), | 
|  | 130 | +          comments('no_regex'), | 
|  | 131 | +          { | 
|  | 132 | +            token: 'string', | 
|  | 133 | +            regex: "'(?=.)", | 
|  | 134 | +            next: 'qstring', | 
|  | 135 | +          }, | 
|  | 136 | +          { | 
|  | 137 | +            token: 'string', | 
|  | 138 | +            regex: '"(?=.)', | 
|  | 139 | +            next: 'qqstring', | 
|  | 140 | +          }, | 
|  | 141 | +          { | 
|  | 142 | +            token: 'constant.numeric', // hexadecimal, octal and binary | 
|  | 143 | +            regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/, | 
|  | 144 | +          }, | 
|  | 145 | +          { | 
|  | 146 | +            token: 'constant.numeric', // decimal integers and floats | 
|  | 147 | +            regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/, | 
|  | 148 | +          }, | 
|  | 149 | +          { | 
|  | 150 | +            token: [ | 
|  | 151 | +              'storage.type', | 
|  | 152 | +              'punctuation.operator', | 
|  | 153 | +              'support.function', | 
|  | 154 | +              'punctuation.operator', | 
|  | 155 | +              'entity.name.function', | 
|  | 156 | +              'text', | 
|  | 157 | +              'keyword.operator', | 
|  | 158 | +            ], | 
|  | 159 | +            regex: '(' + identifierRe + ')(\\.)(prototype)(\\.)(' + identifierRe + ')(\\s*)(=)', | 
|  | 160 | +            next: 'function_arguments', | 
|  | 161 | +          }, | 
|  | 162 | +          { | 
|  | 163 | +            token: [ | 
|  | 164 | +              'storage.type', | 
|  | 165 | +              'punctuation.operator', | 
|  | 166 | +              'entity.name.function', | 
|  | 167 | +              'text', | 
|  | 168 | +              'keyword.operator', | 
|  | 169 | +              'text', | 
|  | 170 | +              'storage.type', | 
|  | 171 | +              'text', | 
|  | 172 | +              'paren.lparen', | 
|  | 173 | +            ], | 
|  | 174 | +            regex: | 
|  | 175 | +              '(' + | 
|  | 176 | +              identifierRe + | 
|  | 177 | +              ')(\\.)(' + | 
|  | 178 | +              identifierRe + | 
|  | 179 | +              ')(\\s*)(=)(\\s*)(function)(\\s*)(\\()', | 
|  | 180 | +            next: 'function_arguments', | 
|  | 181 | +          }, | 
|  | 182 | +          { | 
|  | 183 | +            token: [ | 
|  | 184 | +              'entity.name.function', | 
|  | 185 | +              'text', | 
|  | 186 | +              'keyword.operator', | 
|  | 187 | +              'text', | 
|  | 188 | +              'storage.type', | 
|  | 189 | +              'text', | 
|  | 190 | +              'paren.lparen', | 
|  | 191 | +            ], | 
|  | 192 | +            regex: '(' + identifierRe + ')(\\s*)(=)(\\s*)(function)(\\s*)(\\()', | 
|  | 193 | +            next: 'function_arguments', | 
|  | 194 | +          }, | 
|  | 195 | +          { | 
|  | 196 | +            token: [ | 
|  | 197 | +              'storage.type', | 
|  | 198 | +              'punctuation.operator', | 
|  | 199 | +              'entity.name.function', | 
|  | 200 | +              'text', | 
|  | 201 | +              'keyword.operator', | 
|  | 202 | +              'text', | 
|  | 203 | +              'storage.type', | 
|  | 204 | +              'text', | 
|  | 205 | +              'entity.name.function', | 
|  | 206 | +              'text', | 
|  | 207 | +              'paren.lparen', | 
|  | 208 | +            ], | 
|  | 209 | +            regex: | 
|  | 210 | +              '(' + | 
|  | 211 | +              identifierRe + | 
|  | 212 | +              ')(\\.)(' + | 
|  | 213 | +              identifierRe + | 
|  | 214 | +              ')(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()', | 
|  | 215 | +            next: 'function_arguments', | 
|  | 216 | +          }, | 
|  | 217 | +          { | 
|  | 218 | +            token: ['storage.type', 'text', 'entity.name.function', 'text', 'paren.lparen'], | 
|  | 219 | +            regex: '(function)(\\s+)(' + identifierRe + ')(\\s*)(\\()', | 
|  | 220 | +            next: 'function_arguments', | 
|  | 221 | +          }, | 
|  | 222 | +          { | 
|  | 223 | +            token: [ | 
|  | 224 | +              'entity.name.function', | 
|  | 225 | +              'text', | 
|  | 226 | +              'punctuation.operator', | 
|  | 227 | +              'text', | 
|  | 228 | +              'storage.type', | 
|  | 229 | +              'text', | 
|  | 230 | +              'paren.lparen', | 
|  | 231 | +            ], | 
|  | 232 | +            regex: '(' + identifierRe + ')(\\s*)(:)(\\s*)(function)(\\s*)(\\()', | 
|  | 233 | +            next: 'function_arguments', | 
|  | 234 | +          }, | 
|  | 235 | +          { | 
|  | 236 | +            token: ['text', 'text', 'storage.type', 'text', 'paren.lparen'], | 
|  | 237 | +            regex: '(:)(\\s*)(function)(\\s*)(\\()', | 
|  | 238 | +            next: 'function_arguments', | 
|  | 239 | +          }, | 
|  | 240 | +          { | 
|  | 241 | +            token: 'keyword', | 
|  | 242 | +            regex: 'from(?=\\s*(\'|"))', | 
|  | 243 | +          }, | 
|  | 244 | +          { | 
|  | 245 | +            token: 'keyword', | 
|  | 246 | +            regex: '(?:' + kwBeforeRe + ')\\b', | 
|  | 247 | +            next: 'start', | 
|  | 248 | +          }, | 
|  | 249 | +          { | 
|  | 250 | +            token: ['support.constant'], | 
|  | 251 | +            regex: /that\b/, | 
|  | 252 | +          }, | 
|  | 253 | +          { | 
|  | 254 | +            token: ['storage.type', 'punctuation.operator', 'support.function.firebug'], | 
|  | 255 | +            regex: /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/, | 
|  | 256 | +          }, | 
|  | 257 | +          { | 
|  | 258 | +            token: keywordMapper, | 
|  | 259 | +            regex: identifierRe, | 
|  | 260 | +          }, | 
|  | 261 | +          { | 
|  | 262 | +            token: 'punctuation.operator', | 
|  | 263 | +            regex: /[.](?![.])/, | 
|  | 264 | +            next: 'property', | 
|  | 265 | +          }, | 
|  | 266 | +          { | 
|  | 267 | +            token: 'storage.type', | 
|  | 268 | +            regex: /=>/, | 
|  | 269 | +            next: 'start', | 
|  | 270 | +          }, | 
|  | 271 | +          { | 
|  | 272 | +            token: 'keyword.operator', | 
|  | 273 | +            regex: /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/, | 
|  | 274 | +            next: 'start', | 
|  | 275 | +          }, | 
|  | 276 | +          { | 
|  | 277 | +            token: 'punctuation.operator', | 
|  | 278 | +            regex: /[?:,;.]/, | 
|  | 279 | +            next: 'start', | 
|  | 280 | +          }, | 
|  | 281 | +          { | 
|  | 282 | +            token: 'paren.lparen', | 
|  | 283 | +            regex: /[\[({]/, | 
|  | 284 | +            next: 'start', | 
|  | 285 | +          }, | 
|  | 286 | +          { | 
|  | 287 | +            token: 'paren.rparen', | 
|  | 288 | +            regex: /[\])}]/, | 
|  | 289 | +          }, | 
|  | 290 | +          { | 
|  | 291 | +            token: 'comment', | 
|  | 292 | +            regex: /^#!.*$/, | 
|  | 293 | +          }, | 
|  | 294 | +        ], | 
|  | 295 | +        property: [ | 
|  | 296 | +          { | 
|  | 297 | +            token: 'text', | 
|  | 298 | +            regex: '\\s+', | 
|  | 299 | +          }, | 
|  | 300 | +          { | 
|  | 301 | +            token: [ | 
|  | 302 | +              'storage.type', | 
|  | 303 | +              'punctuation.operator', | 
|  | 304 | +              'entity.name.function', | 
|  | 305 | +              'text', | 
|  | 306 | +              'keyword.operator', | 
|  | 307 | +              'text', | 
|  | 308 | +              'storage.type', | 
|  | 309 | +              'text', | 
|  | 310 | +              'entity.name.function', | 
|  | 311 | +              'text', | 
|  | 312 | +              'paren.lparen', | 
|  | 313 | +            ], | 
|  | 314 | +            regex: | 
|  | 315 | +              '(' + | 
|  | 316 | +              identifierRe + | 
|  | 317 | +              ')(\\.)(' + | 
|  | 318 | +              identifierRe + | 
|  | 319 | +              ')(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()', | 
|  | 320 | +            next: 'function_arguments', | 
|  | 321 | +          }, | 
|  | 322 | +          { | 
|  | 323 | +            token: 'punctuation.operator', | 
|  | 324 | +            regex: /[.](?![.])/, | 
|  | 325 | +          }, | 
|  | 326 | +          { | 
|  | 327 | +            token: 'support.function', | 
|  | 328 | +            regex: | 
|  | 329 | +              /(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(?=\()/, | 
|  | 330 | +          }, | 
|  | 331 | +          { | 
|  | 332 | +            token: 'support.function.dom', | 
|  | 333 | +            regex: | 
|  | 334 | +              /(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(?=\()/, | 
|  | 335 | +          }, | 
|  | 336 | +          { | 
|  | 337 | +            token: 'support.constant', | 
|  | 338 | +            regex: | 
|  | 339 | +              /(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/, | 
|  | 340 | +          }, | 
|  | 341 | +          { | 
|  | 342 | +            token: 'identifier', | 
|  | 343 | +            regex: identifierRe, | 
|  | 344 | +          }, | 
|  | 345 | +          { | 
|  | 346 | +            regex: '', | 
|  | 347 | +            token: 'empty', | 
|  | 348 | +            next: 'no_regex', | 
|  | 349 | +          }, | 
|  | 350 | +        ], | 
|  | 351 | +        start: [ | 
|  | 352 | +          DocCommentHighlightRules.getStartRule('doc-start'), | 
|  | 353 | +          comments('start'), | 
|  | 354 | +          { | 
|  | 355 | +            token: 'string.regexp', | 
|  | 356 | +            regex: '\\/', | 
|  | 357 | +            next: 'regex', | 
|  | 358 | +          }, | 
|  | 359 | +          { | 
|  | 360 | +            token: 'text', | 
|  | 361 | +            regex: '\\s+|^$', | 
|  | 362 | +            next: 'start', | 
|  | 363 | +          }, | 
|  | 364 | +          { | 
|  | 365 | +            token: 'empty', | 
|  | 366 | +            regex: '', | 
|  | 367 | +            next: 'no_regex', | 
|  | 368 | +          }, | 
|  | 369 | +        ], | 
|  | 370 | +        regex: [ | 
|  | 371 | +          { | 
|  | 372 | +            token: 'regexp.keyword.operator', | 
|  | 373 | +            regex: '\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)', | 
|  | 374 | +          }, | 
|  | 375 | +          { | 
|  | 376 | +            token: 'string.regexp', | 
|  | 377 | +            regex: '/[sxngimy]*', | 
|  | 378 | +            next: 'no_regex', | 
|  | 379 | +          }, | 
|  | 380 | +          { | 
|  | 381 | +            token: 'invalid', | 
|  | 382 | +            regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/, | 
|  | 383 | +          }, | 
|  | 384 | +          { | 
|  | 385 | +            token: 'constant.language.escape', | 
|  | 386 | +            regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/, | 
|  | 387 | +          }, | 
|  | 388 | +          { | 
|  | 389 | +            token: 'constant.language.delimiter', | 
|  | 390 | +            regex: /\|/, | 
|  | 391 | +          }, | 
|  | 392 | +          { | 
|  | 393 | +            token: 'constant.language.escape', | 
|  | 394 | +            regex: /\[\^?/, | 
|  | 395 | +            next: 'regex_character_class', | 
|  | 396 | +          }, | 
|  | 397 | +          { | 
|  | 398 | +            token: 'empty', | 
|  | 399 | +            regex: '$', | 
|  | 400 | +            next: 'no_regex', | 
|  | 401 | +          }, | 
|  | 402 | +          { | 
|  | 403 | +            defaultToken: 'string.regexp', | 
|  | 404 | +          }, | 
|  | 405 | +        ], | 
|  | 406 | +        regex_character_class: [ | 
|  | 407 | +          { | 
|  | 408 | +            token: 'regexp.charclass.keyword.operator', | 
|  | 409 | +            regex: '\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)', | 
|  | 410 | +          }, | 
|  | 411 | +          { | 
|  | 412 | +            token: 'constant.language.escape', | 
|  | 413 | +            regex: ']', | 
|  | 414 | +            next: 'regex', | 
|  | 415 | +          }, | 
|  | 416 | +          { | 
|  | 417 | +            token: 'constant.language.escape', | 
|  | 418 | +            regex: '-', | 
|  | 419 | +          }, | 
|  | 420 | +          { | 
|  | 421 | +            token: 'empty', | 
|  | 422 | +            regex: '$', | 
|  | 423 | +            next: 'no_regex', | 
|  | 424 | +          }, | 
|  | 425 | +          { | 
|  | 426 | +            defaultToken: 'string.regexp.charachterclass', | 
|  | 427 | +          }, | 
|  | 428 | +        ], | 
|  | 429 | +        function_arguments: [ | 
|  | 430 | +          { | 
|  | 431 | +            token: 'variable.parameter', | 
|  | 432 | +            regex: identifierRe, | 
|  | 433 | +          }, | 
|  | 434 | +          { | 
|  | 435 | +            token: 'punctuation.operator', | 
|  | 436 | +            regex: '[, ]+', | 
|  | 437 | +          }, | 
|  | 438 | +          { | 
|  | 439 | +            token: 'punctuation.operator', | 
|  | 440 | +            regex: '$', | 
|  | 441 | +          }, | 
|  | 442 | +          { | 
|  | 443 | +            token: 'empty', | 
|  | 444 | +            regex: '', | 
|  | 445 | +            next: 'no_regex', | 
|  | 446 | +          }, | 
|  | 447 | +        ], | 
|  | 448 | +        qqstring: [ | 
|  | 449 | +          { | 
|  | 450 | +            token: 'constant.language.escape', | 
|  | 451 | +            regex: escapedRe, | 
|  | 452 | +          }, | 
|  | 453 | +          { | 
|  | 454 | +            token: 'string', | 
|  | 455 | +            regex: '\\\\$', | 
|  | 456 | +            consumeLineEnd: true, | 
|  | 457 | +          }, | 
|  | 458 | +          { | 
|  | 459 | +            token: 'string', | 
|  | 460 | +            regex: '"|$', | 
|  | 461 | +            next: 'no_regex', | 
|  | 462 | +          }, | 
|  | 463 | +          { | 
|  | 464 | +            defaultToken: 'string', | 
|  | 465 | +          }, | 
|  | 466 | +        ], | 
|  | 467 | +        qstring: [ | 
|  | 468 | +          { | 
|  | 469 | +            token: 'constant.language.escape', | 
|  | 470 | +            regex: escapedRe, | 
|  | 471 | +          }, | 
|  | 472 | +          { | 
|  | 473 | +            token: 'string', | 
|  | 474 | +            regex: '\\\\$', | 
|  | 475 | +            consumeLineEnd: true, | 
|  | 476 | +          }, | 
|  | 477 | +          { | 
|  | 478 | +            token: 'string', | 
|  | 479 | +            regex: "'|$", | 
|  | 480 | +            next: 'no_regex', | 
|  | 481 | +          }, | 
|  | 482 | +          { | 
|  | 483 | +            defaultToken: 'string', | 
|  | 484 | +          }, | 
|  | 485 | +        ], | 
|  | 486 | +      }; | 
|  | 487 | + | 
|  | 488 | +      if (!options || !options.noES6) { | 
|  | 489 | +        this.$rules.no_regex.unshift( | 
|  | 490 | +          { | 
|  | 491 | +            regex: '[{}]', | 
|  | 492 | +            onMatch: function (val, state, stack) { | 
|  | 493 | +              this.next = val == '{' ? this.nextState : ''; | 
|  | 494 | +              if (val == '{' && stack.length) { | 
|  | 495 | +                stack.unshift('start', state); | 
|  | 496 | +              } else if (val == '}' && stack.length) { | 
|  | 497 | +                stack.shift(); | 
|  | 498 | +                this.next = stack.shift(); | 
|  | 499 | +                if (this.next.indexOf('string') != -1 || this.next.indexOf('jsx') != -1) | 
|  | 500 | +                  return 'paren.quasi.end'; | 
|  | 501 | +              } | 
|  | 502 | +              return val == '{' ? 'paren.lparen' : 'paren.rparen'; | 
|  | 503 | +            }, | 
|  | 504 | +            nextState: 'start', | 
|  | 505 | +          }, | 
|  | 506 | +          { | 
|  | 507 | +            token: 'string.quasi.start', | 
|  | 508 | +            regex: /`/, | 
|  | 509 | +            push: [ | 
|  | 510 | +              { | 
|  | 511 | +                token: 'constant.language.escape', | 
|  | 512 | +                regex: escapedRe, | 
|  | 513 | +              }, | 
|  | 514 | +              { | 
|  | 515 | +                token: 'paren.quasi.start', | 
|  | 516 | +                regex: /\${/, | 
|  | 517 | +                push: 'start', | 
|  | 518 | +              }, | 
|  | 519 | +              { | 
|  | 520 | +                token: 'string.quasi.end', | 
|  | 521 | +                regex: /`/, | 
|  | 522 | +                next: 'pop', | 
|  | 523 | +              }, | 
|  | 524 | +              { | 
|  | 525 | +                defaultToken: 'string.quasi', | 
|  | 526 | +              }, | 
|  | 527 | +            ], | 
|  | 528 | +          } | 
|  | 529 | +        ); | 
|  | 530 | + | 
|  | 531 | +        if (!options || options.jsx != false) JSX.call(this); | 
|  | 532 | +      } | 
|  | 533 | + | 
|  | 534 | +      this.embedRules(DocCommentHighlightRules, 'doc-', [ | 
|  | 535 | +        DocCommentHighlightRules.getEndRule('no_regex'), | 
|  | 536 | +      ]); | 
|  | 537 | + | 
|  | 538 | +      this.normalizeRules(); | 
|  | 539 | +    }; | 
|  | 540 | + | 
|  | 541 | +    oop.inherits(JavaScriptHighlightRules, TextHighlightRules); | 
|  | 542 | + | 
|  | 543 | +    function JSX() { | 
|  | 544 | +      var tagRegex = identifierRe.replace('\\d', '\\d\\-'); | 
|  | 545 | +      var jsxTag = { | 
|  | 546 | +        onMatch: function (val, state, stack) { | 
|  | 547 | +          var offset = val.charAt(1) == '/' ? 2 : 1; | 
|  | 548 | +          if (offset == 1) { | 
|  | 549 | +            if (state != this.nextState) stack.unshift(this.next, this.nextState, 0); | 
|  | 550 | +            else stack.unshift(this.next); | 
|  | 551 | +            stack[2]++; | 
|  | 552 | +          } else if (offset == 2) { | 
|  | 553 | +            if (state == this.nextState) { | 
|  | 554 | +              stack[1]--; | 
|  | 555 | +              if (!stack[1] || stack[1] < 0) { | 
|  | 556 | +                stack.shift(); | 
|  | 557 | +                stack.shift(); | 
|  | 558 | +              } | 
|  | 559 | +            } | 
|  | 560 | +          } | 
|  | 561 | +          return [ | 
|  | 562 | +            { | 
|  | 563 | +              type: 'meta.tag.punctuation.' + (offset == 1 ? '' : 'end-') + 'tag-open.xml', | 
|  | 564 | +              value: val.slice(0, offset), | 
|  | 565 | +            }, | 
|  | 566 | +            { | 
|  | 567 | +              type: 'meta.tag.tag-name.xml', | 
|  | 568 | +              value: val.substr(offset), | 
|  | 569 | +            }, | 
|  | 570 | +          ]; | 
|  | 571 | +        }, | 
|  | 572 | +        regex: '</?' + tagRegex + '', | 
|  | 573 | +        next: 'jsxAttributes', | 
|  | 574 | +        nextState: 'jsx', | 
|  | 575 | +      }; | 
|  | 576 | +      this.$rules.start.unshift(jsxTag); | 
|  | 577 | +      var jsxJsRule = { | 
|  | 578 | +        regex: '{', | 
|  | 579 | +        token: 'paren.quasi.start', | 
|  | 580 | +        push: 'start', | 
|  | 581 | +      }; | 
|  | 582 | +      this.$rules.jsx = [jsxJsRule, jsxTag, { include: 'reference' }, { defaultToken: 'string' }]; | 
|  | 583 | +      this.$rules.jsxAttributes = [ | 
|  | 584 | +        { | 
|  | 585 | +          token: 'meta.tag.punctuation.tag-close.xml', | 
|  | 586 | +          regex: '/?>', | 
|  | 587 | +          onMatch: function (value, currentState, stack) { | 
|  | 588 | +            if (currentState == stack[0]) stack.shift(); | 
|  | 589 | +            if (value.length == 2) { | 
|  | 590 | +              if (stack[0] == this.nextState) stack[1]--; | 
|  | 591 | +              if (!stack[1] || stack[1] < 0) { | 
|  | 592 | +                stack.splice(0, 2); | 
|  | 593 | +              } | 
|  | 594 | +            } | 
|  | 595 | +            this.next = stack[0] || 'start'; | 
|  | 596 | +            return [{ type: this.token, value: value }]; | 
|  | 597 | +          }, | 
|  | 598 | +          nextState: 'jsx', | 
|  | 599 | +        }, | 
|  | 600 | +        jsxJsRule, | 
|  | 601 | +        comments('jsxAttributes'), | 
|  | 602 | +        { | 
|  | 603 | +          token: 'entity.other.attribute-name.xml', | 
|  | 604 | +          regex: tagRegex, | 
|  | 605 | +        }, | 
|  | 606 | +        { | 
|  | 607 | +          token: 'keyword.operator.attribute-equals.xml', | 
|  | 608 | +          regex: '=', | 
|  | 609 | +        }, | 
|  | 610 | +        { | 
|  | 611 | +          token: 'text.tag-whitespace.xml', | 
|  | 612 | +          regex: '\\s+', | 
|  | 613 | +        }, | 
|  | 614 | +        { | 
|  | 615 | +          token: 'string.attribute-value.xml', | 
|  | 616 | +          regex: "'", | 
|  | 617 | +          stateName: 'jsx_attr_q', | 
|  | 618 | +          push: [ | 
|  | 619 | +            { token: 'string.attribute-value.xml', regex: "'", next: 'pop' }, | 
|  | 620 | +            { include: 'reference' }, | 
|  | 621 | +            { defaultToken: 'string.attribute-value.xml' }, | 
|  | 622 | +          ], | 
|  | 623 | +        }, | 
|  | 624 | +        { | 
|  | 625 | +          token: 'string.attribute-value.xml', | 
|  | 626 | +          regex: '"', | 
|  | 627 | +          stateName: 'jsx_attr_qq', | 
|  | 628 | +          push: [ | 
|  | 629 | +            { token: 'string.attribute-value.xml', regex: '"', next: 'pop' }, | 
|  | 630 | +            { include: 'reference' }, | 
|  | 631 | +            { defaultToken: 'string.attribute-value.xml' }, | 
|  | 632 | +          ], | 
|  | 633 | +        }, | 
|  | 634 | +        jsxTag, | 
|  | 635 | +      ]; | 
|  | 636 | +      this.$rules.reference = [ | 
|  | 637 | +        { | 
|  | 638 | +          token: 'constant.language.escape.reference.xml', | 
|  | 639 | +          regex: '(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)', | 
|  | 640 | +        }, | 
|  | 641 | +      ]; | 
|  | 642 | +    } | 
|  | 643 | + | 
|  | 644 | +    function comments(next) { | 
|  | 645 | +      return [ | 
|  | 646 | +        { | 
|  | 647 | +          token: 'comment', // multi line comment | 
|  | 648 | +          regex: /\/\*/, | 
|  | 649 | +          next: [ | 
|  | 650 | +            DocCommentHighlightRules.getTagRule(), | 
|  | 651 | +            { token: 'comment', regex: '\\*\\/', next: next || 'pop' }, | 
|  | 652 | +            { defaultToken: 'comment', caseInsensitive: true }, | 
|  | 653 | +          ], | 
|  | 654 | +        }, | 
|  | 655 | +        { | 
|  | 656 | +          token: 'comment', | 
|  | 657 | +          regex: '\\/\\/', | 
|  | 658 | +          next: [ | 
|  | 659 | +            DocCommentHighlightRules.getTagRule(), | 
|  | 660 | +            { token: 'comment', regex: '$|^', next: next || 'pop' }, | 
|  | 661 | +            { defaultToken: 'comment', caseInsensitive: true }, | 
|  | 662 | +          ], | 
|  | 663 | +        }, | 
|  | 664 | +      ]; | 
|  | 665 | +    } | 
|  | 666 | +    exports.JavaScriptHighlightRules = JavaScriptHighlightRules; | 
|  | 667 | +  } | 
|  | 668 | +); | 
|  | 669 | + | 
|  | 670 | +ace.define( | 
|  | 671 | +  'ace/mode/matching_brace_outdent', | 
|  | 672 | +  ['require', 'exports', 'module', 'ace/range'], | 
|  | 673 | +  function (require, exports, module) { | 
|  | 674 | +    'use strict'; | 
|  | 675 | + | 
|  | 676 | +    var Range = require('../range').Range; | 
|  | 677 | + | 
|  | 678 | +    var MatchingBraceOutdent = function () {}; | 
|  | 679 | + | 
|  | 680 | +    (function () { | 
|  | 681 | +      this.checkOutdent = function (line, input) { | 
|  | 682 | +        if (!/^\s+$/.test(line)) return false; | 
|  | 683 | + | 
|  | 684 | +        return /^\s*\}/.test(input); | 
|  | 685 | +      }; | 
|  | 686 | + | 
|  | 687 | +      this.autoOutdent = function (doc, row) { | 
|  | 688 | +        var line = doc.getLine(row); | 
|  | 689 | +        var match = line.match(/^(\s*\})/); | 
|  | 690 | + | 
|  | 691 | +        if (!match) return 0; | 
|  | 692 | + | 
|  | 693 | +        var column = match[1].length; | 
|  | 694 | +        var openBracePos = doc.findMatchingBracket({ row: row, column: column }); | 
|  | 695 | + | 
|  | 696 | +        if (!openBracePos || openBracePos.row == row) return 0; | 
|  | 697 | + | 
|  | 698 | +        var indent = this.$getIndent(doc.getLine(openBracePos.row)); | 
|  | 699 | +        doc.replace(new Range(row, 0, row, column - 1), indent); | 
|  | 700 | +      }; | 
|  | 701 | + | 
|  | 702 | +      this.$getIndent = function (line) { | 
|  | 703 | +        return line.match(/^\s*/)[0]; | 
|  | 704 | +      }; | 
|  | 705 | +    }).call(MatchingBraceOutdent.prototype); | 
|  | 706 | + | 
|  | 707 | +    exports.MatchingBraceOutdent = MatchingBraceOutdent; | 
|  | 708 | +  } | 
|  | 709 | +); | 
|  | 710 | + | 
|  | 711 | +ace.define( | 
|  | 712 | +  'ace/mode/folding/cstyle', | 
|  | 713 | +  ['require', 'exports', 'module', 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], | 
|  | 714 | +  function (require, exports, module) { | 
|  | 715 | +    'use strict'; | 
|  | 716 | + | 
|  | 717 | +    var oop = require('../../lib/oop'); | 
|  | 718 | +    var Range = require('../../range').Range; | 
|  | 719 | +    var BaseFoldMode = require('./fold_mode').FoldMode; | 
|  | 720 | + | 
|  | 721 | +    var FoldMode = (exports.FoldMode = function (commentRegex) { | 
|  | 722 | +      if (commentRegex) { | 
|  | 723 | +        this.foldingStartMarker = new RegExp( | 
|  | 724 | +          this.foldingStartMarker.source.replace(/\|[^|]*?$/, '|' + commentRegex.start) | 
|  | 725 | +        ); | 
|  | 726 | +        this.foldingStopMarker = new RegExp( | 
|  | 727 | +          this.foldingStopMarker.source.replace(/\|[^|]*?$/, '|' + commentRegex.end) | 
|  | 728 | +        ); | 
|  | 729 | +      } | 
|  | 730 | +    }); | 
|  | 731 | +    oop.inherits(FoldMode, BaseFoldMode); | 
|  | 732 | + | 
|  | 733 | +    (function () { | 
|  | 734 | +      this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; | 
|  | 735 | +      this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; | 
|  | 736 | +      this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/; | 
|  | 737 | +      this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; | 
|  | 738 | +      this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; | 
|  | 739 | +      this._getFoldWidgetBase = this.getFoldWidget; | 
|  | 740 | +      this.getFoldWidget = function (session, foldStyle, row) { | 
|  | 741 | +        var line = session.getLine(row); | 
|  | 742 | + | 
|  | 743 | +        if (this.singleLineBlockCommentRe.test(line)) { | 
|  | 744 | +          if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) | 
|  | 745 | +            return ''; | 
|  | 746 | +        } | 
|  | 747 | + | 
|  | 748 | +        var fw = this._getFoldWidgetBase(session, foldStyle, row); | 
|  | 749 | + | 
|  | 750 | +        if (!fw && this.startRegionRe.test(line)) return 'start'; // lineCommentRegionStart | 
|  | 751 | + | 
|  | 752 | +        return fw; | 
|  | 753 | +      }; | 
|  | 754 | + | 
|  | 755 | +      this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) { | 
|  | 756 | +        var line = session.getLine(row); | 
|  | 757 | + | 
|  | 758 | +        if (this.startRegionRe.test(line)) return this.getCommentRegionBlock(session, line, row); | 
|  | 759 | + | 
|  | 760 | +        var match = line.match(this.foldingStartMarker); | 
|  | 761 | +        if (match) { | 
|  | 762 | +          var i = match.index; | 
|  | 763 | + | 
|  | 764 | +          if (match[1]) return this.openingBracketBlock(session, match[1], row, i); | 
|  | 765 | + | 
|  | 766 | +          var range = session.getCommentFoldRange(row, i + match[0].length, 1); | 
|  | 767 | + | 
|  | 768 | +          if (range && !range.isMultiLine()) { | 
|  | 769 | +            if (forceMultiline) { | 
|  | 770 | +              range = this.getSectionRange(session, row); | 
|  | 771 | +            } else if (foldStyle != 'all') range = null; | 
|  | 772 | +          } | 
|  | 773 | + | 
|  | 774 | +          return range; | 
|  | 775 | +        } | 
|  | 776 | + | 
|  | 777 | +        if (foldStyle === 'markbegin') return; | 
|  | 778 | + | 
|  | 779 | +        var match = line.match(this.foldingStopMarker); | 
|  | 780 | +        if (match) { | 
|  | 781 | +          var i = match.index + match[0].length; | 
|  | 782 | + | 
|  | 783 | +          if (match[1]) return this.closingBracketBlock(session, match[1], row, i); | 
|  | 784 | + | 
|  | 785 | +          return session.getCommentFoldRange(row, i, -1); | 
|  | 786 | +        } | 
|  | 787 | +      }; | 
|  | 788 | + | 
|  | 789 | +      this.getSectionRange = function (session, row) { | 
|  | 790 | +        var line = session.getLine(row); | 
|  | 791 | +        var startIndent = line.search(/\S/); | 
|  | 792 | +        var startRow = row; | 
|  | 793 | +        var startColumn = line.length; | 
|  | 794 | +        row = row + 1; | 
|  | 795 | +        var endRow = row; | 
|  | 796 | +        var maxRow = session.getLength(); | 
|  | 797 | +        while (++row < maxRow) { | 
|  | 798 | +          line = session.getLine(row); | 
|  | 799 | +          var indent = line.search(/\S/); | 
|  | 800 | +          if (indent === -1) continue; | 
|  | 801 | +          if (startIndent > indent) break; | 
|  | 802 | +          var subRange = this.getFoldWidgetRange(session, 'all', row); | 
|  | 803 | + | 
|  | 804 | +          if (subRange) { | 
|  | 805 | +            if (subRange.start.row <= startRow) { | 
|  | 806 | +              break; | 
|  | 807 | +            } else if (subRange.isMultiLine()) { | 
|  | 808 | +              row = subRange.end.row; | 
|  | 809 | +            } else if (startIndent == indent) { | 
|  | 810 | +              break; | 
|  | 811 | +            } | 
|  | 812 | +          } | 
|  | 813 | +          endRow = row; | 
|  | 814 | +        } | 
|  | 815 | + | 
|  | 816 | +        return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); | 
|  | 817 | +      }; | 
|  | 818 | +      this.getCommentRegionBlock = function (session, line, row) { | 
|  | 819 | +        var startColumn = line.search(/\s*$/); | 
|  | 820 | +        var maxRow = session.getLength(); | 
|  | 821 | +        var startRow = row; | 
|  | 822 | + | 
|  | 823 | +        var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; | 
|  | 824 | +        var depth = 1; | 
|  | 825 | +        while (++row < maxRow) { | 
|  | 826 | +          line = session.getLine(row); | 
|  | 827 | +          var m = re.exec(line); | 
|  | 828 | +          if (!m) continue; | 
|  | 829 | +          if (m[1]) depth--; | 
|  | 830 | +          else depth++; | 
|  | 831 | + | 
|  | 832 | +          if (!depth) break; | 
|  | 833 | +        } | 
|  | 834 | + | 
|  | 835 | +        var endRow = row; | 
|  | 836 | +        if (endRow > startRow) { | 
|  | 837 | +          return new Range(startRow, startColumn, endRow, line.length); | 
|  | 838 | +        } | 
|  | 839 | +      }; | 
|  | 840 | +    }).call(FoldMode.prototype); | 
|  | 841 | +  } | 
|  | 842 | +); | 
|  | 843 | + | 
|  | 844 | +ace.define( | 
|  | 845 | +  'ace/mode/tbel', | 
|  | 846 | +  [ | 
|  | 847 | +    'require', | 
|  | 848 | +    'exports', | 
|  | 849 | +    'module', | 
|  | 850 | +    'ace/lib/oop', | 
|  | 851 | +    'ace/mode/text', | 
|  | 852 | +    'ace/mode/javascript_highlight_rules', | 
|  | 853 | +    'ace/mode/matching_brace_outdent', | 
|  | 854 | +    'ace/worker/worker_client', | 
|  | 855 | +    'ace/mode/behaviour/cstyle', | 
|  | 856 | +    'ace/mode/folding/cstyle', | 
|  | 857 | +  ], | 
|  | 858 | +  function (require, exports, module) { | 
|  | 859 | +    'use strict'; | 
|  | 860 | + | 
|  | 861 | +    var oop = require('../lib/oop'); | 
|  | 862 | +    var TextMode = require('./text').Mode; | 
|  | 863 | +    var JavaScriptHighlightRules = require('./javascript_highlight_rules').JavaScriptHighlightRules; | 
|  | 864 | +    var MatchingBraceOutdent = require('./matching_brace_outdent').MatchingBraceOutdent; | 
|  | 865 | +    var WorkerClient = require('../worker/worker_client').WorkerClient; | 
|  | 866 | +    var CstyleBehaviour = require('./behaviour/cstyle').CstyleBehaviour; | 
|  | 867 | +    var CStyleFoldMode = require('./folding/cstyle').FoldMode; | 
|  | 868 | + | 
|  | 869 | +    var Mode = function () { | 
|  | 870 | +      this.HighlightRules = JavaScriptHighlightRules; | 
|  | 871 | + | 
|  | 872 | +      this.$outdent = new MatchingBraceOutdent(); | 
|  | 873 | +      this.$behaviour = new CstyleBehaviour(); | 
|  | 874 | +      this.foldingRules = new CStyleFoldMode(); | 
|  | 875 | +    }; | 
|  | 876 | +    oop.inherits(Mode, TextMode); | 
|  | 877 | + | 
|  | 878 | +    (function () { | 
|  | 879 | +      this.lineCommentStart = '//'; | 
|  | 880 | +      this.blockComment = { start: '/*', end: '*/' }; | 
|  | 881 | +      this.$quotes = { '"': '"', "'": "'", '`': '`' }; | 
|  | 882 | + | 
|  | 883 | +      this.getNextLineIndent = function (state, line, tab) { | 
|  | 884 | +        var indent = this.$getIndent(line); | 
|  | 885 | + | 
|  | 886 | +        var tokenizedLine = this.getTokenizer().getLineTokens(line, state); | 
|  | 887 | +        var tokens = tokenizedLine.tokens; | 
|  | 888 | +        var endState = tokenizedLine.state; | 
|  | 889 | + | 
|  | 890 | +        if (tokens.length && tokens[tokens.length - 1].type == 'comment') { | 
|  | 891 | +          return indent; | 
|  | 892 | +        } | 
|  | 893 | + | 
|  | 894 | +        if (state == 'start' || state == 'no_regex') { | 
|  | 895 | +          var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/); | 
|  | 896 | +          if (match) { | 
|  | 897 | +            indent += tab; | 
|  | 898 | +          } | 
|  | 899 | +        } else if (state == 'doc-start') { | 
|  | 900 | +          if (endState == 'start' || endState == 'no_regex') { | 
|  | 901 | +            return ''; | 
|  | 902 | +          } | 
|  | 903 | +          var match = line.match(/^\s*(\/?)\*/); | 
|  | 904 | +          if (match) { | 
|  | 905 | +            if (match[1]) { | 
|  | 906 | +              indent += ' '; | 
|  | 907 | +            } | 
|  | 908 | +            indent += '* '; | 
|  | 909 | +          } | 
|  | 910 | +        } | 
|  | 911 | + | 
|  | 912 | +        return indent; | 
|  | 913 | +      }; | 
|  | 914 | + | 
|  | 915 | +      this.checkOutdent = function (state, line, input) { | 
|  | 916 | +        return this.$outdent.checkOutdent(line, input); | 
|  | 917 | +      }; | 
|  | 918 | + | 
|  | 919 | +      this.autoOutdent = function (state, doc, row) { | 
|  | 920 | +        this.$outdent.autoOutdent(doc, row); | 
|  | 921 | +      }; | 
|  | 922 | + | 
|  | 923 | +      this.createWorker = function (session) { | 
|  | 924 | +        var worker = new WorkerClient(['ace'], 'ace/mode/tbel_worker', 'TbelWorker'); | 
|  | 925 | +        worker.attachToDocument(session.getDocument()); | 
|  | 926 | + | 
|  | 927 | +        worker.on('annotate', function (results) { | 
|  | 928 | +          session.setAnnotations(results.data); | 
|  | 929 | +        }); | 
|  | 930 | + | 
|  | 931 | +        worker.on('terminate', function () { | 
|  | 932 | +          session.clearAnnotations(); | 
|  | 933 | +        }); | 
|  | 934 | + | 
|  | 935 | +        return worker; | 
|  | 936 | +      }; | 
|  | 937 | + | 
|  | 938 | +      this.$id = 'ace/mode/tbel'; | 
|  | 939 | +      this.snippetFileId = 'ace/snippets/javascript'; | 
|  | 940 | +    }).call(Mode.prototype); | 
|  | 941 | + | 
|  | 942 | +    exports.Mode = Mode; | 
|  | 943 | +  } | 
|  | 944 | +); | 
|  | 945 | +(function () { | 
|  | 946 | +  ace.require(['ace/mode/tbel'], function (m) { | 
|  | 947 | +    if (typeof module == 'object' && typeof exports == 'object' && module) { | 
|  | 948 | +      module.exports = m; | 
|  | 949 | +    } | 
|  | 950 | +  }); | 
|  | 951 | +})(); | 
... | ... |  |