1Syntax::Highlight::EngiUnsee:r:KCaotnet(r3i)buted Perl DSoycnutmaexn:t:aHtiigohnlight::Engine::Kate(3)
2
3
4
6 Syntax::Highlight::Engine::Kate - a port to Perl of the syntax
7 highlight engine of the Kate text editor.
8
10 #if you want to create a compiled executable, you may want to do this:
11 use Syntax::Highlight::Engine::Kate::All;
12
13 use Syntax::Highlight::Engine::Kate;
14 my $hl = Syntax::Highlight::Engine::Kate->new(
15 language => 'Perl',
16 substitutions => {
17 "<" => "<",
18 ">" => ">",
19 "&" => "&",
20 " " => " ",
21 "\t" => " ",
22 "\n" => "<BR>\n",
23 },
24 format_table => {
25 Alert => [ "<font color=\"#0000ff\">", "</font>" ],
26 BaseN => [ "<font color=\"#007f00\">", "</font>" ],
27 BString => [ "<font color=\"#c9a7ff\">", "</font>" ],
28 Char => [ "<font color=\"#ff00ff\">", "</font>" ],
29 Comment => [ "<font color=\"#7f7f7f\"><i>", "</i></font>" ],
30 DataType => [ "<font color=\"#0000ff\">", "</font>" ],
31 DecVal => [ "<font color=\"#00007f\">", "</font>" ],
32 Error => [ "<font color=\"#ff0000\"><b><i>", "</i></b></font>" ],
33 Float => [ "<font color=\"#00007f\">", "</font>" ],
34 Function => [ "<font color=\"#007f00\">", "</font>" ],
35 IString => [ "<font color=\"#ff0000\">", "" ],
36 Keyword => [ "<b>", "</b>" ],
37 Normal => [ "", "" ],
38 Operator => [ "<font color=\"#ffa500\">", "</font>" ],
39 Others => [ "<font color=\"#b03060\">", "</font>" ],
40 RegionMarker => [ "<font color=\"#96b9ff\"><i>", "</i></font>" ],
41 Reserved => [ "<font color=\"#9b30ff\"><b>", "</b></font>" ],
42 String => [ "<font color=\"#ff0000\">", "</font>" ],
43 Variable => [ "<font color=\"#0000ff\"><b>", "</b></font>" ],
44 Warning => [ "<font color=\"#0000ff\"><b><i>", "</b></i></font>" ],
45 },
46 );
47
48 #or
49
50 my $hl = Syntax::Highlight::Engine::Kate::Perl->new(
51 substitutions => {
52 # ...
53 },
54 format_table => {
55 # ...
56 },
57 );
58
59 print "<html>\n<head>\n</head>\n<body>\n";
60 while ( my $in = <> ) {
61 print $hl->highlightText($in);
62 }
63 print "</body>\n</html>\n";
64
66 This module is now deprecated.
67
68 It is superseded and replaced by Syntax::Kamelon. Best use
69 Syntax::Kamelon for new projects.
70
71 Syntax::Highlight::Engine::Kate is a port to Perl of the syntax
72 highlight engine of the Kate text editor.
73
74 The language XML files of Kate have been rewritten to Perl modules
75 using a script. These modules function as plugins to this module.
76
77 Syntax::Highlight::Engine::Kate inherits
78 Syntax::Highlight::Engine::Kate::Template.
79
81 language
82 Specify the language you want highlighted. Look in the PLUGINS
83 section for supported languages.
84
85 plugins
86 If you created your own language plugins you may specify a list of
87 them with this option.
88
89 plugins => [
90 ["MyModuleName", "MyLanguageName", "*,ext1;*.ext2", "Section"],
91 ....
92 ]
93
94 format_table
95 This option must be specified if the highlightText method needs to
96 do anything useful for you. All mentioned keys in the synopsis
97 must be specified.
98
99 substitutions
100 With this option you can specify additional formatting options.
101
103 extensions
104 Returns a reference to the extensions hash.
105
106 language(?$language?)
107 Sets and returns the current language that is highlighted. When
108 setting the language a reset is also done.
109
110 languageAutoSet($filename)
111 Suggests language name for the given file $filename.
112
113 languageList
114 Returns a list of languages for which plugins have been defined.
115
116 languagePlug($language, ?$insensitive?)
117 Returns the module name of the plugin for $language.
118
119 If $insensitive is set it will also try to match names ignoring
120 case and return the correct module name of the plugin.
121
122 e.g. "$highlighter->languagePlug('HtMl', 1);" will return "HTML".
123
124 languagePropose($filename)
125 Suggests language name for the given file $filename.
126
127 sections
128 Returns a reference to the sections hash.
129
131 In the Kate XML syntax files you find under the section <itemDatas>
132 entries like "<itemData name="Unknown Property" defStyleNum="dsError"
133 italic="1"/>". Kate is an editor so it is ok to have definitions for
134 foreground and background colors and so on. However, since this module
135 is supposed to be a more universal highlight engine, the attributes
136 need to be fully abstract. In which case, Kate does not have enough
137 default attributes defined to fulfill all needs. Kate defines the
138 following standard attributes:
139
140 · dsNormal
141
142 · dsKeyword
143
144 · dsDataType
145
146 · dsDecVal
147
148 · dsBaseN
149
150 · dsFloat
151
152 · dsChar
153
154 · dsString
155
156 · dsComment
157
158 · dsOthers
159
160 · dsAlert
161
162 · dsFunction
163
164 · dsRegionMarker
165
166 · dsError
167
168 This module leaves out the <ds> part and uses following additional
169 attributes:
170
171 · BString
172
173 · IString
174
175 · Operator
176
177 · Reserved
178
179 · Variable
180
181 I have modified the XML files so that each highlight mode would get its
182 own attribute. In quite a few cases still not enough attributes were
183 defined. So in some languages different modes have the same attribute.
184
186 Below is an overview of existing plugins. All have been tested on use
187 and can be created. The ones for which no sample file is available are
188 marked. Those marked OK have highlighted the test file without apparent
189 mistakes. This does not mean that all bugs are shaken out.
190
191 LANGUAGE MODULE COMMENT
192 ******** ****** ******
193 .desktop Desktop OK
194 4GL FourGL No sample file
195 4GL-PER FourGLminusPER No sample file
196 ABC ABC OK
197 AHDL AHDL OK
198 ANSI C89 ANSI_C89 No sample file
199 ASP ASP OK
200 AVR Assembler AVR_Assembler OK
201 AWK AWK OK
202 Ada Ada No sample file
203 Alerts OK hidden module
204 Ansys Ansys No sample file
205 Apache Configuration Apache_Configuration No sample file
206 Asm6502 Asm6502 No sample file
207 Bash Bash OK
208 BibTeX BibTeX OK
209 C C No sample file
210 C# Cdash No sample file
211 C++ Cplusplus OK
212 CGiS CGiS No sample file
213 CMake CMake OK
214 CSS CSS OK
215 CUE Sheet CUE_Sheet No sample file
216 Cg Cg No sample file
217 ChangeLog ChangeLog No sample file
218 Cisco Cisco No sample file
219 Clipper Clipper OK
220 ColdFusion ColdFusion No sample file
221 Common Lisp Common_Lisp OK
222 Component-Pascal ComponentminusPascal No sample file
223 D D No sample file
224 Debian Changelog Debian_Changelog No sample file
225 Debian Control Debian_Control No sample file
226 Diff Diff No sample file
227 Doxygen Doxygen OK
228 E Language E_Language OK
229 Eiffel Eiffel No sample file
230 Email Email OK
231 Euphoria Euphoria OK
232 Fortran Fortran OK
233 FreeBASIC FreeBASIC No sample file
234 GDL GDL No sample file
235 GLSL GLSL OK
236 GNU Assembler GNU_Assembler No sample file
237 GNU Gettext GNU_Gettext No sample file
238 HTML HTML OK
239 Haskell Haskell OK
240 IDL IDL No sample file
241 ILERPG ILERPG No sample file
242 INI Files INI_Files No sample file
243 Inform Inform No sample file
244 Intel x86 (NASM) Intel_X86_NASM seems to have issues
245 JSP JSP OK
246 Java Java OK
247 JavaScript JavaScript OK
248 Javadoc Javadoc No sample file
249 KBasic KBasic No sample file
250 Kate File Template Kate_File_Template No sample file
251 LDIF LDIF No sample file
252 LPC LPC No sample file
253 LaTeX LaTex OK
254 Lex/Flex Lex_Flex OK
255 LilyPond LilyPond OK
256 Literate Haskell Literate_Haskell OK
257 Lua Lua No sample file
258 M3U M3U OK
259 MAB-DB MABminusDB No sample file
260 MIPS Assembler MIPS_Assembler No sample file
261 Makefile Makefile No sample file
262 Mason Mason No sample file
263 Matlab Matlab has issues
264 Modula-2 Modulaminus2 No sample file
265 Music Publisher Music_Publisher No sample file
266 Octave Octave OK
267 PHP (HTML) PHP_HTML OK
268 PHP_PHP OK hidden module
269 POV-Ray POV_Ray OK
270 Pascal Pascal No sample file
271 Perl Perl OK
272 PicAsm PicAsm OK
273 Pike Pike OK
274 PostScript PostScript OK
275 Prolog Prolog No sample file
276 PureBasic PureBasic OK
277 Python Python OK
278 Quake Script Quake_Script No sample file
279 R Script R_Script No sample file
280 REXX REXX No sample file
281 RPM Spec RPM_Spec No sample file
282 RSI IDL RSI_IDL No sample file
283 RenderMan RIB RenderMan_RIB OK
284 Ruby Ruby OK
285 SGML SGML No sample file
286 SML SML No sample file
287 SQL SQL No sample file
288 SQL (MySQL) SQL_MySQL No sample file
289 SQL (PostgreSQL) SQL_PostgreSQL No sample file
290 Sather Sather No sample file
291 Scheme Scheme OK
292 Sieve Sieve No sample file
293 Spice Spice OK
294 Stata Stata OK
295 TI Basic TI_Basic No sample file
296 TaskJuggler TaskJuggler No sample file
297 Tcl/Tk TCL_Tk OK
298 UnrealScript UnrealScript OK
299 VHDL VHDL No sample file
300 VRML VRML OK
301 Velocity Velocity No sample file
302 Verilog Verilog No sample file
303 WINE Config WINE_Config No sample file
304 Wikimedia Wikimedia No sample file
305 XML XML OK
306 XML (Debug) XML_Debug No sample file
307 Yacc/Bison Yacc_Bison OK
308 de_DE De_DE No sample file
309 en_EN En_EN No sample file
310 ferite Ferite No sample file
311 nl Nl No sample file
312 progress Progress No sample file
313 scilab Scilab No sample file
314 txt2tags Txt2tags No sample file
315 x.org Configuration X_org_Configuration OK
316 xHarbour XHarbour OK
317 xslt Xslt No sample file
318 yacas Yacas No sample file
319
320 Module Syntax::Highlight::Engine::Kate::Convert::ToolKit and script hl-
321 kate-convert can be used to convert existing Kate/KTextEditor Syntax
322 Highlighting file from XML format to Perl.
323
325 Float is detected differently than in the Kate editor.
326
327 The regular expression engine of the Kate editor, qregexp, appears to
328 be more tolerant to mistakes in regular expressions than Perl. This
329 might lead to error messages and differences in behaviour. Most of the
330 problems were sorted out while developing, because error messages
331 appeared. For as far as differences in behaviour is concerned, testing
332 is the only way to find out, so I hope the users out there will be able
333 to tell me more.
334
335 This module is mimicking the behaviour of the syntax highlight engine
336 of the Kate editor. If you find a bug/mistake in the highlighting,
337 please check if Kate behaves in the same way. If yes, the cause is
338 likely to be found there.
339
341 Rebuild the scripts I am using to generate the modules from XML files
342 so they are more pro-actively tracking flaws in the build of the XML
343 files like missing lists. Also regular expressions in the XML can be
344 tested better before they are used in plugins.
345
346 Refine the test methods in Syntax::Highlight::Engine::Kate::Template,
347 so that choices for case sensitivity, dynamic behaviour and lookahead
348 can be determined at generate time of the plugin, might increase
349 throughput.
350
351 Implement code folding.
352
354 All the people who wrote Kate and the syntax highlight XML files.
355
357 This module is written and maintained by:
358
359 Hans Jeuken < haje at toneel dot demon dot nl >
360
361 Copyright (c) 2006 by Hans Jeuken, all rights reserved.
362
363 You may freely distribute and/or modify this module under the same
364 terms as Perl itself.
365
367 · Syntax::Highlight::Engine::Kate::Template
368
369 · <http://www.kate-editor.org>
370
371 · KTextEditor Syntax Highlighting Repository
372 <https://quickgit.kde.org/?p=ktexteditor.git&a=tree&f=src%2Fsyntax%2Fdata>
373
374
375
376perl v5.30.0 2019-07-26Syntax::Highlight::Engine::Kate(3)