source: PSPA/madxPSPA/syntax/kate/madx.xml @ 430

Last change on this file since 430 was 430, checked in by touze, 11 years ago

import madx-5.01.00

File size: 19.2 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE language SYSTEM "language.dtd"
3[
4        <!ENTITY funcname "[A-Za-z_:][A-Za-z0-9_:#&#37;@-]*">
5        <!ENTITY varname  "[A-Za-z_][A-Za-z0-9_]*">
6        <!ENTITY word     "[^|&amp;;()&lt;&gt;\s]+">    <!-- see man bash -->
7        <!ENTITY eos      "(?=($|\s))">                 <!-- eol or space following -->
8        <!ENTITY noword   "(?![\w$+-])">                <!-- no word, $, + or - following -->
9]>
10<language name="Mad-X" version="0.1" kateversion="2.4" section="Scientific" extensions="*.madx;*.mad;*.gmad;*.mad8" casesensitive="0" author="Yngve Inntjore Levinsen (ylevinse@cern.ch)" license="LGPL">
11<!-- copy file to ~/.kde/share/apps/katepart/syntax/ -->
12<!-- You must also include the file types in a file association (in system settings) in order to activate the highlighting -->
13<!-- Contact me (Yngve) if any problems/bugs arise -->
14  <highlighting>
15<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
16<!-- *                              L I S T S                            *  -->
17<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
18        <list name="datatypes">
19      <item> float </item>
20      <item> real </item>
21      <item> const </item>
22        </list>
23    <list name="commands">
24      <item> assign </item>
25      <item> beam </item>
26      <item> call </item>
27      <item> cycle </item>
28          <item> endedit </item>
29      <item> endmatch </item>
30      <item> exec </item>
31      <item> global </item>
32      <item> lmdif </item>
33      <item> makethin </item>
34      <item> match </item>
35      <item> option </item>
36          <item> plot </item>
37          <item> print </item>
38      <item> ptc_create_universe </item>
39      <item> ptc_create_layout </item>
40      <item> ptc_align </item>
41      <item> ptc_start </item>
42      <item> ptc_end </item>
43      <item> ptc_twiss </item>
44      <item> ptc_track </item>
45      <item> savebeta </item>
46      <item> select </item>
47      <item> set </item>
48      <item> seqedit </item>
49      <item> setplot </item>
50      <item> show </item>
51      <item> sixtrack </item>
52      <item> stop </item>
53      <item> system </item>
54      <item> title </item>
55      <item> twiss </item>
56          <item> use </item>
57      <item> value </item>
58      <item> vary </item>
59    </list>
60        <!-- Keywords for creation of new elements, ... ; -->
61        <list name="beam_keywords">
62                <item> sequence </item>
63                <item> particle </item>
64                <item> mass </item>
65                <item> charge </item>
66                <item> energy </item>
67                <item> gamma </item>
68                <item> sigt </item>
69                <item> sige </item>
70                <item> kbunch </item>
71                <item> npart </item>
72                <item> bcurrent </item>
73                <item> bunched </item>
74                <item> pc  </item>
75                <item> exn </item>
76                <item> ex </item>
77                <item> eyn </item>
78                <item> ey </item>
79                <item> et </item>
80        </list>
81        <list name="beam_attributes">
82                <item> electron </item>
83                <item> proton </item>
84        </list>
85        <list name="ptc_keywords">
86                <item> icase </item>
87                <item> deltap </item>
88                <item> turns </item>
89                <item> maxaper </item>
90                <item> norm </item>
91                <item> file </item>
92                <item> ffile </item>
93                <item> model </item>
94                <item> method </item>
95                <item> nst </item>
96                <item> x </item>
97                <item> y </item>
98                <item> px </item>
99                <item> py </item>
100        </list>
101        <list name="ptc_attributes">
102                <item> exact </item>
103                <item> dump </item>
104                <item> closed_orbit </item>
105                <item> element_by_element </item>
106                <item> norm_out </item>
107                <item> radiation </item>
108                <item> radiation_model1 </item>
109                <item> radiation_energy_loss </item>
110                <item> radiation_quadr </item>
111                <item> beam_envelope </item>
112                <item> space_charge </item>
113        </list>
114        <list name="element_keywords">
115                <item> angle  </item>
116                <item> k1 </item>
117                <item> k2 </item>
118                <item> l </item>
119                <item> e1 </item>
120                <item> e2 </item>
121        </list>
122        <list name="element_attributes">
123        </list>
124        <!-- Common keywords for all commands-->
125        <list name="keywords">
126                <item> file </item>
127        </list>
128        <list name="attributes">
129        </list>
130        <!-- Keywords in twiss, ... ; -->
131        <list name="twiss_keywords">
132                <item> sequence </item>
133                <item> chrom </item>
134                <item> deltap </item>
135                <item> marker_plot </item>
136                <item> save </item>
137        </list>
138        <list name="twiss_attributes">
139                <item> alfx </item>
140                <item> alfy </item>
141                <item> betx </item>
142                <item> bety </item>
143                <item> dx </item>
144                <item> dy </item>
145                <item> dpx </item>
146                <item> dpy </item>
147                <item> pt </item>
148                <item> x </item>
149                <item> y </item>
150        </list>
151        <!-- Keywords in plot, ... ; -->
152        <list name="plot_keywords">
153                <item> colour </item>
154                <item> haxis </item>
155                <item> range </item>
156                <item> table </item>
157                <item> vmin </item>
158                <item> vmax </item>
159                <item> vaxis1 </item>
160                <item> vaxis2 </item>
161    </list>
162        <list name="plot_attributes">
163                <item> alfx </item>
164                <item> alfy </item>
165                <item> betx </item>
166                <item> bety </item>
167                <item> dx </item>
168                <item> dy </item>
169                <item> dpx </item>
170                <item> dpy </item>
171                <item> ptc_twiss </item>
172                <item> rbetx </item>
173                <item> rbety </item>
174                <item> twiss </item>
175                <item> x </item>
176                <item> y </item>
177                <item> s </item>
178                <item> aper_1 </item>
179                <item> aper_2 </item>
180                <item> aper_3 </item>
181                <item> aper_4 </item>
182    </list>
183        <!-- Keywords in savebeta, ... ; -->
184        <list name="savebeta_keywords">
185                <item> label </item>
186                <item> place </item>
187        </list>
188        <list name="savebeta_attributes">
189        </list>
190        <!-- Keywords in select, ... ; -->
191        <list name="select_keywords">
192                <item> clear </item>
193                <item> column </item>
194                <item> flag </item>
195                <item> pattern </item>
196        </list>
197        <list name="select_attributes">
198                <item> alfx </item>
199                <item> alfy </item>
200                <item> betx </item>
201                <item> bety </item>
202                <item> dx </item>
203                <item> dy </item>
204                <item> dpx </item>
205                <item> dpy </item>
206                <item> keyword </item>
207                <item> mux </item>
208                <item> muy </item>
209                <item> name </item>
210                <item> ptc_twiss </item>
211                <item> px </item>
212                <item> py </item>
213                <item> twiss </item>
214                <item> x </item>
215                <item> y </item>
216                <item> s </item>
217                <item> aper_1 </item>
218                <item> aper_2 </item>
219                <item> aper_3 </item>
220                <item> aper_4 </item>
221                <item> n1 </item>
222                <item> xtol </item>
223        </list>
224        <!-- Keywords in setplot, ... ; -->
225        <list name="setplot_keywords">
226                <item> ascale </item>
227                <item> font </item>
228                <item> lwidth </item>
229                <item> post </item>
230                <item> rscale </item>
231                <item> sscale </item>
232                <item> xsize </item>
233                <item> ysize </item>
234    </list>
235        <list name="setplot_attributes">
236    </list>
237        <!-- Keywords in sequence, ... ; -->
238        <list name="savebeta_keywords">
239                <item> label </item>
240                <item> place </item>
241        </list>
242        <list name="savebeta_attributes">
243        </list>
244        <!-- Keywords in use, ... ; -->
245        <list name="use_keywords">
246                <item> period </item>
247                <item> range  </item>
248                <item> sequence </item>
249        </list>
250        <list name="use_attributes">
251        </list>
252
253<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
254<!-- *                           C O N T E X T S                         *  -->
255<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
256        <contexts>
257                <context attribute="Normal Text" lineEndContext="#stay" name="default" >
258                        <IncludeRules context="find_alerts" />
259                        <IncludeRules context="find_comments" />
260                        <IncludeRules context="find_strings" />
261                        <IncludeRules context="find_varnames" />
262                        <IncludeRules context="find_commands" />
263                        <IncludeRules context="find_names" />
264                        <IncludeRules context="find_numbers" />
265                        <keyword attribute="Data Type" context="#stay" String="datatypes"/>
266                </context>
267<!--************************END OF THE MAIN CONTEXT*************************-->
268
269
270<!-- The following context matches integer and real numbers -->
271      <context attribute="Normal Text" lineEndContext="#stay" name="find_numbers">
272        <!-- Floating-point numbers with optional kind -->
273                <RegExpr attribute="Normal" context="#stay" String="[+-]?[0-9]*\.[0-9]+\.[0-9]+" insensitive="TRUE"/>
274                <RegExpr context="#pop" String="[A-Za-z]+[0-9]+[A-Za-z0-9]*" insensitive="TRUE"/>
275        <RegExpr attribute="Float" context="#stay" String="[+-]?[0-9]*\.[0-9]+([de][+-]?[0-9]+)?([_]([0-9]+|[a-z][\w_]*))?" insensitive="TRUE"/>
276        <RegExpr attribute="Float" context="#stay" String="[+-]?[0-9]+\.[0-9]*([de][+-]?[0-9]+)?([_]([0-9]+|[a-z][\w_]*))?(?![a-z])" insensitive="TRUE"/>
277        <RegExpr attribute="Float" context="#stay" String="\b[0-9]+[de][+-]?[0-9]+([_]([0-9]+|[a-z][\w_]*))?" insensitive="TRUE"/>
278        <!-- Integers with optional kind specifier -->
279        <RegExpr attribute="Decimal" context="#stay" String="[+-]?[0-9]+([_]([0-9]+|[a-zA-Z][\w_]*))?"/>
280        <!-- Integers in binary, octal and hexadecimal notations -->
281        <RegExpr attribute="Decimal" context="#stay" String="\b[bozx]([&apos;][0-9a-f]+[&apos;]|[&quot;][0-9a-f]+[&quot;])" insensitive="TRUE"/>
282      </context>
283         
284<!-- This context highlights warnings -->
285        <context attribute="Normal Text" lookAhead="true" lineEndContext="#stay" name="find_alerts">
286                <RegExpr attribute="Alert" context="#stay" String="(warning|todo)" insensitive="true"/>
287        </context>
288
289<!-- This context highlights element names -->
290        <context attribute="Normal Text" lineEndContext="#stay" name="find_names">
291                <RegExpr attribute="ElementNames" context="#stay" String="[A-Za-z][A-Za-z0-9]*\.[A-Za-z0-9]+\.[A-Za-z0-9]+\.[A-Za-z0-9]+"/>
292                <RegExpr attribute="ElementNames" context="#stay" String="[A-Za-z][A-Za-z0-9]*\.[A-Za-z0-9]+\.[A-Za-z0-9]+"/>
293                <RegExpr attribute="ElementNames" context="#stay" String="[A-Za-z][A-Za-z0-9]*\.[A-Za-z0-9]+"/>
294                <RegExpr attribute="ElementNames" context="#stay" String="[A-Za-z][A-Za-z0-9]*\_[A-Za-z0-9]*"/>
295                <RegExpr attribute="ElementNames" context="#stay" String="[iI][pP][0-9]+"/>
296                <IncludeRules context="find_numbers" />
297        </context>
298
299<!-- This context highlights comments -->
300      <context attribute="Normal Text" lineEndContext="#stay" name="find_comments">
301        <RegExpr attribute="Comment" context="ShortComment" String="!"/>
302                <RegExpr attribute="Comment" context="ShortComment" String="//"/>
303                <Detect2Chars attribute="Comment" context="LongComment" char="/" char1="*" beginRegion="LongComment"/>
304      </context>
305        <context name="ShortComment" attribute="Comment" lineEndContext="#pop" endRegion="ShortComment" noIndentationBasedFolding="true">
306                <IncludeRules context="find_alerts" />
307<!--            <HlCChar attribute="Comment" context="#stay"/> -->
308        </context>
309        <context name="LongComment" attribute="Comment" lineEndContext="#stay" noIndentationBasedFolding="true">
310<!--            <HlCChar attribute="Comment" context="#stay"/> -->
311                <IncludeRules context="find_alerts" />
312                <Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="LongComment"/>
313        </context>
314       
315<!-- The following four contexts implement the complex string multi-line declarations -->
316      <!-- Matches STRINGS (there are 2 types of strings: '...' and "...") -->
317      <context attribute="String" lineEndContext="#stay" name="find_strings">
318        <DetectChar attribute="String" context="string_1" char="&apos;"/>
319        <DetectChar attribute="String" context="string_2" char="&quot;"/>
320      </context>
321
322      <context attribute="String" lineEndContext="#stay" name="string_1" fallthrough="true" fallthroughContext="#pop">
323        <RegExpr attribute="String" context="#pop" String="[^&apos;]*&apos;"/>
324        <RegExpr attribute="Keyword" context="end_of_string" String="&amp;\s*$"/>
325        <RegExpr attribute="String" context="end_of_string" String=".*(?=&amp;\s*$)"/>
326      </context>
327
328      <context attribute="String" lineEndContext="#stay" name="string_2" fallthrough="true" fallthroughContext="#pop">
329        <RegExpr attribute="String" context="#pop" String="[^&quot;]*&quot;"/>
330        <RegExpr attribute="Keyword" context="end_of_string" String="&amp;\s*$"/>
331        <RegExpr attribute="String" context="end_of_string" String=".*(?=&amp;\s*$)"/>
332      </context>
333
334      <context attribute="String" lineEndContext="#stay" name="end_of_string" fallthrough="true" fallthroughContext="#pop#pop">
335        <DetectSpaces />
336        <RegExpr attribute="Keyword" context="#stay" String="&amp;\s*$"/>
337        <DetectChar attribute="Keyword" context="#pop" char="&amp;" firstNonSpace="true"/>
338        <RegExpr attribute="Comment" context="#stay" String="(!.*)?$" firstNonSpace="true"/>
339      </context>
340         
341                <context attribute="String" lineEndContext="#stay" name="find_commands" >
342                        <RegExpr attribute="Command" context="find_command_option" String="\boption\s*[,]" insensitive="TRUE"/>
343                        <RegExpr attribute="Command" context="find_command_plot" String="\bplot\s*[,]" insensitive="TRUE"/>
344                        <RegExpr attribute="Command" context="find_command_savebeta" String="savebeta\s*[,]" insensitive="TRUE"/>
345                        <RegExpr attribute="Command" context="find_command_select" String="select\s*[,]" insensitive="TRUE"/>
346                        <RegExpr attribute="Command" context="find_command_setplot" String="\bsetplot\s*[,]" insensitive="TRUE"/>
347                        <RegExpr attribute="Command" context="find_command_twiss" String="\btwiss\s*[,]" insensitive="TRUE"/>
348                        <RegExpr attribute="Command" context="find_command_use" String="\buse\s*[,]" insensitive="TRUE"/>
349                        <RegExpr attribute="Command" context="find_command_beam" String="\bbeam\s*[,]" insensitive="TRUE"/>
350                        <RegExpr attribute="Command" context="find_command_ptc" String="\bptc_[a-z\_]*\s*[,]" insensitive="TRUE"/>
351                        <keyword attribute="Command" context="find_command_parent" String="commands"/>
352                </context>
353               
354                <!-- This context matches content in command statements (one for each command) -->
355                <context attribute="Normal Text" lineEndContext="#stay" name="find_command_parent">
356                        <keyword attribute="CommandParameters"  context="#stay" String="keywords"/>
357                        <keyword attribute="CommandAttributes"  context="#stay" String="attributes"/>
358                        <DetectChar attribute="Command" context="#pop" char=";"/>
359                        <IncludeRules context="find_strings" />
360                        <IncludeRules context="find_names" />
361                        <IncludeRules context="find_numbers" />
362                </context>
363                <context attribute="Normal Text" lineEndContext="#stay" name="find_command_option">
364                        <RegExpr attribute="Option Off"  context="#stay" String="(\-echo|\-warn|\-info|\-verify)"/>
365                        <RegExpr attribute="CommandParameters"  context="#stay" String="(echo|warn|info|verify)"/>
366                        <DetectChar attribute="Command" context="#pop" char=";"/>
367                </context>
368                <context attribute="Normal Text" lineEndContext="#stay" name="find_command_plot">
369                        <keyword attribute="CommandParameters"  context="#stay" String="plot_keywords"/>
370                        <IncludeRules context="find_names" />
371                        <keyword attribute="CommandAttributes"  context="#stay" String="plot_attributes"/>
372                        <IncludeRules context="find_command_parent"/>
373                </context>
374                <context attribute="Normal Text" lineEndContext="#stay" name="find_command_savebeta">
375                        <IncludeRules context="find_command_parent"/>
376                        <keyword attribute="CommandParameters"  context="#stay" String="savebeta_keywords"/>
377                        <keyword attribute="CommandAttributes"  context="#stay" String="savebeta_attributes"/>
378                </context>
379                <context attribute="Normal Text" lineEndContext="#stay" name="find_command_select">
380                        <IncludeRules context="find_command_parent"/>
381                        <keyword attribute="CommandParameters"  context="#stay" String="select_keywords"/>
382                        <keyword attribute="CommandAttributes"  context="#stay" String="select_attributes"/>
383                </context>
384                <context attribute="Normal Text" lineEndContext="#stay" name="find_command_setplot">
385                        <IncludeRules context="find_command_parent"/>
386                        <keyword attribute="CommandParameters"  context="#stay" String="setplot_keywords"/>
387                        <keyword attribute="CommandAttributes"  context="#stay" String="setplot_attributes"/>
388                </context>
389                <context attribute="Normal Text" lineEndContext="#stay" name="find_command_twiss">
390                        <IncludeRules context="find_command_parent"/>
391                        <keyword attribute="CommandParameters"  context="#stay" String="twiss_keywords"/>
392                        <keyword attribute="CommandAttributes"  context="#stay" String="twiss_attributes"/>
393                </context>
394                <context attribute="Normal Text" lineEndContext="#stay" name="find_command_use">
395                        <IncludeRules context="find_command_parent"/>
396                        <keyword attribute="CommandParameters"  context="#stay" String="use_keywords"/>
397                        <keyword attribute="CommandAttributes"  context="#stay" String="use_attributes"/>
398                </context>
399                <context attribute="Normal Text" lineEndContext="#stay" name="find_command_beam">
400                        <IncludeRules context="find_command_parent"/>
401                        <keyword attribute="CommandParameters"  context="#stay" String="beam_keywords"/>
402                        <keyword attribute="CommandAttributes"  context="#stay" String="beam_attributes"/>
403                </context>
404                <context attribute="Normal Text" lineEndContext="#stay" name="find_command_ptc">
405                        <IncludeRules context="find_command_parent"/>
406                        <keyword attribute="CommandParameters"  context="#stay" String="ptc_keywords"/>
407                        <keyword attribute="CommandAttributes"  context="#stay" String="ptc_attributes"/>
408                </context>
409               
410                <context attribute="Normal Text" lineEndContext="#stay" name="find_varnames">
411                        <!-- handle variable assignments -->
412                        <RegExpr attribute="Varname" context="#stay" String="[A-Za-z0-9\_\-]+\s*:?=" />
413                        <RegExpr attribute="ElementNames" context="newElement" String="[A-Za-z][A-Za-z0-9]*:"/>
414                </context>
415                <context name="newElement" attribute="ElementTypes" lineEndContext="#stay" noIndentationBasedFolding="true">
416                        <HlCChar attribute="ElementTypes" context="#stay"/>
417                        <DetectChar attribute="Normal Text" context="thisElement" char="," endRegion="newElement"/>
418                        <DetectChar attribute="Normal Text" context="#pop" char="="/>
419                        <DetectChar attribute="Normal Text" context="#pop" char=","/>
420                        <DetectChar attribute="Normal Text" context="#pop#pop" char=";"/>
421                </context>
422                <context name="thisElement" attribute="Normal Text" lineEndContext="#stay" noIndentationBasedFolding="true">
423                        <keyword attribute="CommandParameters"  context="#stay" String="element_keywords"/>
424                        <keyword attribute="CommandAttributes"  context="#stay" String="element_attributes"/>
425                        <DetectChar attribute="Normal Text" context="#pop#pop" char=";"/>
426                        <IncludeRules context="find_strings" />
427<!--                    <IncludeRules context="find_numbers" /> -->
428                        <IncludeRules context="find_names" />
429                </context>
430        </contexts>
431
432<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
433<!-- *             S T Y L E   I T E M   D E F I N I T I O N S           *  -->
434<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  -->
435    <itemDatas>
436      <itemData name="Normal Text" defStyleNum="dsNormal"/>
437      <itemData name="Keyword" defStyleNum="dsKeyword"/>
438      <itemData name="Command" defStyleNum="dsKeyword"/>
439      <itemData name="CommandParameters" defStyleNum="dsFunction"/>
440      <itemData name="CommandAttributes" defStyleNum="dsNormal" color="#802000"/>
441      <itemData name="ElementNames" defStyleNum="dsKeyword" color="#008000" selColor="#ff00ff" bold="1" italic="0"/>
442      <itemData name="ElementTypes" defStyleNum="dsKeyword" color="#00d000" selColor="#ff00ff" bold="0" italic="0"/>
443      <itemData name="Varname" defStyleNum="dsOthers"/>
444      <itemData name="Option Off" defStyleNum="dsKeyword" color="#900000"/>
445      <itemData name="Data Type" defStyleNum="dsDataType"/>
446      <itemData name="Decimal" defStyleNum="dsDecVal"/>
447      <itemData name="Float" defStyleNum="dsFloat"/>
448      <itemData name="String" defStyleNum="dsString"/>
449      <itemData name="Comment" defStyleNum="dsComment"/>
450      <itemData name="Symbol" defStyleNum="dsNormal"/>
451      <itemData name="Alert" defStyleNum="dsAlert"/>
452    </itemDatas>
453  </highlighting>
454  <general>
455    <comments>
456      <comment name="multiLine" start="/*" end="*/" region="LongComment"/>
457      <comment name="singleLine" start="!"/>
458    </comments>
459    <keywords casesensitive="0"/>
460  </general>
461</language>
Note: See TracBrowser for help on using the repository browser.