123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
- "use strict";
- var Range = require("../range").Range;
- var MatchingBraceOutdent = function() {};
- (function() {
- this.checkOutdent = function(line, input) {
- if (! /^\s+$/.test(line))
- return false;
- return /^\s*\}/.test(input);
- };
- this.autoOutdent = function(doc, row) {
- var line = doc.getLine(row);
- var match = line.match(/^(\s*\})/);
- if (!match) return 0;
- var column = match[1].length;
- var openBracePos = doc.findMatchingBracket({row: row, column: column});
- if (!openBracePos || openBracePos.row == row) return 0;
- var indent = this.$getIndent(doc.getLine(openBracePos.row));
- doc.replace(new Range(row, 0, row, column-1), indent);
- };
- this.$getIndent = function(line) {
- return line.match(/^\s*/)[0];
- };
- }).call(MatchingBraceOutdent.prototype);
- exports.MatchingBraceOutdent = MatchingBraceOutdent;
- });
- ace.define("ace/mode/livescript",["require","exports","module","ace/tokenizer","ace/mode/matching_brace_outdent","ace/mode/text"], function(require, exports, module){
- var identifier, LiveScriptMode, keywordend, stringfill;
- identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*';
- exports.Mode = LiveScriptMode = (function(superclass){
- var indenter, prototype = extend$((import$(LiveScriptMode, superclass).displayName = 'LiveScriptMode', LiveScriptMode), superclass).prototype, constructor = LiveScriptMode;
- function LiveScriptMode(){
- var that;
- this.$tokenizer = new (require('../tokenizer')).Tokenizer(LiveScriptMode.Rules);
- if (that = require('../mode/matching_brace_outdent')) {
- this.$outdent = new that.MatchingBraceOutdent;
- }
- this.$id = "ace/mode/livescript";
- }
- indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$');
- prototype.getNextLineIndent = function(state, line, tab){
- var indent, tokens;
- indent = this.$getIndent(line);
- tokens = this.$tokenizer.getLineTokens(line, state).tokens;
- if (!(tokens.length && tokens[tokens.length - 1].type === 'comment')) {
- if (state === 'start' && indenter.test(line)) {
- indent += tab;
- }
- }
- return indent;
- };
- prototype.lineCommentStart = "#";
- prototype.blockComment = {start: "###", end: "###"};
- prototype.checkOutdent = function(state, line, input){
- var ref$;
- return (ref$ = this.$outdent) != null ? ref$.checkOutdent(line, input) : void 8;
- };
- prototype.autoOutdent = function(state, doc, row){
- var ref$;
- return (ref$ = this.$outdent) != null ? ref$.autoOutdent(doc, row) : void 8;
- };
- return LiveScriptMode;
- }(require('../mode/text').Mode));
- keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
- stringfill = {
- defaultToken: 'string'
- };
- LiveScriptMode.Rules = {
- start: [
- {
- token: 'keyword',
- 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
- }, {
- token: 'constant.language',
- regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend
- }, {
- token: 'invalid.illegal',
- regex: '(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)' + keywordend
- }, {
- token: 'language.support.class',
- regex: '(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)' + keywordend
- }, {
- token: 'language.support.function',
- regex: '(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)' + keywordend
- }, {
- token: 'variable.language',
- regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend
- }, {
- token: 'identifier',
- regex: identifier + '\\s*:(?![:=])'
- }, {
- token: 'variable',
- regex: identifier
- }, {
- token: 'keyword.operator',
- regex: '(?:\\.{3}|\\s+\\?)'
- }, {
- token: 'keyword.variable',
- regex: '(?:@+|::|\\.\\.)',
- next: 'key'
- }, {
- token: 'keyword.operator',
- regex: '\\.\\s*',
- next: 'key'
- }, {
- token: 'string',
- regex: '\\\\\\S[^\\s,;)}\\]]*'
- }, {
- token: 'string.doc',
- regex: '\'\'\'',
- next: 'qdoc'
- }, {
- token: 'string.doc',
- regex: '"""',
- next: 'qqdoc'
- }, {
- token: 'string',
- regex: '\'',
- next: 'qstring'
- }, {
- token: 'string',
- regex: '"',
- next: 'qqstring'
- }, {
- token: 'string',
- regex: '`',
- next: 'js'
- }, {
- token: 'string',
- regex: '<\\[',
- next: 'words'
- }, {
- token: 'string.regex',
- regex: '//',
- next: 'heregex'
- }, {
- token: 'comment.doc',
- regex: '/\\*',
- next: 'comment'
- }, {
- token: 'comment',
- regex: '#.*'
- }, {
- token: 'string.regex',
- regex: '\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}',
- next: 'key'
- }, {
- token: 'constant.numeric',
- 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$]*)'
- }, {
- token: 'lparen',
- regex: '[({[]'
- }, {
- token: 'rparen',
- regex: '[)}\\]]',
- next: 'key'
- }, {
- token: 'keyword.operator',
- regex: '[\\^!|&%+\\-]+'
- }, {
- token: 'text',
- regex: '\\s+'
- }
- ],
- heregex: [
- {
- token: 'string.regex',
- regex: '.*?//[gimy$?]{0,4}',
- next: 'start'
- }, {
- token: 'string.regex',
- regex: '\\s*#{'
- }, {
- token: 'comment.regex',
- regex: '\\s+(?:#.*)?'
- }, {
- defaultToken: 'string.regex'
- }
- ],
- key: [
- {
- token: 'keyword.operator',
- regex: '[.?@!]+'
- }, {
- token: 'identifier',
- regex: identifier,
- next: 'start'
- }, {
- token: 'text',
- regex: '',
- next: 'start'
- }
- ],
- comment: [
- {
- token: 'comment.doc',
- regex: '.*?\\*/',
- next: 'start'
- }, {
- defaultToken: 'comment.doc'
- }
- ],
- qdoc: [
- {
- token: 'string',
- regex: ".*?'''",
- next: 'key'
- }, stringfill
- ],
- qqdoc: [
- {
- token: 'string',
- regex: '.*?"""',
- next: 'key'
- }, stringfill
- ],
- qstring: [
- {
- token: 'string',
- regex: '[^\\\\\']*(?:\\\\.[^\\\\\']*)*\'',
- next: 'key'
- }, stringfill
- ],
- qqstring: [
- {
- token: 'string',
- regex: '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
- next: 'key'
- }, stringfill
- ],
- js: [
- {
- token: 'string',
- regex: '[^\\\\`]*(?:\\\\.[^\\\\`]*)*`',
- next: 'key'
- }, stringfill
- ],
- words: [
- {
- token: 'string',
- regex: '.*?\\]>',
- next: 'key'
- }, stringfill
- ]
- };
- function extend$(sub, sup){
- function fun(){} fun.prototype = (sub.superclass = sup).prototype;
- (sub.prototype = new fun).constructor = sub;
- if (typeof sup.extended == 'function') sup.extended(sub);
- return sub;
- }
- function import$(obj, src){
- var own = {}.hasOwnProperty;
- for (var key in src) if (own.call(src, key)) obj[key] = src[key];
- return obj;
- }
- });
|