Projekt

Obecné

Profil

Stáhnout (12.1 KB) Statistiky
| Větev: | Tag: | Revize:
1
ace.define("ace/mode/mushcode_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
2
"use strict";
3

    
4
var oop = require("../lib/oop");
5
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
6

    
7
var MushCodeRules = function() {
8

    
9

    
10
    var keywords = (
11
 "@if|"+
12
 "@ifelse|"+
13
 "@switch|"+
14
 "@halt|"+
15
 "@dolist|"+
16
 "@create|"+
17
 "@scent|"+
18
 "@sound|"+
19
 "@touch|"+
20
 "@ataste|"+
21
 "@osound|"+
22
 "@ahear|"+
23
 "@aahear|"+
24
 "@amhear|"+
25
 "@otouch|"+
26
 "@otaste|"+
27
 "@drop|"+
28
 "@odrop|"+
29
 "@adrop|"+
30
 "@dropfail|"+
31
 "@odropfail|"+
32
 "@smell|"+
33
 "@oemit|"+
34
 "@emit|"+
35
 "@pemit|"+
36
 "@parent|"+
37
 "@clone|"+
38
 "@taste|"+
39
 "whisper|"+
40
 "page|"+
41
 "say|"+
42
 "pose|"+
43
 "semipose|"+
44
 "teach|"+
45
 "touch|"+
46
 "taste|"+
47
 "smell|"+
48
 "listen|"+
49
 "look|"+
50
 "move|"+
51
 "go|"+
52
 "home|"+
53
 "follow|"+
54
 "unfollow|"+
55
 "desert|"+
56
 "dismiss|"+
57
 "@tel"
58
    );
59

    
60
    var builtinConstants = (
61
        "=#0"
62
    );
63

    
64
    var builtinFunctions = (
65
 "default|"+
66
 "edefault|"+
67
 "eval|"+
68
 "get_eval|"+
69
 "get|"+
70
 "grep|"+
71
 "grepi|"+
72
 "hasattr|"+
73
 "hasattrp|"+
74
 "hasattrval|"+
75
 "hasattrpval|"+
76
 "lattr|"+
77
 "nattr|"+
78
 "poss|"+
79
 "udefault|"+
80
 "ufun|"+
81
 "u|"+
82
 "v|"+
83
 "uldefault|"+
84
 "xget|"+
85
 "zfun|"+
86
 "band|"+
87
 "bnand|"+
88
 "bnot|"+
89
 "bor|"+
90
 "bxor|"+
91
 "shl|"+
92
 "shr|"+
93
 "and|"+
94
 "cand|"+
95
 "cor|"+
96
 "eq|"+
97
 "gt|"+
98
 "gte|"+
99
 "lt|"+
100
 "lte|"+
101
 "nand|"+
102
 "neq|"+
103
 "nor|"+
104
 "not|"+
105
 "or|"+
106
 "t|"+
107
 "xor|"+
108
 "con|"+
109
 "entrances|"+
110
 "exit|"+
111
 "followers|"+
112
 "home|"+
113
 "lcon|"+
114
 "lexits|"+
115
 "loc|"+
116
 "locate|"+
117
 "lparent|"+
118
 "lsearch|"+
119
 "next|"+
120
 "num|"+
121
 "owner|"+
122
 "parent|"+
123
 "pmatch|"+
124
 "rloc|"+
125
 "rnum|"+
126
 "room|"+
127
 "where|"+
128
 "zone|"+
129
 "worn|"+
130
 "held|"+
131
 "carried|"+
132
 "acos|"+
133
 "asin|"+
134
 "atan|"+
135
 "ceil|"+
136
 "cos|"+
137
 "e|"+
138
 "exp|"+
139
 "fdiv|"+
140
 "fmod|"+
141
 "floor|"+
142
 "log|"+
143
 "ln|"+
144
 "pi|"+
145
 "power|"+
146
 "round|"+
147
 "sin|"+
148
 "sqrt|"+
149
 "tan|"+
150
 "aposs|"+
151
 "andflags|"+
152
 "conn|"+
153
 "commandssent|"+
154
 "controls|"+
155
 "doing|"+
156
 "elock|"+
157
 "findable|"+
158
 "flags|"+
159
 "fullname|"+
160
 "hasflag|"+
161
 "haspower|"+
162
 "hastype|"+
163
 "hidden|"+
164
 "idle|"+
165
 "isbaker|"+
166
 "lock|"+
167
 "lstats|"+
168
 "money|"+
169
 "who|"+
170
 "name|"+
171
 "nearby|"+
172
 "obj|"+
173
 "objflags|"+
174
 "photo|"+
175
 "poll|"+
176
 "powers|"+
177
 "pendingtext|"+
178
 "receivedtext|"+
179
 "restarts|"+
180
 "restarttime|"+
181
 "subj|"+
182
 "shortestpath|"+
183
 "tmoney|"+
184
 "type|"+
185
 "visible|"+
186
 "cat|"+
187
 "element|"+
188
 "elements|"+
189
 "extract|"+
190
 "filter|"+
191
 "filterbool|"+
192
 "first|"+
193
 "foreach|"+
194
 "fold|"+
195
 "grab|"+
196
 "graball|"+
197
 "index|"+
198
 "insert|"+
199
 "itemize|"+
200
 "items|"+
201
 "iter|"+
202
 "last|"+
203
 "ldelete|"+
204
 "map|"+
205
 "match|"+
206
 "matchall|"+
207
 "member|"+
208
 "mix|"+
209
 "munge|"+
210
 "pick|"+
211
 "remove|"+
212
 "replace|"+
213
 "rest|"+
214
 "revwords|"+
215
 "setdiff|"+
216
 "setinter|"+
217
 "setunion|"+
218
 "shuffle|"+
219
 "sort|"+
220
 "sortby|"+
221
 "splice|"+
222
 "step|"+
223
 "wordpos|"+
224
 "words|"+
225
 "add|"+
226
 "lmath|"+
227
 "max|"+
228
 "mean|"+
229
 "median|"+
230
 "min|"+
231
 "mul|"+
232
 "percent|"+
233
 "sign|"+
234
 "stddev|"+
235
 "sub|"+
236
 "val|"+
237
 "bound|"+
238
 "abs|"+
239
 "inc|"+
240
 "dec|"+
241
 "dist2d|"+
242
 "dist3d|"+
243
 "div|"+
244
 "floordiv|"+
245
 "mod|"+
246
 "modulo|"+
247
 "remainder|"+
248
 "vadd|"+
249
 "vdim|"+
250
 "vdot|"+
251
 "vmag|"+
252
 "vmax|"+
253
 "vmin|"+
254
 "vmul|"+
255
 "vsub|"+
256
 "vunit|"+
257
 "regedit|"+
258
 "regeditall|"+
259
 "regeditalli|"+
260
 "regediti|"+
261
 "regmatch|"+
262
 "regmatchi|"+
263
 "regrab|"+
264
 "regraball|"+
265
 "regraballi|"+
266
 "regrabi|"+
267
 "regrep|"+
268
 "regrepi|"+
269
 "after|"+
270
 "alphamin|"+
271
 "alphamax|"+
272
 "art|"+
273
 "before|"+
274
 "brackets|"+
275
 "capstr|"+
276
 "case|"+
277
 "caseall|"+
278
 "center|"+
279
 "containsfansi|"+
280
 "comp|"+
281
 "decompose|"+
282
 "decrypt|"+
283
 "delete|"+
284
 "edit|"+
285
 "encrypt|"+
286
 "escape|"+
287
 "if|"+
288
 "ifelse|"+
289
 "lcstr|"+
290
 "left|"+
291
 "lit|"+
292
 "ljust|"+
293
 "merge|"+
294
 "mid|"+
295
 "ostrlen|"+
296
 "pos|"+
297
 "repeat|"+
298
 "reverse|"+
299
 "right|"+
300
 "rjust|"+
301
 "scramble|"+
302
 "secure|"+
303
 "space|"+
304
 "spellnum|"+
305
 "squish|"+
306
 "strcat|"+
307
 "strmatch|"+
308
 "strinsert|"+
309
 "stripansi|"+
310
 "stripfansi|"+
311
 "strlen|"+
312
 "switch|"+
313
 "switchall|"+
314
 "table|"+
315
 "tr|"+
316
 "trim|"+
317
 "ucstr|"+
318
 "unsafe|"+
319
 "wrap|"+
320
 "ctitle|"+
321
 "cwho|"+
322
 "channels|"+
323
 "clock|"+
324
 "cflags|"+
325
 "ilev|"+
326
 "itext|"+
327
 "inum|"+
328
 "convsecs|"+
329
 "convutcsecs|"+
330
 "convtime|"+
331
 "ctime|"+
332
 "etimefmt|"+
333
 "isdaylight|"+
334
 "mtime|"+
335
 "secs|"+
336
 "msecs|"+
337
 "starttime|"+
338
 "time|"+
339
 "timefmt|"+
340
 "timestring|"+
341
 "utctime|"+
342
 "atrlock|"+
343
 "clone|"+
344
 "create|"+
345
 "cook|"+
346
 "dig|"+
347
 "emit|"+
348
 "lemit|"+
349
 "link|"+
350
 "oemit|"+
351
 "open|"+
352
 "pemit|"+
353
 "remit|"+
354
 "set|"+
355
 "tel|"+
356
 "wipe|"+
357
 "zemit|"+
358
 "fbcreate|"+
359
 "fbdestroy|"+
360
 "fbwrite|"+
361
 "fbclear|"+
362
 "fbcopy|"+
363
 "fbcopyto|"+
364
 "fbclip|"+
365
 "fbdump|"+
366
 "fbflush|"+
367
 "fbhset|"+
368
 "fblist|"+
369
 "fbstats|"+
370
 "qentries|"+
371
 "qentry|"+
372
 "play|"+
373
 "ansi|"+
374
 "break|"+
375
 "c|"+
376
 "asc|"+
377
 "die|"+
378
 "isdbref|"+
379
 "isint|"+
380
 "isnum|"+
381
 "isletters|"+
382
 "linecoords|"+
383
 "localize|"+
384
 "lnum|"+
385
 "nameshort|"+
386
 "null|"+
387
 "objeval|"+
388
 "r|"+
389
 "rand|"+
390
 "s|"+
391
 "setq|"+
392
 "setr|"+
393
 "soundex|"+
394
 "soundslike|"+
395
 "valid|"+
396
 "vchart|"+
397
 "vchart2|"+
398
 "vlabel|"+
399
 "@@|"+
400
 "bakerdays|"+
401
 "bodybuild|"+
402
 "box|"+
403
 "capall|"+
404
 "catalog|"+
405
 "children|"+
406
 "ctrailer|"+
407
 "darttime|"+
408
 "debt|"+
409
 "detailbar|"+
410
 "exploredroom|"+
411
 "fansitoansi|"+
412
 "fansitoxansi|"+
413
 "fullbar|"+
414
 "halfbar|"+
415
 "isdarted|"+
416
 "isnewbie|"+
417
 "isword|"+
418
 "lambda|"+
419
 "lobjects|"+
420
 "lplayers|"+
421
 "lthings|"+
422
 "lvexits|"+
423
 "lvobjects|"+
424
 "lvplayers|"+
425
 "lvthings|"+
426
 "newswrap|"+
427
 "numsuffix|"+
428
 "playerson|"+
429
 "playersthisweek|"+
430
 "randomad|"+
431
 "randword|"+
432
 "realrandword|"+
433
 "replacechr|"+
434
 "second|"+
435
 "splitamount|"+
436
 "strlenall|"+
437
 "text|"+
438
 "third|"+
439
 "tofansi|"+
440
 "totalac|"+
441
 "unique|"+
442
 "getaddressroom|"+
443
 "listpropertycomm|"+
444
 "listpropertyres|"+
445
 "lotowner|"+
446
 "lotrating|"+
447
 "lotratingcount|"+
448
 "lotvalue|"+
449
 "boughtproduct|"+
450
 "companyabb|"+
451
 "companyicon|"+
452
 "companylist|"+
453
 "companyname|"+
454
 "companyowners|"+
455
 "companyvalue|"+
456
 "employees|"+
457
 "invested|"+
458
 "productlist|"+
459
 "productname|"+
460
 "productowners|"+
461
 "productrating|"+
462
 "productratingcount|"+
463
 "productsoldat|"+
464
 "producttype|"+
465
 "ratedproduct|"+
466
 "soldproduct|"+
467
 "topproducts|"+
468
 "totalspentonproduct|"+
469
 "totalstock|"+
470
 "transfermoney|"+
471
 "uniquebuyercount|"+
472
 "uniqueproductsbought|"+
473
 "validcompany|"+
474
 "deletepicture|"+
475
 "fbsave|"+
476
 "getpicturesecurity|"+
477
 "haspicture|"+
478
 "listpictures|"+
479
 "picturesize|"+
480
 "replacecolor|"+
481
 "rgbtocolor|"+
482
 "savepicture|"+
483
 "setpicturesecurity|"+
484
 "showpicture|"+
485
 "piechart|"+
486
 "piechartlabel|"+
487
 "createmaze|"+
488
 "drawmaze|"+
489
 "drawwireframe"
490
    );
491
    var keywordMapper = this.createKeywordMapper({
492
        "invalid.deprecated": "debugger",
493
        "support.function": builtinFunctions,
494
        "constant.language": builtinConstants,
495
        "keyword": keywords
496
    }, "identifier");
497

    
498
    var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
499

    
500
    var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
501
    var octInteger = "(?:0[oO]?[0-7]+)";
502
    var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
503
    var binInteger = "(?:0[bB][01]+)";
504
    var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
505

    
506
    var exponent = "(?:[eE][+-]?\\d+)";
507
    var fraction = "(?:\\.\\d+)";
508
    var intPart = "(?:\\d+)";
509
    var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
510
    var exponentFloat = "(?:(?:" + pointFloat + "|" +  intPart + ")" + exponent + ")";
511
    var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
512

    
513
    this.$rules = {
514
        "start" : [
515
         {
516
                token : "variable", // mush substitution register
517
                regex : "%[0-9]{1}"
518
         },
519
         {
520
                token : "variable", // mush substitution register
521
                regex : "%q[0-9A-Za-z]{1}"
522
         },
523
         {
524
                token : "variable", // mush special character register
525
                regex : "%[a-zA-Z]{1}"
526
         },
527
         {
528
                token: "variable.language",
529
                regex: "%[a-z0-9-_]+"
530
         },
531
        {
532
            token : "constant.numeric", // imaginary
533
            regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
534
        }, {
535
            token : "constant.numeric", // float
536
            regex : floatNumber
537
        }, {
538
            token : "constant.numeric", // long integer
539
            regex : integer + "[lL]\\b"
540
        }, {
541
            token : "constant.numeric", // integer
542
            regex : integer + "\\b"
543
        }, {
544
            token : keywordMapper,
545
            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
546
        }, {
547
            token : "keyword.operator",
548
            regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|#|%|<<|>>|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
549
        }, {
550
            token : "paren.lparen",
551
            regex : "[\\[\\(\\{]"
552
        }, {
553
            token : "paren.rparen",
554
            regex : "[\\]\\)\\}]"
555
        }, {
556
            token : "text",
557
            regex : "\\s+"
558
        } ]
559
    };
560
};
561

    
562
oop.inherits(MushCodeRules, TextHighlightRules);
563

    
564
exports.MushCodeRules = MushCodeRules;
565
});
566

    
567
ace.define("ace/mode/folding/pythonic",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
568
"use strict";
569

    
570
var oop = require("../../lib/oop");
571
var BaseFoldMode = require("./fold_mode").FoldMode;
572

    
573
var FoldMode = exports.FoldMode = function(markers) {
574
    this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + markers + ")(?:\\s*)(?:#.*)?$");
575
};
576
oop.inherits(FoldMode, BaseFoldMode);
577

    
578
(function() {
579

    
580
    this.getFoldWidgetRange = function(session, foldStyle, row) {
581
        var line = session.getLine(row);
582
        var match = line.match(this.foldingStartMarker);
583
        if (match) {
584
            if (match[1])
585
                return this.openingBracketBlock(session, match[1], row, match.index);
586
            if (match[2])
587
                return this.indentationBlock(session, row, match.index + match[2].length);
588
            return this.indentationBlock(session, row);
589
        }
590
    };
591

    
592
}).call(FoldMode.prototype);
593

    
594
});
595

    
596
ace.define("ace/mode/mushcode",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mushcode_highlight_rules","ace/mode/folding/pythonic","ace/range"], function(require, exports, module) {
597
"use strict";
598

    
599
var oop = require("../lib/oop");
600
var TextMode = require("./text").Mode;
601
var MushCodeRules = require("./mushcode_highlight_rules").MushCodeRules;
602
var PythonFoldMode = require("./folding/pythonic").FoldMode;
603
var Range = require("../range").Range;
604

    
605
var Mode = function() {
606
    this.HighlightRules = MushCodeRules;
607
    this.foldingRules = new PythonFoldMode("\\:");
608
    this.$behaviour = this.$defaultBehaviour;
609
};
610
oop.inherits(Mode, TextMode);
611

    
612
(function() {
613

    
614

    
615
    this.getNextLineIndent = function(state, line, tab) {
616
        var indent = this.$getIndent(line);
617

    
618
        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
619
        var tokens = tokenizedLine.tokens;
620

    
621
        if (tokens.length && tokens[tokens.length-1].type == "comment") {
622
            return indent;
623
        }
624

    
625
        if (state == "start") {
626
            var match = line.match(/^.*[\{\(\[:]\s*$/);
627
            if (match) {
628
                indent += tab;
629
            }
630
        }
631

    
632
        return indent;
633
    };
634

    
635
   var outdents = {
636
        "pass": 1,
637
        "return": 1,
638
        "raise": 1,
639
        "break": 1,
640
        "continue": 1
641
    };
642

    
643
    this.checkOutdent = function(state, line, input) {
644
        if (input !== "\r\n" && input !== "\r" && input !== "\n")
645
            return false;
646

    
647
        var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
648

    
649
        if (!tokens)
650
            return false;
651
        do {
652
            var last = tokens.pop();
653
        } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
654

    
655
        if (!last)
656
            return false;
657

    
658
        return (last.type == "keyword" && outdents[last.value]);
659
    };
660

    
661
    this.autoOutdent = function(state, doc, row) {
662

    
663
        row += 1;
664
        var indent = this.$getIndent(doc.getLine(row));
665
        var tab = doc.getTabString();
666
        if (indent.slice(-tab.length) == tab)
667
            doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
668
    };
669

    
670
    this.$id = "ace/mode/mushcode";
671
}).call(Mode.prototype);
672

    
673
exports.Mode = Mode;
674
});                (function() {
675
                    ace.require(["ace/mode/mushcode"], function(m) {
676
                        if (typeof module == "object" && typeof exports == "object" && module) {
677
                            module.exports = m;
678
                        }
679
                    });
680
                })();
681
            
(124-124/244)