By lack of answers on many occasions, and the good answers I have received here, here's my question.
I'm writing a program for the ABC music notation language (sample given below). This is not a supported language in wx.stc, and I have not yet found a good explanation or example on how to:
- add my own lexer/highlighter
- create my own highlighter from scratch and use a RichTextCtrl or the likes.
Any help in any direction is welcomed.
ABC-notation example:
%% this is a midi or postscript argument, and should be colored
X: 1 % this is a comment and should be colored differently
T: Speed The Plough % everything followed by a colon, except for |: should be colored
M: 4/4 % a variety of others should be colored
L: 1/8
R: reel
K: Dmaj
d3A BAFB|AF~F2 EFDE|F2AF ~G3B| % the non-alphanumerics should be colored
ABdg fgfe|d3A BAFB|AF~F2 EFDE|
F2AF GABG|1ABdg fedc:|2ABde fdde||
|:f2ab afdf|g2fg ed (3Bcd|a2ab afdB| % | and |: should be colored differently
ABde fe~e2|f2ab afdf|g2fg edBA|
[1F2AF GABG|ABdg fddg:|2F2AF ~G3B|ABdg fgfe||
Based on the "scintilla" tag you've got there I presume you're aware that Scintilla is what underlies wx.stc.StyledTextCtrl.
I was able to find a brief how-to to add some new styling to Scintilla: http://sphere.sourceforge.net/flik/docs/scintilla-container_lexer.html
It's pretty low-level and it's not Python. I wish I could make this a comment instead of an 'answer' but I don't have enough reputation for that yet.