| 1 |
ace.define("ace/mode/erlang_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){ |
| 2 |
"use strict"; |
| 3 |
var oop = require("../lib/oop"); |
| 4 |
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; |
| 5 |
var ErlangHighlightRules = function () { |
| 6 |
this.$rules = { start: [{ include: '#module-directive' }, |
| 7 |
{ include: '#import-export-directive' }, |
| 8 |
{ include: '#behaviour-directive' }, |
| 9 |
{ include: '#record-directive' }, |
| 10 |
{ include: '#define-directive' }, |
| 11 |
{ include: '#macro-directive' }, |
| 12 |
{ include: '#directive' }, |
| 13 |
{ include: '#function' }, |
| 14 |
{ include: '#everything-else' }], |
| 15 |
'#atom': [{ token: 'punctuation.definition.symbol.begin.erlang', |
| 16 |
regex: '\'', |
| 17 |
push: [{ token: 'punctuation.definition.symbol.end.erlang', |
| 18 |
regex: '\'', |
| 19 |
next: 'pop' }, |
| 20 |
{ token: ['punctuation.definition.escape.erlang', |
| 21 |
'constant.other.symbol.escape.erlang', |
| 22 |
'punctuation.definition.escape.erlang', |
| 23 |
'constant.other.symbol.escape.erlang', |
| 24 |
'constant.other.symbol.escape.erlang'], |
| 25 |
regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' }, |
| 26 |
{ token: 'invalid.illegal.atom.erlang', regex: '\\\\\\^?.?' }, |
| 27 |
{ defaultToken: 'constant.other.symbol.quoted.single.erlang' }] }, |
| 28 |
{ token: 'constant.other.symbol.unquoted.erlang', |
| 29 |
regex: '[a-z][a-zA-Z\\d@_]*' }], |
| 30 |
'#behaviour-directive': [{ token: ['meta.directive.behaviour.erlang', |
| 31 |
'punctuation.section.directive.begin.erlang', |
| 32 |
'meta.directive.behaviour.erlang', |
| 33 |
'keyword.control.directive.behaviour.erlang', |
| 34 |
'meta.directive.behaviour.erlang', |
| 35 |
'punctuation.definition.parameters.begin.erlang', |
| 36 |
'meta.directive.behaviour.erlang', |
| 37 |
'entity.name.type.class.behaviour.definition.erlang', |
| 38 |
'meta.directive.behaviour.erlang', |
| 39 |
'punctuation.definition.parameters.end.erlang', |
| 40 |
'meta.directive.behaviour.erlang', |
| 41 |
'punctuation.section.directive.end.erlang'], |
| 42 |
regex: '^(\\s*)(-)(\\s*)(behaviour)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' }], |
| 43 |
'#binary': [{ token: 'punctuation.definition.binary.begin.erlang', |
| 44 |
regex: '<<', |
| 45 |
push: [{ token: 'punctuation.definition.binary.end.erlang', |
| 46 |
regex: '>>', |
| 47 |
next: 'pop' }, |
| 48 |
{ token: ['punctuation.separator.binary.erlang', |
| 49 |
'punctuation.separator.value-size.erlang'], |
| 50 |
regex: '(,)|(:)' }, |
| 51 |
{ include: '#internal-type-specifiers' }, |
| 52 |
{ include: '#everything-else' }, |
| 53 |
{ defaultToken: 'meta.structure.binary.erlang' }] }], |
| 54 |
'#character': [{ token: ['punctuation.definition.character.erlang', |
| 55 |
'punctuation.definition.escape.erlang', |
| 56 |
'constant.character.escape.erlang', |
| 57 |
'punctuation.definition.escape.erlang', |
| 58 |
'constant.character.escape.erlang', |
| 59 |
'constant.character.escape.erlang'], |
| 60 |
regex: '(\\$)(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' }, |
| 61 |
{ token: 'invalid.illegal.character.erlang', |
| 62 |
regex: '\\$\\\\\\^?.?' }, |
| 63 |
{ token: ['punctuation.definition.character.erlang', |
| 64 |
'constant.character.erlang'], |
| 65 |
regex: '(\\$)(\\S)' }, |
| 66 |
{ token: 'invalid.illegal.character.erlang', regex: '\\$.?' }], |
| 67 |
'#comment': [{ token: 'punctuation.definition.comment.erlang', |
| 68 |
regex: '%.*$', |
| 69 |
push_: [{ token: 'comment.line.percentage.erlang', |
| 70 |
regex: '$', |
| 71 |
next: 'pop' }, |
| 72 |
{ defaultToken: 'comment.line.percentage.erlang' }] }], |
| 73 |
'#define-directive': [{ token: ['meta.directive.define.erlang', |
| 74 |
'punctuation.section.directive.begin.erlang', |
| 75 |
'meta.directive.define.erlang', |
| 76 |
'keyword.control.directive.define.erlang', |
| 77 |
'meta.directive.define.erlang', |
| 78 |
'punctuation.definition.parameters.begin.erlang', |
| 79 |
'meta.directive.define.erlang', |
| 80 |
'entity.name.function.macro.definition.erlang', |
| 81 |
'meta.directive.define.erlang', |
| 82 |
'punctuation.separator.parameters.erlang'], |
| 83 |
regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(,)', |
| 84 |
push: [{ token: ['punctuation.definition.parameters.end.erlang', |
| 85 |
'meta.directive.define.erlang', |
| 86 |
'punctuation.section.directive.end.erlang'], |
| 87 |
regex: '(\\))(\\s*)(\\.)', |
| 88 |
next: 'pop' }, |
| 89 |
{ include: '#everything-else' }, |
| 90 |
{ defaultToken: 'meta.directive.define.erlang' }] }, |
| 91 |
{ token: 'meta.directive.define.erlang', |
| 92 |
regex: '(?=^\\s*-\\s*define\\s*\\(\\s*[a-zA-Z\\d@_]+\\s*\\()', |
| 93 |
push: [{ token: ['punctuation.definition.parameters.end.erlang', |
| 94 |
'meta.directive.define.erlang', |
| 95 |
'punctuation.section.directive.end.erlang'], |
| 96 |
regex: '(\\))(\\s*)(\\.)', |
| 97 |
next: 'pop' }, |
| 98 |
{ token: ['text', |
| 99 |
'punctuation.section.directive.begin.erlang', |
| 100 |
'text', |
| 101 |
'keyword.control.directive.define.erlang', |
| 102 |
'text', |
| 103 |
'punctuation.definition.parameters.begin.erlang', |
| 104 |
'text', |
| 105 |
'entity.name.function.macro.definition.erlang', |
| 106 |
'text', |
| 107 |
'punctuation.definition.parameters.begin.erlang'], |
| 108 |
regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\()', |
| 109 |
push: [{ token: ['punctuation.definition.parameters.end.erlang', |
| 110 |
'text', |
| 111 |
'punctuation.separator.parameters.erlang'], |
| 112 |
regex: '(\\))(\\s*)(,)', |
| 113 |
next: 'pop' }, |
| 114 |
{ token: 'punctuation.separator.parameters.erlang', regex: ',' }, |
| 115 |
{ include: '#everything-else' }] }, |
| 116 |
{ token: 'punctuation.separator.define.erlang', |
| 117 |
regex: '\\|\\||\\||:|;|,|\\.|->' }, |
| 118 |
{ include: '#everything-else' }, |
| 119 |
{ defaultToken: 'meta.directive.define.erlang' }] }], |
| 120 |
'#directive': [{ token: ['meta.directive.erlang', |
| 121 |
'punctuation.section.directive.begin.erlang', |
| 122 |
'meta.directive.erlang', |
| 123 |
'keyword.control.directive.erlang', |
| 124 |
'meta.directive.erlang', |
| 125 |
'punctuation.definition.parameters.begin.erlang'], |
| 126 |
regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\(?)', |
| 127 |
push: [{ token: ['punctuation.definition.parameters.end.erlang', |
| 128 |
'meta.directive.erlang', |
| 129 |
'punctuation.section.directive.end.erlang'], |
| 130 |
regex: '(\\)?)(\\s*)(\\.)', |
| 131 |
next: 'pop' }, |
| 132 |
{ include: '#everything-else' }, |
| 133 |
{ defaultToken: 'meta.directive.erlang' }] }, |
| 134 |
{ token: ['meta.directive.erlang', |
| 135 |
'punctuation.section.directive.begin.erlang', |
| 136 |
'meta.directive.erlang', |
| 137 |
'keyword.control.directive.erlang', |
| 138 |
'meta.directive.erlang', |
| 139 |
'punctuation.section.directive.end.erlang'], |
| 140 |
regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\.)' }], |
| 141 |
'#everything-else': [{ include: '#comment' }, |
| 142 |
{ include: '#record-usage' }, |
| 143 |
{ include: '#macro-usage' }, |
| 144 |
{ include: '#expression' }, |
| 145 |
{ include: '#keyword' }, |
| 146 |
{ include: '#textual-operator' }, |
| 147 |
{ include: '#function-call' }, |
| 148 |
{ include: '#tuple' }, |
| 149 |
{ include: '#list' }, |
| 150 |
{ include: '#binary' }, |
| 151 |
{ include: '#parenthesized-expression' }, |
| 152 |
{ include: '#character' }, |
| 153 |
{ include: '#number' }, |
| 154 |
{ include: '#atom' }, |
| 155 |
{ include: '#string' }, |
| 156 |
{ include: '#symbolic-operator' }, |
| 157 |
{ include: '#variable' }], |
| 158 |
'#expression': [{ token: 'keyword.control.if.erlang', |
| 159 |
regex: '\\bif\\b', |
| 160 |
push: [{ token: 'keyword.control.end.erlang', |
| 161 |
regex: '\\bend\\b', |
| 162 |
next: 'pop' }, |
| 163 |
{ include: '#internal-expression-punctuation' }, |
| 164 |
{ include: '#everything-else' }, |
| 165 |
{ defaultToken: 'meta.expression.if.erlang' }] }, |
| 166 |
{ token: 'keyword.control.case.erlang', |
| 167 |
regex: '\\bcase\\b', |
| 168 |
push: [{ token: 'keyword.control.end.erlang', |
| 169 |
regex: '\\bend\\b', |
| 170 |
next: 'pop' }, |
| 171 |
{ include: '#internal-expression-punctuation' }, |
| 172 |
{ include: '#everything-else' }, |
| 173 |
{ defaultToken: 'meta.expression.case.erlang' }] }, |
| 174 |
{ token: 'keyword.control.receive.erlang', |
| 175 |
regex: '\\breceive\\b', |
| 176 |
push: [{ token: 'keyword.control.end.erlang', |
| 177 |
regex: '\\bend\\b', |
| 178 |
next: 'pop' }, |
| 179 |
{ include: '#internal-expression-punctuation' }, |
| 180 |
{ include: '#everything-else' }, |
| 181 |
{ defaultToken: 'meta.expression.receive.erlang' }] }, |
| 182 |
{ token: ['keyword.control.fun.erlang', |
| 183 |
'text', |
| 184 |
'entity.name.type.class.module.erlang', |
| 185 |
'text', |
| 186 |
'punctuation.separator.module-function.erlang', |
| 187 |
'text', |
| 188 |
'entity.name.function.erlang', |
| 189 |
'text', |
| 190 |
'punctuation.separator.function-arity.erlang'], |
| 191 |
regex: '\\b(fun)(\\s*)(?:([a-z][a-zA-Z\\d@_]*)(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*)(\\s*)(/)' }, |
| 192 |
{ token: 'keyword.control.fun.erlang', |
| 193 |
regex: '\\bfun\\b', |
| 194 |
push: [{ token: 'keyword.control.end.erlang', |
| 195 |
regex: '\\bend\\b', |
| 196 |
next: 'pop' }, |
| 197 |
{ token: 'text', |
| 198 |
regex: '(?=\\()', |
| 199 |
push: [{ token: 'punctuation.separator.clauses.erlang', |
| 200 |
regex: ';|(?=\\bend\\b)', |
| 201 |
next: 'pop' }, |
| 202 |
{ include: '#internal-function-parts' }] }, |
| 203 |
{ include: '#everything-else' }, |
| 204 |
{ defaultToken: 'meta.expression.fun.erlang' }] }, |
| 205 |
{ token: 'keyword.control.try.erlang', |
| 206 |
regex: '\\btry\\b', |
| 207 |
push: [{ token: 'keyword.control.end.erlang', |
| 208 |
regex: '\\bend\\b', |
| 209 |
next: 'pop' }, |
| 210 |
{ include: '#internal-expression-punctuation' }, |
| 211 |
{ include: '#everything-else' }, |
| 212 |
{ defaultToken: 'meta.expression.try.erlang' }] }, |
| 213 |
{ token: 'keyword.control.begin.erlang', |
| 214 |
regex: '\\bbegin\\b', |
| 215 |
push: [{ token: 'keyword.control.end.erlang', |
| 216 |
regex: '\\bend\\b', |
| 217 |
next: 'pop' }, |
| 218 |
{ include: '#internal-expression-punctuation' }, |
| 219 |
{ include: '#everything-else' }, |
| 220 |
{ defaultToken: 'meta.expression.begin.erlang' }] }, |
| 221 |
{ token: 'keyword.control.query.erlang', |
| 222 |
regex: '\\bquery\\b', |
| 223 |
push: [{ token: 'keyword.control.end.erlang', |
| 224 |
regex: '\\bend\\b', |
| 225 |
next: 'pop' }, |
| 226 |
{ include: '#everything-else' }, |
| 227 |
{ defaultToken: 'meta.expression.query.erlang' }] }], |
| 228 |
'#function': [{ token: ['meta.function.erlang', |
| 229 |
'entity.name.function.definition.erlang', |
| 230 |
'meta.function.erlang'], |
| 231 |
regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()', |
| 232 |
push: [{ token: 'punctuation.terminator.function.erlang', |
| 233 |
regex: '\\.', |
| 234 |
next: 'pop' }, |
| 235 |
{ token: ['text', 'entity.name.function.erlang', 'text'], |
| 236 |
regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()' }, |
| 237 |
{ token: 'text', |
| 238 |
regex: '(?=\\()', |
| 239 |
push: [{ token: 'punctuation.separator.clauses.erlang', |
| 240 |
regex: ';|(?=\\.)', |
| 241 |
next: 'pop' }, |
| 242 |
{ include: '#parenthesized-expression' }, |
| 243 |
{ include: '#internal-function-parts' }] }, |
| 244 |
{ include: '#everything-else' }, |
| 245 |
{ defaultToken: 'meta.function.erlang' }] }], |
| 246 |
'#function-call': [{ token: 'meta.function-call.erlang', |
| 247 |
regex: '(?=(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*(?:\\(|:\\s*(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*\\())', |
| 248 |
push: [{ token: 'punctuation.definition.parameters.end.erlang', |
| 249 |
regex: '\\)', |
| 250 |
next: 'pop' }, |
| 251 |
{ token: ['entity.name.type.class.module.erlang', |
| 252 |
'text', |
| 253 |
'punctuation.separator.module-function.erlang', |
| 254 |
'text', |
| 255 |
'entity.name.function.guard.erlang', |
| 256 |
'text', |
| 257 |
'punctuation.definition.parameters.begin.erlang'], |
| 258 |
regex: '(?:(erlang)(\\s*)(:)(\\s*))?(is_atom|is_binary|is_constant|is_float|is_function|is_integer|is_list|is_number|is_pid|is_port|is_reference|is_tuple|is_record|abs|element|hd|length|node|round|self|size|tl|trunc)(\\s*)(\\()', |
| 259 |
push: [{ token: 'text', regex: '(?=\\))', next: 'pop' }, |
| 260 |
{ token: 'punctuation.separator.parameters.erlang', regex: ',' }, |
| 261 |
{ include: '#everything-else' }] }, |
| 262 |
{ token: ['entity.name.type.class.module.erlang', |
| 263 |
'text', |
| 264 |
'punctuation.separator.module-function.erlang', |
| 265 |
'text', |
| 266 |
'entity.name.function.erlang', |
| 267 |
'text', |
| 268 |
'punctuation.definition.parameters.begin.erlang'], |
| 269 |
regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\()', |
| 270 |
push: [{ token: 'text', regex: '(?=\\))', next: 'pop' }, |
| 271 |
{ token: 'punctuation.separator.parameters.erlang', regex: ',' }, |
| 272 |
{ include: '#everything-else' }] }, |
| 273 |
{ defaultToken: 'meta.function-call.erlang' }] }], |
| 274 |
'#import-export-directive': [{ token: ['meta.directive.import.erlang', |
| 275 |
'punctuation.section.directive.begin.erlang', |
| 276 |
'meta.directive.import.erlang', |
| 277 |
'keyword.control.directive.import.erlang', |
| 278 |
'meta.directive.import.erlang', |
| 279 |
'punctuation.definition.parameters.begin.erlang', |
| 280 |
'meta.directive.import.erlang', |
| 281 |
'entity.name.type.class.module.erlang', |
| 282 |
'meta.directive.import.erlang', |
| 283 |
'punctuation.separator.parameters.erlang'], |
| 284 |
regex: '^(\\s*)(-)(\\s*)(import)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)', |
| 285 |
push: [{ token: ['punctuation.definition.parameters.end.erlang', |
| 286 |
'meta.directive.import.erlang', |
| 287 |
'punctuation.section.directive.end.erlang'], |
| 288 |
regex: '(\\))(\\s*)(\\.)', |
| 289 |
next: 'pop' }, |
| 290 |
{ include: '#internal-function-list' }, |
| 291 |
{ defaultToken: 'meta.directive.import.erlang' }] }, |
| 292 |
{ token: ['meta.directive.export.erlang', |
| 293 |
'punctuation.section.directive.begin.erlang', |
| 294 |
'meta.directive.export.erlang', |
| 295 |
'keyword.control.directive.export.erlang', |
| 296 |
'meta.directive.export.erlang', |
| 297 |
'punctuation.definition.parameters.begin.erlang'], |
| 298 |
regex: '^(\\s*)(-)(\\s*)(export)(\\s*)(\\()', |
| 299 |
push: [{ token: ['punctuation.definition.parameters.end.erlang', |
| 300 |
'meta.directive.export.erlang', |
| 301 |
'punctuation.section.directive.end.erlang'], |
| 302 |
regex: '(\\))(\\s*)(\\.)', |
| 303 |
next: 'pop' }, |
| 304 |
{ include: '#internal-function-list' }, |
| 305 |
{ defaultToken: 'meta.directive.export.erlang' }] }], |
| 306 |
'#internal-expression-punctuation': [{ token: ['punctuation.separator.clause-head-body.erlang', |
| 307 |
'punctuation.separator.clauses.erlang', |
| 308 |
'punctuation.separator.expressions.erlang'], |
| 309 |
regex: '(->)|(;)|(,)' }], |
| 310 |
'#internal-function-list': [{ token: 'punctuation.definition.list.begin.erlang', |
| 311 |
regex: '\\[', |
| 312 |
push: [{ token: 'punctuation.definition.list.end.erlang', |
| 313 |
regex: '\\]', |
| 314 |
next: 'pop' }, |
| 315 |
{ token: ['entity.name.function.erlang', |
| 316 |
'text', |
| 317 |
'punctuation.separator.function-arity.erlang'], |
| 318 |
regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(/)', |
| 319 |
push: [{ token: 'punctuation.separator.list.erlang', |
| 320 |
regex: ',|(?=\\])', |
| 321 |
next: 'pop' }, |
| 322 |
{ include: '#everything-else' }] }, |
| 323 |
{ include: '#everything-else' }, |
| 324 |
{ defaultToken: 'meta.structure.list.function.erlang' }] }], |
| 325 |
'#internal-function-parts': [{ token: 'text', |
| 326 |
regex: '(?=\\()', |
| 327 |
push: [{ token: 'punctuation.separator.clause-head-body.erlang', |
| 328 |
regex: '->', |
| 329 |
next: 'pop' }, |
| 330 |
{ token: 'punctuation.definition.parameters.begin.erlang', |
| 331 |
regex: '\\(', |
| 332 |
push: [{ token: 'punctuation.definition.parameters.end.erlang', |
| 333 |
regex: '\\)', |
| 334 |
next: 'pop' }, |
| 335 |
{ token: 'punctuation.separator.parameters.erlang', regex: ',' }, |
| 336 |
{ include: '#everything-else' }] }, |
| 337 |
{ token: 'punctuation.separator.guards.erlang', regex: ',|;' }, |
| 338 |
{ include: '#everything-else' }] }, |
| 339 |
{ token: 'punctuation.separator.expressions.erlang', |
| 340 |
regex: ',' }, |
| 341 |
{ include: '#everything-else' }], |
| 342 |
'#internal-record-body': [{ token: 'punctuation.definition.class.record.begin.erlang', |
| 343 |
regex: '\\{', |
| 344 |
push: [{ token: 'meta.structure.record.erlang', |
| 345 |
regex: '(?=\\})', |
| 346 |
next: 'pop' }, |
| 347 |
{ token: ['variable.other.field.erlang', |
| 348 |
'variable.language.omitted.field.erlang', |
| 349 |
'text', |
| 350 |
'keyword.operator.assignment.erlang'], |
| 351 |
regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')|(_))(\\s*)(=|::)', |
| 352 |
push: [{ token: 'punctuation.separator.class.record.erlang', |
| 353 |
regex: ',|(?=\\})', |
| 354 |
next: 'pop' }, |
| 355 |
{ include: '#everything-else' }] }, |
| 356 |
{ token: ['variable.other.field.erlang', |
| 357 |
'text', |
| 358 |
'punctuation.separator.class.record.erlang'], |
| 359 |
regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)((?:,)?)' }, |
| 360 |
{ include: '#everything-else' }, |
| 361 |
{ defaultToken: 'meta.structure.record.erlang' }] }], |
| 362 |
'#internal-type-specifiers': [{ token: 'punctuation.separator.value-type.erlang', |
| 363 |
regex: '/', |
| 364 |
push: [{ token: 'text', regex: '(?=,|:|>>)', next: 'pop' }, |
| 365 |
{ token: ['storage.type.erlang', |
| 366 |
'storage.modifier.signedness.erlang', |
| 367 |
'storage.modifier.endianness.erlang', |
| 368 |
'storage.modifier.unit.erlang', |
| 369 |
'punctuation.separator.type-specifiers.erlang'], |
| 370 |
regex: '(integer|float|binary|bytes|bitstring|bits)|(signed|unsigned)|(big|little|native)|(unit)|(-)' }] }], |
| 371 |
'#keyword': [{ token: 'keyword.control.erlang', |
| 372 |
regex: '\\b(?:after|begin|case|catch|cond|end|fun|if|let|of|query|try|receive|when)\\b' }], |
| 373 |
'#list': [{ token: 'punctuation.definition.list.begin.erlang', |
| 374 |
regex: '\\[', |
| 375 |
push: [{ token: 'punctuation.definition.list.end.erlang', |
| 376 |
regex: '\\]', |
| 377 |
next: 'pop' }, |
| 378 |
{ token: 'punctuation.separator.list.erlang', |
| 379 |
regex: '\\||\\|\\||,' }, |
| 380 |
{ include: '#everything-else' }, |
| 381 |
{ defaultToken: 'meta.structure.list.erlang' }] }], |
| 382 |
'#macro-directive': [{ token: ['meta.directive.ifdef.erlang', |
| 383 |
'punctuation.section.directive.begin.erlang', |
| 384 |
'meta.directive.ifdef.erlang', |
| 385 |
'keyword.control.directive.ifdef.erlang', |
| 386 |
'meta.directive.ifdef.erlang', |
| 387 |
'punctuation.definition.parameters.begin.erlang', |
| 388 |
'meta.directive.ifdef.erlang', |
| 389 |
'entity.name.function.macro.erlang', |
| 390 |
'meta.directive.ifdef.erlang', |
| 391 |
'punctuation.definition.parameters.end.erlang', |
| 392 |
'meta.directive.ifdef.erlang', |
| 393 |
'punctuation.section.directive.end.erlang'], |
| 394 |
regex: '^(\\s*)(-)(\\s*)(ifdef)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' }, |
| 395 |
{ token: ['meta.directive.ifndef.erlang', |
| 396 |
'punctuation.section.directive.begin.erlang', |
| 397 |
'meta.directive.ifndef.erlang', |
| 398 |
'keyword.control.directive.ifndef.erlang', |
| 399 |
'meta.directive.ifndef.erlang', |
| 400 |
'punctuation.definition.parameters.begin.erlang', |
| 401 |
'meta.directive.ifndef.erlang', |
| 402 |
'entity.name.function.macro.erlang', |
| 403 |
'meta.directive.ifndef.erlang', |
| 404 |
'punctuation.definition.parameters.end.erlang', |
| 405 |
'meta.directive.ifndef.erlang', |
| 406 |
'punctuation.section.directive.end.erlang'], |
| 407 |
regex: '^(\\s*)(-)(\\s*)(ifndef)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' }, |
| 408 |
{ token: ['meta.directive.undef.erlang', |
| 409 |
'punctuation.section.directive.begin.erlang', |
| 410 |
'meta.directive.undef.erlang', |
| 411 |
'keyword.control.directive.undef.erlang', |
| 412 |
'meta.directive.undef.erlang', |
| 413 |
'punctuation.definition.parameters.begin.erlang', |
| 414 |
'meta.directive.undef.erlang', |
| 415 |
'entity.name.function.macro.erlang', |
| 416 |
'meta.directive.undef.erlang', |
| 417 |
'punctuation.definition.parameters.end.erlang', |
| 418 |
'meta.directive.undef.erlang', |
| 419 |
'punctuation.section.directive.end.erlang'], |
| 420 |
regex: '^(\\s*)(-)(\\s*)(undef)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' }], |
| 421 |
'#macro-usage': [{ token: ['keyword.operator.macro.erlang', |
| 422 |
'meta.macro-usage.erlang', |
| 423 |
'entity.name.function.macro.erlang'], |
| 424 |
regex: '(\\?\\??)(\\s*)([a-zA-Z\\d@_]+)' }], |
| 425 |
'#module-directive': [{ token: ['meta.directive.module.erlang', |
| 426 |
'punctuation.section.directive.begin.erlang', |
| 427 |
'meta.directive.module.erlang', |
| 428 |
'keyword.control.directive.module.erlang', |
| 429 |
'meta.directive.module.erlang', |
| 430 |
'punctuation.definition.parameters.begin.erlang', |
| 431 |
'meta.directive.module.erlang', |
| 432 |
'entity.name.type.class.module.definition.erlang', |
| 433 |
'meta.directive.module.erlang', |
| 434 |
'punctuation.definition.parameters.end.erlang', |
| 435 |
'meta.directive.module.erlang', |
| 436 |
'punctuation.section.directive.end.erlang'], |
| 437 |
regex: '^(\\s*)(-)(\\s*)(module)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' }], |
| 438 |
'#number': [{ token: 'text', |
| 439 |
regex: '(?=\\d)', |
| 440 |
push: [{ token: 'text', regex: '(?!\\d)', next: 'pop' }, |
| 441 |
{ token: ['constant.numeric.float.erlang', |
| 442 |
'punctuation.separator.integer-float.erlang', |
| 443 |
'constant.numeric.float.erlang', |
| 444 |
'punctuation.separator.float-exponent.erlang'], |
| 445 |
regex: '(\\d+)(\\.)(\\d+)((?:[eE][\\+\\-]?\\d+)?)' }, |
| 446 |
{ token: ['constant.numeric.integer.binary.erlang', |
| 447 |
'punctuation.separator.base-integer.erlang', |
| 448 |
'constant.numeric.integer.binary.erlang'], |
| 449 |
regex: '(2)(#)([0-1]+)' }, |
| 450 |
{ token: ['constant.numeric.integer.base-3.erlang', |
| 451 |
'punctuation.separator.base-integer.erlang', |
| 452 |
'constant.numeric.integer.base-3.erlang'], |
| 453 |
regex: '(3)(#)([0-2]+)' }, |
| 454 |
{ token: ['constant.numeric.integer.base-4.erlang', |
| 455 |
'punctuation.separator.base-integer.erlang', |
| 456 |
'constant.numeric.integer.base-4.erlang'], |
| 457 |
regex: '(4)(#)([0-3]+)' }, |
| 458 |
{ token: ['constant.numeric.integer.base-5.erlang', |
| 459 |
'punctuation.separator.base-integer.erlang', |
| 460 |
'constant.numeric.integer.base-5.erlang'], |
| 461 |
regex: '(5)(#)([0-4]+)' }, |
| 462 |
{ token: ['constant.numeric.integer.base-6.erlang', |
| 463 |
'punctuation.separator.base-integer.erlang', |
| 464 |
'constant.numeric.integer.base-6.erlang'], |
| 465 |
regex: '(6)(#)([0-5]+)' }, |
| 466 |
{ token: ['constant.numeric.integer.base-7.erlang', |
| 467 |
'punctuation.separator.base-integer.erlang', |
| 468 |
'constant.numeric.integer.base-7.erlang'], |
| 469 |
regex: '(7)(#)([0-6]+)' }, |
| 470 |
{ token: ['constant.numeric.integer.octal.erlang', |
| 471 |
'punctuation.separator.base-integer.erlang', |
| 472 |
'constant.numeric.integer.octal.erlang'], |
| 473 |
regex: '(8)(#)([0-7]+)' }, |
| 474 |
{ token: ['constant.numeric.integer.base-9.erlang', |
| 475 |
'punctuation.separator.base-integer.erlang', |
| 476 |
'constant.numeric.integer.base-9.erlang'], |
| 477 |
regex: '(9)(#)([0-8]+)' }, |
| 478 |
{ token: ['constant.numeric.integer.decimal.erlang', |
| 479 |
'punctuation.separator.base-integer.erlang', |
| 480 |
'constant.numeric.integer.decimal.erlang'], |
| 481 |
regex: '(10)(#)(\\d+)' }, |
| 482 |
{ token: ['constant.numeric.integer.base-11.erlang', |
| 483 |
'punctuation.separator.base-integer.erlang', |
| 484 |
'constant.numeric.integer.base-11.erlang'], |
| 485 |
regex: '(11)(#)([\\daA]+)' }, |
| 486 |
{ token: ['constant.numeric.integer.base-12.erlang', |
| 487 |
'punctuation.separator.base-integer.erlang', |
| 488 |
'constant.numeric.integer.base-12.erlang'], |
| 489 |
regex: '(12)(#)([\\da-bA-B]+)' }, |
| 490 |
{ token: ['constant.numeric.integer.base-13.erlang', |
| 491 |
'punctuation.separator.base-integer.erlang', |
| 492 |
'constant.numeric.integer.base-13.erlang'], |
| 493 |
regex: '(13)(#)([\\da-cA-C]+)' }, |
| 494 |
{ token: ['constant.numeric.integer.base-14.erlang', |
| 495 |
'punctuation.separator.base-integer.erlang', |
| 496 |
'constant.numeric.integer.base-14.erlang'], |
| 497 |
regex: '(14)(#)([\\da-dA-D]+)' }, |
| 498 |
{ token: ['constant.numeric.integer.base-15.erlang', |
| 499 |
'punctuation.separator.base-integer.erlang', |
| 500 |
'constant.numeric.integer.base-15.erlang'], |
| 501 |
regex: '(15)(#)([\\da-eA-E]+)' }, |
| 502 |
{ token: ['constant.numeric.integer.hexadecimal.erlang', |
| 503 |
'punctuation.separator.base-integer.erlang', |
| 504 |
'constant.numeric.integer.hexadecimal.erlang'], |
| 505 |
regex: '(16)(#)([\\da-fA-F]+)' }, |
| 506 |
{ token: ['constant.numeric.integer.base-17.erlang', |
| 507 |
'punctuation.separator.base-integer.erlang', |
| 508 |
'constant.numeric.integer.base-17.erlang'], |
| 509 |
regex: '(17)(#)([\\da-gA-G]+)' }, |
| 510 |
{ token: ['constant.numeric.integer.base-18.erlang', |
| 511 |
'punctuation.separator.base-integer.erlang', |
| 512 |
'constant.numeric.integer.base-18.erlang'], |
| 513 |
regex: '(18)(#)([\\da-hA-H]+)' }, |
| 514 |
{ token: ['constant.numeric.integer.base-19.erlang', |
| 515 |
'punctuation.separator.base-integer.erlang', |
| 516 |
'constant.numeric.integer.base-19.erlang'], |
| 517 |
regex: '(19)(#)([\\da-iA-I]+)' }, |
| 518 |
{ token: ['constant.numeric.integer.base-20.erlang', |
| 519 |
'punctuation.separator.base-integer.erlang', |
| 520 |
'constant.numeric.integer.base-20.erlang'], |
| 521 |
regex: '(20)(#)([\\da-jA-J]+)' }, |
| 522 |
{ token: ['constant.numeric.integer.base-21.erlang', |
| 523 |
'punctuation.separator.base-integer.erlang', |
| 524 |
'constant.numeric.integer.base-21.erlang'], |
| 525 |
regex: '(21)(#)([\\da-kA-K]+)' }, |
| 526 |
{ token: ['constant.numeric.integer.base-22.erlang', |
| 527 |
'punctuation.separator.base-integer.erlang', |
| 528 |
'constant.numeric.integer.base-22.erlang'], |
| 529 |
regex: '(22)(#)([\\da-lA-L]+)' }, |
| 530 |
{ token: ['constant.numeric.integer.base-23.erlang', |
| 531 |
'punctuation.separator.base-integer.erlang', |
| 532 |
'constant.numeric.integer.base-23.erlang'], |
| 533 |
regex: '(23)(#)([\\da-mA-M]+)' }, |
| 534 |
{ token: ['constant.numeric.integer.base-24.erlang', |
| 535 |
'punctuation.separator.base-integer.erlang', |
| 536 |
'constant.numeric.integer.base-24.erlang'], |
| 537 |
regex: '(24)(#)([\\da-nA-N]+)' }, |
| 538 |
{ token: ['constant.numeric.integer.base-25.erlang', |
| 539 |
'punctuation.separator.base-integer.erlang', |
| 540 |
'constant.numeric.integer.base-25.erlang'], |
| 541 |
regex: '(25)(#)([\\da-oA-O]+)' }, |
| 542 |
{ token: ['constant.numeric.integer.base-26.erlang', |
| 543 |
'punctuation.separator.base-integer.erlang', |
| 544 |
'constant.numeric.integer.base-26.erlang'], |
| 545 |
regex: '(26)(#)([\\da-pA-P]+)' }, |
| 546 |
{ token: ['constant.numeric.integer.base-27.erlang', |
| 547 |
'punctuation.separator.base-integer.erlang', |
| 548 |
'constant.numeric.integer.base-27.erlang'], |
| 549 |
regex: '(27)(#)([\\da-qA-Q]+)' }, |
| 550 |
{ token: ['constant.numeric.integer.base-28.erlang', |
| 551 |
'punctuation.separator.base-integer.erlang', |
| 552 |
'constant.numeric.integer.base-28.erlang'], |
| 553 |
regex: '(28)(#)([\\da-rA-R]+)' }, |
| 554 |
{ token: ['constant.numeric.integer.base-29.erlang', |
| 555 |
'punctuation.separator.base-integer.erlang', |
| 556 |
'constant.numeric.integer.base-29.erlang'], |
| 557 |
regex: '(29)(#)([\\da-sA-S]+)' }, |
| 558 |
{ token: ['constant.numeric.integer.base-30.erlang', |
| 559 |
'punctuation.separator.base-integer.erlang', |
| 560 |
'constant.numeric.integer.base-30.erlang'], |
| 561 |
regex: '(30)(#)([\\da-tA-T]+)' }, |
| 562 |
{ token: ['constant.numeric.integer.base-31.erlang', |
| 563 |
'punctuation.separator.base-integer.erlang', |
| 564 |
'constant.numeric.integer.base-31.erlang'], |
| 565 |
regex: '(31)(#)([\\da-uA-U]+)' }, |
| 566 |
{ token: ['constant.numeric.integer.base-32.erlang', |
| 567 |
'punctuation.separator.base-integer.erlang', |
| 568 |
'constant.numeric.integer.base-32.erlang'], |
| 569 |
regex: '(32)(#)([\\da-vA-V]+)' }, |
| 570 |
{ token: ['constant.numeric.integer.base-33.erlang', |
| 571 |
'punctuation.separator.base-integer.erlang', |
| 572 |
'constant.numeric.integer.base-33.erlang'], |
| 573 |
regex: '(33)(#)([\\da-wA-W]+)' }, |
| 574 |
{ token: ['constant.numeric.integer.base-34.erlang', |
| 575 |
'punctuation.separator.base-integer.erlang', |
| 576 |
'constant.numeric.integer.base-34.erlang'], |
| 577 |
regex: '(34)(#)([\\da-xA-X]+)' }, |
| 578 |
{ token: ['constant.numeric.integer.base-35.erlang', |
| 579 |
'punctuation.separator.base-integer.erlang', |
| 580 |
'constant.numeric.integer.base-35.erlang'], |
| 581 |
regex: '(35)(#)([\\da-yA-Y]+)' }, |
| 582 |
{ token: ['constant.numeric.integer.base-36.erlang', |
| 583 |
'punctuation.separator.base-integer.erlang', |
| 584 |
'constant.numeric.integer.base-36.erlang'], |
| 585 |
regex: '(36)(#)([\\da-zA-Z]+)' }, |
| 586 |
{ token: 'invalid.illegal.integer.erlang', |
| 587 |
regex: '\\d+#[\\da-zA-Z]+' }, |
| 588 |
{ token: 'constant.numeric.integer.decimal.erlang', |
| 589 |
regex: '\\d+' }] }], |
| 590 |
'#parenthesized-expression': [{ token: 'punctuation.section.expression.begin.erlang', |
| 591 |
regex: '\\(', |
| 592 |
push: [{ token: 'punctuation.section.expression.end.erlang', |
| 593 |
regex: '\\)', |
| 594 |
next: 'pop' }, |
| 595 |
{ include: '#everything-else' }, |
| 596 |
{ defaultToken: 'meta.expression.parenthesized' }] }], |
| 597 |
'#record-directive': [{ token: ['meta.directive.record.erlang', |
| 598 |
'punctuation.section.directive.begin.erlang', |
| 599 |
'meta.directive.record.erlang', |
| 600 |
'keyword.control.directive.import.erlang', |
| 601 |
'meta.directive.record.erlang', |
| 602 |
'punctuation.definition.parameters.begin.erlang', |
| 603 |
'meta.directive.record.erlang', |
| 604 |
'entity.name.type.class.record.definition.erlang', |
| 605 |
'meta.directive.record.erlang', |
| 606 |
'punctuation.separator.parameters.erlang'], |
| 607 |
regex: '^(\\s*)(-)(\\s*)(record)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)', |
| 608 |
push: [{ token: ['punctuation.definition.class.record.end.erlang', |
| 609 |
'meta.directive.record.erlang', |
| 610 |
'punctuation.definition.parameters.end.erlang', |
| 611 |
'meta.directive.record.erlang', |
| 612 |
'punctuation.section.directive.end.erlang'], |
| 613 |
regex: '(\\})(\\s*)(\\))(\\s*)(\\.)', |
| 614 |
next: 'pop' }, |
| 615 |
{ include: '#internal-record-body' }, |
| 616 |
{ defaultToken: 'meta.directive.record.erlang' }] }], |
| 617 |
'#record-usage': [{ token: ['keyword.operator.record.erlang', |
| 618 |
'meta.record-usage.erlang', |
| 619 |
'entity.name.type.class.record.erlang', |
| 620 |
'meta.record-usage.erlang', |
| 621 |
'punctuation.separator.record-field.erlang', |
| 622 |
'meta.record-usage.erlang', |
| 623 |
'variable.other.field.erlang'], |
| 624 |
regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\.)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')' }, |
| 625 |
{ token: ['keyword.operator.record.erlang', |
| 626 |
'meta.record-usage.erlang', |
| 627 |
'entity.name.type.class.record.erlang'], |
| 628 |
regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')', |
| 629 |
push: [{ token: 'punctuation.definition.class.record.end.erlang', |
| 630 |
regex: '\\}', |
| 631 |
next: 'pop' }, |
| 632 |
{ include: '#internal-record-body' }, |
| 633 |
{ defaultToken: 'meta.record-usage.erlang' }] }], |
| 634 |
'#string': [{ token: 'punctuation.definition.string.begin.erlang', |
| 635 |
regex: '"', |
| 636 |
push: [{ token: 'punctuation.definition.string.end.erlang', |
| 637 |
regex: '"', |
| 638 |
next: 'pop' }, |
| 639 |
{ token: ['punctuation.definition.escape.erlang', |
| 640 |
'constant.character.escape.erlang', |
| 641 |
'punctuation.definition.escape.erlang', |
| 642 |
'constant.character.escape.erlang', |
| 643 |
'constant.character.escape.erlang'], |
| 644 |
regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' }, |
| 645 |
{ token: 'invalid.illegal.string.erlang', regex: '\\\\\\^?.?' }, |
| 646 |
{ token: ['punctuation.definition.placeholder.erlang', |
| 647 |
'punctuation.separator.placeholder-parts.erlang', |
| 648 |
'constant.other.placeholder.erlang', |
| 649 |
'punctuation.separator.placeholder-parts.erlang', |
| 650 |
'punctuation.separator.placeholder-parts.erlang', |
| 651 |
'constant.other.placeholder.erlang', |
| 652 |
'punctuation.separator.placeholder-parts.erlang', |
| 653 |
'punctuation.separator.placeholder-parts.erlang', |
| 654 |
'punctuation.separator.placeholder-parts.erlang', |
| 655 |
'constant.other.placeholder.erlang', |
| 656 |
'constant.other.placeholder.erlang'], |
| 657 |
regex: '(~)(?:((?:\\-)?)(\\d+)|(\\*))?(?:(\\.)(?:(\\d+)|(\\*)))?(?:(\\.)(?:(\\*)|(.)))?([~cfegswpWPBX#bx\\+ni])' }, |
| 658 |
{ token: ['punctuation.definition.placeholder.erlang', |
| 659 |
'punctuation.separator.placeholder-parts.erlang', |
| 660 |
'constant.other.placeholder.erlang', |
| 661 |
'constant.other.placeholder.erlang'], |
| 662 |
regex: '(~)((?:\\*)?)((?:\\d+)?)([~du\\-#fsacl])' }, |
| 663 |
{ token: 'invalid.illegal.string.erlang', regex: '~.?' }, |
| 664 |
{ defaultToken: 'string.quoted.double.erlang' }] }], |
| 665 |
'#symbolic-operator': [{ token: 'keyword.operator.symbolic.erlang', |
| 666 |
regex: '\\+\\+|\\+|--|-|\\*|/=|/|=/=|=:=|==|=<|=|<-|<|>=|>|!|::' }], |
| 667 |
'#textual-operator': [{ token: 'keyword.operator.textual.erlang', |
| 668 |
regex: '\\b(?:andalso|band|and|bxor|xor|bor|orelse|or|bnot|not|bsl|bsr|div|rem)\\b' }], |
| 669 |
'#tuple': [{ token: 'punctuation.definition.tuple.begin.erlang', |
| 670 |
regex: '\\{', |
| 671 |
push: [{ token: 'punctuation.definition.tuple.end.erlang', |
| 672 |
regex: '\\}', |
| 673 |
next: 'pop' }, |
| 674 |
{ token: 'punctuation.separator.tuple.erlang', regex: ',' }, |
| 675 |
{ include: '#everything-else' }, |
| 676 |
{ defaultToken: 'meta.structure.tuple.erlang' }] }], |
| 677 |
'#variable': [{ token: ['variable.other.erlang', 'variable.language.omitted.erlang'], |
| 678 |
regex: '(_[a-zA-Z\\d@_]+|[A-Z][a-zA-Z\\d@_]*)|(_)' }] }; |
| 679 |
this.normalizeRules(); |
| 680 |
}; |
| 681 |
ErlangHighlightRules.metaData = { comment: 'The recognition of function definitions and compiler directives (such as module, record and macro definitions) requires that each of the aforementioned constructs must be the first string inside a line (except for whitespace). Also, the function/module/record/macro names must be given unquoted. -- desp', |
| 682 |
fileTypes: ['erl', 'hrl'], |
| 683 |
keyEquivalent: '^~E', |
| 684 |
name: 'Erlang', |
| 685 |
scopeName: 'source.erlang' }; |
| 686 |
oop.inherits(ErlangHighlightRules, TextHighlightRules); |
| 687 |
exports.ErlangHighlightRules = ErlangHighlightRules; |
| 688 |
|
| 689 |
}); |
| 690 |
|
| 691 |
ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module){"use strict"; |
| 692 |
var oop = require("../../lib/oop"); |
| 693 |
var Range = require("../../range").Range; |
| 694 |
var BaseFoldMode = require("./fold_mode").FoldMode; |
| 695 |
var FoldMode = exports.FoldMode = function (commentRegex) { |
| 696 |
if (commentRegex) { |
| 697 |
this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)); |
| 698 |
this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)); |
| 699 |
} |
| 700 |
}; |
| 701 |
oop.inherits(FoldMode, BaseFoldMode); |
| 702 |
(function () { |
| 703 |
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; |
| 704 |
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; |
| 705 |
this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/; |
| 706 |
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; |
| 707 |
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; |
| 708 |
this._getFoldWidgetBase = this.getFoldWidget; |
| 709 |
this.getFoldWidget = function (session, foldStyle, row) { |
| 710 |
var line = session.getLine(row); |
| 711 |
if (this.singleLineBlockCommentRe.test(line)) { |
| 712 |
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) |
| 713 |
return ""; |
| 714 |
} |
| 715 |
var fw = this._getFoldWidgetBase(session, foldStyle, row); |
| 716 |
if (!fw && this.startRegionRe.test(line)) |
| 717 |
return "start"; |
| 718 |
return fw; |
| 719 |
}; |
| 720 |
this.getFoldWidgetRange = function (session, foldStyle, row, forceMultiline) { |
| 721 |
var line = session.getLine(row); |
| 722 |
if (this.startRegionRe.test(line)) |
| 723 |
return this.getCommentRegionBlock(session, line, row); |
| 724 |
var match = line.match(this.foldingStartMarker); |
| 725 |
if (match) { |
| 726 |
var i = match.index; |
| 727 |
if (match[1]) |
| 728 |
return this.openingBracketBlock(session, match[1], row, i); |
| 729 |
var range = session.getCommentFoldRange(row, i + match[0].length, 1); |
| 730 |
if (range && !range.isMultiLine()) { |
| 731 |
if (forceMultiline) { |
| 732 |
range = this.getSectionRange(session, row); |
| 733 |
} |
| 734 |
else if (foldStyle != "all") |
| 735 |
range = null; |
| 736 |
} |
| 737 |
return range; |
| 738 |
} |
| 739 |
if (foldStyle === "markbegin") |
| 740 |
return; |
| 741 |
var match = line.match(this.foldingStopMarker); |
| 742 |
if (match) { |
| 743 |
var i = match.index + match[0].length; |
| 744 |
if (match[1]) |
| 745 |
return this.closingBracketBlock(session, match[1], row, i); |
| 746 |
return session.getCommentFoldRange(row, i, -1); |
| 747 |
} |
| 748 |
}; |
| 749 |
this.getSectionRange = function (session, row) { |
| 750 |
var line = session.getLine(row); |
| 751 |
var startIndent = line.search(/\S/); |
| 752 |
var startRow = row; |
| 753 |
var startColumn = line.length; |
| 754 |
row = row + 1; |
| 755 |
var endRow = row; |
| 756 |
var maxRow = session.getLength(); |
| 757 |
while (++row < maxRow) { |
| 758 |
line = session.getLine(row); |
| 759 |
var indent = line.search(/\S/); |
| 760 |
if (indent === -1) |
| 761 |
continue; |
| 762 |
if (startIndent > indent) |
| 763 |
break; |
| 764 |
var subRange = this.getFoldWidgetRange(session, "all", row); |
| 765 |
if (subRange) { |
| 766 |
if (subRange.start.row <= startRow) { |
| 767 |
break; |
| 768 |
} |
| 769 |
else if (subRange.isMultiLine()) { |
| 770 |
row = subRange.end.row; |
| 771 |
} |
| 772 |
else if (startIndent == indent) { |
| 773 |
break; |
| 774 |
} |
| 775 |
} |
| 776 |
endRow = row; |
| 777 |
} |
| 778 |
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); |
| 779 |
}; |
| 780 |
this.getCommentRegionBlock = function (session, line, row) { |
| 781 |
var startColumn = line.search(/\s*$/); |
| 782 |
var maxRow = session.getLength(); |
| 783 |
var startRow = row; |
| 784 |
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; |
| 785 |
var depth = 1; |
| 786 |
while (++row < maxRow) { |
| 787 |
line = session.getLine(row); |
| 788 |
var m = re.exec(line); |
| 789 |
if (!m) |
| 790 |
continue; |
| 791 |
if (m[1]) |
| 792 |
depth--; |
| 793 |
else |
| 794 |
depth++; |
| 795 |
if (!depth) |
| 796 |
break; |
| 797 |
} |
| 798 |
var endRow = row; |
| 799 |
if (endRow > startRow) { |
| 800 |
return new Range(startRow, startColumn, endRow, line.length); |
| 801 |
} |
| 802 |
}; |
| 803 |
}).call(FoldMode.prototype); |
| 804 |
|
| 805 |
}); |
| 806 |
|
| 807 |
ace.define("ace/mode/erlang",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/erlang_highlight_rules","ace/mode/folding/cstyle"], function(require, exports, module){ |
| 808 |
|
| 809 |
|
| 810 |
"use strict"; |
| 811 |
var oop = require("../lib/oop"); |
| 812 |
var TextMode = require("./text").Mode; |
| 813 |
var ErlangHighlightRules = require("./erlang_highlight_rules").ErlangHighlightRules; |
| 814 |
var FoldMode = require("./folding/cstyle").FoldMode; |
| 815 |
var Mode = function () { |
| 816 |
this.HighlightRules = ErlangHighlightRules; |
| 817 |
this.foldingRules = new FoldMode(); |
| 818 |
this.$behaviour = this.$defaultBehaviour; |
| 819 |
}; |
| 820 |
oop.inherits(Mode, TextMode); |
| 821 |
(function () { |
| 822 |
this.lineCommentStart = "%"; |
| 823 |
this.blockComment = null; |
| 824 |
this.$id = "ace/mode/erlang"; |
| 825 |
this.snippetFileId = "ace/snippets/erlang"; |
| 826 |
}).call(Mode.prototype); |
| 827 |
exports.Mode = Mode; |
| 828 |
|
| 829 |
}); (function() { |
| 830 |
ace.require(["ace/mode/erlang"], function(m) { |
| 831 |
if (typeof module == "object" && typeof exports == "object" && module) { |
| 832 |
module.exports = m; |
| 833 |
} |
| 834 |
}); |
| 835 |
})(); |
| 836 |
|