Partilhar via


PSParser.Tokenize Method

Definition

Overloads

Tokenize(Object[], Collection<PSParseError>)

Parse a script into a collection of tokens.

Tokenize(String, Collection<PSParseError>)

Parse a script into a collection of tokens.

Tokenize(Object[], Collection<PSParseError>)

Parse a script into a collection of tokens.

public:
 static System::Collections::ObjectModel::Collection<System::Management::Automation::PSToken ^> ^ Tokenize(cli::array <System::Object ^> ^ script, [Runtime::InteropServices::Out] System::Collections::ObjectModel::Collection<System::Management::Automation::PSParseError ^> ^ % errors);
public static System.Collections.ObjectModel.Collection<System.Management.Automation.PSToken> Tokenize (object[] script, out System.Collections.ObjectModel.Collection<System.Management.Automation.PSParseError> errors);
static member Tokenize : obj[] * Collection -> System.Collections.ObjectModel.Collection<System.Management.Automation.PSToken>
Public Shared Function Tokenize (script As Object(), ByRef errors As Collection(Of PSParseError)) As Collection(Of PSToken)

Parameters

script
Object[]

Script to parse, as an array of lines.

errors
Collection<PSParseError>

Errors happened during parsing.

Returns

Collection of tokens generated during parsing.

Exceptions

Although this API returns most parse-time exceptions in the errors collection, there are some scenarios where resource limits will result in an exception being thrown by this API. This allows the caller to distinguish between a successful parse with errors and a failed parse. All exceptions thrown will be derived from System.Management.Automation.RuntimeException but may contain an inner exception that describes the real issue.

Applies to

Tokenize(String, Collection<PSParseError>)

Parse a script into a collection of tokens.

public:
 static System::Collections::ObjectModel::Collection<System::Management::Automation::PSToken ^> ^ Tokenize(System::String ^ script, [Runtime::InteropServices::Out] System::Collections::ObjectModel::Collection<System::Management::Automation::PSParseError ^> ^ % errors);
public static System.Collections.ObjectModel.Collection<System.Management.Automation.PSToken> Tokenize (string script, out System.Collections.ObjectModel.Collection<System.Management.Automation.PSParseError> errors);
static member Tokenize : string * Collection -> System.Collections.ObjectModel.Collection<System.Management.Automation.PSToken>
Public Shared Function Tokenize (script As String, ByRef errors As Collection(Of PSParseError)) As Collection(Of PSToken)

Parameters

script
String

Script to parse.

errors
Collection<PSParseError>

Errors happened during parsing.

Returns

Collection of tokens generated during parsing.

Exceptions

Although this API returns most parse-time exceptions in the errors collection, there are some scenarios where resource limits will result in an exception being thrown by this API. This allows the caller to distinguish between a successful parse with errors and a failed parse. All exceptions thrown will be derived from System.Management.Automation.RuntimeException but may contain an inner exception that describes the real issue.

Applies to