[QScintilla] XML and Python Lexer suggestions

Phil Thompson phil at riverbankcomputing.com
Fri Nov 14 17:49:19 GMT 2008


On Fri, 14 Nov 2008 17:23:14 +0000, Baz Walter <bazwal at ftml.net> wrote:
> Phil Thompson wrote:
>> On Wed, 12 Nov 2008 22:43:28 +0000, Baz Walter <bazwal at ftml.net> wrote:
> 
> you're way too quick for me, phil - i was hoping to post a patch for 
> these yesterday, but you beat me to it :)
> 
>>> in earlier versions of scintilla, the xml lexer does not style cdata 
>>> sections inside script tags. scintilla 1.77 has introduced a property 
>>> 'lexer.xml.allow.scripts' to control this behaviour, and it would be 
>>> nice if a getter/setter for it could be added to qscintilla's xml lexer

>>> class. unfortunately, the property is switched on (i.e. no styling) by 
>>> default, which (to my eye) looks like a bug when viewing xhtml
documents
>>>
>>> as xml. (is this one of the bugs referred to recently in qscintilla's 
>>> change history?)
>> 
>> The flag is the other way round and the fact that scripts aren't styled
>> is
>> a bug. Fixed in tonight's snapshot.
> 
> i think we're on the same page here - it's just that you're better at 
> explaining it than i am :) the property defaults to styling the content 
> of script tags *as scripts*, rather than as cdata; this makes it *look 
> like* a bug because the xml lexer doesn't set fonts/colours for embedded 
> scripts.

It does now.

> so the property needs to be set to false (i.e. not allow 
> scripts) to style cdata correctly.
> 
>> A future version will allow you to disable the styling of scripts.
> 
> i have a patch 95% done for this and i should be able to send it to you 
> later this evening. i'm calling it allowScripts() and it will default to 
> false - is this okay?

The default should be the same as the Scintilla lexer, ie true. I'm not
keen on the name as it's confusing.

>>> the python lexer suggestion is a lot simpler: could 'as' be added to
the
>>>
>>> keyword list? (this is mainly for the new exceptions syntax in python
>> 2.6)
>> 
>> Done.
> 
> thanks!
> 
> one more thing. while looking into this, i noticed that there are some 
> properties missing for some of the other lexers as well. so i thought i 
> could have a go at filling in some of the remaining gaps during the 
> weekend. would this be useful to you?

Yes - but they won't go into the next version which will just fix the
regression (and the "as" keyword which won't break anything).

Phil


More information about the QScintilla mailing list