blob: 8806cf55cf2c9451cdf19d6f6f98d3ac656d76ec (
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
[
<!ENTITY roffidc "[^]\s]">
<!ENTITY roffid "(&roffidc;|\(&roffidc;{2}|\[&roffidc;+\])">
<!ENTITY roffnum "([0-9]+)">
<!ENTITY argsep1 "([^\\]|\\[% |^{}'`-_!?@)/,&:~0acdeEprtu])">
<!ENTITY argsep2 "([^\\0-9]|\\[%:{}'`-_!@/cep])">
]>
<language name="Roff" section="Markup" version="0.11" kateversion="2.4" extensions="" author="Matthew Woehlke ([email protected])" license="GPL">
<highlighting>
<list name="layout">
<item>br</item>
<item>sp</item>
</list>
<list name="formatting">
</list>
<list name="gnuext">
</list>
<contexts>
<!-- root context -->
<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="DetectComments"/>
<DetectChar attribute="Other Macros" context="DetectDirective" char="." column="0"/>
<IncludeRules context="DetectOthers"/>
</context>
<context name="DetectComments" attribute="Normal Text" lineEndContext="#stay">
<RegExpr attribute="Comment" context="Comment" String="\.\s*\\"" column="0"/>
<Detect2Chars attribute="Comment" context="Comment" char="\\" char1="""/>
<Detect2Chars attribute="Comment" context="Comment" char="\\" char1="#"/>
</context>
<!-- catch glyphc, registers, strings, etc -->
<context name="DetectOthers" attribute="Normal Text" lineEndContext="#stay">
<IncludeRules context="DetectComments"/>
<DetectChar attribute="Escape" context="DetectEscape" char="\\" lookAhead="true"/>
<DetectChar attribute="String" context="String" char="""/>
</context>
<!-- detect escapes -->
<context name="DetectEscape" attribute="Error" lineEndContext="#pop">
<RegExpr attribute="Register" context="#pop" String="\\(\*|n[+-]?)&roffid;"/>
<RegExpr attribute="Font" context="#pop" String="\\[fF]&roffid;"/>
<RegExpr attribute="Font" context="#pop" String="\\f([0-9]|\([0-9][0-9]|\[[0-9]+\])"/>
<RegExpr attribute="Font" context="#pop" String="\\s(\[([1-3][0-9]|[04-9])\]|[04-9]|[+-][0-9]|([+-]?\(|\([+-])[0-9][0-9])"/>
<Detect2Chars attribute="Escape" context="#pop" char="\\" char1="\\"/>
<RegExpr attribute="Escape" context="#pop" String="\\(\$[0-9*@]|[.:% |^{}_!?@)/,&:~0acdeEprtu])"/>
<RegExpr attribute="Escape" context="Argument" String="\\[AbBDowXZ]&argsep1;"/>
<RegExpr attribute="Escape" context="#pop" String="\\[gkmMVYz]&roffid;"/>
<RegExpr attribute="Escape" context="#pop" String="\\O([0-4]|\[5[lrci][^]]\])"/>
<RegExpr attribute="Escape" context="Measurement" String="\\[hHSvx]&argsep1;"/>
<RegExpr attribute="Escape" context="Measurement" String="\\[lL]&argsep1;\|?"/> <!-- TODO - optional trailing &glyph; -->
<RegExpr attribute="Escape" context="Argument" String="\\R&argsep1;"/> <!-- TODO - &roffid; (register), measurement -->
<RegExpr attribute="Glyph" context="GlyphArgument" String="\\C&argsep1;"/>
<RegExpr attribute="Glyph" context="#pop" String="\\N&argsep2;[0-9]+\1"/>
<RegExpr attribute="Glyph" context="#pop" String="\\&roffid;"/>
<RegExpr attribute="Escape" context="#pop" String="\\$"/>
<DetectChar attribute="Error" context="#pop" char="\\"/>
</context>
<!-- directive start -->
<context name="DetectDirective" attribute="Other Macros" lineEndContext="#pop">
<keyword attribute="Layout Macros" context="Directive" String="layout"/>
<keyword attribute="Format Macros" context="Directive" String="formatting"/>
<keyword attribute="GNU Macros" context="Directive" String="gnuext"/>
<RegExpr attribute="Other Macros" context="dsDirective" String="\s*ds\b" column="1"/>
<RegExpr attribute="Other Macros" context="deDirective" String="\s*de\b" column="1" beginRegion="de"/>
<RegExpr attribute="Other Macros" context="daDirective" String="\s*da(?=\s+[A-Za-z]+)" column="1" beginRegion="di"/>
<RegExpr attribute="Other Macros" context="diDirective" String="\s*di(?=\s+[A-Za-z]+)" column="1" beginRegion="di"/>
<RegExpr attribute="Other Macros" context="Directive" String="\s*[A-Za-z]+\b" column="1"/>
</context>
<!-- comment -->
<context name="Comment" attribute="Comment" lineEndContext="#pop">
<IncludeRules context="##Alerts"/>
</context>
<!-- error -->
<context name="Error" attribute="Error" lineEndContext="#stay"/>
<!-- generic directive -->
<context name="Directive" attribute="Identifier" lineEndContext="#pop">
<Float attribute="Number" context="#stay"/>
<Int attribute="Number" context="#stay"/>
<Detect2Chars attribute="Comment" context="Comment" char="\\" char1="""/>
<IncludeRules context="DetectOthers"/>
</context>
<!-- quoted string -->
<context name="String" attribute="String" lineEndContext="#pop">
<Detect2Chars attribute="Escape" context="#stay" char="\\" char1="""/>
<DetectChar attribute="String" context="#pop" char="""/>
<IncludeRules context="DetectOthers"/>
</context>
<!-- \!, \? escapes -->
<context name="LiteralSL" attribute="Normal Text" lineEndContext="#pop"/>
<context name="LiteralIL" attribute="Normal Text" lineEndContext="Error">
<Detect2Chars attribute="Escape" context="#stay" char="\\" char1="\\"/>
<Detect2Chars attribute="Escape" context="#pop" char="\\" char1="?"/>
</context>
<!-- escape argument -->
<context name="Argument" attribute="String" lineEndContext="Error" dynamic="true">
<RegExpr attribute="Escape" context="#pop#pop" String="%1" dynamic="true"/>
<IncludeRules context="DetectOthers"/>
</context>
<!-- glyph escape argument -->
<context name="GlyphArgument" attribute="Glyph" lineEndContext="Error" dynamic="true">
<RegExpr attribute="Glyph" context="#pop#pop" String="%1" dynamic="true"/>
</context>
<!-- measurement (or expression) escape argument -->
<context name="Measurement" attribute="Error" lineEndContext="Error" dynamic="true">
<RegExpr attribute="Escape" context="#pop#pop" String="%1" dynamic="true"/>
<!-- TODO -->
</context>
<!-- .de directive -->
<context name="deDirective" attribute="Identifier" lineEndContext="deBody"/>
<context name="deBody" attribute="Normal Text" lineEndContext="#stay">
<Detect2Chars attribute="Other Macros" context="#pop#pop" char="." char1="." column="0" endRegion="de"/>
<IncludeRules context="Normal"/>
</context>
<!-- .di directives -->
<context name="diDirective" attribute="Identifier" lineEndContext="diBody"/>
<context name="diBody" attribute="Normal Text" lineEndContext="#stay">
<RegExpr attribute="Other Macros" context="#pop#pop" String="\.\s*di\b" column="0" endRegion="di"/>
<Detect2Chars attribute="Escape" context="LiteralSL" char="\\" char1="!"/>
<Detect2Chars attribute="Escape" context="LiteralIL" char="\\" char1="?"/>
<IncludeRules context="Normal"/>
</context>
<!-- .da directives -->
<context name="daDirective" attribute="Identifier" lineEndContext="daBody"/>
<context name="daBody" attribute="Normal Text" lineEndContext="#stay">
<RegExpr attribute="Other Macros" context="#pop#pop" String="\.\s*da\b" column="0" endRegion="di"/>
<Detect2Chars attribute="Escape" context="LiteralSL" char="\\" char1="!"/>
<Detect2Chars attribute="Escape" context="LiteralIL" char="\\" char1="?"/>
<IncludeRules context="Normal"/>
</context>
<!-- .ds directive -->
<context name="dsDirective" attribute="Identifier" lineEndContext="#pop">
<Int attribute="Number" context="#stay"/>
<Float attribute="Number" context="#stay"/>
<Detect2Chars attribute="Comment" context="Comment" char="\\" char1="""/>
<DetectChar attribute="String" context="dsString" char="""/>
<IncludeRules context="DetectOthers"/>
</context>
<!-- .ds quoted value -->
<context name="dsString" attribute="String" lineEndContext="#pop">
<IncludeRules context="DetectOthers"/>
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal"/>
<itemData name="Comment" defStyleNum="dsComment"/>
<itemData name="Layout Macros" defStyleNum="dsKeyword"/>
<itemData name="Format Macros" defStyleNum="dsKeyword"/>
<itemData name="GNU Macros" defStyleNum="dsDataType"/>
<itemData name="Other Macros" defStyleNum="dsFunction"/>
<itemData name="Identifier" defStyleNum="dsString"/>
<itemData name="Number" defStyleNum="dsDecVal"/>
<itemData name="Register" defStyleNum="dsOthers"/>
<itemData name="Font" defStyleNum="dsOthers"/>
<itemData name="Glyph" defStyleNum="dsOthers"/>
<itemData name="Escape" defStyleNum="dsChar"/>
<itemData name="String" defStyleNum="dsString"/>
<itemData name="Error" defStyleNum="dsError"/>
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start=".\"" />
</comments>
<keywords casesensitive="1"/>
</general>
</language>
|