[TxMt] Re: Language gramar and end match
Josh Varner
josh.varner at gmail.com
Fri Nov 5 19:41:40 UTC 2010
If I understand you correctly, the end of the embedded section is simply the
next '@@' start marker. So, change your end match to use a look-ahead:
end = '^(?=@@)';
On Fri, Nov 5, 2010 at 11:19 AM, Pedro Melo <melo at simplicidade.org> wrote:
> Hi,
>
> I have a small embedded mini-language that allows me to include HTML
> and CSS files inline inside the code.
>
> The layout is something like this:
>
> ------ 8< -----
> @@ filename.html
> <div>....</div>
>
> @@ styles.css
> ... css stuff ...
>
> @@ other.html
> ... more html...
>
> ------ 8< -----
>
> I'm using something like this:
>
> { name = 'embedded.html';
> begin = '^(@@)\s+(.+[.]html?)\s*$';
> end = '^@@';
> captures = {
> 1 = { name = 'embedded.marker'; };
> 2 = { name = 'embedded.filename'; };
> };
> patterns = ( { include = 'text.html'; } );
> },
> { name = 'embedded.css';
> begin = '^(@@)\s+(.+[.]css)\s*$';
> end = '^@@';
> captures = {
> 1 = { name = 'embedded.marker'; };
> 2 = { name = 'embedded.filename'; };
> };
> patterns = ( { include = 'text.css'; } );
> },
>
> But the problem is that the "end" rule captures the @@ pair to it
> cannot be matched by the next block "begin".
>
> If I add an extra @@ just before the second file, it all works fine.
>
> Is there any trick to get around this?
>
> Thanks,
> --
> Pedro Melo
> http://www.simplicidade.org/
> xmpp:melo at simplicidade.org <xmpp%3Amelo at simplicidade.org>
> mailto:melo at simplicidade.org
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20101105/cf9b82f9/attachment.html>
More information about the textmate
mailing list