1 |
458
|
doc
|
/*
|
2 |
|
|
* CodePress regular expressions for SQL syntax highlighting
|
3 |
|
|
* By Merlin Moncure
|
4 |
|
|
*/
|
5 |
|
|
|
6 |
|
|
Language.syntax = [ // SQL
|
7 |
|
|
{ input : /\'(.*?)(\')/g, output : '<s>\'$1$2</s>' }, // strings single quote
|
8 |
|
|
{ input : /\b(add|after|aggregate|alias|all|and|as|authorization|between|by|cascade|cache|cache|called|case|check|column|comment|constraint|createdb|createuser|cycle|database|default|deferrable|deferred|diagnostics|distinct|domain|each|else|elseif|elsif|encrypted|except|exception|for|foreign|from|from|full|function|get|group|having|if|immediate|immutable|in|increment|initially|increment|index|inherits|inner|input|intersect|into|invoker|is|join|key|language|left|limit|local|loop|match|maxvalue|minvalue|natural|nextval|no|nocreatedb|nocreateuser|not|null|of|offset|oids|on|only|operator|or|order|outer|owner|partial|password|perform|plpgsql|primary|record|references|replace|restrict|return|returns|right|row|rule|schema|security|sequence|session|sql|stable|statistics|table|temp|temporary|then|time|to|transaction|trigger|type|unencrypted|union|unique|user|using|valid|value|values|view|volatile|when|where|with|without|zone)\b/gi, output : '<b>$1</b>' }, // reserved words
|
9 |
|
|
{ input : /\b(bigint|bigserial|bit|boolean|box|bytea|char|character|cidr|circle|date|decimal|double|float4|float8|inet|int2|int4|int8|integer|interval|line|lseg|macaddr|money|numeric|oid|path|point|polygon|precision|real|refcursor|serial|serial4|serial8|smallint|text|timestamp|varbit|varchar)\b/gi, output : '<u>$1</u>' }, // types
|
10 |
|
|
{ input : /\b(abort|alter|analyze|begin|checkpoint|close|cluster|comment|commit|copy|create|deallocate|declare|delete|drop|end|execute|explain|fetch|grant|insert|listen|load|lock|move|notify|prepare|reindex|reset|restart|revoke|rollback|select|set|show|start|truncate|unlisten|update)\b/gi, output : '<a>$1</a>' }, // commands
|
11 |
|
|
{ input : /([^:]|^)\-\-(.*?)(<br|<\/P)/g, output: '$1<i>--$2</i>$3' } // comments //
|
12 |
|
|
]
|
13 |
|
|
|
14 |
|
|
// activated with tab
|
15 |
|
|
Language.snippets = [
|
16 |
|
|
{ input : 'select', output : 'select $0 from where ' }
|
17 |
|
|
],
|
18 |
|
|
|
19 |
|
|
// only 1 character auto-complete
|
20 |
|
|
Language.complete = [
|
21 |
|
|
{ input : '\'', output : '\'$0\'' },
|
22 |
|
|
{ input : '"', output : '"$0"' },
|
23 |
|
|
{ input : '(', output : '\($0\)' },
|
24 |
|
|
{ input : '[', output : '\[$0\]' },
|
25 |
|
|
{ input : '{', output : '{\n\t$0\n}' }
|
26 |
|
|
]
|
27 |
|
|
|
28 |
|
|
// ctrl+shift+inputKey
|
29 |
|
|
Language.shortcuts = [
|
30 |
|
|
]
|
31 |
|
|
|
32 |
|
|
|