I wrote this a little while back as a simple explanation of the way to add support for languages supported by Scintilla to PN2.
The editing component underneath PN2 is Scintilla, and this includes a number of built-in lexers, the difficulty being that each one has it’s own style keys/numbers and they each need configuring as .scheme files to bring them into PN.
The list of lexers available looks a bit like this (the names are not necessarily correct for these!):
That’s a lot more than are surfaced in PN!
I got this list by looking at the Scintilla source code. The way I get all the style numbers for the schemes is to look at the property files that ship with SciTE (the scintilla demonstration text editor). These files have lines like this:
<code># Default style.lisp.32=$(font.base) # White space style.lisp.0=fore:#808080 # Line Comment style.lisp.1=$(colour.code.comment.box),$(font.code.comment.box) # Number style.lisp.2=$(colour.number) # Keyword style.lisp.3=$(colour.keyword),bold ...</code>
Which define some styles for lisp and would translate to:
<code><style name="Default" key="32" /> <style name="Whitespace" key="0" /> <style name="Line Comment" key="1" class="commentline" /> <style name="Number" key="2" class="number" /> <style name="Keyword" key="3" class="keyword"/> ...</code>
The style.lisp bit indicates that these are styles for the “lisp” lexer, so that then goes in the lexer line in the style configuration:
Handily, the SciTE config files also include keyword lists and things like that. It’s a matter of a few minutes to translate a SciTE config into a good PN scheme, and the XML for .scheme files is fairly simple so most people should be able to work out the conversion. If you’re trying to do this and get stuck join the pn-discuss list and ask for help.
PN also supports custom scheme definitions (like the VHDL included with PN as vhdl.schemedef). I’ll try and provide some more documentation about this soon.