Udostępnij za pośrednictwem


CommandAst Class

Definition

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

public ref class CommandAst : System::Management::Automation::Language::CommandBaseAst
public class CommandAst : System.Management.Automation.Language.CommandBaseAst
type CommandAst = class
    inherit CommandBaseAst
Public Class CommandAst
Inherits CommandBaseAst
Inheritance

Constructors

CommandAst(IScriptExtent, IEnumerable<CommandElementAst>, TokenKind, IEnumerable<RedirectionAst>)

Construct a command invocation.

Properties

CommandElements

A non-empty collection of command elements. This property is never null.

DefiningKeyword

If this command was synthesized out of a dynamic keyword, this property will point to the DynamicKeyword data structure that was used to create this command.

Extent

The extent in the source this ast represents.

(Inherited from Ast)
InvocationOperator

The invocation operator (either Dot or Ampersand) if one was specified, otherwise the value is Unknown.

Parent

The parent tree for this node.

(Inherited from Ast)
Redirections

The possibly empty collection of redirections for this command.

(Inherited from CommandBaseAst)

Methods

Copy()

Copy the CommandAst instance.

Find(Func<Ast,Boolean>, Boolean)

Traverse the entire Ast, returning the first node in the tree for which predicate returns true.

(Inherited from Ast)
FindAll(Func<Ast,Boolean>, Boolean)

Traverse the entire Ast, returning all nodes in the tree for which predicate returns true.

(Inherited from Ast)
GetCommandName()

Returns the name of the command invoked by this ast.

This command name may not be known statically, in which case null is returned.

For example, if the command name is in a variable: & $foo, then the parser cannot know which command is executed. Similarly, if the command is being invoked in a module: & (gmo SomeModule) Bar, then the parser does not know the command name is Bar because the parser can't determine that the expression (gmo SomeModule) returns a module instead of a string.

SafeGetValue()

Constructs the resultant object from the AST and returns it if it is safe.

(Inherited from Ast)
SafeGetValue(Boolean)

Constructs the resultant object from the AST and returns it if it is safe.

(Inherited from Ast)
ToString()

Formats the ast and returns a string.

(Inherited from Ast)
Visit(AstVisitor)

Visit each node in the Ast, calling the methods in astVisitor for each node in the ast.

(Inherited from Ast)
Visit(ICustomAstVisitor)

Visit the Ast using a visitor that can choose how the tree traversal is performed. This visit method is for advanced uses of the visitor pattern where an AstVisitor is insufficient.

(Inherited from Ast)

Applies to