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 ExprListStr(list []Expr) string
- func ExprStr(e Expr) string
- func Print(node Node)
- func String(node Node) string
- func Walk(v Visitor, node Node)
- type ArithEvalExpr
- type ArithExp
- type ArrayIndexExp
- type AssignStmt
- type BasicLit
- type BasicTestExpr
- type BinaryExpr
- type BlockStmt
- type BreakStmt
- type CallExpr
- type CaseClause
- type CaseConversionExp
- 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 ForeachStmt
- type FuncDecl
- type Ident
- type IfStmt
- type LengthExp
- type Node
- type NonNullCheckExp
- type NonNullExp
- type OperatorExp
- type ParamExp
- type PrefixArrayExp
- type PrefixExp
- type ProcSubst
- type ReplaceExp
- type ReplacePrefixExp
- type ReplaceSuffixExp
- type ReturnStmt
- type Stmt
- type SubstringExp
- type SwitchStmt
- 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 ¶
func ExprListStr ¶
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
type ArithExp ¶
type ArithExp struct { Dollar token.Pos // position of "$" Lparen token.Pos // position of "((" X Expr Rparen token.Pos // position of "))" }
Arithmetic Expansion: $(())
An ArithExp node represents an arithmetic expansion expression.
type ArrayIndexExp ¶
type AssignStmt ¶
A AssignStmt node represents a assign statement.
func (*AssignStmt) End ¶
func (s *AssignStmt) End() token.Pos
func (*AssignStmt) Pos ¶
func (s *AssignStmt) Pos() token.Pos
type BasicLit ¶
type BasicLit struct { Kind token.Token // Token.Empty | Token.Null | Token.Boolean | Token.Byte | Token.Integer | Token.Currency | Token.Long | Token.Single | Token.Double | Token.Date | Token.String | Token.Object | Token.Error Value string ValuePos token.Pos // literal position }
A BasicLit node represents a literal of basic type.
type BasicTestExpr ¶
type BasicTestExpr struct { Lbrack token.Pos // position of "[" X Expr Rbrack token.Pos // position of "]" }
[ ]
A BasicTestExpr node represents a basic test command expression.
func (*BasicTestExpr) End ¶
func (x *BasicTestExpr) End() token.Pos
func (*BasicTestExpr) Pos ¶
func (x *BasicTestExpr) 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 }
type BlockStmt ¶
type BlockStmt struct { Tok token.Token // Token.NONE | Token.LBRACE Opening token.Pos List []Stmt Closing token.Pos }
A BlockStmt node represents a block statement.
type CaseClause ¶
type CaseConversionExp ¶
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 ¶
A ContinueStmt node represents a continue statement.
func (*ContinueStmt) End ¶
func (s *ContinueStmt) End() token.Pos
func (*ContinueStmt) Pos ¶
func (s *ContinueStmt) Pos() token.Pos
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
type File ¶
type File struct { Doc *CommentGroup Stmts []Stmt Decls []Decl }
type ForeachStmt ¶
type ForeachStmt struct { For token.Pos // position of "for" Elem Expr In token.Pos // position of "in" Group []Expr Body *BlockStmt EndPos token.Pos // position of "end" }
A ForeachStmt node represents a foreach statement.
func (*ForeachStmt) End ¶
func (s *ForeachStmt) End() token.Pos
func (*ForeachStmt) Pos ¶
func (s *ForeachStmt) Pos() token.Pos
type FuncDecl ¶
type FuncDecl struct { Function token.Pos // position of "function" Name *Ident Recv []Expr Body *BlockStmt EndPos token.Pos // position of "end" }
A FuncDecl node represents a function declaration.
type IfStmt ¶
type IfStmt struct { If token.Pos // position of "if" Cond Expr Body *BlockStmt Elif []*IfStmt Else *BlockStmt EndPos token.Pos // position of "end" }
An IfStmt node represents an if statement.
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 ParamExp ¶
type ParamExp 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 ParamExp node represents an parameter expansion expression.
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 ¶
A ReturnStmt node represents a return statement.
func (*ReturnStmt) End ¶
func (s *ReturnStmt) End() token.Pos
func (*ReturnStmt) Pos ¶
func (s *ReturnStmt) Pos() token.Pos
type SubstringExp ¶
type SwitchStmt ¶
type SwitchStmt struct { Switch token.Pos // position of "switch" Lparen token.Pos // position of "(" Var Expr Rparen token.Pos // position of ")" Cases []*CaseClause Else *BlockStmt EndPos token.Pos // position of "end" }
A SwitchStmt node represents a switch statement.
func (*SwitchStmt) End ¶
func (s *SwitchStmt) End() token.Pos
func (*SwitchStmt) Pos ¶
func (s *SwitchStmt) Pos() token.Pos
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).