Debian Codegraph @

data/syntax/roff.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE language
3 [
4 <!ENTITY roffidc "[^]\s]">
5 <!ENTITY roffid "(?:&roffidc;|\(&roffidc;{2}|\[&roffidc;+\])">
6 <!ENTITY roffnum "([0-9]+)">
7 <!ENTITY argsep1 "([^\\]|\\[&#37; |\^{}'`\-!?@)/,&amp;:~0E_acdeprtu])">
8 <!ENTITY argsep2 "([^\\0-9]|\\[&#37;:{}'`\-_!@/cep])">
9
10 <!ENTITY font1 "\\[fF]&roffid;">
11 <!ENTITY font2 "\\f([0-9]|\([0-9][0-9]|\[[0-9]+\])">
12 <!ENTITY font3 "\\s(\[([1-3][0-9]|[04-9])\]|[04-9]|[+-][0-9]|([+-]?\(|\([+-])[0-9][0-9])">
13
14 <!ENTITY escape1 "\\(\$[0-9*@]|[.:&#37; |^{}_!?@)/,&amp;:~0acdeEprtu])">
15 <!ENTITY escape2 "\\[gkmMVYz]&roffid;">
16 <!ENTITY escape3 "\\O([0-4]|\[5[lrci][^]]\])">
17 ]>
18 <language name="Roff" section="Markup" version="9" kateversion="5.0" extensions="" author="Matthew Woehlke ([email protected])" license="GPL">
19
20 <highlighting>
21
22 <list name="layout">
23 <item>br</item>
24 <item>sp</item>
25 </list>
26
27 <list name="formatting">
28 </list>
29
30 <list name="gnuext">
31 </list>
32
33 <contexts>
34
35 <!-- root context -->
36 <context name="Normal" attribute="Normal Text" lineEndContext="#stay">
37 <IncludeRules context="DetectComments"/>
38 <DetectChar attribute="Other Macros" context="DetectDirective" char="." column="0"/>
39 <IncludeRules context="DetectOthers"/>
40 </context>
41
42 <context name="DetectComments" attribute="Normal Text" lineEndContext="#stay">
43 <RegExpr attribute="Comment" context="Comment" String="^\.\s*\\&quot;" column="0"/>
44 <Detect2Chars attribute="Comment" context="Comment" char="\" char1="&quot;"/>
45 <Detect2Chars attribute="Comment" context="Comment" char="\" char1="#"/>
46 </context>
47
48 <!-- catch glyphc, registers, strings, etc -->
49 <context name="DetectOthers" attribute="Normal Text" lineEndContext="#stay">
50 <IncludeRules context="DetectComments"/>
51 <DetectChar attribute="Escape" context="DetectEscape" char="\" lookAhead="true"/>
52 <DetectChar attribute="String" context="String" char="&quot;"/>
53 </context>
54
55 <!-- detect escapes -->
56 <context name="DetectEscape" attribute="Error" lineEndContext="#pop">
57 <RegExpr attribute="Register" context="#pop" String="\\(\*|n[+-]?)&roffid;"/>
58 <RegExpr attribute="Font" context="#pop" String="&font1;|&font2;|&font3;"/>
59 <Detect2Chars attribute="Escape" context="#pop" char="\" char1="\"/>
60 <RegExpr attribute="Escape" context="Argument" String="\\[ABDXZbow]&argsep1;"/>
61 <RegExpr attribute="Escape" context="#pop" String="&escape1;|&escape2;|&escape3;"/>
62 <RegExpr attribute="Escape" context="Measurement" String="(?|\\[hHSvx]&argsep1;|\\[lL]&argsep1;\|?)"/> <!-- TODO - optional trailing &glyph; -->
63 <RegExpr attribute="Escape" context="Argument" String="\\R&argsep1;"/> <!-- TODO - &roffid; (register), measurement -->
64 <RegExpr attribute="Glyph" context="GlyphArgument" String="\\C&argsep1;"/>
65 <RegExpr attribute="Glyph" context="#pop" String="\\N&argsep2;[0-9]+\1|\\&roffid;"/>
66 <LineContinue attribute="Escape" context="#pop" char="\"/>
67 <DetectChar attribute="Error" context="#pop" char="\"/>
68 </context>
69
70 <!-- directive start -->
71 <context name="DetectDirective" attribute="Other Macros" lineEndContext="#pop">
72 <keyword attribute="Layout Macros" context="Directive" String="layout"/>
73 <keyword attribute="Format Macros" context="Directive" String="formatting"/>
74 <keyword attribute="GNU Macros" context="Directive" String="gnuext"/>
75 <RegExpr attribute="Other Macros" context="dsDirective" String="\s*ds\b" column="1"/>
76 <RegExpr attribute="Other Macros" context="deDirective" String="\s*de\b" column="1" beginRegion="de"/>
77 <RegExpr attribute="Other Macros" context="daDirective" String="\s*da(?=\s+[A-Za-z]+)" column="1" beginRegion="di"/>
78 <RegExpr attribute="Other Macros" context="diDirective" String="\s*di(?=\s+[A-Za-z]+)" column="1" beginRegion="di"/>
79 <RegExpr attribute="Other Macros" context="Directive" String="\s*[A-Za-z]+\b" column="1"/>
80 </context>
81
82 <!-- comment -->
83 <context name="Comment" attribute="Comment" lineEndContext="#pop">
84 <DetectSpaces />
85 <IncludeRules context="##Comments"/>
86 <DetectIdentifier />
87 </context>
88
89 <!-- error -->
90 <context name="Error" attribute="Error" lineEndContext="#stay"/>
91
92 <!-- generic directive -->
93 <context name="Directive" attribute="Identifier" lineEndContext="#pop">
94 <Float attribute="Number" context="#stay"/>
95 <Int attribute="Number" context="#stay"/>
96 <IncludeRules context="DetectOthers"/>
97 </context>
98
99 <!-- quoted string -->
100 <context name="String" attribute="String" lineEndContext="#pop">
101 <Detect2Chars attribute="Escape" context="#stay" char="\" char1="&quot;"/>
102 <DetectChar attribute="String" context="#pop" char="&quot;"/>
103 <IncludeRules context="DetectOthers"/>
104 </context>
105
106 <!-- \!, \? escapes -->
107 <context name="LiteralSL" attribute="Normal Text" lineEndContext="#pop"/>
108 <context name="LiteralIL" attribute="Normal Text" lineEndContext="Error">
109 <Detect2Chars attribute="Escape" context="#stay" char="\" char1="\"/>
110 <Detect2Chars attribute="Escape" context="#pop" char="\" char1="?"/>
111 </context>
112
113 <!-- escape argument -->
114 <context name="Argument" attribute="String" lineEndContext="Error" dynamic="true">
115 <StringDetect attribute="Escape" context="#pop#pop" String="%1" dynamic="true"/>
116 <IncludeRules context="DetectOthers"/>
117 </context>
118
119 <!-- glyph escape argument -->
120 <context name="GlyphArgument" attribute="Glyph" lineEndContext="Error" dynamic="true">
121 <StringDetect attribute="Glyph" context="#pop#pop" String="%1" dynamic="true"/>
122 </context>
123
124 <!-- measurement (or expression) escape argument -->
125 <context name="Measurement" attribute="Error" lineEndContext="Error" dynamic="true">
126 <StringDetect attribute="Escape" context="#pop#pop" String="%1" dynamic="true"/>
127 <!-- TODO -->
128 </context>
129
130 <!-- .de directive -->
131 <context name="deDirective" attribute="Identifier" lineEndContext="deBody"/>
132 <context name="deBody" attribute="Normal Text" lineEndContext="#stay">
133 <Detect2Chars attribute="Other Macros" context="#pop#pop" char="." char1="." column="0" endRegion="de"/>
134 <IncludeRules context="Normal"/>
135 </context>
136
137 <!-- .di directives -->
138 <context name="diDirective" attribute="Identifier" lineEndContext="diBody"/>
139 <context name="diBody" attribute="Normal Text" lineEndContext="#stay">
140 <RegExpr attribute="Other Macros" context="#pop#pop" String="^\.\s*di\b" column="0" endRegion="di"/>
141 <Detect2Chars attribute="Escape" context="LiteralSL" char="\" char1="!"/>
142 <Detect2Chars attribute="Escape" context="LiteralIL" char="\" char1="?"/>
143 <IncludeRules context="Normal"/>
144 </context>
145
146 <!-- .da directives -->
147 <context name="daDirective" attribute="Identifier" lineEndContext="daBody"/>
148 <context name="daBody" attribute="Normal Text" lineEndContext="#stay">
149 <RegExpr attribute="Other Macros" context="#pop#pop" String="^\.\s*da\b" column="0" endRegion="di"/>
150 <Detect2Chars attribute="Escape" context="LiteralSL" char="\" char1="!"/>
151 <Detect2Chars attribute="Escape" context="LiteralIL" char="\" char1="?"/>
152 <IncludeRules context="Normal"/>
153 </context>
154
155 <!-- .ds directive -->
156 <context name="dsDirective" attribute="Identifier" lineEndContext="#pop">
157 <Float attribute="Number" context="#stay"/>
158 <Int attribute="Number" context="#stay"/>
159 <DetectChar attribute="String" context="dsString" char="&quot;"/>
160 <IncludeRules context="DetectOthers"/>
161 </context>
162
163 <!-- .ds quoted value -->
164 <context name="dsString" attribute="String" lineEndContext="#pop">
165 <IncludeRules context="DetectOthers"/>
166 </context>
167
168 </contexts>
169
170 <itemDatas>
171 <itemData name="Normal Text" defStyleNum="dsNormal"/>
172 <itemData name="Comment" defStyleNum="dsComment"/>
173 <itemData name="Layout Macros" defStyleNum="dsKeyword"/>
174 <itemData name="Format Macros" defStyleNum="dsKeyword"/>
175 <itemData name="GNU Macros" defStyleNum="dsDataType"/>
176 <itemData name="Other Macros" defStyleNum="dsFunction"/>
177 <itemData name="Identifier" defStyleNum="dsString"/>
178 <itemData name="Number" defStyleNum="dsDecVal"/>
179 <itemData name="Register" defStyleNum="dsOthers"/>
180 <itemData name="Font" defStyleNum="dsOthers"/>
181 <itemData name="Glyph" defStyleNum="dsOthers"/>
182 <itemData name="Escape" defStyleNum="dsChar"/>
183 <itemData name="String" defStyleNum="dsString"/>
184 <itemData name="Error" defStyleNum="dsError"/>
185 </itemDatas>
186
187 </highlighting>
188
189 <general>
190
191 <comments>
192 <comment name="singleLine" start=".\&quot;" />
193 </comments>
194
195 <keywords casesensitive="1"/>
196
197 </general>
198
199 </language>
200 <!-- kate: replace-tabs on; tab-width 2; indent-width 2; -->