-
Notifications
You must be signed in to change notification settings - Fork 0
/
pg.xml
188 lines (166 loc) · 10.5 KB
/
pg.xml
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd" [
<!ENTITY space "[ \t]">
<!ENTITY nonSpace "[^ \t]">
<!ENTITY trailingSpace "&space;*(?:#.*)?$">
<!ENTITY ignoredLine "^&trailingSpace;$">
<!ENTITY reserved "\x00-\x20<>"{}\\^`|">
<!ENTITY unquotedStart "[^&reserved;#:',-]">
<!ENTITY unquoted "&unquotedStart;[^&reserved;]*">
<!ENTITY idStart "&unquotedStart;|"|'">
<!ENTITY escapeSequence "\\(?:["'\\/bfnrt]|u[0-9a-fA-f]{4})">
<!-- This does not cover control codes, including line breaks: -->
<!ENTITY singleQuotedString "'(?:[^'\\]*(?:&escapeSequence;)?)*'">
<!ENTITY doubleQuotedString ""(?:[^"\\]*(?:&escapeSequence;)?)*"">
]>
<language name="PG format" version="1" kateversion="5.0" section="Database" extensions="*.pg" author="Jakob Voß ([email protected]>" license="CC0">
<highlighting>
<list name="Boolean">
<item>true</item>
<item>false</item>
</list>
<contexts>
<context name="Start" lineEndContext="#stay" attribute="Space">
<RegExpr String="&ignoredLine;" column="0" attribute="Comment"/>
<RegExpr String="^&nonSpace;" column="0" lookAhead="true" context="Statement"/>
<RegExpr String=".+" attribute="Error"/> <!-- continuation line not allowed here -->
</context>
<context name="Statement" lineEndContext="StartLine" fallthroughContext="Error" fallthrough="true" attribute="Error">
<!-- This does not catch quoted multiline edge identifiers and will wrongly mark nodes with id ending in colon! -->
<RegExpr String="(?:&doubleQuotedString;|&singleQuotedString;|&unquoted;):" context="EdgeIdentifier" lookAhead="1"/>
<RegExpr String="&idStart;" lookAhead="true" context="FirstIdentifier"/>
</context>
<context name="EdgeIdentifier" lineEndContext="Error" fallthroughContext="Error" fallthrough="true" attribute="Identifier">
<DetectChar char=""" attribute="Identifier" context="DoubleQuotedEdgeIdentifier"/>
<DetectChar char="'" attribute="Identifier" context="SingleQuotedEdgeIdentifier"/>
<RegExpr String="([^&reserved;:]+:+)+" attribute="Identifier" context="AfterEdgeIdentifier"/>
</context>
<context name="AfterEdgeIdentifier" lineEndContext="StartLine" fallthroughContext="#pop!FirstIdentifier" fallthrough="true" attribute="Space">
<IncludeRules context="DelimitingSpace"/>
</context>
<context name="Error" attribute="Error" lineEndContext="Error">
<RegExpr String="." context="#pop" attribute="Error"/>
</context>
<!-- Node identifier of a node statement or source of an edge statement -->
<context name="FirstIdentifier" lineEndContext="Error" fallthroughContext="Error" fallthrough="true" attribute="Identifier">
<DetectChar char=""" attribute="Identifier" context="DoubleQuotedFirstIdentifier"/>
<DetectChar char="'" attribute="Identifier" context="SingleQuotedFirstIdentifier"/>
<RegExpr String="&unquoted;" attribute="Identifier" context="AfterFirstIdentifier"/>
</context>
<!-- Node identifier of a node statement or target of an edge statement -->
<context name="LastIdentifier" lineEndContext="StartLine" fallthroughContext="#pop!Labels" fallthrough="true" attribute="Identifier">
<IncludeRules context="DelimitingSpace"/>
<DetectChar char=""" attribute="Identifier" context="DoubleQuotedLastIdentifier"/>
<DetectChar char="'" attribute="Identifier" context="SingleQuotedLastIdentifier"/>
<RegExpr String="&unquoted;" attribute="Identifier" context="#pop!Labels"/>
</context>
<context name="AfterFirstIdentifier" lineEndContext="StartLine" fallthroughContext="#pop#pop!Labels" fallthrough="true" attribute="Error">
<IncludeRules context="DelimitingSpace"/>
<Detect2Chars char="-" char1="-" context="#pop#pop!LastIdentifier" attribute="Direction"/>
<Detect2Chars char="-" char1=">" context="#pop#pop!LastIdentifier" attribute="Direction"/>
</context>
<context name="Labels" attribute="Label" lineEndContext="StartLine" fallthroughContext="Properties" fallthrough="true">
<IncludeRules context="DelimitingSpace"/>
<RegExpr String=":&space;*&unquoted;" context="#stay" attribute="Label"/>
<RegExpr String=":&space;*"" context="DoubleQuotedLabel" attribute="Label"/>
<RegExpr String=":&space;*'" context="SingleQuotedLabel" attribute="Label"/>
</context>
<context name="Properties" attribute="PropertyKey" lineEndContext="StartLine" fallthroughContext="Error" fallthrough="true">
<AnyChar String=" 	" attribute="Space"/>
<RegExpr String="(?:[^&reserved;:]+:)+|(?:(?:&doubleQuotedString;|&singleQuotedString;):)" context="PropertyValue" attribute="PropertyKey" />
<RegExpr String="#.*" attribute="Comment"/>
<DetectChar char="," attribute="Comma" context="PropertyValue"/>
</context>
<context name="StartLine" lineEndContext="#stay" fallthroughContext="Error" fallthrough="true" attribute="Error">
<RegExpr String="&ignoredLine;" column="0" attribute="Comment"/>
<AnyChar String=" 	" context="#pop" lookAhead="true"/>
<RegExpr String="^&nonSpace;" column="0" lookAhead="true" context="#pop#pop#pop#pop!Statement"/>
</context>
<context name="DoubleQuotedLabel" lineEndContext="#stay" attribute="Label">
<DetectChar char=""" context="#pop" attribute="Label"/>
<DetectChar char="\" context="StringEscape" lookAhead="1"/>
</context>
<context name="SingleQuotedLabel" lineEndContext="#stay" attribute="Label">
<DetectChar char="'" context="#pop" attribute="Label"/>
<DetectChar char="\" context="StringEscape" lookAhead="1"/>
</context>
<context name="DoubleQuotedValue" lineEndContext="#stay" attribute="Value">
<DetectChar char=""" context="#pop#pop" attribute="Value"/>
<DetectChar char="\" context="StringEscape" lookAhead="1"/>
</context>
<context name="SingleQuotedValue" lineEndContext="#stay" attribute="Value">
<DetectChar char="'" context="#pop#pop" attribute="Value"/>
<DetectChar char="\" context="StringEscape" lookAhead="1"/>
</context>
<context name="DoubleQuotedEdgeIdentifier" lineEndContext="#stay" attribute="Identifier">
<Detect2Chars char=""" char1=":" context="#pop!AfterEdgeIdentifier" attribute="Identifier"/>
<DetectChar char="\" context="StringEscape" lookAhead="1"/>
</context>
<context name="SingleQuotedEdgeIdentifier" lineEndContext="#stay" attribute="Identifier">
<Detect2Chars char="'" char1=":" context="#pop!AfterEdgeIdentifier" attribute="Identifier"/>
<DetectChar char="\" context="StringEscape" lookAhead="1"/>
</context>
<context name="DoubleQuotedFirstIdentifier" lineEndContext="#stay" attribute="Identifier">
<DetectChar char=""" context="#pop!AfterFirstIdentifier" attribute="Identifier"/>
<DetectChar char="\" context="StringEscape" lookAhead="1"/>
</context>
<context name="SingleQuotedFirstIdentifier" lineEndContext="#stay" attribute="Identifier">
<DetectChar char="'" context="#pop!AfterFirstIdentifier" attribute="Identifier"/>
<DetectChar char="\" context="StringEscape" lookAhead="1"/>
</context>
<context name="DoubleQuotedLastIdentifier" lineEndContext="#stay" attribute="Identifier">
<DetectChar char=""" context="#pop#pop!Labels" attribute="Identifier"/>
<DetectChar char="\" context="StringEscape" lookAhead="1"/>
</context>
<context name="SingleQuotedLastIdentifier" lineEndContext="#stay" attribute="Identifier">
<DetectChar char="'" context="#pop#pop!Labels" attribute="Identifier"/>
<DetectChar char="\" context="StringEscape" lookAhead="1"/>
</context>
<context name="StringEscape" lineEndContext="#stay" attribute="Error">
<RegExpr String="&escapeSequence;" context="#pop" attribute="EscapeSequence"/>
<RegExpr String="\\(u[0-9a-fA-f]+|.)?" context="#pop" attribute="Error"/>
</context>
<!-- this context is only included -->
<context name="DelimitingSpace" lineEndContext="#stay" attribute="Comment">
<RegExpr String="#.*$" attribute="Comment"/>
<!--RegExpr String="&ignoredLine;" column="0" attribute="Comment"/-->
<AnyChar String=" 	" attribute="Space"/>
<RegExpr String="^&nonSpace;" column="0" lookAhead="true" context="Error"/>
</context>
<context name="PropertyValue" lineEndContext="#stay" attribute="Space">
<IncludeRules context="DelimitingSpace"/>
<DetectChar char=""" attribute="Value" context="DoubleQuotedValue"/>
<DetectChar char="'" attribute="Value" context="SingleQuotedValue"/>
<keyword String="Boolean" context="#pop" attribute="Boolean"/>
<RegExpr String="-?(0|[1-9][0-9]*(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?)" context="#pop" attribute="Number"/>
<RegExpr attribute="UnquotedValue" context="#pop" String="&unquotedStart;[^&reserved;,]*"/>
</context>
</contexts>
<itemDatas>
<itemData name="Space" defStyleNum="dsNormal"/>
<itemData name="Identifier" defStyleNum="dsNormal"/>
<itemData name="Label" defStyleNum="dsDataType"/>
<itemData name="PropertyKey" defStyleNum="dsFunction"/>
<itemData name="Direction" defStyleNum="dsControlFlow"/>
<itemData name="Comma" defStyleNum="dsControlFlow"/>
<itemData name="Value" defStyleNum="dsString"/>
<itemData name="UnquotedValue" defStyleNum="dsString"/>
<itemData name="Number" defStyleNum="dsDecVal"/>
<itemData name="Boolean" defStyleNum="dsKeyword"/>
<itemData name="Comment" defStyleNum="dsComment"/>
<itemData name="EscapeSequence" defStyleNum="dsSpecialChar"/>
<itemData name="Error" defStyleNum="dsError"/>
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start="#" position="afterwhitespace"/>
</comments>
<emptyLines>
<emptyLine regexpr="\s+"/>
<emptyLine regexpr="\s*#.*"/>
</emptyLines>
<keywords casesensitive="true"/>
<folding indentationsensitive="true"/>
</general>
</language>