Share via


IParseSink::StartParameters Method

Called when the parameters of a method are started, for example, "(".

HRESULT StartParameters ( 
   long line,
   long idx
);

Parameters

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

  • idx
    [in] Index position of the starting 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 started, for example, "(".

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

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

For a more detailed example of using the StdService::startParameters method, see How to: Enable Parameter Info ToolTips.

Example

This is a fragment from the default parser.y grammar file that is created using the Visual Studio Language Service Wizard. 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 startParameters method eventually calls the IParseSink::StartParameters 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

ParseReason Enumeration

IBabelService::ParseSource Method