[TxMt] Re: question RE code reuse in language grammar

Allan Odgaard mailinglist at textmate.org
Mon Apr 22 04:43:56 UTC 2013


On Apr 21, 2013, at 23:14, Phil Schumm <pschumm at uchicago.edu> wrote:

> […] Now in your example, what if 'art' were in the repository?  Could I do the following:
> 
>    { begin    = 'st';
>      end      = '$';
>      patterns = ( { include = '#art'; } );
>    }
> 
> where in the repository I have
> 
>    art = {
>        name  = 'meta.innert';
>        match = '\Gart';
>    }

Yes, that is functionally equivalent.

> Finally, suppose 'art' were also valid at the beginning of a line?  It seems like if I wanted to reuse the definition (including the scope), I would add:
> 
>    { begin    = '^';
>      end      = '$';
>      patterns = ( { include = '#art'; } );
>    }
> 
> Does that make sense? […]

An alternative would be to anchor the match to either BOL or end of last match, example:

   art = {
       name  = 'meta.innert';
       match = '(^|\G)art';
   }



More information about the textmate mailing list