[TxMt] Re: Syntax coloring for POV-Ray?

Jacob Rus jrus at hcs.harvard.edu
Tue Oct 24 19:58:10 UTC 2006


Okay, a lot of questions.  Let me see if I can tackle them.

James Reynolds wrote:
> Ok, how do I start?  Should I copy an existing bundle or start from 
> scratch.

I recommend starting from scratch in this case, as POV ray is not very 
close to the other languages we have.

> I've written a simple POV-Ray parser using Perl, so I have a 
> pretty good understanding of how to read POV-Ray code, but I'm only a 
> few weeks old with TextMate, and haven't really studied it's syntax 
> highlighting engine at all.

That's okay.  The grammars are in a quite understandable plist format. 
To see what one looks like, open the bundle editor (⌥⌘B) and then click 
on any language grammar.  There is pretty decent documentation in the TM 
help files.  If you have any questions (and you will), please drop by 
the IRC channel.

> The only problems I see with rendering from TextMate and displaying the 
> results is: POV-Ray makes tga files by default;

Not a problem at all.  If browsers can't handle tga files we can easily 
convert them to another format before display.

> POV-Ray requires command 
> line arguments that change or an ini file that typically isn't edited.  
> So if I'm editing a .pov file, if I chose render, it would have to 
> either figure out where my ini file was located or ask me for the 
> command line options.  None of that information is stored in the .pov 
> file.  To do this, I would want a project?...  not sure.

It can do several things.  First, it can find an ini file if one is in 
the same directory.  It could pop up a prompt for some new options if no 
ini file exists (and even save those options out in the ini file). 
Alternately, it could be in a project, and we could set project 
variables.  Drop by the IRC channel, and between our knowledge of TM, 
and yours of POVRay, we should be all set.


> Also, is it possible to include the povray binaries with the bundle?  It 
> would have to be huge as POV-Ray licensing requires the source code to 
> be distributed with any binary.

Well this depends on the definition of huge.  It would probably be 
better to provide an easy download link from a help document, if it's 
bigger than a few megabytes.  Look in the LaTeX bundle for an example of 
how this can be done

> Another funny question.  Can I take the syntax rules that TextMate uses 
> and use it as the rules for a parser engine?  My Perl parser is pretty 
> simple, and it would be cool if I could make it more functional (like 
> for it to be able to understand expressions).

Probably, but you'll need to use the Oniguruma regular expressions 
library (or one that supports its options), and you'll need to do a lot 
of work to support all of TM grammars' features.  I think it would be 
easier to wait for TM 2.0 in a few months, when Allan says he plans to 
open-source some of the parsing stuff for use in other projects.

There's certainly nothing proprietary about TM's grammar format though. 
  It's about as open as can be at the moment, though new stuff does get 
added somewhat frequently as we users pound on its limitations.

* * *

So, to summarize: yes, we want to help you.  Come on down, and we can 
get the ball rolling.

-Jacob




More information about the textmate mailing list