/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codeigniter/js/ace/mode-scheme.js

  • Committer: Henrik G.
  • Date: 2013-03-26 23:22:55 UTC
  • Revision ID: henrik.gustavsson@his.se-20130326232255-ik6snyatlbkf3zs1
First seed of Lenasys ... Needs to be Organized Further

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ***** BEGIN LICENSE BLOCK *****
2
 
 * Distributed under the BSD license:
3
 
 *
4
 
 * Copyright (c) 2012, Ajax.org B.V.
5
 
 * All rights reserved.
6
 
 * 
7
 
 * Redistribution and use in source and binary forms, with or without
8
 
 * modification, are permitted provided that the following conditions are met:
9
 
 *     * Redistributions of source code must retain the above copyright
10
 
 *       notice, this list of conditions and the following disclaimer.
11
 
 *     * Redistributions in binary form must reproduce the above copyright
12
 
 *       notice, this list of conditions and the following disclaimer in the
13
 
 *       documentation and/or other materials provided with the distribution.
14
 
 *     * Neither the name of Ajax.org B.V. nor the
15
 
 *       names of its contributors may be used to endorse or promote products
16
 
 *       derived from this software without specific prior written permission.
17
 
 * 
18
 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
 
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
 
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
 
 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
 
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
 
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
 
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
 
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
 
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
 
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 
 *
29
 
 *
30
 
 * Contributor(s):
31
 
 * 
32
 
 * NalaGinrut@gmail.com
33
 
 *
34
 
 * ***** END LICENSE BLOCK ***** */
35
 
 
36
 
define('ace/mode/scheme', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/scheme_highlight_rules'], function(require, exports, module) {
37
 
 
38
 
 
39
 
var oop = require("../lib/oop");
40
 
var TextMode = require("./text").Mode;
41
 
var Tokenizer = require("../tokenizer").Tokenizer;
42
 
var SchemeHighlightRules = require("./scheme_highlight_rules").SchemeHighlightRules;
43
 
 
44
 
var Mode = function() {
45
 
    var highlighter = new SchemeHighlightRules();
46
 
    
47
 
    this.$tokenizer = new Tokenizer(highlighter.getRules());
48
 
};
49
 
oop.inherits(Mode, TextMode);
50
 
 
51
 
(function() {
52
 
       
53
 
    this.lineCommentStart = ";";
54
 
    
55
 
}).call(Mode.prototype);
56
 
 
57
 
exports.Mode = Mode;
58
 
});
59
 
 
60
 
define('ace/mode/scheme_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
61
 
 
62
 
 
63
 
var oop = require("../lib/oop");
64
 
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
65
 
 
66
 
var SchemeHighlightRules = function() {
67
 
    var keywordControl = "case|do|let|loop|if|else|when";
68
 
    var keywordOperator = "eq?|eqv?|equal?|and|or|not|null?";
69
 
    var constantLanguage = "#t|#f";
70
 
    var supportFunctions = "cons|car|cdr|cond|lambda|lambda*|syntax-rules|format|set!|quote|eval|append|list|list?|member?|load";
71
 
 
72
 
    var keywordMapper = this.createKeywordMapper({
73
 
        "keyword.control": keywordControl,
74
 
        "keyword.operator": keywordOperator,
75
 
        "constant.language": constantLanguage,
76
 
        "support.function": supportFunctions
77
 
    }, "identifier", true);
78
 
 
79
 
    this.$rules = 
80
 
        {
81
 
    "start": [
82
 
        {
83
 
            token : "comment",
84
 
            regex : ";.*$"
85
 
        },
86
 
        {
87
 
            "token": ["storage.type.function-type.scheme", "text", "entity.name.function.scheme"],
88
 
            "regex": "(?:\\b(?:(define|define-syntax|define-macro))\\b)(\\s+)((?:\\w|\\-|\\!|\\?)*)"
89
 
        },
90
 
        {
91
 
            "token": "punctuation.definition.constant.character.scheme",
92
 
            "regex": "#:\\S+"
93
 
        },
94
 
        {
95
 
            "token": ["punctuation.definition.variable.scheme", "variable.other.global.scheme", "punctuation.definition.variable.scheme"],
96
 
            "regex": "(\\*)(\\S*)(\\*)"
97
 
        },
98
 
        {
99
 
            "token" : "constant.numeric", // hex
100
 
            "regex" : "#[xXoObB][0-9a-fA-F]+"
101
 
        }, 
102
 
        {
103
 
            "token" : "constant.numeric", // float
104
 
            "regex" : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?"
105
 
        },
106
 
        {
107
 
                "token" : keywordMapper,
108
 
                "regex" : "[a-zA-Z_#][a-zA-Z0-9_\\-\\?\\!\\*]*"
109
 
        },
110
 
        {
111
 
            "token" : "string",
112
 
            "regex" : '"(?=.)',
113
 
            "next"  : "qqstring"
114
 
        }
115
 
    ],
116
 
    "qqstring": [
117
 
        {
118
 
            "token": "constant.character.escape.scheme",
119
 
            "regex": "\\\\."
120
 
        },
121
 
        {
122
 
            "token" : "string",
123
 
            "regex" : '[^"\\\\]+',
124
 
            "merge" : true
125
 
        }, {
126
 
            "token" : "string",
127
 
            "regex" : "\\\\$",
128
 
            "next"  : "qqstring",
129
 
            "merge" : true
130
 
        }, {
131
 
            "token" : "string",
132
 
            "regex" : '"|$',
133
 
            "next"  : "start",
134
 
            "merge" : true
135
 
        }
136
 
    ]
137
 
}
138
 
 
139
 
};
140
 
 
141
 
oop.inherits(SchemeHighlightRules, TextHighlightRules);
142
 
 
143
 
exports.SchemeHighlightRules = SchemeHighlightRules;
144
 
});