Language editor (was: [SVN] Revision 1189 (Latex))

Allan Odgaard allan at macromates.com
Tue Jun 14 18:21:58 UTC 2005


On Jun 14, 2005, at 16:53, Brad Miller wrote:

> OK.   BTW is there any chance you could make the TM service work  
> with the language definition text widget to make editing the  
> language definitions easier?  I imagine long term you are headed in  
> a different direction, but short term that would be handy.

Unfortuantely not really, since the service stalls the calling  
application.

As for long term plans -- I'd very much like to create a real GUI  
editor, but I'm at a loss as to how to do it.

The problem is that the grammar is a tree where each node can have  
different values and multiple children. Looking around for  
inspiration what comes closest is probably the Netinfo Manager:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedGraphic.png
Type: image/png
Size: 34817 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate-dev/attachments/20050614/1456bb2e/attachment.png>
-------------- next part --------------

At the top would be the rules, and at the bottom would be values for  
the selected rule (begin/end pattern etc.).

As children to each rule could potentially be patterns and begin/end  
captures. Captures would have children 1-n and while currently the  
only attribute which one can set for a capture is name (which would  
be in the bottom view), I probably will extend captures to also allow  
to have sub-patterns in the future.

All in all, I really think this will be a mess, because information  
gets very scattered, and how to add new attributes like e.g. captures  
or change a captures into a beginCaptures key will be cumbersome.


Another option (as I mention in the release notes) is an outline  
editor similar to OmniOutline -- this would probably be much better  
than the clumsy GUI above, but OTOH it's also a lot of work to create  
this widget.

So I'm thinking, the reason why I don't like the current plist format  
is:

  1) double-escaping of regular expressions
  2) needing to put , after array elements and ; after dictionaries  
(something easy forgotten)
  3) no way to have actual comments as long as the OS parses the  
format for me
  4) semantically a bit strange with ?key = value;? for stuff like:  
?include = source.php;?

As for the actual editing widget, yes, that one sucks, but it should  
eventually be possible to use my own component in the bundle editor.

Additionally, I've added type-checks to b13, but to actually show the  
user where the type-error is, I'd need to parse the format myself.

So I'm thinking, maybe at least a short-term solution would be to use  
a new format (just for editing in the bundle editor). I've been  
looking at YAML, and while I think their format itself is too complex  
(to many special rules), a simplified and hardcoded version would  
probably suffice. Hardcoded in the sense that since I know all  
strings are single-lines, and I know which keys are used for strings,  
I don't need any quoting at all (and thus no escaping either).

I have attached the current latex.plist in my simplified YAML format.

If I change the presentation, I was thinking I should also rename the  
keys like this:
    begin    -> starts-with
    end      -> ends-with
    match    -> matches
    patterns -> contains
    include  -> import/reference?

These changes all in an attempt to make it more inviting for  
?newbies? to go ahead and experiment with their own language  
definitions. I still think a GUI is ideal for such goal, because then  
there's no way the user can screwup, OTOH I can't envision how the  
ideal GUI should look.

Comments more than welcome!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: latex.yaml
Type: application/octet-stream
Size: 5672 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate-dev/attachments/20050614/1456bb2e/attachment.yaml>
-------------- next part --------------



More information about the textmate-dev mailing list