[TxMt] Windows Script Components

Allan Odgaard throw-away-1 at macromates.com
Mon Jul 3 14:33:26 UTC 2006


On 3/7/2006, at 11:07, Luke Daley wrote:

>> If you’re adding to the default HTML grammar, be sure to place the  
>> rule above the JS <script> rule.
> Shouldn't I be adding it to the XML grammar? Apologies for not be  
> clearer about that.
>
> I am working with .wsc files which are XML declarations of simple  
> COM objects which TextMate already recognises as XML.

Then XML sounds right.

> .....
>
> Actually, just worked out what is wrong. I moved it from the bottom  
> of the list of declerations to the top and it works now :) I wasn't  
> aware that order played a part (I know, RTFM).
>
> I suspect now it has destroyed other declarations though.

Shouldn’t have -- your rule wasn’t applied because a more general tag  
matching rule ate the tag. By moving your rule up, it gets the script  
tag, and still leaves the rest to the general rule.

> What would be ideal is to treat everything inside '<script  
> language="VBScript">\n<![CDATA['  and  ']]>\n</script>' as  
> 'source.vbscript'
>
> Is there a way to match everything inside these tags excluding the  
> tags themselves?

That’s what the begin/end stuff does. The begin matches the start  
(though it can’t match newlines, thus we do just the script tag) and  
end matches the end. The patterns array then setup rules to use  
inside this construct (where we could just include another grammar).

There are a dozen examples of this in the default grammars, e.g. HTML  
includes CSS, JavaScript, PHP, and Ruby inside various special  
constructs.




More information about the textmate mailing list