|
12 | 12 | "include": "#comments" |
13 | 13 | }, |
14 | 14 | { |
15 | | - "begin": "(?i)^\\s*(create)\\s+(or\\s+replace\\s+)?(function|view)\\s+((?:(?:[\\w]+|\".+\")\\.)?(?:[\\w]+|\".+\"))", |
16 | | - "beginCaptures": { |
17 | | - "1": { |
18 | | - "name": "keyword.other.create.pgsql" |
19 | | - }, |
20 | | - "2": { |
21 | | - "name": "keyword.other.pgsql" |
22 | | - }, |
23 | | - "3": { |
24 | | - "name": "keyword.other.pgsql" |
25 | | - }, |
26 | | - "4": { |
27 | | - "name": "entity.name.function.pgsql" |
28 | | - } |
29 | | - }, |
| 15 | + "begin": "^", |
30 | 16 | "end": ";\\s*", |
31 | | - "name": "meta.statement.pgsql.create", |
| 17 | + "name": "meta.statement.pgsql", |
32 | 18 | "patterns": [ |
33 | 19 | { |
34 | | - "include": "#dollar_quotes" |
35 | | - }, |
36 | | - { |
37 | | - "include": "#comments" |
38 | | - }, |
39 | | - { |
40 | | - "include": "#strings" |
| 20 | + "include": "#create_entities" |
41 | 21 | }, |
42 | 22 | { |
43 | | - "include": "#keywords" |
| 23 | + "include": "#parens" |
44 | 24 | }, |
45 | | - { |
46 | | - "include": "#misc" |
47 | | - } |
48 | | - ] |
49 | | - }, |
50 | | - { |
51 | | - "begin": "(?i:^\\s*(create)\\s+(aggregate|collation|conversion|database|domain|event trigger|group|(?:unique\\s+)?index|language|operator class|operator|rule|schema|sequence|(?:global\\s+|local\\s+)?(?:temp\\s+|temporary\\s+|unlogged\\s+)?table|tablespace|trigger|type|user|(?:materialized\\s+)?view)\\s+)(if\\s+not\\s+exists\\s+)?((?:(?:[\\w]+|\".+\")\\.)?(?:[\\w]+|\".+\"))", |
52 | | - "beginCaptures": { |
53 | | - "1": { |
54 | | - "name": "keyword.other.create.pgsql" |
55 | | - }, |
56 | | - "2": { |
57 | | - "name": "keyword.other.pgsql" |
58 | | - }, |
59 | | - "3": { |
60 | | - "name": "keyword.other.pgsql" |
61 | | - }, |
62 | | - "4": { |
63 | | - "name": "entity.name.function.pgsql" |
64 | | - } |
65 | | - }, |
66 | | - "end": ";\\s*", |
67 | | - "name": "meta.statement.pgsql.create", |
68 | | - "patterns": [ |
69 | | - { |
70 | | - "include": "#dollar_quotes" |
71 | | - }, |
72 | | - { |
73 | | - "include": "#comments" |
74 | | - }, |
75 | | - { |
76 | | - "include": "#strings" |
77 | | - }, |
78 | | - { |
79 | | - "include": "#keywords" |
80 | | - }, |
81 | | - { |
82 | | - "include": "#misc" |
83 | | - } |
84 | | - ] |
85 | | - }, |
86 | | - { |
87 | | - "begin": "(^\\s*[a-zA-Z]+)", |
88 | | - "beginCaptures": { |
89 | | - "0": { |
90 | | - "name": "keyword.other.pgsql" |
91 | | - } |
92 | | - }, |
93 | | - "comment": "Last update (including keywords below) using postgres 9.3. See classes/Help.php for update method. Testing change below to just assume starting word is a SQL keyword.", |
94 | | - "end": ";\\s*", |
95 | | - "name": "meta.statement.pgsql", |
96 | | - "patterns": [ |
97 | 25 | { |
98 | 26 | "include": "#dollar_quotes" |
99 | 27 | }, |
|
124 | 52 | } |
125 | 53 | ], |
126 | 54 | "repository": { |
| 55 | + "create_entities": { |
| 56 | + "patterns": [ |
| 57 | + { |
| 58 | + "match": "(?i)\\b(create)\\s+(or\\s+replace\\s+)?(function|view)\\s+((?:(?:[\\w]+|\".+\")\\.){0,2}(?:[\\w]+|\".+\"))", |
| 59 | + "captures": { |
| 60 | + "1": { |
| 61 | + "name": "keyword.other.create.pgsql" |
| 62 | + }, |
| 63 | + "2": { |
| 64 | + "name": "keyword.other.pgsql" |
| 65 | + }, |
| 66 | + "3": { |
| 67 | + "name": "keyword.other.pgsql" |
| 68 | + }, |
| 69 | + "4": { |
| 70 | + "name": "entity.name.function.pgsql" |
| 71 | + } |
| 72 | + } |
| 73 | + }, |
| 74 | + { |
| 75 | + "match": "(?i)\\b(create)\\s+(aggregate|collation|conversion|database|domain|event\\s+trigger|group|(?:unique\\s+)?index|language|operator\\s+class|operator|rule|schema|sequence|(?:(?:global|local)\\s+)?(?:(?:temp|temporary|unlogged)\\s+)?table|tablespace|trigger|type|user|(?:materialized\\s+)?view)\\s+(if\\s+not\\s+exists\\s+)?((?:(?:[\\w]+|\".+\")\\.){0,2}(?:[\\w]+|\".+\"))", |
| 76 | + "captures": { |
| 77 | + "1": { |
| 78 | + "name": "keyword.other.create.pgsql" |
| 79 | + }, |
| 80 | + "2": { |
| 81 | + "name": "keyword.other.pgsql" |
| 82 | + }, |
| 83 | + "3": { |
| 84 | + "name": "keyword.other.pgsql" |
| 85 | + }, |
| 86 | + "4": { |
| 87 | + "name": "entity.name.function.pgsql" |
| 88 | + } |
| 89 | + } |
| 90 | + } |
| 91 | + ] |
| 92 | + }, |
127 | 93 | "comments": { |
128 | 94 | "patterns": [ |
129 | 95 | { |
|
155 | 121 | "end": "\\1", |
156 | 122 | "name": "meta.dollar-quote.pgsql", |
157 | 123 | "patterns": [ |
| 124 | + { |
| 125 | + "include": "#parens" |
| 126 | + }, |
158 | 127 | { |
159 | 128 | "include": "#dollar_quotes" |
160 | 129 | }, |
|
210 | 179 | } |
211 | 180 | ] |
212 | 181 | }, |
| 182 | + "parens": { |
| 183 | + "begin": "\\(", |
| 184 | + "end": "\\)", |
| 185 | + "patterns": [ |
| 186 | + { |
| 187 | + "include": "#parens" |
| 188 | + }, |
| 189 | + { |
| 190 | + "include": "#dollar_quotes" |
| 191 | + }, |
| 192 | + { |
| 193 | + "include": "#comments" |
| 194 | + }, |
| 195 | + { |
| 196 | + "include": "#strings" |
| 197 | + }, |
| 198 | + { |
| 199 | + "include": "#keywords" |
| 200 | + }, |
| 201 | + { |
| 202 | + "include": "#misc" |
| 203 | + } |
| 204 | + ] |
| 205 | + }, |
213 | 206 | "string_escape": { |
214 | 207 | "match": "\\\\.", |
215 | 208 | "name": "constant.character.escape.pgsql" |
|
0 commit comments