Condividi tramite


ParseRequest Class

Provides information to execute a parsing operation in a language service.

This API is not CLS-compliant. 

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)

Syntax

'Dichiarazione
<CLSCompliantAttribute(False)> _
Public Class ParseRequest
'Utilizzo
Dim instance As ParseRequest
[CLSCompliantAttribute(false)]
public class ParseRequest
[CLSCompliantAttribute(false)]
public ref class ParseRequest
[<CLSCompliantAttribute(false)>]
type ParseRequest =  class end
public class ParseRequest

Remarks

This class is used to communicate information to a parser about a particular parsing operation and to return information about the parsing operation. The source used by the parser is accessed as a single block of text through the Text property. This text is passed to the ParseRequest constructor.

Notes to Implementers

Everything a typical parsing operation needs can be found in this class so there should be no reason to derive from this class. However, if you do need to derive a class from the ParseRequest class, you must derive a class from the LanguageService class and override the CreateParseRequest method to instantiate your own version of the ParseRequest class.

Note that if your language service is going to support parsing variables for display in the Autos debugging window and/or support validation of breakpoints, you must derive a class from the AuthoringSink class and set the Sink property in an instance of the ParseRequest class to your version of the AuthoringSink class. This can be done in the CreateParseRequest method after the ParseRequest object is created.

Notes to Callers

This class is instantiated by a call to the CreateParseRequest method in the LanguageService class.

Do not attempt to use the View property in a background thread: the IVsTextView object is meant only for foreground use by the base Source class.

Examples

This example shows how to create a new ParseRequest object with a custom AuthoringSink object (the class for which is not shown).

using Microsoft.VisualStudio.Package;
using Microsoft.VisualStudio.TextManager.Interop;

namespace MyLanguagePackage
{
    class MyLanguageService : LanguageService
    {
        public ParseRequest CreateParseRequest(Source s, 
                                               int line, 
                                               int idx, 
                                               TokenInfo info, 
                                               string sourceText, 
                                               string fname, 
                                               ParseReason reason, 
                                               IVsTextView view)
        {
             ParseRequest req = new ParseRequest(line,
                                                 idx,
                                                 info,
                                                 sourceText,
                                                 fname,
                                                 reason,
                                                 view);
             if (req != null)
             {
                  req.Sink = new MyAuthoringSink(reason, line, idx);
             }
             return req;
         }
    }
}

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Package.ParseRequest

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

ParseRequest Members

Microsoft.VisualStudio.Package Namespace