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.
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 ¶
- Constants
- func Inspect(node Node, f func(Node) bool)
- func Print(node Node)
- func String(node Node) string
- func Walk(v Visitor, node Node)
- type ArithEvalExpr
- type ArithExpr
- type ArrExpr
- type ArrayIndexExp
- type AssignStmt
- type BasicLit
- type BinaryExpr
- type BlockStmt
- type BreakStmt
- type CallExpr
- type CaseClause
- type CaseConversionExp
- type CaseStmt
- type CmdGroup
- type CmdSubst
- type Comment
- type CommentGroup
- type ContinueStmt
- type Decl
- type DefaultValAssignExp
- type DefaultValExp
- type DelPrefix
- type DelSuffix
- type ExpOperator
- type Expr
- type ExprStmt
- type ExtendedTestExpr
- type File
- type ForInStmt
- type ForStmt
- type FuncDecl
- type Ident
- type IfStmt
- type IndexExpr
- type LengthExp
- type Node
- type NonNullCheckExp
- type NonNullExp
- type OperatorExp
- type ParamExpExpr
- type PrefixArrayExp
- type PrefixExp
- type ProcSubst
- type ReplaceExp
- type ReplacePrefixExp
- type ReplaceSuffixExp
- type ReturnStmt
- type SelectStmt
- type Stmt
- type SubstringExp
- type TestExpr
- type UnaryExpr
- type UntilStmt
- type VarExpExpr
- type Visitor
- type WhileStmt
Constants ¶
const ( // The expansion is a string that is the value of parameter // with lowercase alphabetic characters converted to uppercase. ExpOperatorU = "U" // The expansion is a string that is the value of parameter // with the first character converted to uppercase, // if it is alphabetic. ExpOperatoru = "u" // The expansion is a string that is the value of parameter // with uppercase alphabetic characters converted to lowercase. ExpOperatorL = "L" // The expansion is a string that is the value of parameter quoted // in a format that can be reused as input. ExpOperatorQ = "Q" // The expansion is a string that is the value of parameter // with backslash escape sequences expanded as with the $'…' quoting mechanism. ExpOperatorE = "E" // The expansion is a string that is the result of expanding the value of parameter // as if it were a prompt string (see Controlling the Prompt). ExpOperatorP = "P" // The expansion is a string in the form of an assignment statement or declare command that, // if evaluated, will recreate parameter with its attributes and value. ExpOperatorA = "A" // Produces a possibly-quoted version of the value of parameter, // except that it prints the values of indexed and // associative arrays as a sequence of quoted key-value pairs (see Arrays). ExpOperatorK = "K" // The expansion is a string consisting of flag values representing parameter’s attributes. ExpOperatora = "a" // Like the ‘K’ transformation, but expands the keys and values of indexed and // associative arrays to separate words after word splitting. ExpOperatork = "k" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArithEvalExpr ¶
type ArithEvalExpr struct { Lparen token.Pos // position of "((" X Expr Rparen token.Pos // position of "))" }
(( ))
An ArithEvalExpr node represents an arithmetic evaluation expression.
func (*ArithEvalExpr) End ¶
func (x *ArithEvalExpr) End() token.Pos
func (*ArithEvalExpr) Pos ¶
func (x *ArithEvalExpr) Pos() token.Pos
func (*ArithEvalExpr) String ¶
func (e *ArithEvalExpr) String() string
type ArithExpr ¶
type ArithExpr struct { Dollar token.Pos // position of "$" Lparen token.Pos // position of "((" X Expr Rparen token.Pos // position of "))" }
Arithmetic Expansion: $(())
An ArithExpr node represents an arithmetic expansion expression.
type ArrExpr ¶
type ArrExpr struct { Lparen token.Pos // position of "(" Vars []Expr Rparen token.Pos // position of ")" }
(VAR1 VAR2 ... VARN)
type ArrayIndexExp ¶
type AssignStmt ¶
type AssignStmt struct { Local token.Pos // position of "local" Lhs Expr Assign token.Pos // position of "=" Rhs Expr }
func (*AssignStmt) End ¶
func (s *AssignStmt) End() token.Pos
func (*AssignStmt) Pos ¶
func (s *AssignStmt) Pos() token.Pos
type BinaryExpr ¶
type BinaryExpr struct { Compress bool 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 (x Word) End() token.Pos { return token.NoPos }
func (*BinaryExpr) Pos ¶
func (x *BinaryExpr) Pos() token.Pos
func (x Word) Pos() token.Pos { return token.NoPos }
func (*BinaryExpr) String ¶
func (e *BinaryExpr) String() string
type BlockStmt ¶
type CaseClause ¶
type CaseConversionExp ¶
type CaseStmt ¶
type CmdGroup ¶
type CmdGroup struct { Lbrace token.Pos // position of "{" List []Stmt Rbrace token.Pos // position of "}" }
Command Grouping: { }
A CmdGroup node represents a command group expression.
type CmdSubst ¶
type CmdSubst struct { Dollar token.Pos Tok token.Token // Token.LPAREN or Token.BACK_QUOTE Opening token.Pos X Expr Closing token.Pos }
Command Substitution: $( ) or ` `
A CmdSubst node represents a command substitution expression.
type CommentGroup ¶
type CommentGroup struct {
List []*Comment
}
func (*CommentGroup) End ¶
func (g *CommentGroup) End() token.Pos
func (*CommentGroup) Pos ¶
func (g *CommentGroup) Pos() token.Pos
type ContinueStmt ¶
func (*ContinueStmt) End ¶
func (s *ContinueStmt) End() token.Pos
func (*ContinueStmt) Pos ¶
func (s *ContinueStmt) Pos() token.Pos
type Decl ¶
type Decl interface { Node // contains filtered or unexported methods }
All declaration nodes implement the Decl interface.
type DefaultValAssignExp ¶
If parameter is unset or null, the expansion of word is assigned to parameter. The value of parameter is then substituted. Positional parameters and special parameters may not be assigned to in this way.
type DefaultValExp ¶
If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.
type ExpOperator ¶
type ExpOperator string
type ExtendedTestExpr ¶
type ExtendedTestExpr struct { Lbrack token.Pos // position of "[[" X Expr Rbrack token.Pos // position of "]]" }
[[ ]]
An ExtendedTestExpr node represents an extended test command expression.
func (*ExtendedTestExpr) End ¶
func (x *ExtendedTestExpr) End() token.Pos
func (*ExtendedTestExpr) Pos ¶
func (x *ExtendedTestExpr) Pos() token.Pos
func (*ExtendedTestExpr) String ¶
func (e *ExtendedTestExpr) String() string
type File ¶
type File struct { Doc *CommentGroup Stmts []Stmt Decls []Decl }
type ForInStmt ¶
type ForInStmt struct { For token.Pos // position of "for" Var Expr In token.Pos // position of "in" List Expr Semi token.Pos // position of ";" Do token.Pos // position of "do" Body *BlockStmt Done token.Pos // position of "done" }
for name [ [in [words …] ] ; ] do commands; done
type ForStmt ¶
type ForStmt struct { For token.Pos // position of "for" Lparen token.Pos // position of "((" Init Node Semi1 token.Pos // position of ";" Cond Expr Semi2 token.Pos // position of ";" Post Node Rparen token.Pos // position of "))" Do token.Pos // position of "do" Body *BlockStmt Done token.Pos // position of "done" }
for (( expr1 ; expr2 ; expr3 )) ; do commands ; done
type FuncDecl ¶
type IfStmt ¶
type IndexExpr ¶
type IndexExpr struct { X Expr Lbrack token.Pos // position of "[" Y Expr Rbrack token.Pos // position of "]" }
X[Y]
A IndexExpr node represents index expression.
type Node ¶
type Node interface { Pos() token.Pos // position of first character belonging to the node End() token.Pos // position of first character immediately after the node }
All node types implement the Node interface.
type NonNullCheckExp ¶
If parameter is null or unset, the expansion of word (or a message to that effect if word is not present) is written to the standard error and the shell, if it is not interactive, exits. Otherwise, the value of parameter is substituted.
type NonNullExp ¶
If parameter is null or unset, nothing is substituted, otherwise the expansion of word is substituted.
type OperatorExp ¶
type OperatorExp struct { At token.Pos // position of "@" Op ExpOperator }
type ParamExpExpr ¶
type ParamExpExpr struct { Dollar token.Pos // position of "$" Lbrace token.Pos // position of "{" Var Expr *DefaultValExp // ${var:-val} *DefaultValAssignExp // ${var:=val} *NonNullCheckExp // ${var:?val} *NonNullExp // ${var:+val} *PrefixExp // ${!var*} *PrefixArrayExp // ${!var@} *ArrayIndexExp // ${!var[*]} or ${!var[@]} *LengthExp // ${#var} *DelPrefix // ${var#val} or ${var##val} *DelSuffix // ${var%val} or ${var%%val} *SubstringExp // ${var:offset} or ${var:offset:length} *ReplaceExp // ${var/old/new} *ReplacePrefixExp // ${var/#old/new} *ReplaceSuffixExp // ${var/%old/new} *CaseConversionExp // ${var,} or ${var^} or ${var,,} or ${var^^} *OperatorExp // ${var@op} Rbrace token.Pos // position of "}" }
Parameter Expandsion: ${}
A ParamExpExpr node represents an parameter expansion expression.
func (*ParamExpExpr) End ¶
func (x *ParamExpExpr) End() token.Pos
func (*ParamExpExpr) Pos ¶
func (x *ParamExpExpr) Pos() token.Pos
func (*ParamExpExpr) String ¶
func (e *ParamExpExpr) String() string
type PrefixArrayExp ¶
type ProcSubst ¶
type ProcSubst struct { Tok token.Token // Token.GT or Token.LT TokPos token.Pos Lparen token.Pos // position of "(" X Expr Rparen token.Pos // position of ")" }
Process Substitution: <( ) or >( )
A ProcSubst node represents a process substitution expression.
type ReplaceExp ¶
type ReplacePrefixExp ¶
type ReplaceSuffixExp ¶
type ReturnStmt ¶
func (*ReturnStmt) End ¶
func (s *ReturnStmt) End() token.Pos
func (*ReturnStmt) Pos ¶
func (s *ReturnStmt) Pos() token.Pos
type SelectStmt ¶
type SelectStmt struct { Select token.Pos // position of "select" Var Expr In token.Pos // position of "in" List Expr Semi token.Pos // position of ";" Do token.Pos // position of "do" Body *BlockStmt Done token.Pos // position of "done" }
func (*SelectStmt) End ¶
func (s *SelectStmt) End() token.Pos
func (*SelectStmt) Pos ¶
func (s *SelectStmt) Pos() token.Pos
type Stmt ¶
type Stmt interface { Node // contains filtered or unexported methods }
All statement nodes implement the Stmt interface.
type SubstringExp ¶
type TestExpr ¶
type TestExpr struct { Lbrack token.Pos // position of "[" X Expr Rbrack token.Pos // position of "]" }
[ ]
A TestExpr node represents a basic test command expression.
type UntilStmt ¶
type VarExpExpr ¶
Variable Expansion: $a
A VarExpExpr node represents an variable expansion expression.
func (*VarExpExpr) End ¶
func (x *VarExpExpr) End() token.Pos
func (*VarExpExpr) Pos ¶
func (x *VarExpExpr) Pos() token.Pos
func (*VarExpExpr) String ¶
func (e *VarExpExpr) String() string
type Visitor ¶
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).