[Mono-dev] csharp tab completion.

Marek Safar marek.safar at seznam.cz
Mon Mar 23 13:56:01 EDT 2009


Hi,
>   
>>  Secondly, instead of rewriting token in 
>> tokenizer it can be easier to just handle the token specially in the 
>> parser at few places where you want to support completion.
>>     
>
> I am not sure that I understand the suggested approach here.
>   
The idea was something like this

Replace

member_access
: primary_expression DOT IDENTIFIER opt_type_argument_list
{
LocatedToken lt = (LocatedToken) $3;
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, 
lt.Location);
}
| predefined_type DOT IDENTIFIER opt_type_argument_list
{
LocatedToken lt = (LocatedToken) $3;
// TODO: Location is wrong as some predefined types doesn't hold a location
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, 
lt.Location);
}

with

member_access
: primary_expression DOT identifier_completion opt_type_argument_list
{
LocatedToken lt = (LocatedToken) $3;
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, 
lt.Location);
if ($3 != null)
$$ = new CompletionExpression ((Expression) $$);
}
| predefined_type DOT identifier_completion opt_type_argument_list
{
LocatedToken lt = (LocatedToken) $3;
// TODO: Location is wrong as some predefined types doesn't hold a location
$$ = new MemberAccess ((Expression) $1, lt.Value, (TypeArguments) $4, 
lt.Location);
if ($3 != null)
$$ = new CompletionExpression ((Expression) $$);
}

identifier_completion
: IDENTIFIER { $$ = null; }
| COMPLETION { $$ = this; }
;

and we will share most of the code, it will not fit to all cases but the 
majority should benefit.

Marek


More information about the Mono-devel-list mailing list