[TxMt] language grammar suggestion: auto-numbering captures
Michael Sheets
mummer at whitefalls.org
Wed Aug 8 05:13:30 UTC 2007
On Aug 7, 2007, at 6:52 PM, Timothy Bates wrote:
> It seems there is no way to have parts of a capture scoped by calls
> to $self or #repository elements, which means that complex captures
> get to have many capture elements.
>
> It would be handy if there was a code for language grammar capture
> numbering, so that these are more resilient and self-healing when
> the regexp underlying their definition changes.
>
> What I would suggest for TM2 is something like a code for "next
> group" so instead of explicitly numbering all matches, only non-
> sequential elements are explicitly numbered, and all others are
> self numbering. A nice code would be "#". A nice twist would be if
> this supported skipping elements when suffixed with an addition "#+
> +" or "#+n"
The simple flaw in this is that the captures are a dictionary, and
each dictionary key must be unique. It's not possible to have a
single character like that. Now it could happen where you use this
notation and then TextMate translates it into the actual numbers when
it saves it. However try hitting enter inside a capture dictionary, a
new capture set will be created with the next sequential number,
basically the same thing already built in. :)
More information about the textmate
mailing list