PageRenderTime 204ms CodeModel.GetById 176ms app.highlight 15ms RepoModel.GetById 9ms app.codeStats 1ms

/jEdit/tags/jedit-4-2-pre14/modes/xsl.xml

#
XML | 435 lines | 309 code | 44 blank | 82 comment | 0 complexity | 5abd106091bc493cabdb64e583aed1c6 MD5 | raw file
  1<?xml version="1.0"?>
  2<!DOCTYPE MODE SYSTEM "xmode.dtd"><!-- 
  3  ======================================================================
  4  Edit mode for XSLT 1.0 and XSLT 2.0
  5  ======================================================================
  6  Token types:
  7
  8  COMMENT1    XML comments
  9  COMMENT2    XPath 2.0 comments - top or nested within COMMENT3
 10  COMMENT3    XPath 2.0 comments - nested within COMMENT2
 11  COMMENT4    Default task names used in Task List
 12  DIGIT       Digits
 13  FUNCTION    Functions
 14  INVALID     -
 15  KEYWORD1    XSLT element names
 16  KEYWORD2    XSLT attribute names
 17  KEYWORD3    Attribute values
 18  KEYWORD4    Axes specifiers
 19  LABEL       Namespace prefixes
 20  LITERAL1    String literals
 21  LITERAL2    Parameter and variable references
 22  LITERAL3    Entity references and processing instructions
 23  LITERAL4    DTD constructs and CDATA sections
 24  MARKUP      Result elements and extension elements
 25  OPERATOR    XPath 2.0 keywords + some other stuff
 26  ======================================================================
 27-->
 28
 29<MODE>
 30
 31  <PROPS>
 32    <PROPERTY NAME="commentStart" VALUE="&lt;!--"/>
 33    <PROPERTY NAME="commentEnd" VALUE="--&gt;"/>
 34  </PROPS>
 35
 36  <RULES HIGHLIGHT_DIGITS="FALSE" IGNORE_CASE="FALSE">
 37
 38    <!-- XML comments -->
 39    <SPAN DELEGATE="TASKS" TYPE="COMMENT1">
 40      <BEGIN>&lt;!--</BEGIN>
 41      <END>--&gt;</END>
 42    </SPAN>
 43
 44    <!-- Assume 'xsl' prefix for XSLT elements -->
 45    <SPAN_REGEXP HASH_CHAR="&lt;" DELEGATE="XSLTAGS" TYPE="KEYWORD2">
 46      <BEGIN>&lt;(?=xsl:)</BEGIN>
 47      <END>&gt;</END>
 48    </SPAN_REGEXP>
 49
 50    <SPAN_REGEXP HASH_CHAR="&lt;" DELEGATE="XSLTAGS" TYPE="KEYWORD2">
 51      <BEGIN>&lt;(?=/xsl:)</BEGIN>
 52      <END>&gt;</END>
 53    </SPAN_REGEXP>
 54
 55    <!-- CDATA marked sections. Reuse common xml mode -->
 56    <SPAN TYPE="KEYWORD2" DELEGATE="xml::CDATA">
 57      <BEGIN>&lt;![CDATA[</BEGIN>
 58      <END>]]&gt;</END>
 59    </SPAN>
 60
 61    <!-- DTD constructs. Reuse common xml mode  -->
 62    <SPAN TYPE="KEYWORD2" DELEGATE="xml::DTD-TAGS">
 63      <BEGIN>&lt;!</BEGIN>
 64      <END>&gt;</END>
 65    </SPAN>
 66    
 67    <!-- Entity references -->
 68    <SPAN TYPE="LITERAL3" NO_WORD_BREAK="TRUE">
 69      <BEGIN>&amp;</BEGIN>
 70      <END>;</END>
 71    </SPAN>
 72    
 73    <!-- Processing instructions -->
 74    <SPAN TYPE="LITERAL3">
 75      <BEGIN>&lt;?</BEGIN>
 76      <END>?&gt;</END>
 77    </SPAN>
 78
 79    <!-- Result elements and extension elements -->
 80    <SPAN DELEGATE="TAGS" TYPE="MARKUP">
 81      <BEGIN>&lt;</BEGIN>
 82      <END>&gt;</END>
 83    </SPAN>
 84  </RULES>
 85
 86  <!-- XML comments -->
 87  <RULES DEFAULT="COMMENT1" IGNORE_CASE="FALSE" SET="TASKS">
 88    <!-- Default task names used in Task List -->
 89    <KEYWORDS>
 90      <COMMENT4>DEBUG:</COMMENT4>
 91      <COMMENT4>DONE:</COMMENT4>
 92      <COMMENT4>FIXME:</COMMENT4>
 93      <COMMENT4>IDEA:</COMMENT4>
 94      <COMMENT4>NOTE:</COMMENT4>
 95      <COMMENT4>QUESTION:</COMMENT4>
 96      <COMMENT4>TODO:</COMMENT4>
 97      <COMMENT4>XXX</COMMENT4>
 98      <COMMENT4>???</COMMENT4>
 99    </KEYWORDS>
100  </RULES>
101  
102  <!-- Result elements and extension elements -->
103  <RULES DEFAULT="MARKUP" HIGHLIGHT_DIGITS="FALSE" NO_WORD_SEP=".-_:" SET="TAGS">
104  
105    <!-- Highlight all AVTs in result attribute values. -->
106    <SPAN TYPE="MARKUP" DELEGATE="AVT">
107      <BEGIN>"</BEGIN>
108      <END>"</END>
109    </SPAN>
110    <SPAN TYPE="MARKUP" DELEGATE="AVT">
111      <BEGIN>'</BEGIN>
112      <END>'</END>
113    </SPAN>
114    
115    <!-- Namespace declarations -->
116    <SEQ TYPE="OPERATOR">xmlns:</SEQ>
117    <!-- Default namespace declaration. Not really used in XSLT -->
118    <SEQ TYPE="OPERATOR">xmlns</SEQ>
119    
120    <!-- Namespace prefixes -->
121    <MARK_PREVIOUS EXCLUDE_MATCH="FALSE" TYPE="LABEL">:</MARK_PREVIOUS>
122
123  </RULES>
124  
125  <!-- AVTs -->
126  <RULES DEFAULT="KEYWORD3" HIGHLIGHT_DIGITS="FALSE" NO_WORD_SEP=".-_:" SET="AVT">
127  
128    <!-- Literal curly braces ({}) must be written as {{ or }} -->
129    <SEQ>{{</SEQ>
130    <SEQ>}}</SEQ><!-- Does nothing. Is overridden by the SPAN below. -->
131    
132    <!-- The AVT itself -->
133    <SPAN DELEGATE="XPATH" TYPE="OPERATOR">
134      <BEGIN>{</BEGIN>
135      <END>}</END>
136    </SPAN>
137    
138    <!-- Entity references -->
139    <SPAN TYPE="LITERAL3" NO_WORD_BREAK="TRUE">
140      <BEGIN>&amp;</BEGIN>
141      <END>;</END>
142    </SPAN>
143
144  </RULES>
145  
146  <!-- XSLT tags -->
147  <RULES DEFAULT="KEYWORD2" HIGHLIGHT_DIGITS="FALSE" NO_WORD_SEP=".-_:" SET="XSLTAGS">
148    
149    <!-- If we spot something that looks like an AVT, assume it is. Lazy, I know... -->
150    <SPAN TYPE="KEYWORD2" DELEGATE="AVT">
151      <BEGIN>"</BEGIN>
152      <END>"</END>
153    </SPAN>
154    <SPAN TYPE="KEYWORD2" DELEGATE="AVT">
155      <BEGIN>'</BEGIN>
156      <END>'</END>
157    </SPAN>
158    
159    <!-- XSLT attributes that contains XPath expressions or match patterns -->
160    <!-- count -->
161    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="c" DELEGATE="XPATH">
162      <BEGIN>count[[:space:]]*=[[:space:]]*"</BEGIN>
163      <END>"</END>
164    </SPAN_REGEXP>
165    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="c" DELEGATE="XPATH">
166      <BEGIN>count[[:space:]]*=[[:space:]]*'</BEGIN>
167      <END>'</END>
168    </SPAN_REGEXP>
169    <!-- from -->
170    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="f" DELEGATE="XPATH">
171      <BEGIN>from[[:space:]]*=[[:space:]]*"</BEGIN>
172      <END>"</END>
173    </SPAN_REGEXP>
174    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="f" DELEGATE="XPATH">
175      <BEGIN>from[[:space:]]*=[[:space:]]*'</BEGIN>
176      <END>'</END>
177    </SPAN_REGEXP>
178    <!-- group-adjacent -->
179    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="g" DELEGATE="XPATH">
180      <BEGIN>group-adjacent[[:space:]]*=[[:space:]]*"</BEGIN>
181      <END>"</END>
182    </SPAN_REGEXP>
183    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="g" DELEGATE="XPATH">
184      <BEGIN>group-adjacent[[:space:]]*=[[:space:]]*'</BEGIN>
185      <END>'</END>
186    </SPAN_REGEXP>
187    <!-- group-by -->
188    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="g" DELEGATE="XPATH">
189      <BEGIN>group-by[[:space:]]*=[[:space:]]*"</BEGIN>
190      <END>"</END>
191    </SPAN_REGEXP>
192    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="g" DELEGATE="XPATH">
193      <BEGIN>group-by[[:space:]]*=[[:space:]]*'</BEGIN>
194      <END>'</END>
195    </SPAN_REGEXP>
196    <!-- group-ending-with -->
197    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="g" DELEGATE="XPATH">
198      <BEGIN>group-ending-with[[:space:]]*=[[:space:]]*"</BEGIN>
199      <END>"</END>
200    </SPAN_REGEXP>
201    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="g" DELEGATE="XPATH">
202      <BEGIN>group-ending-with[[:space:]]*=[[:space:]]*'</BEGIN>
203      <END>'</END>
204    </SPAN_REGEXP>
205    <!-- group-starting-with -->
206    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="g" DELEGATE="XPATH">
207      <BEGIN>group-starting-with[[:space:]]*=[[:space:]]*"</BEGIN>
208      <END>"</END>
209    </SPAN_REGEXP>
210    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="g" DELEGATE="XPATH">
211      <BEGIN>group-starting-with[[:space:]]*=[[:space:]]*'</BEGIN>
212      <END>'</END>
213    </SPAN_REGEXP>
214    <!-- match -->
215    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="m" DELEGATE="XPATH">
216      <BEGIN>match[[:space:]]*=[[:space:]]*"</BEGIN>
217      <END>"</END>
218    </SPAN_REGEXP>
219    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="m" DELEGATE="XPATH">
220      <BEGIN>match[[:space:]]*=[[:space:]]*'</BEGIN>
221      <END>'</END>
222    </SPAN_REGEXP>
223    <!-- select -->
224    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="s" DELEGATE="XPATH">
225      <BEGIN>select[[:space:]]*=[[:space:]]*"</BEGIN>
226      <END>"</END>
227    </SPAN_REGEXP>
228    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="s" DELEGATE="XPATH">
229      <BEGIN>select[[:space:]]*=[[:space:]]*'</BEGIN>
230      <END>'</END>
231    </SPAN_REGEXP>
232    <!-- test -->
233    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="t" DELEGATE="XPATH">
234      <BEGIN>test[[:space:]]*=[[:space:]]*"</BEGIN>
235      <END>"</END>
236    </SPAN_REGEXP>
237    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="t" DELEGATE="XPATH">
238      <BEGIN>test[[:space:]]*=[[:space:]]*'</BEGIN>
239      <END>'</END>
240    </SPAN_REGEXP>
241    <!-- use -->
242    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="u" DELEGATE="XPATH">
243      <BEGIN>use[[:space:]]*=[[:space:]]*"</BEGIN>
244      <END>"</END>
245    </SPAN_REGEXP>
246    <SPAN_REGEXP TYPE="KEYWORD2" HASH_CHAR="u" DELEGATE="XPATH">
247      <BEGIN>use[[:space:]]*=[[:space:]]*'</BEGIN>
248      <END>'</END>
249    </SPAN_REGEXP>
250    
251    <!-- Namespace declarations -->
252    <SEQ TYPE="OPERATOR">xmlns:</SEQ>
253    <!-- Default namespace declaration. Not really used in XSLT -->
254    <SEQ TYPE="OPERATOR">xmlns</SEQ>
255    
256    <!-- Namespace prefixes -->
257    <MARK_PREVIOUS EXCLUDE_MATCH="FALSE" TYPE="LABEL">:</MARK_PREVIOUS>
258    
259    <!-- XSLT 2.0 element names -->
260    <KEYWORDS>
261      <KEYWORD1>analyze-string</KEYWORD1>
262      <KEYWORD1>apply-imports</KEYWORD1>
263      <KEYWORD1>apply-templates</KEYWORD1>
264      <KEYWORD1>attribute</KEYWORD1>
265      <KEYWORD1>attribute-set</KEYWORD1>
266      <KEYWORD1>call-template</KEYWORD1>
267      <KEYWORD1>character-map</KEYWORD1>
268      <KEYWORD1>choose</KEYWORD1>
269      <KEYWORD1>comment</KEYWORD1>
270      <KEYWORD1>copy</KEYWORD1>
271      <KEYWORD1>copy-of</KEYWORD1>
272      <KEYWORD1>date-format</KEYWORD1>
273      <KEYWORD1>decimal-format</KEYWORD1>
274      <KEYWORD1>element</KEYWORD1>
275      <KEYWORD1>fallback</KEYWORD1>
276      <KEYWORD1>for-each</KEYWORD1>
277      <KEYWORD1>for-each-group</KEYWORD1>
278      <KEYWORD1>function</KEYWORD1>
279      <KEYWORD1>if</KEYWORD1>
280      <KEYWORD1>import</KEYWORD1>
281      <KEYWORD1>import-schema</KEYWORD1>
282      <KEYWORD1>include</KEYWORD1>
283      <KEYWORD1>key</KEYWORD1>
284      <KEYWORD1>matching-substring</KEYWORD1>
285      <KEYWORD1>message</KEYWORD1>
286      <KEYWORD1>namespace</KEYWORD1>
287      <KEYWORD1>namespace-alias</KEYWORD1>
288      <KEYWORD1>next-match</KEYWORD1>
289      <KEYWORD1>non-matching-substring</KEYWORD1>
290      <KEYWORD1>number</KEYWORD1>
291      <KEYWORD1>otherwise</KEYWORD1>
292      <KEYWORD1>output</KEYWORD1>
293      <KEYWORD1>output-character</KEYWORD1>
294      <KEYWORD1>param</KEYWORD1>
295      <KEYWORD1>preserve-space</KEYWORD1>
296      <KEYWORD1>processing-instruction</KEYWORD1>
297      <KEYWORD1>result-document</KEYWORD1>
298      <KEYWORD1>sequence</KEYWORD1>
299      <KEYWORD1>sort</KEYWORD1>
300      <KEYWORD1>sort-key</KEYWORD1>
301      <KEYWORD1>strip-space</KEYWORD1>
302      <KEYWORD1>stylesheet</KEYWORD1>
303      <KEYWORD1>template</KEYWORD1>
304      <KEYWORD1>text</KEYWORD1>
305      <KEYWORD1>transform</KEYWORD1>
306      <KEYWORD1>value-of</KEYWORD1>
307      <KEYWORD1>variable</KEYWORD1>
308      <KEYWORD1>when</KEYWORD1>
309      <KEYWORD1>with-param</KEYWORD1>
310    </KEYWORDS>
311
312  </RULES>
313
314  <RULES DEFAULT="KEYWORD3" HIGHLIGHT_DIGITS="TRUE" DIGIT_RE="[[:digit:]]+([[:punct:]][[:digit:]]+)?" NO_WORD_SEP=".-_" SET="XPATH">
315    <!-- String literals -->
316    <SPAN TYPE="LITERAL1">
317      <BEGIN>"</BEGIN>
318      <END>"</END>
319    </SPAN>
320    <SPAN TYPE="LITERAL1">
321      <BEGIN>'</BEGIN>
322      <END>'</END>
323    </SPAN>
324    
325    <!-- XPath comments -->
326    <SPAN TYPE="COMMENT2" DELEGATE="XPATHCOMMENT2">
327      <BEGIN>(:</BEGIN>
328      <END>:)</END>
329    </SPAN>
330    
331    <!-- Axes specifiers -->
332    <MARK_PREVIOUS TYPE="KEYWORD4" EXCLUDE_MATCH="FALSE">::</MARK_PREVIOUS>
333    <!-- Abbreviated 'attribute::' -->
334    <SEQ TYPE="KEYWORD4">@</SEQ>
335    
336    <!-- XPath 2.0 operators + some other stuff -->
337    <!-- Comparison expressions -->
338    <SEQ TYPE="OPERATOR">=</SEQ>
339    <SEQ TYPE="OPERATOR">!=</SEQ>
340    <SEQ TYPE="OPERATOR">&gt;</SEQ>
341    <SEQ TYPE="OPERATOR">&amp;gt;</SEQ><!-- Treat as operator -->
342    <SEQ TYPE="OPERATOR">&amp;lt;</SEQ><!-- Treat as operator -->
343    <!-- Optional occurrence indicator -->
344    <SEQ TYPE="OPERATOR">?</SEQ>
345    <!-- Addition operator, one-or-more occurrence indicator-->
346    <SEQ TYPE="OPERATOR">+</SEQ>
347    <!-- Multiplication operator, zero-or-more occurrence indicator, node test -->
348    <SEQ TYPE="OPERATOR">*</SEQ>
349    <!-- Path expression step separator -->
350    <SEQ TYPE="OPERATOR">/</SEQ>
351    <!-- Union operator -->
352    <SEQ TYPE="OPERATOR">|</SEQ>
353    <!-- Sequence expression item separator -->
354    <SEQ TYPE="OPERATOR">,</SEQ>
355    
356    <!-- Predicates -->
357    <SPAN TYPE="OPERATOR" DELEGATE="XPATH">
358      <BEGIN>[</BEGIN>
359      <END>]</END>
360    </SPAN>
361    
362    <!-- Entity references -->
363    <SPAN TYPE="LITERAL3" NO_WORD_BREAK="TRUE">
364      <BEGIN>&amp;</BEGIN>
365      <END>;</END>
366    </SPAN>
367
368    <!-- Namespace prefixes -->
369    <MARK_PREVIOUS TYPE="LABEL" EXCLUDE_MATCH="FALSE">:</MARK_PREVIOUS>
370    
371    <!-- Functions -->
372    <MARK_PREVIOUS TYPE="FUNCTION" EXCLUDE_MATCH="TRUE">(</MARK_PREVIOUS>
373    
374    <!-- Variables -->
375    <MARK_FOLLOWING TYPE="LITERAL2">$</MARK_FOLLOWING>
376    <!-- XPath 2.0 keywords + some other stuff -->
377    <KEYWORDS>
378      <!-- Keywords -->
379      <OPERATOR>and</OPERATOR>
380      <OPERATOR>as</OPERATOR>
381      <OPERATOR>castable</OPERATOR>
382      <OPERATOR>div</OPERATOR>
383      <OPERATOR>else</OPERATOR>
384      <OPERATOR>eq</OPERATOR>
385      <OPERATOR>every</OPERATOR>
386      <OPERATOR>except</OPERATOR>
387      <OPERATOR>for</OPERATOR>
388      <OPERATOR>ge</OPERATOR>
389      <OPERATOR>gt</OPERATOR>
390      <OPERATOR>idiv</OPERATOR>
391      <OPERATOR>if</OPERATOR>
392      <OPERATOR>in</OPERATOR>
393      <OPERATOR>instance</OPERATOR>
394      <OPERATOR>intersect</OPERATOR>
395      <OPERATOR>is</OPERATOR>
396      <OPERATOR>isnot</OPERATOR>
397      <OPERATOR>le</OPERATOR>
398      <OPERATOR>lt</OPERATOR>
399      <OPERATOR>mod</OPERATOR>
400      <OPERATOR>nillable</OPERATOR>
401      <OPERATOR>ne</OPERATOR>
402      <OPERATOR>of</OPERATOR>
403      <OPERATOR>or</OPERATOR>
404      <OPERATOR>return</OPERATOR>
405      <OPERATOR>satisfies</OPERATOR>
406      <OPERATOR>some</OPERATOR>
407      <OPERATOR>then</OPERATOR>
408      <OPERATOR>to</OPERATOR>
409      <OPERATOR>treat</OPERATOR>
410      <OPERATOR>union</OPERATOR>
411      
412      <!-- Subtraction operator -->
413      <OPERATOR>-</OPERATOR>
414
415    </KEYWORDS>
416
417  </RULES>
418  
419  <!-- XPath comments - top or nested within COMMENT3 -->
420  <RULES DEFAULT="COMMENT2" SET="XPATHCOMMENT2">
421    <SPAN TYPE="COMMENT3" DELEGATE="XPATHCOMMENT3">
422      <BEGIN>(:</BEGIN>
423      <END>:)</END>
424    </SPAN>
425  </RULES>
426  
427  <!-- XPath comments - nested within COMMENT2 -->
428  <RULES DEFAULT="COMMENT3" SET="XPATHCOMMENT3">
429    <SPAN TYPE="COMMENT2" DELEGATE="XPATHCOMMENT2">
430      <BEGIN>(:</BEGIN>
431      <END>:)</END>
432    </SPAN>
433  </RULES>
434
435</MODE>