-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpg.xml
173 lines (149 loc) · 8.89 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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language
[
<!ENTITY space "[ \t]">
<!ENTITY nonSpace "[^ \t]">
<!ENTITY ignoredLine "^&space;*(?:#.*)?$">
<!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" kateversion="5.0" section="Scripts" extensions="*.pg" casesensitive="1" author="Jakob Voß" license="CC0" version="0">
<highlighting>
<list name="Boolean">
<item>true</item>
<item>false</item>
</list>
<contexts>
<context name="Start" lineEndContext="#stay" attribute="Error">
<RegExpr String="&ignoredLine;" attribute="Comment" column="0"/>
<RegExpr String="^&nonSpace;" column="0" lookAhead="true" context="Statement"/>
<RegExpr String=".+" attribute="Error"/> <!-- continuation line not allowed here -->
</context>
<context name="Statement" lineEndContext="#stay" fallthroughContext="Error" fallthrough="true" attribute="Error">
<RegExpr String="&idStart;" context="StatementStart" lookAhead="true" />
</context>
<context name="StatementStart" lineEndContext="StartLine" fallthroughContext="Elements" fallthrough="true">
<!--RegExpr String="&idStart;" context="Identifier" /-->
<RegExpr String="&idStart;" context="Identifier" lookAhead="true" />
</context>
<context name="Error">
<RegExpr String="." attribute="Error" context="#pop" />
</context>
<context name="Elements" lineEndContext="StartLine" fallthroughContext="Error" fallthrough="true">
<Detect2Chars char="-" char1="-" attribute="Direction" context="Identifier" />
<Detect2Chars char="-" char1=">" attribute="Direction" context="Identifier" />
<RegExpr String="&idStart;" context="Identifier" lookAhead="true" />
<RegExpr String="&space;*#.*" attribute="Comment" context="StartLine" />
<!-- Labels -->
<RegExpr String="&space;+:&space;*(?:&unquoted;|"|')" context="Labels" lookAhead="true" />
<RegExpr String="&space;+" attribute="Space" context="#stay" />
<DetectChar char="," attribute="Comma" context="PropertyValue" />
<DetectChar char=":" attribute="Colon" context="PropertyValue" />
</context>
<!-- TODO: lineEndContext back to label -->
<context name="Labels" attribute="Label" lineEndContext="StartLine" fallthroughContext="Properties" fallthrough="true">
<RegExpr String="&space;+:&space;*&unquoted;" attribute="Label" />
<RegExpr String="&space;+:&space;*"" attribute="Label" context="DoubleQuotedLabel" />
<RegExpr String="&space;+:&space;*'" attribute="Label" context="SingleQuotedLabel" />
<RegExpr String="&space;*#.*" attribute="Comment" context="StartLine" />
<RegExpr String="&space;+" attribute="Space" />
</context>
<!-- TODO: fallthough to Error instead? -->
<context name="Properties" attribute="Property" lineEndContext="StartLine" fallthroughContext="Error" fallthrough="true">
<RegExpr String="([^&reserved;:]*:)+" attribute="PropertyKey" context="PropertyValue" />
<RegExpr String="&doubleQuotedString;:" attribute="PropertyKey" context="PropertyValue" />
<RegExpr String="&singleQuotedString;:" attribute="PropertyKey" context="PropertyValue" />
<RegExpr String="&space;*#.*" attribute="Comment" />
<RegExpr String="&space;+" attribute="Space" />
<DetectChar char="," attribute="Comma" context="PropertyValue" />
</context>
<context name="StartLine" lineEndContext="#stay" fallthroughContext="Error" fallthrough="true">
<RegExpr String="&ignoredLine;" attribute="Comment" column="0"/>
<!-- continuation line -->
<RegExpr String="&space;+" attribute="Space" context="#pop" lookAhead="true"/>
<!-- start of the first statement -->
<RegExpr String="^&nonSpace;" column="0" lookAhead="true" context="#pop!Statement"/>
</context>
<context name="Identifier" fallthroughContext="Elements" fallthrough="true">
<DetectChar char=""" context="DoubleQuotedIdentifier" attribute="Identifier" />
<DetectChar char="'" context="SingleQuotedIdentifier" attribute="Identifier" />
<RegExpr String="&unquoted;" attribute="Identifier" context="#stay" />
</context>
<context name="DoubleQuotedLabel" lineEndContext="#stay" attribute="Label" noIndentationBasedFolding="1">
<DetectChar char=""" context="#pop" attribute="Label" />
<DetectChar char="\" context="StringEscape" lookAhead="1" />
</context>
<context name="SingleQuotedLabel" lineEndContext="#stay" attribute="Label" noIndentationBasedFolding="1">
<DetectChar char="'" context="#pop" attribute="Label" />
<DetectChar char="\" context="StringEscape" lookAhead="1" />
</context>
<context name="DoubleQuotedValue" lineEndContext="#stay" attribute="Value" noIndentationBasedFolding="1">
<DetectChar char=""" context="#pop#pop" attribute="Value" />
<DetectChar char="\" context="StringEscape" lookAhead="1" />
</context>
<context name="SingleQuotedValue" lineEndContext="#stay" attribute="Value" noIndentationBasedFolding="1">
<DetectChar char="'" context="#pop#pop" attribute="Value" />
<DetectChar char="\" context="StringEscape" lookAhead="1" />
</context>
<context name="DoubleQuotedIdentifier" lineEndContext="#stay" attribute="Identifier" noIndentationBasedFolding="1">
<DetectChar char=""" context="#pop" attribute="Identifier" />
<DetectChar char="\" context="StringEscape" lookAhead="1" />
</context>
<context name="SingleQuotedIdentifier" lineEndContext="#stay" attribute="Identifier" noIndentationBasedFolding="1">
<DetectChar char="'" context="#pop" attribute="Identifier" />
<DetectChar char="\" context="StringEscape" lookAhead="1" />
</context>
<context name="StringEscape" lineEndContext="#stay">
<RegExpr String="&escapeSequence;" context="#pop" attribute="EscapeSequence" />
<RegExpr String="\\(u[0-9a-fA-f]+|.)?" context="#pop" attribute="Error" />
</context>
<context name="OptionalDelimitingSpace" lineEndContext="#stay">
<RegExpr String="#.*$" attribute="Comment" />
<RegExpr String="&ignoredLine;" attribute="Comment" column="0"/>
<RegExpr String="^&nonSpace;" column="0" lookAhead="true" context="Error"/>
<RegExpr String="&space;+" attribute="Space" />
</context>
<context name="PropertyValue" lineEndContext="#stay" attribute="Error">
<IncludeRules context="OptionalDelimitingSpace" />
<RegExpr String=""" attribute="Value" context="DoubleQuotedValue" />
<RegExpr String="'" attribute="Value" context="SingleQuotedValue" />
<keyword String="Boolean" context="#pop" attribute="Boolean" />
<RegExpr String="-?\b([1-9][0-9]*\.[0-9]+(?:[eE][+-]?[0-9]+)?)" context="#pop" attribute="Number" />
<RegExpr String="-?\b(0\b|[1-9][0-9]*(?:[eE][+-]?[0-9]+)?)" context="#pop" attribute="Number" />
<RegExpr attribute="UnquotedValue" attribute="Value" context="#pop" String="&unquotedStart;[^&reserved;,]*" />
</context>
</contexts>
<itemDatas>
<itemData name="Error" defStyleNum="dsError" />
<itemData name="Space" defStyleNum="dsNormal" />
<itemData name="Identifier" defStyleNum="dsString" />
<itemData name="Label" defStyleNum="dsAttribute" />
<itemData name="PropertyKey" defStyleNum="dsFunction" />
<itemData name="Direction" defStyleNum="dsOperator" />
<itemData name="Comma" defStyleNum="dsOperator" />
<itemData name="Value" defStyleNum="dsSpecialString" />
<itemData name="UnquotedValue" defStyleNum="dsString" />
<itemData name="EscapeSequence" defStyleNum="dsSpecialChar" />
<itemData name="Number" defStyleNum="dsDecVal" />
<itemData name="Boolean" defStyleNum="dsKeyword" />
<itemData name="Comment" defStyleNum="dsComment" />
</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>