[TxMt] Re: Re: Pimping the LaTeX grammar - trying to, at least

Allan Odgaard throw-away-1 at macromates.com
Sun Mar 26 08:38:54 UTC 2006


On 26/3/2006, at 3:15, Daniel Käsmayr wrote:

> [...] A couple questions still bog my mind, though:
> - Am I correct assuming that I can use a certain pattern just once?  
> When I copy a rule from Latex.plist to my custom.plist - only the  
> one encountered first gets to markup the text.

Yes, just like a regular parser :)

> - Is there a way to markup a pattern with more than just one  
> scopes? Like for \begin{mycustomlist} set something like  
> meta.environment.list *and* meta.package.custom

Generally one would use a longer scope name and put the extra  
information deeeper in the scope name. But you can use captures to  
overcome the limitation. For example:

    {  match = '\\begin\{mycustomlist\}';
       name = 'meta.environment.list';
       captures = {
          0 = { name = 'meta.package.custom' };
       };
    }

Here capture 0 refer to the entire match. If you wanted even more  
names assigned ot the match, you could just add (…) around the match  
and assign name to that capture (which would also be for the entire  
match).




More information about the textmate mailing list