I'm trying to work an issue out...
It's a smalltalk grammar for redline smalltalk.
method start with either + or - to indicate class or instance
then all of the following are examples of valid smalltalk methods
string
at:
at:put:
textually those would be something like
- string
- at: anIndex
- at: anIndex put: aValue
The current rule I have to match that is:
method_definition = {
begin = '^-|\+\s';
end = '$';
patterns = (
{ match = '((\w+:?)(\s*\w+)?)';
captures = {
2 = { name = 'entity.name.function.instance.smalltalk'; };
3 = { name = 'variable.parameter.method.smalltalk'; };
};
},
{ include = '#language_elements'; },
);
};
The problem really are ones like
at:put:
Keyword methods with more than a single keyword.
Textmate sees it not as
at:put:
But at: & put:
Highlighting works great but the naming isn't correct.
Can I mark
at: anIndex put: aValue
as the function
then further say anIndex and aValue are method parameters?
then transforming into just at:put:
If that is a reasonable approach. What is the best way to match the variable number of keywords as a single run?
I can get the one at a time in the above approach but I can't figure out a way to match all at once and still mark the individual method parameters.
On Wednesday, November 30, 2011 at 4:02 AM, Martin Kühl wrote:
What are the rules for what items from a language grammar appear in the
symbol list?
I think the `
entity.name` scopes are included by default.
If you're defining a grammar for a class-based language (it sounds
like you are) you might want to customize their appearance anyway, as
described in [1]. (The Java bundle is a good example.)
Cheers,
Martin
_______________________________________________
textmate mailing list