From mailinglist@textmate.org Thu Jul 29 12:45:38 2010 From: Allan Odgaard To: textmate@lists.macromates.com Subject: [TxMt] Re: code coloring/language scope question Date: Thu, 29 Jul 2010 14:45:35 +0200 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2813588374538198201==" --===============2813588374538198201== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit On 22 Jul 2010, at 01:10, bennett von bennett wrote: > On Wed, Jul 21, 2010 at 1:44 AM, Allan Odgaard >wrote: >> On 20 Jul 2010, at 09:47, plastichairdoo wrote: >>> [...] I know that there's a way to use different code coloring for >>> different parts of a document [...] >> [...] Are you writing your own language grammar? > > actually no - I'd prefer it if someone has already accomplished this > - this > functionality exists for PHP and CSS and (sometimes) for JS code > inside an > HTML page but I was recently working with Processing.js which gets > put into >
 tags and it all gets treated as plain text.
> here is a screenshot.
> since I don't really know how to change this or add new tag colors  
> etc it
> seemed like a good learning opportunity.

For this you need to alter the grammar.

There is one root grammar for your document, e.g. HTML for a HTML file.

This grammar will match tags like