Documentation
¶
Index ¶
- type ArithmExp
- type ArithmExpr
- type ArrayExpr
- type Assign
- type BinaryCmd
- type BinaryExpr
- type Block
- type CStyleLoop
- type CallExpr
- type CaseClause
- type CmdSubst
- type Command
- type Comment
- type DeclClause
- type Elif
- type EvalClause
- type Expansion
- type File
- type ForClause
- type FuncDecl
- type IfClause
- type Index
- type LetClause
- type Lit
- type Loop
- type Node
- type ParamExp
- type ParenExpr
- type PatternList
- type ProcSubst
- type Quoted
- type Redirect
- type Replace
- type SglQuoted
- type Stmt
- type Subshell
- type TestClause
- type UnaryExpr
- type UntilClause
- type WhileClause
- type Word
- type WordIter
- type WordPart
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArithmExp ¶
type ArithmExp struct {
Token token.Token
Left, Right token.Pos
X ArithmExpr
}
ArithmExp represents an arithmetic expansion.
type ArithmExpr ¶
type ArithmExpr interface {
Node
// contains filtered or unexported methods
}
ArithmExpr represents all nodes that form arithmetic expressions.
type BinaryExpr ¶
type BinaryExpr struct {
OpPos token.Pos
Op token.Token
X, Y ArithmExpr
}
BinaryExpr represents a binary expression between two arithmetic expression.
func (*BinaryExpr) End ¶
func (b *BinaryExpr) End() token.Pos
func (*BinaryExpr) Pos ¶
func (b *BinaryExpr) Pos() token.Pos
type CStyleLoop ¶
type CStyleLoop struct {
Lparen, Rparen token.Pos
Init, Cond, Post ArithmExpr
}
CStyleLoop represents the behaviour of a for clause similar to the C language.
func (*CStyleLoop) End ¶
func (c *CStyleLoop) End() token.Pos
func (*CStyleLoop) Pos ¶
func (c *CStyleLoop) Pos() token.Pos
type CallExpr ¶
type CallExpr struct {
Args []Word
}
CallExpr represents a command execution or function call.
type CaseClause ¶
type CaseClause struct {
Case, Esac token.Pos
Word Word
List []*PatternList
}
CaseClause represents a case (switch) clause.
func (*CaseClause) End ¶
func (c *CaseClause) End() token.Pos
func (*CaseClause) Pos ¶
func (c *CaseClause) Pos() token.Pos
type Command ¶
type Command interface {
Node
// contains filtered or unexported methods
}
Command represents all nodes that are simple commands, which are directly placed in a Stmt.
type DeclClause ¶
DeclClause represents a Bash declare clause.
func (*DeclClause) End ¶
func (d *DeclClause) End() token.Pos
func (*DeclClause) Pos ¶
func (d *DeclClause) Pos() token.Pos
type EvalClause ¶
EvalClause represents a Bash eval clause.
func (*EvalClause) End ¶
func (e *EvalClause) End() token.Pos
func (*EvalClause) Pos ¶
func (e *EvalClause) Pos() token.Pos
type Expansion ¶
Expansion represents string manipulation in a ParamExp other than those covered by Replace.
type File ¶
type File struct {
Name string
Stmts []*Stmt
Comments []*Comment
// Lines contains the offset of the first character for each
// line (the first entry is always 0)
Lines []int
}
File is a shell program.
type IfClause ¶
type IfClause struct {
If, Then, Fi token.Pos
CondStmts []*Stmt
ThenStmts []*Stmt
Elifs []*Elif
Else token.Pos
ElseStmts []*Stmt
}
IfClause represents an if statement.
type Index ¶
type Index struct {
Word Word
}
Index represents access to an array via an index inside a ParamExp.
type LetClause ¶
type LetClause struct {
Let token.Pos
Exprs []ArithmExpr
}
LetClause represents a Bash let clause.
type Loop ¶
type Loop interface {
Node
// contains filtered or unexported methods
}
Loop represents all nodes that can be loops in a for clause.
type Node ¶
type Node interface {
// Pos returns the first character of the node
Pos() token.Pos
// End returns the character immediately after the node
End() token.Pos
}
Node represents an AST node.
type ParamExp ¶
type ParamExp struct {
Dollar token.Pos
Short, Length bool
Param Lit
Ind *Index
Repl *Replace
Exp *Expansion
}
ParamExp represents a parameter expansion.
type ParenExpr ¶
type ParenExpr struct {
Lparen, Rparen token.Pos
X ArithmExpr
}
ParenExpr represents an expression within parentheses inside an ArithmExp.
type PatternList ¶
PatternList represents a pattern list (case) within a CaseClause.
type Quoted ¶
Quoted represents a quoted list of nodes. Single quotes are represented separately as SglQuoted.
type Stmt ¶
type Stmt struct {
Cmd Command
Position token.Pos
Negated bool
Background bool
Assigns []*Assign
Redirs []*Redirect
}
Stmt represents a statement, otherwise known as a compound command. It is compromised of a node, like Command or IfStmt, and other components that may come before or after it.
type Subshell ¶
Subshell represents a series of commands that should be executed in a nested shell environment.
type TestClause ¶
type TestClause struct {
Left, Right token.Pos
X ArithmExpr
}
TestClause represents a Bash extended test clause.
func (*TestClause) End ¶
func (t *TestClause) End() token.Pos
func (*TestClause) Pos ¶
func (t *TestClause) Pos() token.Pos
type UntilClause ¶
UntilClause represents an until clause.
func (*UntilClause) End ¶
func (u *UntilClause) End() token.Pos
func (*UntilClause) Pos ¶
func (u *UntilClause) Pos() token.Pos
type WhileClause ¶
WhileClause represents a while clause.
func (*WhileClause) End ¶
func (w *WhileClause) End() token.Pos
func (*WhileClause) Pos ¶
func (w *WhileClause) Pos() token.Pos
type Word ¶
type Word struct {
Parts []WordPart
}
Word represents a list of nodes that are contiguous to each other and are delimeted by word boundaries.