Hi --
I'm trying to develop a new language syntax for project management, note taking and task management around GTD. I've been using Markdown but would like to integrate some of the task features of the GTD2 bundle as well as some project reporting scripts. Rather than develop this as a completely distinct language, I'd like to simply extend the Markdown bundle, based on special casing more specific syntactic matches of existing Markdown syntax. For example, where Markdown recognizes:
- my colleague
as an unordered list, I'd like to extend it to recognize:
- @call my colleague
as a todo item, with a phone call context. This allows specialized todo items to be spread throughout a project document, then extracted, rolled up, etc using reporting scripts.
This is my first attempt at bundle development, so I'm trying to figure the cleanest way to do this type of language extension. I've read the various docs and blog entries on language syntax and contexts, as well as http://wiki.macromates.com/Main/Howtos#bundleExtension, which is on target but lacks some detail. In particular:
1. How do you override or specialize certain syntactic patterns from a base language? The language docs show how to use "include" to reference a whole separate grammar, but I think what I'm looking for is to override only a single grammar rule. In the above example, should I copy the "unordered list" pattern from the Markdown plist file and use a modified version in the new language file? Or is there a way to "subclass" the syntax w/out this copy-paste model by including only the one rule?
2. Are there restrictions on the file suffixes for this new language? Should the new language share the same file suffix as the original, or come up with a different one?
Any pointers to sample code or even bundles that already do this type of extension would be greatly appreciated.
Thanks!
Ramon
On 5 Nov 2007, at 06:50, Ramon M. Felciano @ Yahoo wrote:
- How do you override or specialize certain syntactic patterns from
a base language? The language docs show how to use "include" to reference a whole separate grammar, but I think what I'm looking for is to override only a single grammar rule. In the above example, should I copy the "unordered list" pattern from the Markdown plist file and use a modified version in the new language file? Or is there a way to "subclass" the syntax w/out this copy-paste model by including only the one rule?
Include is presently the only way to “subclass”. So in your case you likely want to copy/paste.
- Are there restrictions on the file suffixes for this new
language? Should the new language share the same file suffix as the original, or come up with a different one?
It would be good to pick a new file extension, so that the new language can be bound to that extension (and old files will still use the regular grammar).