1
|
ace.define("ace/mode/ada_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 AdaHighlightRules = function() {
|
8
|
var keywords = "abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|" +
|
9
|
"access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|" +
|
10
|
"array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|" +
|
11
|
"body|private|then|if|procedure|type|case|in|protected|constant|interface|until|" +
|
12
|
"|is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor";
|
13
|
|
14
|
var builtinConstants = (
|
15
|
"true|false|null"
|
16
|
);
|
17
|
|
18
|
var builtinFunctions = (
|
19
|
"count|min|max|avg|sum|rank|now|coalesce|main"
|
20
|
);
|
21
|
|
22
|
var keywordMapper = this.createKeywordMapper({
|
23
|
"support.function": builtinFunctions,
|
24
|
"keyword": keywords,
|
25
|
"constant.language": builtinConstants
|
26
|
}, "identifier", true);
|
27
|
|
28
|
this.$rules = {
|
29
|
"start" : [ {
|
30
|
token : "comment",
|
31
|
regex : "--.*$"
|
32
|
}, {
|
33
|
token : "string", // " string
|
34
|
regex : '".*?"'
|
35
|
}, {
|
36
|
token : "string", // character
|
37
|
regex : "'.'"
|
38
|
}, {
|
39
|
token : "constant.numeric", // float
|
40
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
41
|
}, {
|
42
|
token : keywordMapper,
|
43
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
44
|
}, {
|
45
|
token : "keyword.operator",
|
46
|
regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
|
47
|
}, {
|
48
|
token : "paren.lparen",
|
49
|
regex : "[\\(]"
|
50
|
}, {
|
51
|
token : "paren.rparen",
|
52
|
regex : "[\\)]"
|
53
|
}, {
|
54
|
token : "text",
|
55
|
regex : "\\s+"
|
56
|
} ]
|
57
|
};
|
58
|
};
|
59
|
|
60
|
oop.inherits(AdaHighlightRules, TextHighlightRules);
|
61
|
|
62
|
exports.AdaHighlightRules = AdaHighlightRules;
|
63
|
});
|
64
|
|
65
|
ace.define("ace/mode/ada",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/ada_highlight_rules","ace/range"], function(require, exports, module) {
|
66
|
"use strict";
|
67
|
|
68
|
var oop = require("../lib/oop");
|
69
|
var TextMode = require("./text").Mode;
|
70
|
var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules;
|
71
|
var Range = require("../range").Range;
|
72
|
|
73
|
var Mode = function() {
|
74
|
this.HighlightRules = AdaHighlightRules;
|
75
|
this.$behaviour = this.$defaultBehaviour;
|
76
|
};
|
77
|
oop.inherits(Mode, TextMode);
|
78
|
|
79
|
(function() {
|
80
|
|
81
|
this.lineCommentStart = "--";
|
82
|
|
83
|
this.getNextLineIndent = function(state, line, tab) {
|
84
|
var indent = this.$getIndent(line);
|
85
|
|
86
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
87
|
var tokens = tokenizedLine.tokens;
|
88
|
|
89
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
90
|
return indent;
|
91
|
}
|
92
|
if (state == "start") {
|
93
|
var match = line.match(/^.*(begin|loop|then|is|do)\s*$/);
|
94
|
if (match) {
|
95
|
indent += tab;
|
96
|
}
|
97
|
}
|
98
|
|
99
|
return indent;
|
100
|
};
|
101
|
|
102
|
this.checkOutdent = function(state, line, input) {
|
103
|
var complete_line = line + input;
|
104
|
if (complete_line.match(/^\s*(begin|end)$/)) {
|
105
|
return true;
|
106
|
}
|
107
|
|
108
|
return false;
|
109
|
};
|
110
|
|
111
|
this.autoOutdent = function(state, session, row) {
|
112
|
|
113
|
var line = session.getLine(row);
|
114
|
var prevLine = session.getLine(row - 1);
|
115
|
var prevIndent = this.$getIndent(prevLine).length;
|
116
|
var indent = this.$getIndent(line).length;
|
117
|
if (indent <= prevIndent) {
|
118
|
return;
|
119
|
}
|
120
|
|
121
|
session.outdentRows(new Range(row, 0, row + 2, 0));
|
122
|
};
|
123
|
|
124
|
|
125
|
this.$id = "ace/mode/ada";
|
126
|
}).call(Mode.prototype);
|
127
|
|
128
|
exports.Mode = Mode;
|
129
|
|
130
|
}); (function() {
|
131
|
ace.require(["ace/mode/ada"], function(m) {
|
132
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
133
|
module.exports = m;
|
134
|
}
|
135
|
});
|
136
|
})();
|
137
|
|