From 38e3452313adeeea0089927b14656a4b0ce998a8 Mon Sep 17 00:00:00 2001 From: Joshua Saxby Date: Wed, 11 Mar 2015 21:05:54 +0000 Subject: [PATCH] added SQL data types --- lib/ace/mode/sql_highlight_rules.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/ace/mode/sql_highlight_rules.js b/lib/ace/mode/sql_highlight_rules.js index 31e8846b..ee32dce2 100644 --- a/lib/ace/mode/sql_highlight_rules.js +++ b/lib/ace/mode/sql_highlight_rules.js @@ -38,23 +38,28 @@ var SqlHighlightRules = function() { var keywords = ( "select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|" + - "when|else|end|type|left|right|join|on|outer|desc|asc|union|create|table|primary key|if|not|" + - "foreign key|" + "when|else|end|type|left|right|join|on|outer|desc|asc|union|create|table|primary|key|if|" + + "foreign|not|references|default|null" ); var builtinConstants = ( - "true|false|null" + "true|false" ); var builtinFunctions = ( - "count|min|max|avg|sum|rank|now|coalesce|int|numeric|decimal|date|boolean|varchar|char|bigint|" + - "float|double" + "count|min|max|avg|sum|rank|now|coalesce" + ); + + var dataTypes = ( + "int|numeric|decimal|date|varchar|char|bigint|" + + "float|double|bit|binary|text|set|timestamp|money|real|number" ); var keywordMapper = this.createKeywordMapper({ "support.function": builtinFunctions, "keyword": keywords, - "constant.language": builtinConstants + "constant.language": builtinConstants, + "storage.type": dataTypes }, "identifier", true); this.$rules = { @@ -89,6 +94,9 @@ var SqlHighlightRules = function() { }, { token : "text", regex : "\\s+" + }, { + token : "entity.name.function", + regex : "\\s+" } ] }; this.normalizeRules();