1
|
ace.define("ace/mode/doc_comment_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 DocCommentHighlightRules = function() {
|
8
|
this.$rules = {
|
9
|
"start" : [ {
|
10
|
token : "comment.doc.tag",
|
11
|
regex : "@[\\w\\d_]+" // TODO: fix email addresses
|
12
|
},
|
13
|
DocCommentHighlightRules.getTagRule(),
|
14
|
{
|
15
|
defaultToken : "comment.doc",
|
16
|
caseInsensitive: true
|
17
|
}]
|
18
|
};
|
19
|
};
|
20
|
|
21
|
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
|
22
|
|
23
|
DocCommentHighlightRules.getTagRule = function(start) {
|
24
|
return {
|
25
|
token : "comment.doc.tag.storage.type",
|
26
|
regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
|
27
|
};
|
28
|
};
|
29
|
|
30
|
DocCommentHighlightRules.getStartRule = function(start) {
|
31
|
return {
|
32
|
token : "comment.doc", // doc comment
|
33
|
regex : "\\/\\*(?=\\*)",
|
34
|
next : start
|
35
|
};
|
36
|
};
|
37
|
|
38
|
DocCommentHighlightRules.getEndRule = function (start) {
|
39
|
return {
|
40
|
token : "comment.doc", // closing comment
|
41
|
regex : "\\*\\/",
|
42
|
next : start
|
43
|
};
|
44
|
};
|
45
|
|
46
|
|
47
|
exports.DocCommentHighlightRules = DocCommentHighlightRules;
|
48
|
|
49
|
});
|
50
|
|
51
|
ace.define("ace/mode/mysql_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
52
|
|
53
|
var oop = require("../lib/oop");
|
54
|
var lang = require("../lib/lang");
|
55
|
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
56
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
57
|
|
58
|
var MysqlHighlightRules = function() {
|
59
|
|
60
|
var mySqlKeywords = /*sql*/ "alter|and|as|asc|between|count|create|delete|desc|distinct|drop|from|having|in|insert|into|is|join|like|not|on|or|order|select|set|table|union|update|values|where" + "|accessible|action|add|after|algorithm|all|analyze|asensitive|at|authors|auto_increment|autocommit|avg|avg_row_length|before|binary|binlog|both|btree|cache|call|cascade|cascaded|case|catalog_name|chain|change|changed|character|check|checkpoint|checksum|class_origin|client_statistics|close|coalesce|code|collate|collation|collations|column|columns|comment|commit|committed|completion|concurrent|condition|connection|consistent|constraint|contains|continue|contributors|convert|cross|current_date|current_time|current_timestamp|current_user|cursor|data|database|databases|day_hour|day_microsecond|day_minute|day_second|deallocate|dec|declare|default|delay_key_write|delayed|delimiter|des_key_file|describe|deterministic|dev_pop|dev_samp|deviance|directory|disable|discard|distinctrow|div|dual|dumpfile|each|elseif|enable|enclosed|end|ends|engine|engines|enum|errors|escape|escaped|even|event|events|every|execute|exists|exit|explain|extended|fast|fetch|field|fields|first|flush|for|force|foreign|found_rows|full|fulltext|function|general|global|grant|grants|group|groupby_concat|handler|hash|help|high_priority|hosts|hour_microsecond|hour_minute|hour_second|if|ignore|ignore_server_ids|import|index|index_statistics|infile|inner|innodb|inout|insensitive|insert_method|install|interval|invoker|isolation|iterate|key|keys|kill|language|last|leading|leave|left|level|limit|linear|lines|list|load|local|localtime|localtimestamp|lock|logs|low_priority|master|master_heartbeat_period|master_ssl_verify_server_cert|masters|match|max|max_rows|maxvalue|message_text|middleint|migrate|min|min_rows|minute_microsecond|minute_second|mod|mode|modifies|modify|mutex|mysql_errno|natural|next|no|no_write_to_binlog|offline|offset|one|online|open|optimize|option|optionally|out|outer|outfile|pack_keys|parser|partition|partitions|password|phase|plugin|plugins|prepare|preserve|prev|primary|privileges|procedure|processlist|profile|profiles|purge|query|quick|range|read|read_write|reads|real|rebuild|recover|references|regexp|relaylog|release|remove|rename|reorganize|repair|repeatable|replace|require|resignal|restrict|resume|return|returns|revoke|right|rlike|rollback|rollup|row|row_format|rtree|savepoint|schedule|schema|schema_name|schemas|second_microsecond|security|sensitive|separator|serializable|server|session|share|show|signal|slave|slow|smallint|snapshot|soname|spatial|specific|sql|sql_big_result|sql_buffer_result|sql_cache|sql_calc_found_rows|sql_no_cache|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|start|starting|starts|status|std|stddev|stddev_pop|stddev_samp|storage|straight_join|subclass_origin|sum|suspend|table_name|table_statistics|tables|tablespace|temporary|terminated|to|trailing|transaction|trigger|triggers|truncate|uncommitted|undo|uninstall|unique|unlock|upgrade|usage|use|use_frm|user|user_resources|user_statistics|using|utc_date|utc_time|utc_timestamp|value|variables|varying|view|views|warnings|when|while|with|work|write|xa|xor|year_month|zerofill|begin|do|then|else|loop|repeat";
|
61
|
var builtins = "by|bool|boolean|bit|blob|decimal|double|enum|float|long|longblob|longtext|medium|mediumblob|mediumint|mediumtext|time|timestamp|tinyblob|tinyint|tinytext|text|bigint|int|int1|int2|int3|int4|int8|integer|float|float4|float8|double|char|varbinary|varchar|varcharacter|precision|date|datetime|year|unsigned|signed|numeric|ucase|lcase|mid|len|round|rank|now|format|coalesce|ifnull|isnull|nvl";
|
62
|
var variable = "charset|clear|connect|edit|ego|exit|go|help|nopager|notee|nowarning|pager|print|prompt|quit|rehash|source|status|system|tee";
|
63
|
|
64
|
var keywordMapper = this.createKeywordMapper({
|
65
|
"support.function": builtins,
|
66
|
"keyword": mySqlKeywords,
|
67
|
"constant": "false|true|null|unknown|date|time|timestamp|ODBCdotTable|zerolessFloat",
|
68
|
"variable.language": variable
|
69
|
}, "identifier", true);
|
70
|
|
71
|
|
72
|
function string(rule) {
|
73
|
var start = rule.start;
|
74
|
var escapeSeq = rule.escape;
|
75
|
return {
|
76
|
token: "string.start",
|
77
|
regex: start,
|
78
|
next: [
|
79
|
{token: "constant.language.escape", regex: escapeSeq},
|
80
|
{token: "string.end", next: "start", regex: start},
|
81
|
{defaultToken: "string"}
|
82
|
]
|
83
|
};
|
84
|
}
|
85
|
|
86
|
this.$rules = {
|
87
|
"start" : [ {
|
88
|
token : "comment", regex : "(?:-- |#).*$"
|
89
|
},
|
90
|
string({start: '"', escape: /\\[0'"bnrtZ\\%_]?/}),
|
91
|
string({start: "'", escape: /\\[0'"bnrtZ\\%_]?/}),
|
92
|
DocCommentHighlightRules.getStartRule("doc-start"),
|
93
|
{
|
94
|
token : "comment", // multi line comment
|
95
|
regex : /\/\*/,
|
96
|
next : "comment"
|
97
|
}, {
|
98
|
token : "constant.numeric", // hex
|
99
|
regex : /0[xX][0-9a-fA-F]+|[xX]'[0-9a-fA-F]+'|0[bB][01]+|[bB]'[01]+'/
|
100
|
}, {
|
101
|
token : "constant.numeric", // float
|
102
|
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
103
|
}, {
|
104
|
token : keywordMapper,
|
105
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
106
|
}, {
|
107
|
token : "constant.class",
|
108
|
regex : "@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
109
|
}, {
|
110
|
token : "constant.buildin",
|
111
|
regex : "`[^`]*`"
|
112
|
}, {
|
113
|
token : "keyword.operator",
|
114
|
regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
|
115
|
}, {
|
116
|
token : "paren.lparen",
|
117
|
regex : "[\\(]"
|
118
|
}, {
|
119
|
token : "paren.rparen",
|
120
|
regex : "[\\)]"
|
121
|
}, {
|
122
|
token : "text",
|
123
|
regex : "\\s+"
|
124
|
} ],
|
125
|
"comment" : [
|
126
|
{token : "comment", regex : "\\*\\/", next : "start"},
|
127
|
{defaultToken : "comment"}
|
128
|
]
|
129
|
};
|
130
|
|
131
|
this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);
|
132
|
this.normalizeRules();
|
133
|
};
|
134
|
|
135
|
oop.inherits(MysqlHighlightRules, TextHighlightRules);
|
136
|
|
137
|
exports.MysqlHighlightRules = MysqlHighlightRules;
|
138
|
});
|
139
|
|
140
|
ace.define("ace/mode/mysql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mysql_highlight_rules"], function(require, exports, module) {
|
141
|
|
142
|
var oop = require("../lib/oop");
|
143
|
var TextMode = require("../mode/text").Mode;
|
144
|
var MysqlHighlightRules = require("./mysql_highlight_rules").MysqlHighlightRules;
|
145
|
|
146
|
var Mode = function() {
|
147
|
this.HighlightRules = MysqlHighlightRules;
|
148
|
this.$behaviour = this.$defaultBehaviour;
|
149
|
};
|
150
|
oop.inherits(Mode, TextMode);
|
151
|
|
152
|
(function() {
|
153
|
this.lineCommentStart = ["--", "#"]; // todo space
|
154
|
this.blockComment = {start: "/*", end: "*/"};
|
155
|
|
156
|
this.$id = "ace/mode/mysql";
|
157
|
}).call(Mode.prototype);
|
158
|
|
159
|
exports.Mode = Mode;
|
160
|
}); (function() {
|
161
|
ace.require(["ace/mode/mysql"], function(m) {
|
162
|
if (typeof module == "object" && typeof exports == "object" && module) {
|
163
|
module.exports = m;
|
164
|
}
|
165
|
});
|
166
|
})();
|
167
|
|