[TxMt] Defining own language based on php + html? (2)
Allan Odgaard
throw-away-1 at macromates.com
Tue Sep 12 22:01:42 UTC 2006
On 12/9/2006, at 17:12, Andreas Pardeike wrote:
> Additional question:
>
> When I include another language, can I still "add" to that language?
> [...]
> <?php
> include 'foo';
> <htm>
> <i>foo</i>
> </htm>
> ?>
>
> is ignored. I thought it would match my part_html rule and become
> a text.html.basic score and get parsed like that?
Normally, yes -- but because the PHP grammar matches the <?php tag,
and enters a new context after this tag, it will not see the other
rules you include (as these are only in the parent context of the <?
php match) -- the match for <?php you do in your new grammar is a
look-ahead match, meaning that this itself does not “eat” the
construct, and thus leaves it for the PHP grammar.
Again this is a problem with having the PHP grammar match <?php … ?>
itself.
I’d suggest you clone the PHP grammar, remove the matching of <?php
… ?> from this clone, and then include that instead of the stock PHP
grammar -- long-term there will be more flexible solutions for
augmenting language grammars.
More information about the textmate
mailing list