[TxMt] two things on language bundle syntax definitions

Allan Odgaard throw-away-1 at macromates.com
Thu Nov 10 05:32:20 UTC 2005


On 09/11/2005, at 22.16, Paul Bissex wrote:

> [...] What I'd like to do is also specially color the heredoc tags,  
> just to
> make the beginning and end of each block stand out. Is there a "right
> way" to do that?

Use captures. In your case that'd be something like:

	{	name = 'meta.scope.heredoc';
		begin = '<<<(HTML)';
		end = '^(HTML);';
		patterns = ( { include = 'text.html.basic'; } );
		captures = { 1 = { name = "keyword.other.HTML-token"; }; };
	}

Then capture #1 of the begin/end match gets assigned  
keyword.other.HTML-token as name, and you can style that.

You can also specify beginCaptures and endCaptures to only name  
captures in the begin or end patterns.

If you include \n in the match (capture), styling the background of  
it will continue to the right border, so that'd make it possible to  
get sort of a divider line (like e.g. in Diff files or the release  
notes).

> [...] What's the canonical name for these language syntax definitions?

Initially it was syntaxes, but since then, I've referred to them  
mostly as language grammars, as I think that's a nicer phrase, and  
they have approached real grammars (since the initial release).

Keeping Syntax Highlight in the Help books table of contents though,  
was sort of on purpose, since I figured everybody would know what  
that was about.




More information about the textmate mailing list