1Syntax::Highlight::EngiUnsee:r:KCaotnet(r3i)buted Perl DSoycnutmaexn:t:aHtiigohnlight::Engine::Kate(3)
2
3
4

NAME

6       Syntax::Highlight::Engine::Kate - a port to Perl of the syntax
7       highlight engine of the Kate texteditor.
8

SYNOPSIS

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 = new Syntax::Highlight::Engine::Kate(
15           language => 'Perl',
16           substitutions => {
17              "<" => "&lt;",
18              ">" => "&gt;",
19              "&" => "&amp;",
20              " " => "&nbsp;",
21              "\t" => "&nbsp;&nbsp;&nbsp;",
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 = new Syntax::Highlight::Engine::Kate::Perl(
51           substitutions => {
52              "<" => "&lt;",
53              ">" => "&gt;",
54              "&" => "&amp;",
55              " " => "&nbsp;",
56              "\t" => "&nbsp;&nbsp;&nbsp;",
57              "\n" => "<BR>\n",
58           },
59           format_table => {
60              Alert => ["<font color=\"#0000ff\">", "</font>"],
61              BaseN => ["<font color=\"#007f00\">", "</font>"],
62              BString => ["<font color=\"#c9a7ff\">", "</font>"],
63              Char => ["<font color=\"#ff00ff\">", "</font>"],
64              Comment => ["<font color=\"#7f7f7f\"><i>", "</i></font>"],
65              DataType => ["<font color=\"#0000ff\">", "</font>"],
66              DecVal => ["<font color=\"#00007f\">", "</font>"],
67              Error => ["<font color=\"#ff0000\"><b><i>", "</i></b></font>"],
68              Float => ["<font color=\"#00007f\">", "</font>"],
69              Function => ["<font color=\"#007f00\">", "</font>"],
70              IString => ["<font color=\"#ff0000\">", ""],
71              Keyword => ["<b>", "</b>"],
72              Normal => ["", ""],
73              Operator => ["<font color=\"#ffa500\">", "</font>"],
74              Others => ["<font color=\"#b03060\">", "</font>"],
75              RegionMarker => ["<font color=\"#96b9ff\"><i>", "</i></font>"],
76              Reserved => ["<font color=\"#9b30ff\"><b>", "</b></font>"],
77              String => ["<font color=\"#ff0000\">", "</font>"],
78              Variable => ["<font color=\"#0000ff\"><b>", "</b></font>"],
79              Warning => ["<font color=\"#0000ff\"><b><i>", "</b></i></font>"],
80           },
81        );
82
83
84        print "<html>\n<head>\n</head>\n<body>\n";
85        while (my $in = <>) {
86           print $hl->highlightText($in);
87        }
88        print "</body>\n</html>\n";
89

DESCRIPTION

91       Syntax::Highlight::Engine::Kate is a port to perl of the syntax
92       highlight engine of the Kate text editor.
93
94       The language xml files of kate have been rewritten to perl modules
95       using a script. These modules function as plugins to this module.
96
97       Syntax::Highlight::Engine::Kate inherits
98       Syntax::Highlight::Engine::Kate::Template.
99

OPTIONS

101       language
102           Specify the language you want highlighted.  look in the PLUGINS
103           section for supported languages.
104
105       plugins
106           If you created your own language plugins you may specify a list of
107           them with this option.
108
109            plugins => [
110              ["MyModuleName", "MyLanguageName", "*,ext1;*.ext2", "Section"],
111              ....
112            ]
113
114       format_table
115           This option must be specified if the highlightText method needs to
116           do anything usefull for you.  All mentioned keys in the synopsis
117           must be specified.
118
119       substitutions
120           With this option you can specify additional formatting options.
121

METHODS

123       extensions
124           returns a reference to the extensions hash,
125
126       language(?$language?)
127           Sets and returns the current language that is highlighted. when
128           setting the language a reset is also done.
129
130       languageAutoSet($filename);
131           Suggests language name for the fiven file $filename
132
133       languageList
134           returns a list of languages for which plugins have been defined.
135
136       languagePlug($language);
137           returns the module name of the plugin for $language
138
139       languagePropose($filename);
140           Suggests language name for the fiven file $filename
141
142       sections
143           Returns a reference to the sections hash.
144

ATTRIBUTES

146       In the kate XML syntax files you find under the section <itemDatas>
147       entries like <itemData name="Unknown Property"  defStyleNum="dsError"
148       italic="1"/>. Kate is an editor so it is ok to have definitions for
149       forground and background colors and so on. However, since this Module
150       is supposed to be a more universal highlight engine, the attributes
151       need to be fully abstract. In which case, Kate does not have enough
152       default attributes defined to fullfill all needs. Kate defines the
153       following standard attributes: dsNormal, dsKeyword, dsDataType,
154       dsDecVal, dsBaseN, dsFloat, dsChar, dsString, dsComment, dsOthers,
155       dsAlert, dsFunction, dsRegionMarker, dsError. This module leaves out
156       the "ds" part and uses following additional attributes: BString,
157       IString, Operator, Reserved, Variable. I have modified the XML files so
158       that each highlight mode would get it's own attribute. In quite a few
159       cases still not enough attributes were defined. So in some languages
160       different modes have the same attribute.
161

PLUGINS

163       Below an overview of existing plugins. All have been tested on use and
164       can be created. The ones for which no samplefile is available are
165       marked. Those marked OK have highlighted the testfile without appearant
166       mistakes. This does not mean that all bugs are shaken out.
167
168        LANGUAGE             MODULE                   COMMENT
169        ********             ******                   ******
170        .desktop             Desktop                  OK
171        4GL                  FourGL                   No sample file
172        4GL-PER              FourGLminusPER           No sample file
173        ABC                  ABC                      OK
174        AHDL                 AHDL                     OK
175        ANSI C89             ANSI_C89                 No sample file
176        ASP                  ASP                      OK
177        AVR Assembler        AVR_Assembler            OK
178        AWK                  AWK                      OK
179        Ada                  Ada                      No sample file
180                             Alerts                   OK hidden module
181        Ansys                Ansys                    No sample file
182        Apache Configuration Apache_Configuration     No sample file
183        Asm6502              Asm6502                  No sample file
184        Bash                 Bash                     OK
185        BibTeX               BibTeX                   OK
186        C                    C                        No sample file
187        C#                   Cdash                    No sample file
188        C++                  Cplusplus                OK
189        CGiS                 CGiS                     No sample file
190        CMake                CMake                    OK
191        CSS                  CSS                      OK
192        CUE Sheet            CUE_Sheet                No sample file
193        Cg                   Cg                       No sample file
194        ChangeLog            ChangeLog                No sample file
195        Cisco                Cisco                    No sample file
196        Clipper              Clipper                  OK
197        ColdFusion           ColdFusion               No sample file
198        Common Lisp          Common_Lisp              OK
199        Component-Pascal     ComponentminusPascal     No sample file
200        D                    D                        No sample file
201        Debian Changelog     Debian_Changelog         No sample file
202        Debian Control       Debian_Control           No sample file
203        Diff                 Diff                     No sample file
204        Doxygen              Doxygen                  OK
205        E Language           E_Language               OK
206        Eiffel               Eiffel                   No sample file
207        Email                Email                    OK
208        Euphoria             Euphoria                 OK
209        Fortran              Fortran                  OK
210        FreeBASIC            FreeBASIC                No sample file
211        GDL                  GDL                      No sample file
212        GLSL                 GLSL                     OK
213        GNU Assembler        GNU_Assembler            No sample file
214        GNU Gettext          GNU_Gettext              No sample file
215        HTML                 HTML                     OK
216        Haskell              Haskell                  OK
217        IDL                  IDL                      No sample file
218        ILERPG               ILERPG                   No sample file
219        INI Files            INI_Files                No sample file
220        Inform               Inform                   No sample file
221        Intel x86 (NASM)     Intel_X86_NASM           seems to have issues
222        JSP                  JSP                      OK
223        Java                 Java                     OK
224        JavaScript           JavaScript               OK
225        Javadoc              Javadoc                  No sample file
226        KBasic               KBasic                   No sample file
227        Kate File Template   Kate_File_Template       No sample file
228        LDIF                 LDIF                     No sample file
229        LPC                  LPC                      No sample file
230        LaTeX                LaTex                    OK
231        Lex/Flex             Lex_Flex                 OK
232        LilyPond             LilyPond                 OK
233        Literate Haskell     Literate_Haskell         OK
234        Lua                  Lua                      No sample file
235        M3U                  M3U                      OK
236        MAB-DB               MABminusDB               No sample file
237        MIPS Assembler       MIPS_Assembler           No sample file
238        Makefile             Makefile                 No sample file
239        Mason                Mason                    No sample file
240        Matlab               Matlab                   has issues
241        Modula-2             Modulaminus2             No sample file
242        Music Publisher      Music_Publisher          No sample file
243        Octave               Octave                   OK
244        PHP (HTML)           PHP_HTML                 OK
245                             PHP_PHP                  OK hidden module
246        POV-Ray              POV_Ray                  OK
247        Pascal               Pascal                   No sample file
248        Perl                 Perl                     OK
249        PicAsm               PicAsm                   OK
250        Pike                 Pike                     OK
251        PostScript           PostScript               OK
252        Prolog               Prolog                   No sample file
253        PureBasic            PureBasic                OK
254        Python               Python                   OK
255        Quake Script         Quake_Script             No sample file
256        R Script             R_Script                 No sample file
257        REXX                 REXX                     No sample file
258        RPM Spec             RPM_Spec                 No sample file
259        RSI IDL              RSI_IDL                  No sample file
260        RenderMan RIB        RenderMan_RIB            OK
261        Ruby                 Ruby                     OK
262        SGML                 SGML                     No sample file
263        SML                  SML                      No sample file
264        SQL                  SQL                      No sample file
265        SQL (MySQL)          SQL_MySQL                No sample file
266        SQL (PostgreSQL)     SQL_PostgreSQL           No sample file
267        Sather               Sather                   No sample file
268        Scheme               Scheme                   OK
269        Sieve                Sieve                    No sample file
270        Spice                Spice                    OK
271        Stata                Stata                    OK
272        TI Basic             TI_Basic                 No sample file
273        TaskJuggler          TaskJuggler              No sample file
274        Tcl/Tk               TCL_Tk                   OK
275        UnrealScript         UnrealScript             OK
276        VHDL                 VHDL                     No sample file
277        VRML                 VRML                     OK
278        Velocity             Velocity                 No sample file
279        Verilog              Verilog                  No sample file
280        WINE Config          WINE_Config              No sample file
281        Wikimedia            Wikimedia                No sample file
282        XML                  XML                      OK
283        XML (Debug)          XML_Debug                No sample file
284        Yacc/Bison           Yacc_Bison               OK
285        de_DE                De_DE                    No sample file
286        en_EN                En_EN                    No sample file
287        ferite               Ferite                   No sample file
288        nl                   Nl                       No sample file
289        progress             Progress                 No sample file
290        scilab               Scilab                   No sample file
291        txt2tags             Txt2tags                 No sample file
292        x.org Configuration  X_org_Configuration      OK
293        xHarbour             XHarbour                 OK
294        xslt                 Xslt                     No sample file
295        yacas                Yacas                    No sample file
296

BUGS

298       Float is detected differently than in the Kate editor.
299
300       The regular expression engine of the Kate editor, qregexp, appears to
301       be more tolerant to mistakes in regular expressions than perl. This
302       might lead to error messages and differences in behaviour.  Most of the
303       problems were sorted out while developing, because error messages
304       appeared. For as far as differences in behaviour is concerned, testing
305       is the only way to find out, so i hope the users out there will be able
306       to tell me more.
307
308       This module is mimicking the behaviour of the syntax highlight engine
309       of the Kate editor. If you find a bug/mistake in the highlighting,
310       please check if Kate behaves in the same way. If yes, the cause is
311       likely to be found there.
312

TO DO

314       Rebuild the scripts i am using to generate the modules from xml files
315       so they are more pro-actively tracking flaws in the build of the xml
316       files like missing lists. Also regular expressions in the xml can be
317       tested better before used in plugins.
318
319       Refine the testmethods in Syntax::Highlight::Engine::Kate::Template, so
320       that choices for casesensitivity, dynamic behaviour and lookahead can
321       be determined at generate time of the plugin, might increase
322       throughput.
323
324       Implement codefolding.
325

ACKNOWLEDGEMENTS

327       All the people who wrote Kate and the syntax highlight xml files.
328
330       This module is written and maintained by:
331
332       Hans Jeuken < haje at toneel dot demon dot nl >
333
334       Copyright (c) 2006 by Hans Jeuken, all rights reserved.
335
336       You may freely distribute and/or modify this module under the same
337       terms as Perl itself.
338

SEE ALSO

340       Syntax::Highlight::Engine::Kate::Template http:://www.kate-editor.org
341
342
343
344perl v5.16.3                      2012-09-23Syntax::Highlight::Engine::Kate(3)
Impressum