[TxMt] Re: Modifying the embedded SQL rule in the PHP language bundle

Quinn Comendant quinn at strangecode.com
Thu Jul 31 13:52:41 UTC 2014


On Thu, 31 Jul 2014 13:05:52 +0200, Allan Odgaard wrote:
>> […] I tried many variations of the following, added just below the 
>> existing meta.embedded.sql rule
> 
> I only see one rule with that name, it is included as part of 
> `heredoc_interior`.

I mean _I_ added it just below the existing meta.embedded.sql rule, like this:

    {	name = 'meta.embedded.sql';
    	begin = '(<<<)\s*([''"]?)(SQL)(\2)\s*$\n?';
    	end = '^(\3)\b';
    	beginCaptures = {
    		0 = { name = 'punctuation.section.embedded.begin.php'; };
    		1 = { name = 'punctuation.definition.string.php'; };
    		3 = { name = 'keyword.operator.heredoc.php'; };
    	};
    	endCaptures = {
    		0 = { name = 'punctuation.section.embedded.end.php'; };
    		1 = { name = 'keyword.operator.heredoc.php'; };
    	};
    	contentName = 'source.sql';
    	patterns = ( { include = 'source.sql'; } );
    },
    {	name = 'meta.embedded.sql';
    	begin = '(\$db)->(query)\((")';
    	end = '(\3)\);';
    	beginCaptures = {
    		0 = { name = 'variable.other.php'; };
    		1 = { name = 'meta.function-call.object.php'; };
    		2 = { name = 'string.quoted.double.php'; };
    	};
    	endCaptures = {
    		0 = { name = 'string.quoted.double.php'; };
    	};
    	contentName = 'source.sql';
    	patterns = ( { include = 'source.sql'; } );
    },

The first one is stock, the second a custom rule. Or is it illegal to have two rules with the same 'name'? Clearly I've forgotten how to do this correctly, any advice is appreciated.

Quinn



More information about the textmate mailing list