Re(2): [TxMt] excluding match from language pattern

Allan Odgaard throw-away-1 at macromates.com
Wed Mar 8 22:49:53 UTC 2006


On 8/3/2006, at 9:10, Quinn Comendant wrote:

> Problem 1: The SQL is treated as a double quoted string, which it is,
> but I want source.sql.embedded to override string.quoted.double.php. I
> added contentName = 'source.sql.embedded'; and now it works.

So no problem, I presume?

> Problem 2: $foo should be variable.other.php. Ok, I think I know  
> how to
> do this, using captures, right? Or maybe even better would be to  
> use {	
> include = '#var_basic'; }? Nope, none of those work.

Yes, I believe my example did use a capture to name it.

> Problem 3: '" . $this->bar() . "' should be source.php but instead it
> considers it a string.quoted.single.php

I would think it is: string.quoted.single.sql

This is because the ' starts a single quoted string in SQL. You will  
need a rule to override that, likely only when next character is a ".

> What does it mean to use a pattern with only a "match" statement?

That this pattern is matched against the text, and if it does match,  
the name of the rule is assigned to that portion of the text (and the  
text is not matched by other rules afterwards).

> What is "\\."?

That’s the regular expression to match a backslash followed by any  
character.

This is for things like: "this \"is\" a string"

Here \\. will match the two \", so that the " there won’t end the  
string.

> But there is a problem with this solution: it doesn't allow for  
> single-quoted strings
> here, for example if '$foo' needs to be 'foo'.

Not sure what this refers to, but if it lack a match, add it ;)

> [...] Unrelated question: what is "swallow"? It seems to be  
> undocumented.

http://lists.macromates.com/pipermail/textmate/2006-February/008692.html





More information about the textmate mailing list