[Bf-committers] Syntax Highlighting & Alternate Languages

Benjamin Tolputt btolputt at internode.on.net
Wed Jul 27 10:25:23 CEST 2011


On 27/07/2011 2:52 PM, Matt Ebb wrote:
> On Wed, Jul 27, 2011 at 2:49 PM, Sinan Hassani <sinan.hassani at gmail.com>wrote:
>> I use GameKit and this feature would be very useful. It would also be
>> nice to add HLSL and Cg highlighting in addition to Lua and GLSL. Some
>> people are using blender2ogre plugin with GameKit and therefore use the
>> Blender text editor to write Ogre materials which might include both
>> HLSL and GLSL shaders (using Ogre unified shader mechanism). So syntax
>> highlighting of other languages would be very useful.
>>
> Yep, there are other examples such as Renderman SL, too.
>
> Perhaps it would be better if such functionality could be accessible via the
> python API so people could write their own types of syntax highlighting
> independently. At least defining a list of common keywords to highlight
> would be nice!
>
> Not a terribly high priority request though in my personal opinion.

I'm pretty sure that putting the parsing code into the Python layer
would slow the syntax highlighting code quite dramatically and, as such,
is not likely to get the core team approval (let alone be appreciated by
the users). I like the idea of that kind of flexibility, but the code is
currently quite low level & speedy (integer comparisons from a char
array). The speed hit to jump up to Python (with the string passing,
Python string comparisons, and return path) is most likely going to rule
this out almost completely.

That said, in terms of the priority request, I'm willing to do the
low-level code stuff myself. This isn't a request for other developers
to code something for me, it is a request to pre-check whether it is
worth putting the code together myself. It is contained in perhaps two
files, there are no changes to the API required, and it is very close to
a copy/paste job with alternate means of detecting comments, strings,
and special strings. The changes are small, there is no performance
penalty, and the upside is (for people like myself) quite high. If I
cannot get approval for this - I don't think integrating Python would be
worth mentioning ;)

-- 
Regards,

Benjamin Tolputt



More information about the Bf-committers mailing list