1 |
524
|
Ruebenwurz
|
/*
|
2 |
|
|
* CodePress regular expressions for SQL syntax highlighting
|
3 |
|
|
* By Merlin Moncure
|
4 |
|
|
*/
|
5 |
|
|
|
6 |
|
|
// SQL
|
7 |
|
|
Language.syntax = [
|
8 |
|
|
{ input : /\'(.*?)(\')/g, output : '<s>\'$1$2</s>' }, // strings single quote
|
9 |
|
|
{ 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|like|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
|
10 |
|
|
{ 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
|
11 |
|
|
{ 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
|
12 |
|
|
{ input : /([^:]|^)\-\-(.*?)(<br|<\/P)/g, output: '$1<i>--$2</i>$3' } // comments //
|
13 |
|
|
]
|
14 |
|
|
|
15 |
|
|
Language.snippets = [
|
16 |
|
|
{ input : 'select', output : 'select $0 from where ' }
|
17 |
|
|
]
|
18 |
|
|
|
19 |
|
|
Language.complete = [
|
20 |
|
|
{ input : '\'', output : '\'$0\'' },
|
21 |
|
|
{ input : '"', output : '"$0"' },
|
22 |
|
|
{ input : '(', output : '\($0\)' },
|
23 |
|
|
{ input : '[', output : '\[$0\]' },
|
24 |
|
|
{ input : '{', output : '{\n\t$0\n}' }
|
25 |
|
|
]
|
26 |
|
|
|
27 |
|
|
Language.shortcuts = []
|
28 |
|
|
|
29 |
|
|
|