[TxMt] Language grammar feature writeup
Brad Miller
bonelake at mac.com
Thu Jun 23 12:51:12 UTC 2005
Stefan
I'll try to explain the logic behind the LaTeX section rule and the
various names.
{ name = "meta.section.latex";
begin = "((\\\\(?:(?:sub)*section|chapter|paragraph|
part))(\\*?)(?:(\\[)[^\\[]*?(\\]))??(\\{))";
end = "(\\}$)";
captures = { 1 = { name =
"support.function.section.latex"; }; };
patterns = (
{ name = "entity.name.section";
match = "[^}]+";
}
);
},
This rule should match LaTeX markup like: \section{Introduction}
The reason that the name for the whole rule uses meta is that we will
never (probably) style the entire section pattern. It is really just
a container for the parts that we want to style which are: the
\section command itself, and the section name.
The section command falls under the support.function group since we
can think of sectioning commands in LaTeX like library functions. In
general support.xxx is to be used for library like components of al
the languages.
The name of the section "Introduction" for example is an entity in
the LaTeX document. Therefore it falls under the entity.name group.
Entities are for class names, function names, variable names, and
the like.
It helps to look at the overall scheme and the examples provided
here: http://macromates.com/wiki/pmwiki?n=Main.NamingLanguageElements
It takes some getting used to, particularly for a languages like TeX/
LaTeX.
Brad
On Jun 23, 2005, at 5:05 AM, Stefan Brantschen wrote:
> Thanks, this is sort of pretty timely for me...! :-)
>
> Regarding some scopes listed on <http://macromates.com/wiki/pmwiki?
> n=Main.NamingLanguageElements> I am not quite sure which to pick --
> could you please shortly comment on the use of "meta" that is used
> quite a bit in the LaTeX bundle, and "support"? For example, in the
> list of basic scopes I find "entity.name.section" with example
> "\section{name}", in the LaTeX bundle I find "meta.section.latex"
> for sections, also using capture "support.function.section.latex"
> -- resulting in 3 used roots for the same element. I am sure I mix
> up stuff, due to lacking know-how and experience as of now, so
> apologies if this is pretty fundamental. But any help is greatly
> appreciated!
>
> Thanks
> - Stefan
>
> On 23 Jun 2005, at 10:44, Allan Odgaard wrote:
>
>
>
>> For those not subscribed to my RSS feed, I did a writeup of the
>> new language grammar features: http://macromates.com/blog/archives/
>> 2005/06/23/language-grammars/
>>
>> _____________________________________________________________________
>> _
>> For new threads USE THIS: textmate at lists.macromates.com
>> (threading gets destroyed and the universe will collapse if you
>> don't)
>> http://lists.macromates.com/mailman/listinfo/textmate
>>
>>
>>
>>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>
>
More information about the textmate
mailing list