blob: 7b755cdbde8c27aa986584ea7969af73151a7379 (
plain)
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
|
<?xml version="1.0"?>
<!--
Author: Jesse van den Kieboom <jesse@icecrew.nl>
Copyright (C) 2007-2008 Jesse van den Kieboom <jesse@icecrew.nl>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
-->
<language id="snippets" name="Snippets" hidden="true" version="2.0">
<styles>
<style id="placeholder-bounds" name="Placeholder begin and end" map-to="def:function"/>
<style id="default-value" name="Default Value" map-to="def:string"/>
<style id="single-placeholder" name="Single Placeholder" map-to="def:decimal"/>
<style id="shell-placeholder" name="Shell Placeholder" map-to="def:preprocessor"/>
<style id="python-placeholder" name="Python Placeholder" map-to="def:preprocessor"/>
<style id="regex-placeholder" name="Regular Expression Placeholder" map-to="def:preprocessor"/>
<style id="tabstop" name="Tabstop" map-to="def:decimal"/>
<style id="placeholder-ref" name="Placeholder Reference" map-to="def:decimal"/>
<style id="placeholder-def" name="Placeholder Default" map-to="def:string"/>
<style id="escape" name="Escape" map-to="def:special-char"/>
<style id="environmental-var" name="Environmental Variable" map-to="def:string"/>
<style id="seperator" name="Seperator" map-to="def:shebang"/>
<style id="regex-pattern" name="Regular Expression Pattern" map-to="def:string"/>
<style id="replace-pattern" name="Regular Expression Replace Pattern" map-to="def:string"/>
<style id="modifier" name="Modifier" map-to="def:keyword"/>
</styles>
<definitions>
<define-regex id="number">[0-9]+</define-regex>
<define-regex id="tabstop">\s*((\%{number})(:))</define-regex>
<define-regex id="number-list" extended="true">\s*(\[(\%{number}(,\%{number})*)\](:))</define-regex>
<define-regex id="environment">\$[A-Z_]+</define-regex>
<define-regex id="regex-pattern">((?:\\[/]|\\}|[^/}])+)</define-regex>
<context id="escape" style-ref="escape">
<match>\\\$</match>
</context>
<context id="single-placeholder" style-ref="single-placeholder">
<match>\$\%{number}|\${\%{number}}</match>
</context>
<context id="simple-placeholder-def" style-ref="default-value">
<start>\${\%{tabstop}</start>
<end>}</end>
<include>
<context sub-pattern="0" style-ref="placeholder-bounds" where="start"/>
<context sub-pattern="0" style-ref="placeholder-bounds" where="end"/>
<context sub-pattern="2" where="start" style-ref="tabstop"/>
<context sub-pattern="3" where="start" style-ref="seperator"/>
<context>
<match>\\}</match>
</context>
<context ref="escape"/>
<context ref="environmental-variable"/>
</include>
</context>
<context id="simple-placeholder">
<include>
<context ref="single-placeholder"/>
<context ref="simple-placeholder-def"/>
</include>
</context>
<context id="shell-placeholder-contents">
<include>
<context ref="escape"/>
<context ref="environmental-variable"/>
<context ref="single-placeholder"/>
</include>
</context>
<context id="shell-placeholder">
<include>
<context style-ref="shell-placeholder">
<start>\$\(\%{tabstop}?</start>
<end>\)</end>
<include>
<context sub-pattern="0" style-ref="placeholder-bounds" where="start"/>
<context sub-pattern="0" style-ref="placeholder-bounds" where="end"/>
<context sub-pattern="2" where="start" style-ref="tabstop"/>
<context sub-pattern="3" where="start" style-ref="seperator"/>
<context ref="shell-placeholder-contents"/>
<context>
<match>\\\)</match>
</context>
</include>
</context>
<context style-ref="shell-placeholder">
<start>`\%{tabstop}?</start>
<end>`</end>
<include>
<context sub-pattern="0" style-ref="placeholder-bounds" where="start"/>
<context sub-pattern="0" style-ref="placeholder-bounds" where="end"/>
<context sub-pattern="2" where="start" style-ref="tabstop"/>
<context sub-pattern="3" where="start" style-ref="seperator"/>
<context ref="shell-placeholder-contents"/>
<context>
<match>\\`</match>
</context>
</include>
</context>
</include>
</context>
<context id="python-placeholder">
<start>\$<\%{tabstop}?\%{number-list}?</start>
<end>></end>
<include>
<context sub-pattern="0" style-ref="placeholder-bounds" where="start"/>
<context sub-pattern="0" style-ref="placeholder-bounds" where="end"/>
<context sub-pattern="2" where="start" style-ref="tabstop"/>
<context sub-pattern="3" where="start" style-ref="seperator"/>
<context sub-pattern="5" where="start" style-ref="tabstop"/>
<context sub-pattern="7" where="start" style-ref="seperator"/>
<context>
<match>\\></match>
</context>
<context ref="escape"/>
<context ref="environmental-variable"/>
<context ref="single-placeholder"/>
<context ref="python:python"/>
</include>
</context>
<context id="regex-placeholder" style-ref="regex-placeholder">
<match>(\${)\%{tabstop}?(?:\s*(?:(\%{number})|(\%{environment})))/\%{regex-pattern}/\%{regex-pattern}(?:[/]([a-zA-Z]*))?(})</match>
<include>
<context sub-pattern="1" style-ref="placeholder-bounds"/>
<context sub-pattern="10" style-ref="placeholder-bounds"/>
<context sub-pattern="3" style-ref="tabstop"/>
<context sub-pattern="4" style-ref="seperator"/>
<context sub-pattern="5" style-ref="tabstop"/>
<context sub-pattern="6" style-ref="environmental-var"/>
<context sub-pattern="7" style-ref="regex-pattern"/>
<context sub-pattern="8" style-ref="replace-pattern"/>
<context sub-pattern="9" style-ref="modifier"/>
</include>
</context>
<context id="environmental-variable" style-ref="environmental-var">
<match>\%{environment}</match>
</context>
<context id="snippets">
<include>
<context ref="escape"/>
<context ref="regex-placeholder"/>
<context ref="simple-placeholder"/>
<context ref="shell-placeholder"/>
<context ref="python-placeholder"/>
<context ref="environmental-variable"/>
</include>
</context>
</definitions>
</language>
|