.scheme files

These define the fonts, colours, styles and keywords for languages that Programmer's Notepad (via Scintilla) has built-in support for. PN contains code that parses/lexes and understands a lot of languages already. These files surface and configure that support.

.schemedef files

These define the syntax for a language as well as the fonts, colours… The files are interpreted by a plugin for PN called customscheme.lexer which provides code to tell PN how to interpret text according to the rules in the .schemedef.

key attribute

As PN scans the text in a file it assigns every character in the file a “style”, represented by a key. Unfortunately each different built-in language can and often does use the keys to mean different things. So in C++ style 5 is used for keywords whereas HTML uses style 5 for numbers. There is one definitive source of information mapping key numbers to meanings, and that's the .properties files shipped with the SciTE distribution - SciTE is the test editor developed alongside Scintilla.

One style number that is almost always unchanged is that 32 is the default text style - normally this means text with no specific meaning.

When using a .schemedef file, the style keys are fixed:

  • 32: Default
  • 1: Line Comment Style
  • 2: Block Comment Style
  • 3: First Identifiers Type
  • 4: Numbers
  • 5: Keywords
  • 6: Keywords 2
  • 7: Keywords 3
  • 8: Keywords 4
  • 9: Keywords 5
  • 10: First String Type
  • 11: Second String Type
  • 12: Pre-processor
  • 13: Second Identifiers Type

Keywords

The limitation to keyword sets is defined by two hard limits: The first is that Scintilla supports a fixed maximum number of keyword sets, currently 8. The second is that each language lexer only uses the keyword sets that the author thought were necessary - this means that often a language will support only one or two sets of keywords. The .schemedef lexer supports 5 as when it was developed that was the Scintilla limit.

User Configuration and Caches

The changes a user makes to fonts and colours are not stored in the original .scheme or .schemedef files, the configuration of these things is instead stored in a file called UserSettings.xml in the per-user PN application data directory. Unless you're using the portable edition of PN, this will likely be here:

Vista: c:\users\[your username]\AppData\Roaming\Echo Software\PN2 XP: c:\documents and settings\[your username]\Application Data\Echo Software\PN2

The configuration in usersettings.xml is applied to the schemes you have installed, and the result is cached in a binary format in the .cscheme files you'll find in that directory.

 
howto/add_support_for_your_language.txt · Last modified: 2008/06/17 12:16 by simon
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki