Documentation
¶
Overview ¶
Copyright 2025 The Hulo Authors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
PowerShell reference: https://learn.microsoft.com/en-us/powershell/scripting/lang-spec/chapter-01?view=powershell-7.5 And https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about?view=powershell-7.5
Copyright 2025 The Hulo Authors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright 2025 The Hulo Authors. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Index ¶
- func Print(node Node)
- func String(node Node) string
- func Walk(v Visitor, node Node)
- func Write(node Node, output io.Writer)
- type ArrayExpr
- type AssignStmt
- type Attribute
- type BinaryExpr
- type BlockExpr
- type BlockStmt
- type BoolLit
- type BreakStmt
- type CallExpr
- type CaseClause
- type CastExpr
- type CatchClause
- type ClassDecl
- type CmdExpr
- type CommaExpr
- type Comment
- type CommentGroup
- type ConstructorDecl
- type ContinueStmt
- type DataStmt
- type DelimitedComment
- type DoUntilStmt
- type DoWhileStmt
- type DynamicparamStmt
- type EnumDecl
- type EnumKeyValue
- type ExplictExpr
- type Expr
- type ExprStmt
- type File
- type ForStmt
- type ForeachStmt
- type FuncDecl
- type FuncStmt
- type GroupExpr
- type HashEntry
- type HashTable
- type HelpDirective
- type Ident
- type IfStmt
- type IncDecExpr
- type IndexExpr
- type IndicesExpr
- type InlinescriptDecl
- type LabelStmt
- type Lit
- type MemberAccess
- type MethodDecl
- type Modifier
- type MultiStringLit
- type Node
- type NumericLit
- type ParallelDecl
- type ParamBlock
- type Parameter
- type ProcessDecl
- type PropertyDecl
- type RangeExpr
- type RedirectExpr
- type ReturnStmt
- type SelectExpr
- type SequenceDecl
- type SingleLineComment
- type StaticMemberAccess
- type Stmt
- type StringLit
- type SubExpr
- type SwitchPattern
- type SwitchStmt
- type ThrowStmt
- type TrapStmt
- type TryStmt
- type TypeLit
- type UsingAssembly
- type UsingDecl
- type UsingModule
- type UsingNamespace
- type VarExpr
- type Visitor
- type WhileStmt
- type WorkflowDecl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArrayExpr ¶ added in v0.2.0
type ArrayExpr struct { At token.Pos // position of '@' Lparen token.Pos // position of '(' Elems []Expr Rparen token.Pos // position of ')' }
@(10, "blue", 12.54e3, 16.30D)
type AssignStmt ¶
type AssignStmt struct { Lhs Expr TokPos token.Pos // position of '=' or '+=', '-=', '*=', etc. Tok token.Token Rhs Expr }
func (*AssignStmt) End ¶ added in v0.2.0
func (x *AssignStmt) End() token.Pos
func (*AssignStmt) Pos ¶ added in v0.2.0
func (x *AssignStmt) Pos() token.Pos
type Attribute ¶
type BinaryExpr ¶
type BinaryExpr struct { X Expr // left operand OpPos token.Pos // position of Op Op token.Token // operator Y Expr // right operand }
A BinaryExpr node represents a binary expression.
func (*BinaryExpr) End ¶
func (x *BinaryExpr) End() token.Pos
func (*BinaryExpr) Pos ¶
func (x *BinaryExpr) Pos() token.Pos
type BlockExpr ¶
type BlockExpr struct { Lbrace token.Pos // position of '{' List []Expr // list of expressions in the block Rbrace token.Pos // position of '}' }
A BlockExpr node represents a script block expression. e.g., { "Hello there" } or { param($x) $x * 2 }
type CaseClause ¶ added in v0.2.0
func (*CaseClause) End ¶ added in v0.2.0
func (x *CaseClause) End() token.Pos
func (*CaseClause) Pos ¶ added in v0.2.0
func (x *CaseClause) Pos() token.Pos
type CastExpr ¶ added in v0.2.0
type CatchClause ¶ added in v0.2.0
type CatchClause struct { Catch token.Pos // position of 'catch' Lbrack token.Pos // position of '[' Type Expr Rbrack token.Pos // position of ']' Body *BlockStmt }
func (*CatchClause) End ¶ added in v0.2.0
func (x *CatchClause) End() token.Pos
func (*CatchClause) Pos ¶ added in v0.2.0
func (x *CatchClause) Pos() token.Pos
type ClassDecl ¶ added in v0.2.0
type ClassDecl struct { Class token.Pos // position of class keyword Name *Ident Ctors []*ConstructorDecl Properties []*PropertyDecl Methods []*MethodDecl }
type Comment ¶ added in v0.2.0
type Comment interface { Stmt // contains filtered or unexported methods }
type CommentGroup ¶ added in v0.2.0
type CommentGroup struct {
List []Comment
}
func (*CommentGroup) End ¶ added in v0.2.0
func (g *CommentGroup) End() token.Pos
func (*CommentGroup) Pos ¶ added in v0.2.0
func (g *CommentGroup) Pos() token.Pos
type ConstructorDecl ¶ added in v0.3.0
type ConstructorDecl struct { Name *Ident Lparen token.Pos Params []Expr Rparen token.Pos Body *BlockStmt }
func (*ConstructorDecl) End ¶ added in v0.3.0
func (d *ConstructorDecl) End() token.Pos
func (*ConstructorDecl) Pos ¶ added in v0.3.0
func (d *ConstructorDecl) Pos() token.Pos
type ContinueStmt ¶
continue [label]
func (*ContinueStmt) End ¶ added in v0.2.0
func (x *ContinueStmt) End() token.Pos
func (*ContinueStmt) Pos ¶ added in v0.2.0
func (x *ContinueStmt) Pos() token.Pos
type DelimitedComment ¶ added in v0.2.0
type DelimitedComment struct { Opening token.Pos // position of '<#' Text string Closing token.Pos // position of '#>' }
<# <help-directive-1> <help-content-1> ...
<help-directive-n> <help-content-n> #>
func (*DelimitedComment) End ¶ added in v0.2.0
func (c *DelimitedComment) End() token.Pos
func (*DelimitedComment) Pos ¶ added in v0.2.0
func (c *DelimitedComment) Pos() token.Pos
type DoUntilStmt ¶ added in v0.2.0
type DoUntilStmt struct { Do token.Pos // position of 'do' Body *BlockStmt Until token.Pos // position of 'until' Lparen token.Pos // position of '(' Cond Expr Rparen token.Pos // position of ')' }
func (*DoUntilStmt) End ¶ added in v0.2.0
func (x *DoUntilStmt) End() token.Pos
func (*DoUntilStmt) Pos ¶ added in v0.2.0
func (x *DoUntilStmt) Pos() token.Pos
type DoWhileStmt ¶ added in v0.2.0
type DoWhileStmt struct { Do token.Pos // position of 'do' Body *BlockStmt While token.Pos // position of 'while' Lparen token.Pos // position of '(' Cond Expr Rparen token.Pos // position of ')' }
func (*DoWhileStmt) End ¶ added in v0.2.0
func (x *DoWhileStmt) End() token.Pos
func (*DoWhileStmt) Pos ¶ added in v0.2.0
func (x *DoWhileStmt) Pos() token.Pos
type DynamicparamStmt ¶ added in v0.2.0
type DynamicparamStmt struct { Dynamicparam token.Pos // position of 'dynamicparam' Body *BlockStmt }
func (*DynamicparamStmt) End ¶ added in v0.2.0
func (x *DynamicparamStmt) End() token.Pos
func (*DynamicparamStmt) Pos ¶ added in v0.2.0
func (x *DynamicparamStmt) Pos() token.Pos
type EnumDecl ¶ added in v0.2.0
type EnumKeyValue ¶ added in v0.3.0
func (*EnumKeyValue) End ¶ added in v0.3.0
func (d *EnumKeyValue) End() token.Pos
func (*EnumKeyValue) Pos ¶ added in v0.3.0
func (d *EnumKeyValue) Pos() token.Pos
type ExplictExpr ¶
type File ¶
type File struct { Docs []*CommentGroup Name *Ident Stmts []Stmt }
type ForStmt ¶
type ForeachStmt ¶
type ForeachStmt struct { Foreach token.Pos // position of 'foreach' Opt token.Token // TODO: -Parallel Lparen token.Pos // position of '(' Elm Expr In token.Pos // position of 'in' Elms Expr Rparen token.Pos // position of ')' Body *BlockStmt }
func (*ForeachStmt) End ¶ added in v0.2.0
func (x *ForeachStmt) End() token.Pos
func (*ForeachStmt) Pos ¶ added in v0.2.0
func (x *ForeachStmt) Pos() token.Pos
type FuncDecl ¶ added in v0.2.0
type GroupExpr ¶ added in v0.2.0
type HashTable ¶
type HelpDirective ¶ added in v0.2.0
type HelpDirective interface {
// contains filtered or unexported methods
}
TODO: add help directive https://learn.microsoft.com/en-us/powershell/scripting/lang-spec/chapter-14?view=powershell-7.5
type IfStmt ¶
type IncDecExpr ¶
type IncDecExpr struct { Pre bool X Expr Tok token.Token // Token.INC or Token.DEC TokPos token.Pos // position of "++" or "--" }
++$X --$X
func (*IncDecExpr) End ¶
func (x *IncDecExpr) End() token.Pos
func (*IncDecExpr) Pos ¶
func (x *IncDecExpr) Pos() token.Pos
type IndicesExpr ¶ added in v0.2.0
type IndicesExpr struct { X Expr Lbrack token.Pos // position of '[' Indices []Expr Rbrack token.Pos // position of ']' }
func (*IndicesExpr) End ¶ added in v0.2.0
func (x *IndicesExpr) End() token.Pos
func (*IndicesExpr) Pos ¶ added in v0.2.0
func (x *IndicesExpr) Pos() token.Pos
type InlinescriptDecl ¶ added in v0.2.0
type InlinescriptDecl struct { Inlinescript token.Pos // position of inlinescript keyword Body *BlockStmt }
func (*InlinescriptDecl) End ¶ added in v0.2.0
func (d *InlinescriptDecl) End() token.Pos
func (*InlinescriptDecl) Pos ¶ added in v0.2.0
func (d *InlinescriptDecl) Pos() token.Pos
type MemberAccess ¶
type MemberAccess struct { Dollar token.Pos // position of '$' Long bool Lbrace token.Pos // position of '{' X Expr Colon token.Pos // position of ':' Y Expr Rbrace token.Pos // position of '}' }
$X:Y or ${X:Y}
func (*MemberAccess) End ¶ added in v0.2.0
func (x *MemberAccess) End() token.Pos
func (*MemberAccess) Pos ¶ added in v0.2.0
func (x *MemberAccess) Pos() token.Pos
type MethodDecl ¶ added in v0.3.0
type MethodDecl struct { StaticPos token.Pos Static bool Type Expr Name *Ident Lparen token.Pos Params []Expr Rparen token.Pos Body *BlockStmt }
func (*MethodDecl) End ¶ added in v0.3.0
func (d *MethodDecl) End() token.Pos
func (*MethodDecl) Pos ¶ added in v0.3.0
func (d *MethodDecl) Pos() token.Pos
type MultiStringLit ¶ added in v0.2.0
type MultiStringLit struct { LAt token.Pos // position of '@' LQuote token.Pos // position of '"' Val string Rquote token.Pos // position of '"' RAt token.Pos // position of '@' }
@" ... "@
func (*MultiStringLit) End ¶ added in v0.2.0
func (x *MultiStringLit) End() token.Pos
func (*MultiStringLit) Pos ¶ added in v0.2.0
func (x *MultiStringLit) Pos() token.Pos
type NumericLit ¶ added in v0.2.0
func (*NumericLit) End ¶ added in v0.2.0
func (x *NumericLit) End() token.Pos
func (*NumericLit) Pos ¶ added in v0.2.0
func (x *NumericLit) Pos() token.Pos
type ParallelDecl ¶ added in v0.2.0
func (*ParallelDecl) End ¶ added in v0.2.0
func (d *ParallelDecl) End() token.Pos
func (*ParallelDecl) Pos ¶ added in v0.2.0
func (d *ParallelDecl) Pos() token.Pos
type ParamBlock ¶ added in v0.2.0
type ParamBlock struct { Attributes []*Attribute Param token.Pos // position of 'param' Lparen token.Pos // position of '(' Params []*Parameter Rparen token.Pos // position of ')' }
func (*ParamBlock) End ¶ added in v0.2.0
func (x *ParamBlock) End() token.Pos
func (*ParamBlock) Pos ¶ added in v0.2.0
func (x *ParamBlock) Pos() token.Pos
type ProcessDecl ¶ added in v0.2.0
func (*ProcessDecl) End ¶ added in v0.2.0
func (d *ProcessDecl) End() token.Pos
func (*ProcessDecl) Pos ¶ added in v0.2.0
func (d *ProcessDecl) Pos() token.Pos
type PropertyDecl ¶ added in v0.3.0
type PropertyDecl struct { ModPos token.Pos Mod Modifier Type Expr Dollar token.Pos Name *Ident Assign token.Pos Value Expr }
func (*PropertyDecl) End ¶ added in v0.3.0
func (d *PropertyDecl) End() token.Pos
func (*PropertyDecl) Pos ¶ added in v0.3.0
func (d *PropertyDecl) Pos() token.Pos
type RedirectExpr ¶ added in v0.2.0
1>&2 or 1>>2
func (*RedirectExpr) End ¶ added in v0.2.0
func (x *RedirectExpr) End() token.Pos
func (*RedirectExpr) Pos ¶ added in v0.2.0
func (x *RedirectExpr) Pos() token.Pos
type ReturnStmt ¶
func (*ReturnStmt) End ¶ added in v0.3.0
func (x *ReturnStmt) End() token.Pos
func (*ReturnStmt) Pos ¶ added in v0.3.0
func (x *ReturnStmt) Pos() token.Pos
type SelectExpr ¶ added in v0.2.0
func (*SelectExpr) End ¶ added in v0.2.0
func (x *SelectExpr) End() token.Pos
func (*SelectExpr) Pos ¶ added in v0.2.0
func (x *SelectExpr) Pos() token.Pos
type SequenceDecl ¶ added in v0.2.0
func (*SequenceDecl) End ¶ added in v0.2.0
func (d *SequenceDecl) End() token.Pos
func (*SequenceDecl) Pos ¶ added in v0.2.0
func (d *SequenceDecl) Pos() token.Pos
type SingleLineComment ¶ added in v0.2.0
<comment> ¶
func (*SingleLineComment) End ¶ added in v0.2.0
func (c *SingleLineComment) End() token.Pos
func (*SingleLineComment) Pos ¶ added in v0.2.0
func (c *SingleLineComment) Pos() token.Pos
type StaticMemberAccess ¶ added in v0.2.0
X::Y
func (*StaticMemberAccess) End ¶ added in v0.2.0
func (x *StaticMemberAccess) End() token.Pos
func (*StaticMemberAccess) Pos ¶ added in v0.2.0
func (x *StaticMemberAccess) Pos() token.Pos
type SubExpr ¶
type SubExpr struct { Dollar token.Pos // position of '$' Lparen token.Pos // position of '(' X Expr Rparen token.Pos // position of ')' }
$( ... )
type SwitchPattern ¶
type SwitchPattern int
const ( SwitchPatternNone SwitchPattern = iota SwitchPatternRegex SwitchPatternWildcard SwitchPatternExact )
func (SwitchPattern) String ¶
func (p SwitchPattern) String() string
type SwitchStmt ¶
type SwitchStmt struct { Switch token.Pos // position of 'switch' Pattern SwitchPattern Casesensitive bool Lparen token.Pos // position of '(' Value Expr Rparen token.Pos // position of ')' Lbrace token.Pos // position of '{' Cases []*CaseClause Default *BlockStmt Rbrace token.Pos // position of '}' }
func (*SwitchStmt) End ¶ added in v0.2.0
func (x *SwitchStmt) End() token.Pos
func (*SwitchStmt) Pos ¶ added in v0.2.0
func (x *SwitchStmt) Pos() token.Pos
type TryStmt ¶
type TypeLit ¶ added in v0.2.0
type UsingAssembly ¶
type UsingDecl ¶
type UsingDecl struct { Using token.Pos *UsingModule *UsingNamespace *UsingAssembly }
type UsingModule ¶
type UsingNamespace ¶
type Visitor ¶ added in v0.2.0
A Visitor's Visit method is invoked for each node encountered by Walk. If the result visitor w is not nil, Walk visits each of the children of node with the visitor w, followed by a call of w.Visit(nil).
type WhileStmt ¶
type WorkflowDecl ¶ added in v0.2.0
type WorkflowDecl struct { Workflow token.Pos // position of workflow keyword Name *Ident Body *BlockStmt }
func (*WorkflowDecl) End ¶ added in v0.2.0
func (d *WorkflowDecl) End() token.Pos
func (*WorkflowDecl) Pos ¶ added in v0.2.0
func (d *WorkflowDecl) Pos() token.Pos