Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 160 additions & 0 deletions mode/zql.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(acequire, exports, module) {
"use strict";

var oop = acequire("../lib/oop");
var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;

var DocCommentHighlightRules = function() {
this.$rules = {
"start" : [ {
token : "comment.doc.tag",
regex : "@[\\w\\d_]+" // TODO: fix email addresses
},
DocCommentHighlightRules.getTagRule(),
{
defaultToken : "comment.doc",
caseInsensitive: true
}]
};
};

oop.inherits(DocCommentHighlightRules, TextHighlightRules);

DocCommentHighlightRules.getTagRule = function(start) {
return {
token : "comment.doc.tag.storage.type",
regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
};
};

DocCommentHighlightRules.getStartRule = function(start) {
return {
token : "comment.doc", // doc comment
regex : "\\/\\*(?=\\*)",
next : start
};
};

DocCommentHighlightRules.getEndRule = function (start) {
return {
token : "comment.doc", // closing comment
regex : "\\*\\/",
next : start
};
};


exports.DocCommentHighlightRules = DocCommentHighlightRules;

});

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(acequire, exports, module) {

var oop = acequire("../lib/oop");
var lang = acequire("../lib/lang");
var DocCommentHighlightRules = acequire("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = acequire("./text_highlight_rules").TextHighlightRules;

var MysqlHighlightRules = function() {

var mySqlKeywords = /*sql*/ "bytes|length|startswith|endswith|exist|absent|int|long|string|guid|append|key_range|key_prefix|take|skip|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|acequire|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";
var builtins = "by|bool|boolean|bit|blob|decimal|double|enum|float|longblob|longtext|medium|mediumblob|mediumint|mediumtext|time|timestamp|tinyblob|tinyint|tinytext|text|bigint|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";
var variable = "charset|clear|connect|edit|ego|exit|go|help|nopager|notee|nowarning|pager|print|prompt|quit|rehash|source|status|system|tee";

var keywordMapper = this.createKeywordMapper({
"support.function": builtins,
"keyword": mySqlKeywords,
"constant": "false|true|null|unknown|date|time|timestamp|ODBCdotTable|zerolessFloat",
"variable.language": variable
}, "identifier", true);


function string(rule) {
var start = rule.start;
var escapeSeq = rule.escape;
return {
token: "string.start",
regex: start,
next: [
{token: "constant.language.escape", regex: escapeSeq},
{token: "string.end", next: "start", regex: start},
{defaultToken: "string"}
]
};
}

this.$rules = {
"start" : [ {
token : "comment", regex : "(?:-- |#).*$"
},
string({start: '"', escape: /\\[0'"bnrtZ\\%_]?/}),
string({start: "'", escape: /\\[0'"bnrtZ\\%_]?/}),
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi line comment
regex : /\/\*/,
next : "comment"
}, {
token : "constant.numeric", // hex
regex : /0[xX][0-9a-fA-F]+|[xX]'[0-9a-fA-F]+'|0[bB][01]+|[bB]'[01]+'/
}, {
token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, {
token : keywordMapper,
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token : "constant.class",
regex : "@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token : "constant.buildin",
regex : "`[^`]*`"
}, {
token : "keyword.operator",
regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
}, {
token : "paren.lparen",
regex : "[\\(]"
}, {
token : "paren.rparen",
regex : "[\\)]"
}, {
token : "text",
regex : "\\s+"
} ],
"comment" : [
{token : "comment", regex : "\\*\\/", next : "start"},
{defaultToken : "comment"}
]
};

this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);
this.normalizeRules();
};

oop.inherits(MysqlHighlightRules, TextHighlightRules);

exports.MysqlHighlightRules = MysqlHighlightRules;
});

ace.define("ace/mode/zql",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mysql_highlight_rules"], function(acequire, exports, module) {

var oop = acequire("../lib/oop");
var TextMode = acequire("../mode/text").Mode;
var MysqlHighlightRules = acequire("./mysql_highlight_rules").MysqlHighlightRules;

var Mode = function() {
this.HighlightRules = MysqlHighlightRules;
this.$behaviour = this.$defaultBehaviour;
};
oop.inherits(Mode, TextMode);

(function() {
this.lineCommentStart = ["--", "#"]; // todo space
this.blockComment = {start: "/*", end: "*/"};

this.$id = "ace/mode/zql";
}).call(Mode.prototype);

exports.Mode = Mode;
});
133 changes: 133 additions & 0 deletions theme/houston.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
ace.define("ace/theme/houston",["require","exports","module","ace/lib/dom"], function(acequire, exports, module) {

exports.isDark = true;
exports.cssClass = "ace-houston";
exports.cssText = ".ace-houston .ace_gutter {\
background: #3c3c3c;\
color: rgba(255, 255, 255, 0.3)\
}\
.ace-houston .ace_print-margin {\
width: 1px;\
background: #555651\
}\
.ace_gutter-cell.ace_error {\
background-image: none;\
background: #6b3838\
}\
.ace-houston {\
background-color: none;\
color: #F8F8F2;\
font-size: 14px;\
}\
.ace-houston .ace_scrollbar-v {\
width: 7px !important;\
bottom: 7px !important;\
}\
.ace-houston .ace_scrollbar-h {\
height: 7px !important;\
right: 7px !important;\
}\
.ace-houston .ace_scroller {\
right: 0px !important;\
bottom: 0px !important;\
}\
.ace-houston .ace_cursor {\
color: #F8F8F0\
}\
.ace-houston .ace_marker-layer .ace_selection {\
background: #49483E\
}\
.ace-houston.ace_multiselect .ace_selection.ace_start {\
box-shadow: 0 0 3px 0px #272822;\
}\
.ace-houston .ace_marker-layer .ace_step {\
background: rgb(102, 82, 0)\
}\
.ace-houston .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid #49483E\
}\
.ace-houston .ace_marker-layer .ace_active-line {\
background: #202020\
}\
.ace-houston .ace_gutter-active-line {\
background-color: #272727\
}\
.ace-houston .ace_marker-layer .ace_selected-word {\
border: 1px solid #49483E\
}\
.ace-houston .ace_invisible {\
color: #52524d\
}\
.ace-houston .ace_entity.ace_name.ace_tag,\
.ace-houston .ace_keyword,\
.ace-houston .ace_meta.ace_tag,\
.ace-houston .ace_storage {\
color: #F92672\
}\
.ace-houston .ace_punctuation,\
.ace-houston .ace_punctuation.ace_tag {\
color: #fff\
}\
.ace-houston .ace_constant.ace_character,\
.ace-houston .ace_constant.ace_numeric,\
.ace-houston .ace_constant.ace_other {\
color: #00CCBB\
}\
.ace-houston .ace_constant.ace_language{\
color: #0488E0\
}\
.ace-houston .ace_invalid {\
color: #F8F8F0;\
background-color: #F92672\
}\
.ace-houston .ace_invalid.ace_deprecated {\
color: #F8F8F0;\
background-color: #AE81FF\
}\
.ace-houston .ace_support.ace_constant,\
.ace-houston .ace_support.ace_function {\
color: #66D9EF\
}\
.ace-houston .ace_fold {\
background-color: #A6E22E;\
border-color: #585858;\
background-image: none;\
position: relative;\
background-color: rgba(255, 255, 255, 0);\
}\
.ace-houston .ace_fold:after {\
content: '...';\
color: #fff;\
position: absolute;\
top: -7px;\
}\
.ace-houston .ace_storage.ace_type,\
.ace-houston .ace_support.ace_class,\
.ace-houston .ace_support.ace_type {\
font-style: italic;\
color: #66D9EF\
}\
.ace-houston .ace_entity.ace_name.ace_function,\
.ace-houston .ace_entity.ace_other,\
.ace-houston .ace_entity.ace_other.ace_attribute-name,\
.ace-houston .ace_variable {\
color: #fff\
}\
.ace-houston .ace_variable.ace_parameter {\
font-style: italic;\
color: #FD971F\
}\
.ace-houston .ace_string {\
color: #FF809F\
}\
.ace-houston .ace_comment {\
color: #75715E\
}\
.ace-houston .ace_indent-guide {\
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y\
}";

var dom = acequire("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
});
Loading