System.Management.Automation.Language Namespace

Classes

ArrayExpressionAst

The ast that represents an array expression, e.g. @(1). The array literal (e.g. 1,2,3) is represented by ArrayLiteralAst.

ArrayLiteralAst

The ast that represents an array literal expression, e.g. 1,2,3. An array expression, e.g. @(dir), is represented by ArrayExpressionAst. An array literal expression can be constructed from a single element, as happens with the unary comma operator, e.g. ,4.

ArrayTypeName

Represents the name of an array type including the dimensions.

AssignmentStatementAst

The ast that represents an assignment statement, e.g. $x = 42.

Ast

The abstract base class for all PowerShell abstract syntax tree nodes.

AstVisitor

AstVisitor is used for basic scenarios requiring traversal of the nodes in an Ast. An implementation of AstVisitor does not explicitly traverse the Ast, instead, the engine traverses all nodes in the Ast and calls the appropriate method on each node.

AstVisitor2

AstVisitor for new Ast node types.

AttributeAst

The ast representing an attribute with optional positional and named arguments.

AttributeBaseAst

An abstract base class representing attributes that accept optional arguments, e.g. [Parameter()], as well as type constraints, such as [int].

AttributedExpressionAst

The ast that represents an expression with an attribute. This is normally allowed only on parameters or variables being assigned, e.g. [Parameter()]$PassThru or [ValidateScript({$true})$abc = 42.

BaseCtorInvokeMemberExpressionAst

The ast that represents the invocation of a base ctor method from PS class instance ctor, e.g. class B : A{ B() : base() {} }.

BinaryExpressionAst

The ast representing a binary expression, e.g. $a + $b.

BlockStatementAst

The ast that represents a scriptblock with a keyword name. This is normally allowed only for script workflow. e.g. parallel { ... } or sequence { ... }.

BreakStatementAst

The ast representing the break statement.

CatchClauseAst

The ast that represents a single catch as part of a try statement.

ChainableAst

An AST representing a syntax element chainable with '&&' or '||'.

CodeGeneration

Contains utility methods for use in applications that generate PowerShell code.

CommandAst

The ast for a command invocation, e.g. dir *.ps1.

CommandBaseAst

An abstract base class for a command and an expression wrapper that allows an expression as a command in a pipeline.

CommandElementAst

An abstract base class for the components of a CommandAst.

CommandExpressionAst

The ast representing an expression when the expression is used as the first command of a pipeline.

CommandParameterAst

The ast that represents a parameter to a command, e.g. dir -Path a*, this class represent '-Path', and in dir -Path:a*, this class represents '-Path:a*'.

In the first case, the argument 'a*' is not represented by this class because the parser can't know until runtime if the argument is positional or if -Path accepts an argument. In the later case, the argument 'a*' always belongs to the parameter -Path.

CommentHelpInfo

The help content specified via help comments for a given script or script function.

ConfigurationDefinitionAst

The ast represents the DSC configuration statement.

ConstantExpressionAst

The ast representing constant values, such as numbers. Constant values mean truly constant, as in, the value is always the same. Expandable strings with variable references (e.g. "$val") or sub-expressions (e.g. "$(1)") are not considered constant.

ContinueStatementAst

The ast representing the continue statement.

ConvertExpressionAst

The ast that represents a cast expression, e.g. [wmiclass]"Win32_Process".

DataStatementAst

The ast representing the data statement.

DefaultCustomAstVisitor

Default implementation of ICustomAstVisitor interface.

DefaultCustomAstVisitor2

Default implementation of ICustomAstVisitor2 interface.

DoUntilStatementAst

The ast that represents a do/until statement.

DoWhileStatementAst

The ast that represents the do/while statement.

DynamicKeyword

Defines the schema/behaviour for a dynamic keyword. a constrained.

DynamicKeywordParameter

Metadata about a parameter for a dynamic keyword. Adds one new property to the base classL Switch for switch parameters (THere is no such thing as a switch property...)

DynamicKeywordProperty

Metadata about a member property for a dynamic keyword.

DynamicKeywordStatementAst

The ast represents the DynamicKeyword statement.

ErrorExpressionAst

A placeholder expression used when there are syntactic errors in the source script.

ErrorStatementAst

A placeholder statement used when there are syntactic errors in the source script.

ExitStatementAst

The ast representing the exit statement.

ExpandableStringExpressionAst

The ast that represents a double quoted string (here string or normal string) and can have nested variable references or sub-expressions, e.g. "Name: $name`nAge: $([DateTime]::Now.Year - $dob.Year)".

ExpressionAst

An abstract base class that represents all PowerShell expressions.

FileRedirectionAst

The ast representing a redirection to a file, e.g. dir > out.txt, the '> out.txt' is represented by this ast.

FileRedirectionToken

A file redirection.

ForEachStatementAst

The ast representing the foreach statement.

ForStatementAst

The ast for a for statement.

FunctionDefinitionAst

The ast that represents a function or filter definition. The function is always named.

FunctionMemberAst

The ast for a method.

GenericTypeName

Represent a closed generic type including its arguments.

HashtableAst

The ast that represents a hash literal, e.g. @{a = 1}.

IfStatementAst

The ast that represents an if statement.

IndexExpressionAst

The ast that represents an index expression, e.g. $a[0].

InputRedirectionToken

The (currently unimplemented) input redirection.

InvokeMemberExpressionAst

The ast that represents the invocation of a method, e.g. $sb.Append('abc') or [math]::Sign($i).

LabeledStatementAst

An abstract base class for statements that have labels such as a while statement or a switch statement.

LabelToken
LoopStatementAst

An abstract base class for looping statements including a the do/while statement, the do/until statement, the foreach statement, the for statement, and the while statement.

MemberAst

An abstract base class for type members.

MemberExpressionAst

The ast that represents accessing a member as a property, e.g. $x.Length or [int]::MaxValue. Most often this is a simple property access, but methods can also be access in this manner, returning an object that supports invoking that member.

MergingRedirectionAst

The ast representing a redirection that merges 2 streams, e.g. dir 2>&1

MergingRedirectionToken

A merging redirection.

NamedAttributeArgumentAst

The ast representing a named attribute argument. For example, in [Parameter(Mandatory=$true)], this ast represents Mandatory=$true.

NamedBlockAst

The ast representing a begin, process, end, or dynamicparam block in a scriptblock. This ast is used even when the block is unnamed, in which case the block is either an end block (for functions) or process block (for filters).

NoRunspaceAffinityAttribute

The attribute for a PowerShell class to not affiliate with a particular Runspace\SessionState.

NullString

This type is introduced to provide a way to pass null into a .NET method that has a string parameter.

NumberToken

A constant number token. The value may be any numeric type including int, long, double, or decimal.

ParamBlockAst

The ast representing the param statement in a script block.

ParameterAst

The ast representing a parameter to a script. Parameters may appear in one of 2 places, either just after the name of the function, e.g. function foo($a){} or in a param statement, e.g. param($a).

ParameterBindingResult

Represents the binding of a parameter to its argument.

ParameterToken

A parameter to a cmdlet (always starts with a dash, like -Path).

ParenExpressionAst

The ast that represents an expression (or pipeline) that is enclosed in parentheses, e.g. (1) or (dir)

ParseError
Parser

The parser that parses PowerShell script and returns a ScriptBlockAst, tokens, and error messages if the script cannot be parsed successfully.

PipelineAst

The ast that represents a PowerShell pipeline, e.g. gci -re . *.cs | select-string Foo or 65..90 | % { [char]$_ }. A pipeline must have at least 1 command. The first command may be an expression or a command invocation.

PipelineBaseAst

An abstract base class for statements that include command invocations, pipelines, expressions, and assignments. Any statement that does not begin with a keyword is derives from PipelineBastAst.

PipelineChainAst

A command-oriented flow-controlled pipeline chain. E.g. npm build && npm test or Get-Content -Raw ./file.txt || "default".

PropertyMemberAst

The ast for a property.

RedirectionAst

An abstract base class representing both file redirections and merging redirections.

RedirectionToken

An abstract base class for merging and file redirections.

ReflectionTypeName

A class that allows a Type to be used directly in the PowerShell ast.

ReturnStatementAst

The ast representing the return statement.

ScriptBlockAst

A ScriptBlockAst is the root ast node for a complete script.

ScriptBlockExpressionAst

The ast that represents an anonymous script block expression, e.g. { dir }.

ScriptExtent

A script extent used to customize the display of error location information.

ScriptPosition

Represents a single point in a script. The script may come from a file or interactive input.

ScriptRequirements
StatementAst

An abstract base class for any statement like an if statement or while statement.

StatementBlockAst

The ast representing a block of statements. The block of statements could be part of a script block or some other statement such as an if statement or while statement.

StaticBindingError

Represents the exception generated by the static parameter binding process.

StaticBindingResult

Represents the results of the PowerShell parameter binding process.

StaticParameterBinder

Runs the PowerShell parameter binding algorithm against a CommandAst, returning information about which parameters were bound.

StringConstantExpressionAst

The ast that represents a constant string expression that is always constant. This includes both single and double quoted strings, but the double quoted strings will not be scanned for variable references and sub-expressions. If expansion of the string is required, use ExpandableStringExpressionAst.

StringExpandableToken

A double quoted string, or a double quoted here string.

StringLiteralToken

A single quoted string, or a single quoted here string.

StringToken

The base class for any string token, including single quoted string, double quoted strings, and here strings.

SubExpressionAst

The ast that represents a subexpression, e.g. $(1).

SwitchStatementAst

The ast that represents a switch statement.

TernaryExpressionAst

The ast representing a ternary expression, e.g. $a ? 1 : 2.

ThrowStatementAst

The ast representing the throw statement.

Token

Represents many of the various PowerShell tokens, and is the base class for all PowerShell tokens.

TokenTraits

A utility class to get statically known traits and invariant traits about PowerShell tokens.

TrapStatementAst

The ast that represents the trap statement.

TryStatementAst

The ast that represents a try statement.

TypeConstraintAst

The ast representing a type constraint, which is simply a typename with no arguments.

TypeDefinitionAst

The ast representing a type definition including attributes, base class and implemented interfaces, plus it's members.

TypeExpressionAst

The ast that represents a type literal expression, e.g. [int].

TypeName

A simple type that is not an array or does not have generic arguments.

UnaryExpressionAst

The ast representing an expression with a unary operator.

UsingExpressionAst

The ast that represents a "using" expression, e.g. $using:pshome

UsingStatementAst

The ast representing a using statement.

VariableExpressionAst

The ast representing a variable reference, either normal references, e.g. $true, or splatted references @PSBoundParameters.

VariableToken

A variable token - either a regular variable, such as $_, or a splatted variable like @PSBoundParameters.

WhileStatementAst

The ast for a while statement.

Interfaces

IAstPostVisitHandler

Implement this interface when you implement AstVisitor or AstVisitor2 when you want to do something after possibly visiting the children of the ast.

ICustomAstVisitor
ICustomAstVisitor2
IScriptExtent

Represents the a span of text in a script.

IScriptPosition

Represents a single point in a script. The script may come from a file or interactive input.

ITypeName

The name and attributes of a type.

Enums

AstVisitAction

Each Visit* method in AstVisitor returns one of these values to control how visiting nodes in the AST should proceed.

ConfigurationType

Defines types of configuration document.

DynamicKeywordBodyMode

Defines the body mode for a dynamic keyword. It can be a scriptblock, hashtable or command which means no body.

DynamicKeywordNameMode

Defines the name modes for a dynamic keyword. A name expression may be required, optional or not permitted.

ForEachFlags

Flags that are specified on a foreach statement. Values may be or'ed together, not all invalid combinations of flags are detected.

MethodAttributes

Flags for a method.

PropertyAttributes

The attributes for a property.

RedirectionStream

The stream number that is redirected.

StringConstantType

The kind of string constant.

SwitchFlags

Flags that are specified on a switch statement. Values may be or'ed together, not all invalid combinations of flags are detected.

TokenFlags

Flags that specify additional information about a given token.

TokenKind

The specific kind of token.

TypeAttributes

Specifies type attributes.

UsingStatementKind

The kind of using statement.