Share via


IParseSink::EndParameters Method

Called at the end of the parameters, for example, ")".

HRESULT EndParameters ( 
   long line,
   long idx
);

Parameters

  • line
    [in] Line position of the ending character for the parameter list, for example, ")".

  • idx
    [in] Index position of the ending character.

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

This method is called when the parameters of a method are ended, for example, ")".

Call this method only if your IBabelService::ParseSource Method implementation is called with the ParseReason Enumeration value ReasonMethodTip in the reason parameter. You should call IParseSink::EndParameters once for each ending parameter character that is found in the span of text passed to you in the text parameter of the IBabelService::ParseSource Method method.

The Default Babel Implementation in the Language Service Package, this method is called from the StdService::endParameters method that in turn can be called from within your grammar file. The Example in this topic shows how the endParameters method is called when a method parameter list is parsed.

For more details about using the StdService::endParameters method, see How to: Enable Parameter Info ToolTips.

Example

This is a fragment from the default parser.y grammar file that is created by using the Visual Studio Language Service Wizard. This wizard runs when you create a project by selecting the Visual Studio Language Package template in the New Project dialog box. This fragment shows how a method parameter list is parsed, specifically, how the start and end parameter list characters are handled with calls to the methods startParameters and endParameters on the language service (g_service). The endParameters method eventually calls the IParseSink::EndParameters method.

ParenArguments
    : StartArg EndArg                { g_service->matchPair($1,$2); } 
    | StartArg Arguments1 EndArg     { g_service->matchPair($1,$3); }
    | StartArg Arguments1 error      { g_service->endParameters(@3);
                                       g_service->expectError( "unmatched parenthesis", ")" ); }
    ;

StartArg
    : '('                       { g_service->startParameters($1); }
    ;

EndArg
    : ')'                       { g_service->endParameters($1); }
    ;

Arguments1
    : Expr ',' { g_service->parameter($2); } Arguments1
    | Expr
    ;

See Also

Concepts

How to: Enable Parameter Info ToolTips

Reference

IParseSink Interface

IBabelService::ParseSource Method