[TxMt] Re: Symbol list & Language grammar

Sean T Allen sean at monkeysnatchbanana.com
Wed Nov 30 12:44:56 UTC 2011


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:

> On Wed, Nov 30, 2011 at 04:38, Sean T Allen <sean at monkeysnatchbanana.com (mailto:sean at monkeysnatchbanana.com)> wrote:
> > What are the rules for what items from a language grammar appear in the
> > symbol list?
> >  
>  
>  
> I think the `entity.name (http://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
>  
>  
> [1]: http://manual.macromates.com/en/navigation_overview#customizing_the_list
>  
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com (mailto:textmate at lists.macromates.com)
> http://lists.macromates.com/listinfo/textmate
>  
>  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20111130/bc588c40/attachment.html>


More information about the textmate mailing list