[TxMt] language grammar suggestion: auto-numbering captures
Timothy Bates
tim.bates at ed.ac.uk
Tue Aug 7 23:52:06 UTC 2007
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"
Then, if we change a match from, say:
match = '(a)(b)(c)';
To say:
match = '(a)(a1)(b)(c)';
Then the numbering, instead of manually being recoded from this:
1 = { name = 'a'; };
2 = { name = 'b'; };
3 = { name = 'c'; };
to this:
1 = { name = 'a'; };
2 = { name = 'a1'; };
3 = { name = 'b'; };
4 = { name = 'c'; };
Could simply stay as this (where # is a code for "next sequential
number"
1 = { name = 'a'; };
# = { name = 'a1'; };
# = { name = 'b'; };
# = { name = 'c'; };
In the more complex case,
1 = { name = 'a'; };
# = { name = 'a1'; };
#+1 = { name = 'b'; }; //skips a group
# = { name = 'c'; };
More information about the textmate
mailing list