[SVN] RFC: use first (not longest) match

Allan Odgaard allan at macromates.com
Sat Aug 6 08:41:23 UTC 2005


Currently when finding a rule from the grammar, TextMate will use the  
longest match, and in case of a tie, the first of these.

Since this is partly broken by not being able to know how long a  
begin match is (and thus using the length of the begin pattern), I  
was thinking about changing it, so that it always just uses first match.

This would also make it easier when dealing with includes. E.g. for  
embedded source in HTML, the HTML grammar wants to match a shorter  
comment than the actual language (i.e. to the ?>, %> or similar) and  
I also recall a problem with LaTeX where the catch-all TeX rule took  
the keyword (because it did a longer match).

Any objections?




More information about the textmate-dev mailing list