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

Quinn Comendant quinn at strangecode.com
Thu Jul 31 19:36:29 UTC 2014


On Thu, 31 Jul 2014 16:44:34 +0200, Allan Odgaard wrote:
> It should NOT go after meta.embedded.sql unless you only want it 
> active in a here-doc context.

Oh, got it—that makes sense. I got it working by adding this in the `patterns` array under `repository` → `language`:

{   name = 'meta.embedded.sql';
	begin = '(?:mysql_query|dbQuery|DB(::)query|(\$db)(->)(query))\(';
	end = '\);';
	beginCaptures = {
		1 = { name = 'keyword.operator.php'; };
		2 = { name = 'variable.other.php'; };
		3 = { name = 'keyword.operator.php'; };
		4 = { name = 'meta.function-call.object.php'; };
	};
	contentName = 'source.sql';
	patterns = (
		{	name = 'string.quoted.double.php';
			contentName = 'source.sql.embedded';
			begin = '"';
			end = '"';
			patterns = (
				{ match = '\\.'; },
				{ match = "'"; },
				{ include = 'source.sql'; },
				{ include = '#var_global'; },
			);
		},
		{ include = '$self'; },
        { include = 'source.sql'; }
	);
},


More information about the textmate mailing list