[TxMt] syntax tool
Allan Odgaard
allan at macromates.com
Sun Jan 16 06:48:10 UTC 2005
On Jan 16, 2005, at 6:58, Chris Thomas wrote:
> A key question might be: how far along is Allan with the syntax
> highlighting rewrite?
Certainly not where I'd like to be with it :/ Also, my primary priority
is to give maximum flexibility to this system, a GUI editor is unlikely
to appear right away (but I'll make sure that syntaxes can be reloaded
etc. from within the editor, and a general bundle-editor is going to
debut in next beta, probably available in 2-3 days) -- I'd say to Nick,
if you like to program, do go ahead and see what you can do!
> Of course, what one could do is establish hierarchy using the names,
> and then have the editor parse the name keys. So you'd have
> 'comment.block.pascal-one' and 'comment.block.pascal-two' [...]
Great idea! Certainly this should be the case. So far I'd relied on the
context of the element to narrow down the scope of the styles applied.
But this is much better.
So basically there are two hierarchies, the context hierarchy which is
reached using CSS-inspired notation, and then the actual element name,
which is a dot-separated hierarchy.
> I don't know what to do exactly with function names and other elements
> that use part of a keyword match ("foregroundColor[2]").
What I have in mind is naming the captures using a new key, e.g.:
{ name = function;
match = "defun ([a-zA-Z][a-zA-Z0-9_]*)\\s*\\(.*\\)";
captureNames = {
1 = "name";
2 = "arguments";
};
}
Since 'name' and 'arguments' are not a children of 'function' I
initially thought that it should be reached with something like
'function#name'. So 'function' is the entire match, and 'function#name'
is only the name part.
However, I'd like to allow for the actual value (of e.g. name) to be
something that one can test when targeting the element, e.g.:
{ name = tag;
begin = '<(.*?)';
end = ...;
captureNames = {
1 = "name";
};
...;
};
And then apply styles like this:
tag[name=strong] { fontStyle: bold; }
tag[name=em] { fontStyle: italic; }
tag[name=u] { fontStyle: underline; }
But I'm still considering implementation details for this one.
> Sorry if this seems rambling, long day...
Not at all, very good post! :)
More information about the textmate
mailing list