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

DESCRIPTION

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

OPTIONS

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

METHODS

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

ATTRIBUTES

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

PLUGINS

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

BUGS

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

TO DO

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

ACKNOWLEDGEMENTS

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

SEE ALSO

339       Synax::Highlight::Engine::Kate::Template http:://www.kate-editor.org
340
341
342
343perl v5.10.1                      2008-02-03Syntax::Highlight::Engine::Kate(3)
Impressum