[QScintilla] XML lexer and folding
Baz Walter
bazwal at ftml.net
Thu May 8 19:20:27 BST 2008
Stefan Langer wrote:
> so now here is my xml-lexer ^^
> it uses QsciLexerHTML as it's base class ... and tried to keep it as
> small as possible ...
>
> I would be happy, if it finds it way to the next qsci release ;)
Well, that would be up to Phil Thompson as he is the author of
qscintilla. I think that Phil's recipe for qscintilla's lexer classes is
to try to reproduce most of the defaults from SciTE's properties files.
Since SciTE's defaults for xml are not the same as for html, I think any
such differences would need to be encapsulated in an xml lexer.
Here's a few things that I think your xml lexer needs to do if you still
want to try to get it into a future qscintilla release:
The defaultColor, defaultPaper, defaultFont and defaultEolFill member
functions should all return a set of values that match the xml styles
defined in SciTE's default html.properties file. These functions should
also delegate to QsciLexer rather than QsciLexerHTML for any styles not
defined for xml. This is because scintilla's html lexer does a lot of
things which are not appropriate for xml, such as syntax highlighting
embedded javascript, vbscript, python, etc. This would be wrong for,
say, an xhtml document because any embedded scripts should be contained
in CDATA sections (and so the styles for CDATA should take precedence).
The keywords member function needs to delegate to QsciLexerHTML for
keyword set six because this is used when syntax highlighting DOCTYPE
declarations.
The constructor for QsciLexerXML should set the case-sensitive-tags
property to true by default.
Regards
Baz Walter
More information about the QScintilla
mailing list