I'm interested in syntax coloring for POV-Ray. Has anyone worked on this?
--
James Reynolds http://james.magnusviri.com james(a)magnusviri.com - james(a)scl.utah.edu
James Reynolds wrote:
I'm interested in syntax coloring for POV-Ray. Has anyone worked on this?
Nope, but it's on the requested bundles list, and I'd be glad to help out if you run into any snags. I say go for it! And stop by the [##textmate][irc] channel so we can help you out! POVRay is great, and it would be really neat if we could get images to, e.g., render and show up in the TM webkit view.
-Jacob
[irc]: irc://irc.freenode.net/##textmate
On Oct 24, 2006, at 4:22 AM, Jacob Rus wrote:
James Reynolds wrote:
I'm interested in syntax coloring for POV-Ray. Has anyone worked on this?
Nope, but it's on the requested bundles list, and I'd be glad to help out if you run into any snags. I say go for it! And stop by the [##textmate][irc] channel so we can help you out! POVRay is great, and it would be really neat if we could get images to, e.g., render and show up in the TM webkit view.
Ok, how do I start? Should I copy an existing bundle or start from scratch. 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.
The only problems I see with rendering from TextMate and displaying the results is: POV-Ray makes tga files by default; 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.
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.
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).
James
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
On Oct 24, 2006, at 2:44 PM, James Reynolds wrote:
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.
There will be a new beta of the TextMate book[1], probably within the next two weeks. Among other things, the beta will include a full walkthrough of creating a TextMate language grammar.
1: http://www.pragmaticprogrammer.com/titles/textmate/index.html
James Edward Gray II