-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathimpex.sublime-syntax
123 lines (120 loc) · 3.28 KB
/
impex.sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
%YAML 1.2
---
name: ImpEx
scope: text.impex
file_extensions: [impex]
contexts:
main:
- include: macros
- include: headers
- include: comments
- include: rows
- include: string
comments:
- match: '(#).*$\n?'
scope: comment.line.impex
captures:
1: punctuation.definition.comment.impex
headers:
- match: \b(INSERT_UPDATE|INSERT|UPDATE|DELETE)\b
scope: storage.type.action.impex
push:
- meta_scope: meta.structure.header.impex
- match: \b\w+\b
scope: entity.name.type.impex
push:
- include: columns
- match: $\n?
pop: true
columns:
- include: column-definitions
- match: ';'
scope: punctuation.separator.columns.impex
pop: true
column-definitions:
- meta_scope: meta.structure.column-definition.impex
- match: (\w+)\b
captures:
1: entity.name.column.impex
- include: parameters
- include: arguments
- match: \b\s|,|$
pop: true
macros:
- include: macro-name
- match: '='
scope: keyword.operator.macro.assignment.impex
push:
- include: macro-string
- include: column-definitions
- match: \n|;|$
scope: punctuation.macro.end-of-line.impex
pop: true
macro-name:
- match: \$\w+\b
scope: entity.name.macro.impex
arguments:
- match: '\('
scope: punctuation.section.argument-list.impex
push:
- meta_scope: meta.structure.arguments.impex
- include: column-definitions
- match: '\)'
scope: punctuation.section.argument-list.impex
pop: true
parameters:
- match: '\['
scope: punctuation.section.parameter-list.impex
push:
- meta_scope: meta.structure.parameter-list.impex
- include: parameter-assignments
parameter-assignments:
- match: \b(?=\w+\.?)+\b
scope: entity.name.parameter.impex
- include: macro-name
- match: '='
scope: keyword.operator.assignment.impex
set:
- include: macro-name
- match: \b(?=\w+\.?)+\b
scope: value.parameter-list.impex
- match: ','
scope: punctuation.separator.parameter-list.impex
set:
- include: parameter-assignments
- match: '\]'
scope: punctuation.section.parameter-list.impex
pop: true
macro-string:
- match: '([\w,\.]+\s+)+\w+'
scope: string.unquoted.impex
rows:
- match: ^\s*;
scope: punctuation.separator.row.start.impex
push:
- meta_scope: meta.structure.row.impex
- include: separators
- match: '[^;,\$"]+'
scope: string.unquoted.impex
- match: $
pop: true
- include: macro-name
- include: string
separators:
- match: ;
scope: punctuation.separator.row.impex
- match: ','
scope: punctuation.separator.array.impex
string:
- match: '"'
scope: punctuation.definition.string.begin.impex
push:
- meta_scope: string.quoted.double.impex
- match: '(?=SELECT|UPDATE|INSERT|DELETE)'
push:
- match: '(?=")'
pop: true
- include: scope:source.sql
- match: '"'
scope: punctuation.definition.string.end.impex
pop: true