[TxMt] Re: including rules from another language's repository

Gerd Knops gerti-textmate at bitart.com
Fri May 25 20:30:34 UTC 2012


On May 25, 2012, at 2:26 PM, Matthew Johnson wrote:

> I am working on a language grammar.  I would like to include repository rules from a different language.  I have tried including the language itself at the top of my grammar and then including the rule in necessary place in my grammar but it does not appear to work.  I am hoping that there is a syntax for doing this and I just haven't discovered it yet.  If anyone can point me in the right direction I would appreciate it!
> 
There should be many examples (eg HTML should include JS and CSS etc), attached a short custom one for Lua that includes the regular Lua syntax at the end.

Gerd



{	patterns = (
		{	match = '^#!/.*\blua\b';
			name = 'variable.other.register';
		},
		{	captures = {
				1 = { name = 'comment.line.dashdash.lua'; };
				2 = { name = 'punctuation.definition.comment.lua'; };
			};
			match = '^((--).*$\n?)';
			name = 'meta.comment.full-line.lua';
		},
		{	begin = '^(?=(\t| {4}))';
			end = '(?=[^\t\s])';
			name = 'meta.leading-tabs';
			patterns = (
				{	captures = {
						1 = { name = 'meta.odd-tab'; };
						2 = { name = 'meta.even-tab'; };
					};
					match = '(\t| {4})(\t| {4})?';
				},
			);
		},
		{	include = 'source.lua'; },
	);
}



More information about the textmate mailing list