1
 
define('ace/mode/livescript', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/matching_brace_outdent', 'ace/range', 'ace/mode/text'], function(require, exports, module) {
 
2
 
  var identifier, LiveScriptMode, keywordend, stringfill;
 
3
 
  identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*';
 
4
 
  exports.Mode = LiveScriptMode = (function(superclass){
 
5
 
    var indenter, prototype = extend$((import$(LiveScriptMode, superclass).displayName = 'LiveScriptMode', LiveScriptMode), superclass).prototype, constructor = LiveScriptMode;
 
6
 
    function LiveScriptMode(){
 
8
 
      this.$tokenizer = new (require('ace/tokenizer')).Tokenizer(LiveScriptMode.Rules);
 
9
 
      if (that = require('ace/mode/matching_brace_outdent')) {
 
10
 
        this.$outdent = new that.MatchingBraceOutdent;
 
13
 
    indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$');
 
14
 
    prototype.getNextLineIndent = function(state, line, tab){
 
16
 
      indent = this.$getIndent(line);
 
17
 
      tokens = this.$tokenizer.getLineTokens(line, state).tokens;
 
18
 
      if (!(tokens.length && tokens[tokens.length - 1].type === 'comment')) {
 
19
 
        if (state === 'start' && indenter.test(line)) {
 
25
 
    prototype.toggleCommentLines = function(state, doc, startRow, endRow){
 
26
 
      var comment, range, i$, i, out, line;
 
28
 
      range = new (require('ace/range')).Range(0, 0, 0, 0);
 
29
 
      for (i$ = startRow; i$ <= endRow; ++i$) {
 
31
 
        if (out = comment.test(line = doc.getLine(i))) {
 
32
 
          line = line.replace(comment, '$1');
 
34
 
          line = line.replace(/^\s*/, '$&#');
 
36
 
        range.end.row = range.start.row = i;
 
37
 
        range.end.column = line.length + 1;
 
38
 
        doc.replace(range, line);
 
42
 
    prototype.checkOutdent = function(state, line, input){
 
44
 
      return (ref$ = this.$outdent) != null ? ref$.checkOutdent(line, input) : void 8;
 
46
 
    prototype.autoOutdent = function(state, doc, row){
 
48
 
      return (ref$ = this.$outdent) != null ? ref$.autoOutdent(doc, row) : void 8;
 
50
 
    return LiveScriptMode;
 
51
 
  }(require('ace/mode/text').Mode));
 
52
 
  keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
 
57
 
  LiveScriptMode.Rules = {
 
61
 
        regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)' + keywordend
 
63
 
        token: 'constant.language',
 
64
 
        regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend
 
66
 
        token: 'invalid.illegal',
 
67
 
        regex: '(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)' + keywordend
 
69
 
        token: 'language.support.class',
 
70
 
        regex: '(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)' + keywordend
 
72
 
        token: 'language.support.function',
 
73
 
        regex: '(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)' + keywordend
 
75
 
        token: 'variable.language',
 
76
 
        regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend
 
79
 
        regex: identifier + '\\s*:(?![:=])'
 
84
 
        token: 'keyword.operator',
 
85
 
        regex: '(?:\\.{3}|\\s+\\?)'
 
87
 
        token: 'keyword.variable',
 
88
 
        regex: '(?:@+|::|\\.\\.)',
 
91
 
        token: 'keyword.operator',
 
96
 
        regex: '\\\\\\S[^\\s,;)}\\]]*'
 
122
 
        token: 'string.regex',
 
126
 
        token: 'comment.doc',
 
133
 
        token: 'string.regex',
 
134
 
        regex: '\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}',
 
137
 
        token: 'constant.numeric',
 
138
 
        regex: '(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)'
 
147
 
        token: 'keyword.operator',
 
156
 
        token: 'string.regex',
 
157
 
        regex: '.*?//[gimy$?]{0,4}',
 
160
 
        token: 'string.regex',
 
163
 
        token: 'comment.regex',
 
164
 
        regex: '\\s+(?:#.*)?'
 
166
 
        token: 'string.regex',
 
172
 
        token: 'keyword.operator',
 
186
 
        token: 'comment.doc',
 
190
 
        token: 'comment.doc',
 
211
 
        regex: '[^\\\\\']*(?:\\\\.[^\\\\\']*)*\'',
 
218
 
        regex: '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
 
225
 
        regex: '[^\\\\`]*(?:\\\\.[^\\\\`]*)*`',
 
237
 
function extend$(sub, sup){
 
238
 
  function fun(){} fun.prototype = (sub.superclass = sup).prototype;
 
239
 
  (sub.prototype = new fun).constructor = sub;
 
240
 
  if (typeof sup.extended == 'function') sup.extended(sub);
 
243
 
function import$(obj, src){
 
244
 
  var own = {}.hasOwnProperty;
 
245
 
  for (var key in src) if (own.call(src, key)) obj[key] = src[key];
 
250
 
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
 
253
 
var Range = require("../range").Range;
 
255
 
var MatchingBraceOutdent = function() {};
 
259
 
    this.checkOutdent = function(line, input) {
 
260
 
        if (! /^\s+$/.test(line))
 
263
 
        return /^\s*\}/.test(input);
 
266
 
    this.autoOutdent = function(doc, row) {
 
267
 
        var line = doc.getLine(row);
 
268
 
        var match = line.match(/^(\s*\})/);
 
270
 
        if (!match) return 0;
 
272
 
        var column = match[1].length;
 
273
 
        var openBracePos = doc.findMatchingBracket({row: row, column: column});
 
275
 
        if (!openBracePos || openBracePos.row == row) return 0;
 
277
 
        var indent = this.$getIndent(doc.getLine(openBracePos.row));
 
278
 
        doc.replace(new Range(row, 0, row, column-1), indent);
 
281
 
    this.$getIndent = function(line) {
 
282
 
        return line.match(/^\s*/)[0];
 
285
 
}).call(MatchingBraceOutdent.prototype);
 
287
 
exports.MatchingBraceOutdent = MatchingBraceOutdent;