Documentation
¶
Index ¶
- func Walk(node Node, f WalkFn)
- type ArithmeticCommand
- type ArrayAccess
- type BlockStatement
- type Boolean
- type BraceExpansion
- type BracketExpression
- type CallExpression
- type CaseClause
- type CaseStatement
- type CommandSubstitution
- type ConcatenatedExpression
- type CoprocStatement
- type DeclarationAssignment
- type DeclarationStatement
- type DollarParenExpression
- type DoubleBracketExpression
- type Expression
- type ExpressionStatement
- type ForLoopStatement
- type FunctionDefinition
- type FunctionLiteral
- type GroupedExpression
- type Identifier
- type IfStatement
- type IndexExpression
- type InfixExpression
- type IntegerLiteral
- type InvalidArrayAccess
- type LetStatement
- type Node
- type NodeType
- type PostfixExpression
- type PrefixExpression
- type ProcessSubstitution
- type Program
- type Redirection
- type ReturnStatement
- type SelectStatement
- type Shebang
- type SimpleCommand
- type Statement
- type StringLiteral
- type Subshell
- type WalkFn
- type WhileLoopStatement
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArithmeticCommand ¶ added in v0.0.73
type ArithmeticCommand struct {
Token token.Token // The '((' token
Expression Expression
}
func (*ArithmeticCommand) String ¶ added in v0.0.73
func (ac *ArithmeticCommand) String() string
func (*ArithmeticCommand) TokenLiteral ¶ added in v0.0.73
func (ac *ArithmeticCommand) TokenLiteral() string
func (*ArithmeticCommand) TokenLiteralNode ¶ added in v0.0.73
func (ac *ArithmeticCommand) TokenLiteralNode() token.Token
func (*ArithmeticCommand) Type ¶ added in v0.0.73
func (ac *ArithmeticCommand) Type() NodeType
type ArrayAccess ¶
type ArrayAccess struct {
Token token.Token // The '${' token
Left Expression
Index Expression
}
func (*ArrayAccess) String ¶
func (aa *ArrayAccess) String() string
func (*ArrayAccess) TokenLiteral ¶
func (aa *ArrayAccess) TokenLiteral() string
func (*ArrayAccess) TokenLiteralNode ¶ added in v0.0.4
func (n *ArrayAccess) TokenLiteralNode() token.Token
func (*ArrayAccess) Type ¶ added in v0.0.4
func (aa *ArrayAccess) Type() NodeType
type BlockStatement ¶
type BlockStatement struct {
Token token.Token // the { token or then token
Statements []Statement
}
func (*BlockStatement) String ¶
func (bs *BlockStatement) String() string
func (*BlockStatement) TokenLiteral ¶
func (bs *BlockStatement) TokenLiteral() string
func (*BlockStatement) TokenLiteralNode ¶ added in v0.0.4
func (n *BlockStatement) TokenLiteralNode() token.Token
func (*BlockStatement) Type ¶ added in v0.0.4
func (bs *BlockStatement) Type() NodeType
type BraceExpansion ¶ added in v0.0.123
type BraceExpansion struct {
Token token.Token // The '{' token
Elements []Expression
}
func (*BraceExpansion) String ¶ added in v0.0.123
func (be *BraceExpansion) String() string
func (*BraceExpansion) TokenLiteral ¶ added in v0.0.123
func (be *BraceExpansion) TokenLiteral() string
func (*BraceExpansion) TokenLiteralNode ¶ added in v0.0.123
func (be *BraceExpansion) TokenLiteralNode() token.Token
func (*BraceExpansion) Type ¶ added in v0.0.123
func (be *BraceExpansion) Type() NodeType
type BracketExpression ¶
type BracketExpression struct {
Token token.Token // The '[' token
Expressions []Expression
}
func (*BracketExpression) String ¶
func (be *BracketExpression) String() string
func (*BracketExpression) TokenLiteral ¶
func (be *BracketExpression) TokenLiteral() string
func (*BracketExpression) TokenLiteralNode ¶ added in v0.0.4
func (n *BracketExpression) TokenLiteralNode() token.Token
func (*BracketExpression) Type ¶ added in v0.0.4
func (be *BracketExpression) Type() NodeType
type CallExpression ¶
type CallExpression struct {
Token token.Token // The '(' token
Function Expression // Identifier or FunctionLiteral
Arguments []Expression
}
func (*CallExpression) String ¶
func (ce *CallExpression) String() string
func (*CallExpression) TokenLiteral ¶
func (ce *CallExpression) TokenLiteral() string
func (*CallExpression) TokenLiteralNode ¶ added in v0.0.4
func (n *CallExpression) TokenLiteralNode() token.Token
func (*CallExpression) Type ¶ added in v0.0.4
func (ce *CallExpression) Type() NodeType
type CaseClause ¶ added in v0.0.4
type CaseClause struct {
Token token.Token // The first token of pattern
Patterns []Expression
Body *BlockStatement
}
func (*CaseClause) String ¶ added in v0.0.4
func (cc *CaseClause) String() string
func (*CaseClause) TokenLiteralNode ¶ added in v0.0.4
func (cc *CaseClause) TokenLiteralNode() token.Token
type CaseStatement ¶ added in v0.0.4
type CaseStatement struct {
Token token.Token // The 'case' token
Value Expression
Clauses []*CaseClause
}
func (*CaseStatement) String ¶ added in v0.0.4
func (cs *CaseStatement) String() string
func (*CaseStatement) TokenLiteral ¶ added in v0.0.4
func (cs *CaseStatement) TokenLiteral() string
func (*CaseStatement) TokenLiteralNode ¶ added in v0.0.4
func (n *CaseStatement) TokenLiteralNode() token.Token
func (*CaseStatement) Type ¶ added in v0.0.4
func (cs *CaseStatement) Type() NodeType
type CommandSubstitution ¶
type CommandSubstitution struct {
Token token.Token // The ` or $() token
Command Expression
}
func (*CommandSubstitution) String ¶
func (cs *CommandSubstitution) String() string
func (*CommandSubstitution) TokenLiteral ¶
func (cs *CommandSubstitution) TokenLiteral() string
func (*CommandSubstitution) TokenLiteralNode ¶ added in v0.0.4
func (n *CommandSubstitution) TokenLiteralNode() token.Token
func (*CommandSubstitution) Type ¶ added in v0.0.4
func (cs *CommandSubstitution) Type() NodeType
type ConcatenatedExpression ¶ added in v0.0.4
type ConcatenatedExpression struct {
Token token.Token
Parts []Expression
}
func (*ConcatenatedExpression) String ¶ added in v0.0.4
func (ce *ConcatenatedExpression) String() string
func (*ConcatenatedExpression) TokenLiteral ¶ added in v0.0.4
func (ce *ConcatenatedExpression) TokenLiteral() string
func (*ConcatenatedExpression) TokenLiteralNode ¶ added in v0.0.4
func (n *ConcatenatedExpression) TokenLiteralNode() token.Token
func (*ConcatenatedExpression) Type ¶ added in v0.0.4
func (ce *ConcatenatedExpression) Type() NodeType
type CoprocStatement ¶ added in v0.0.123
type CoprocStatement struct {
Token token.Token // The 'coproc' token
Name string // Optional name (Bash/Zsh difference? Zsh `coproc cmd`, Bash `coproc [NAME] command`)
// Zsh `coproc` is simple. `coproc command`.
// Bash `coproc name { cmd; }`.
// Let's support generic Command.
Command Node // Expression (SimpleCommand) or Statement (BlockStatement)
}
func (*CoprocStatement) String ¶ added in v0.0.123
func (cs *CoprocStatement) String() string
func (*CoprocStatement) TokenLiteral ¶ added in v0.0.123
func (cs *CoprocStatement) TokenLiteral() string
func (*CoprocStatement) TokenLiteralNode ¶ added in v0.0.123
func (cs *CoprocStatement) TokenLiteralNode() token.Token
func (*CoprocStatement) Type ¶ added in v0.0.123
func (cs *CoprocStatement) Type() NodeType
type DeclarationAssignment ¶ added in v0.0.123
type DeclarationAssignment struct {
Name Expression
Value Expression // can be nil
IsAppend bool // +=
}
type DeclarationStatement ¶ added in v0.0.123
type DeclarationStatement struct {
Token token.Token // typeset, declare, local
Command string // "typeset", "declare", "local"
Flags []string // e.g. ["-A", "-r"]
Assignments []*DeclarationAssignment
}
func (*DeclarationStatement) String ¶ added in v0.0.123
func (ds *DeclarationStatement) String() string
func (*DeclarationStatement) TokenLiteral ¶ added in v0.0.123
func (ds *DeclarationStatement) TokenLiteral() string
func (*DeclarationStatement) TokenLiteralNode ¶ added in v0.0.123
func (ds *DeclarationStatement) TokenLiteralNode() token.Token
func (*DeclarationStatement) Type ¶ added in v0.0.123
func (ds *DeclarationStatement) Type() NodeType
type DollarParenExpression ¶
type DollarParenExpression struct {
Token token.Token // The '$(' token
Command Expression
}
func (*DollarParenExpression) String ¶
func (dpe *DollarParenExpression) String() string
func (*DollarParenExpression) TokenLiteral ¶
func (dpe *DollarParenExpression) TokenLiteral() string
func (*DollarParenExpression) TokenLiteralNode ¶ added in v0.0.4
func (n *DollarParenExpression) TokenLiteralNode() token.Token
func (*DollarParenExpression) Type ¶ added in v0.0.4
func (dpe *DollarParenExpression) Type() NodeType
type DoubleBracketExpression ¶
type DoubleBracketExpression struct {
Token token.Token // The '[[' token
Expressions []Expression
}
func (*DoubleBracketExpression) String ¶
func (dbe *DoubleBracketExpression) String() string
func (*DoubleBracketExpression) TokenLiteral ¶
func (dbe *DoubleBracketExpression) TokenLiteral() string
func (*DoubleBracketExpression) TokenLiteralNode ¶ added in v0.0.4
func (n *DoubleBracketExpression) TokenLiteralNode() token.Token
func (*DoubleBracketExpression) Type ¶ added in v0.0.4
func (dbe *DoubleBracketExpression) Type() NodeType
type Expression ¶
type Expression interface {
Node
// contains filtered or unexported methods
}
type ExpressionStatement ¶
type ExpressionStatement struct {
Token token.Token // the first token of the expression
Expression Expression
}
func (*ExpressionStatement) String ¶
func (es *ExpressionStatement) String() string
func (*ExpressionStatement) TokenLiteral ¶
func (es *ExpressionStatement) TokenLiteral() string
func (*ExpressionStatement) TokenLiteralNode ¶ added in v0.0.4
func (n *ExpressionStatement) TokenLiteralNode() token.Token
func (*ExpressionStatement) Type ¶ added in v0.0.4
func (es *ExpressionStatement) Type() NodeType
type ForLoopStatement ¶
type ForLoopStatement struct {
Token token.Token // The 'for' token
Init Expression // Variable name (for-each) or Init expr (arithmetic)
Condition Expression // Arithmetic condition
Post Expression // Arithmetic post
Items []Expression // Items to iterate over (for-each)
Body *BlockStatement
}
func (*ForLoopStatement) String ¶
func (fls *ForLoopStatement) String() string
func (*ForLoopStatement) TokenLiteral ¶
func (fls *ForLoopStatement) TokenLiteral() string
func (*ForLoopStatement) TokenLiteralNode ¶ added in v0.0.4
func (n *ForLoopStatement) TokenLiteralNode() token.Token
func (*ForLoopStatement) Type ¶ added in v0.0.4
func (fls *ForLoopStatement) Type() NodeType
type FunctionDefinition ¶ added in v0.0.4
type FunctionDefinition struct {
Token token.Token // The name token
Name *Identifier
Body Statement // The function body (usually BlockStatement)
}
func (*FunctionDefinition) String ¶ added in v0.0.4
func (fd *FunctionDefinition) String() string
func (*FunctionDefinition) TokenLiteral ¶ added in v0.0.4
func (fd *FunctionDefinition) TokenLiteral() string
func (*FunctionDefinition) TokenLiteralNode ¶ added in v0.0.4
func (n *FunctionDefinition) TokenLiteralNode() token.Token
func (*FunctionDefinition) Type ¶ added in v0.0.4
func (fd *FunctionDefinition) Type() NodeType
type FunctionLiteral ¶
type FunctionLiteral struct {
Token token.Token // The 'fn' token
Name string // The function name (optional)
Parameters []*Identifier
Body *BlockStatement
}
func (*FunctionLiteral) String ¶
func (fl *FunctionLiteral) String() string
func (*FunctionLiteral) TokenLiteral ¶
func (fl *FunctionLiteral) TokenLiteral() string
func (*FunctionLiteral) TokenLiteralNode ¶ added in v0.0.4
func (n *FunctionLiteral) TokenLiteralNode() token.Token
func (*FunctionLiteral) Type ¶ added in v0.0.4
func (fl *FunctionLiteral) Type() NodeType
type GroupedExpression ¶ added in v0.0.4
type GroupedExpression struct {
Token token.Token // The '(' token
Exp Expression
}
func (*GroupedExpression) String ¶ added in v0.0.4
func (ge *GroupedExpression) String() string
func (*GroupedExpression) TokenLiteral ¶ added in v0.0.4
func (ge *GroupedExpression) TokenLiteral() string
func (*GroupedExpression) TokenLiteralNode ¶ added in v0.0.4
func (ge *GroupedExpression) TokenLiteralNode() token.Token
func (*GroupedExpression) Type ¶ added in v0.0.4
func (ge *GroupedExpression) Type() NodeType
type Identifier ¶
func (*Identifier) String ¶
func (i *Identifier) String() string
func (*Identifier) TokenLiteral ¶
func (i *Identifier) TokenLiteral() string
func (*Identifier) TokenLiteralNode ¶ added in v0.0.4
func (n *Identifier) TokenLiteralNode() token.Token
func (*Identifier) Type ¶ added in v0.0.4
func (i *Identifier) Type() NodeType
type IfStatement ¶
type IfStatement struct {
Token token.Token // The 'if' token
Condition *BlockStatement
Consequence *BlockStatement
Alternative *BlockStatement
}
func (*IfStatement) String ¶
func (is *IfStatement) String() string
func (*IfStatement) TokenLiteral ¶
func (is *IfStatement) TokenLiteral() string
func (*IfStatement) TokenLiteralNode ¶ added in v0.0.4
func (n *IfStatement) TokenLiteralNode() token.Token
func (*IfStatement) Type ¶ added in v0.0.4
func (is *IfStatement) Type() NodeType
type IndexExpression ¶ added in v0.0.4
type IndexExpression struct {
Token token.Token // The [ token
Left Expression
Index Expression
}
func (*IndexExpression) String ¶ added in v0.0.4
func (ie *IndexExpression) String() string
func (*IndexExpression) TokenLiteral ¶ added in v0.0.4
func (ie *IndexExpression) TokenLiteral() string
func (*IndexExpression) TokenLiteralNode ¶ added in v0.0.4
func (n *IndexExpression) TokenLiteralNode() token.Token
func (*IndexExpression) Type ¶ added in v0.0.4
func (ie *IndexExpression) Type() NodeType
type InfixExpression ¶
type InfixExpression struct {
Token token.Token // The operator token, e.g. +
Left Expression
Operator string
Right Expression
}
func (*InfixExpression) String ¶
func (ie *InfixExpression) String() string
func (*InfixExpression) TokenLiteral ¶
func (ie *InfixExpression) TokenLiteral() string
func (*InfixExpression) TokenLiteralNode ¶ added in v0.0.4
func (n *InfixExpression) TokenLiteralNode() token.Token
func (*InfixExpression) Type ¶ added in v0.0.4
func (ie *InfixExpression) Type() NodeType
type IntegerLiteral ¶
func (*IntegerLiteral) String ¶
func (il *IntegerLiteral) String() string
func (*IntegerLiteral) TokenLiteral ¶
func (il *IntegerLiteral) TokenLiteral() string
func (*IntegerLiteral) TokenLiteralNode ¶ added in v0.0.4
func (n *IntegerLiteral) TokenLiteralNode() token.Token
func (*IntegerLiteral) Type ¶ added in v0.0.4
func (il *IntegerLiteral) Type() NodeType
type InvalidArrayAccess ¶
type InvalidArrayAccess struct {
Token token.Token // The '$' token
Left Expression
Index Expression
}
func (*InvalidArrayAccess) String ¶
func (iaa *InvalidArrayAccess) String() string
func (*InvalidArrayAccess) TokenLiteral ¶
func (iaa *InvalidArrayAccess) TokenLiteral() string
func (*InvalidArrayAccess) TokenLiteralNode ¶ added in v0.0.4
func (n *InvalidArrayAccess) TokenLiteralNode() token.Token
func (*InvalidArrayAccess) Type ¶ added in v0.0.4
func (iaa *InvalidArrayAccess) Type() NodeType
type LetStatement ¶
type LetStatement struct {
Token token.Token // the token.LET token
Name *Identifier
Value Expression
}
func (*LetStatement) String ¶
func (ls *LetStatement) String() string
func (*LetStatement) TokenLiteral ¶
func (ls *LetStatement) TokenLiteral() string
func (*LetStatement) TokenLiteralNode ¶ added in v0.0.4
func (n *LetStatement) TokenLiteralNode() token.Token
func (*LetStatement) Type ¶ added in v0.0.4
func (ls *LetStatement) Type() NodeType
type NodeType ¶ added in v0.0.4
type NodeType int
const ( ProgramNode NodeType = iota LetStatementNode ReturnStatementNode ExpressionStatementNode IdentifierNode IntegerLiteralNode BooleanNode PrefixExpressionNode PostfixExpressionNode InfixExpressionNode BlockStatementNode IfStatementNode ForLoopStatementNode WhileLoopStatementNode FunctionLiteralNode CallExpressionNode StringLiteralNode BracketExpressionNode DoubleBracketExpressionNode ArrayAccessNode InvalidArrayAccessNode CommandSubstitutionNode ShebangNode DollarParenExpressionNode SimpleCommandNode IndexExpressionNode ConcatenatedExpressionNode CaseStatementNode RedirectionNode FunctionDefinitionNode GroupedExpressionNode ArithmeticCommandNode SubshellNode BraceExpansionNode SelectStatementNode CoprocStatementNode DeclarationStatementNode ProcessSubstitutionNode )
type PostfixExpression ¶
type PostfixExpression struct {
Token token.Token // The operator token, e.g. ++
Left Expression
Operator string
}
func (*PostfixExpression) String ¶
func (pe *PostfixExpression) String() string
func (*PostfixExpression) TokenLiteral ¶
func (pe *PostfixExpression) TokenLiteral() string
func (*PostfixExpression) TokenLiteralNode ¶ added in v0.0.4
func (n *PostfixExpression) TokenLiteralNode() token.Token
func (*PostfixExpression) Type ¶ added in v0.0.4
func (pe *PostfixExpression) Type() NodeType
type PrefixExpression ¶
type PrefixExpression struct {
Token token.Token // The operator token, e.g. !
Operator string
Right Expression
}
func (*PrefixExpression) String ¶
func (pe *PrefixExpression) String() string
func (*PrefixExpression) TokenLiteral ¶
func (pe *PrefixExpression) TokenLiteral() string
func (*PrefixExpression) TokenLiteralNode ¶ added in v0.0.4
func (n *PrefixExpression) TokenLiteralNode() token.Token
func (*PrefixExpression) Type ¶ added in v0.0.4
func (pe *PrefixExpression) Type() NodeType
type ProcessSubstitution ¶ added in v0.0.123
type ProcessSubstitution struct {
Token token.Token // <(, >(, =(
Command Expression
}
func (*ProcessSubstitution) String ¶ added in v0.0.123
func (ps *ProcessSubstitution) String() string
func (*ProcessSubstitution) TokenLiteral ¶ added in v0.0.123
func (ps *ProcessSubstitution) TokenLiteral() string
func (*ProcessSubstitution) TokenLiteralNode ¶ added in v0.0.123
func (ps *ProcessSubstitution) TokenLiteralNode() token.Token
func (*ProcessSubstitution) Type ¶ added in v0.0.123
func (ps *ProcessSubstitution) Type() NodeType
type Program ¶
type Program struct {
Statements []Statement
}
func (*Program) TokenLiteral ¶
func (*Program) TokenLiteralNode ¶ added in v0.0.4
type Redirection ¶ added in v0.0.4
type Redirection struct {
Token token.Token
Left Expression
Operator string
Right Expression
}
func (*Redirection) String ¶ added in v0.0.4
func (r *Redirection) String() string
func (*Redirection) TokenLiteral ¶ added in v0.0.4
func (r *Redirection) TokenLiteral() string
func (*Redirection) TokenLiteralNode ¶ added in v0.0.4
func (n *Redirection) TokenLiteralNode() token.Token
func (*Redirection) Type ¶ added in v0.0.4
func (r *Redirection) Type() NodeType
type ReturnStatement ¶
type ReturnStatement struct {
Token token.Token // the token.RETURN token
ReturnValue Expression
}
func (*ReturnStatement) String ¶
func (rs *ReturnStatement) String() string
func (*ReturnStatement) TokenLiteral ¶
func (rs *ReturnStatement) TokenLiteral() string
func (*ReturnStatement) TokenLiteralNode ¶ added in v0.0.4
func (n *ReturnStatement) TokenLiteralNode() token.Token
func (*ReturnStatement) Type ¶ added in v0.0.4
func (rs *ReturnStatement) Type() NodeType
type SelectStatement ¶ added in v0.0.123
type SelectStatement struct {
Token token.Token // The 'select' token
Name *Identifier
Items []Expression
Body *BlockStatement
}
func (*SelectStatement) String ¶ added in v0.0.123
func (ss *SelectStatement) String() string
func (*SelectStatement) TokenLiteral ¶ added in v0.0.123
func (ss *SelectStatement) TokenLiteral() string
func (*SelectStatement) TokenLiteralNode ¶ added in v0.0.123
func (ss *SelectStatement) TokenLiteralNode() token.Token
func (*SelectStatement) Type ¶ added in v0.0.123
func (ss *SelectStatement) Type() NodeType
type SimpleCommand ¶
type SimpleCommand struct {
Token token.Token // The first token of the command
Name Expression
Arguments []Expression
Redirections []Expression // New field for redirections associated with the command
}
func (*SimpleCommand) String ¶
func (sc *SimpleCommand) String() string
func (*SimpleCommand) TokenLiteral ¶
func (sc *SimpleCommand) TokenLiteral() string
func (*SimpleCommand) TokenLiteralNode ¶ added in v0.0.4
func (n *SimpleCommand) TokenLiteralNode() token.Token
func (*SimpleCommand) Type ¶ added in v0.0.4
func (sc *SimpleCommand) Type() NodeType
type StringLiteral ¶
func (*StringLiteral) String ¶
func (sl *StringLiteral) String() string
func (*StringLiteral) TokenLiteral ¶
func (sl *StringLiteral) TokenLiteral() string
func (*StringLiteral) TokenLiteralNode ¶ added in v0.0.4
func (n *StringLiteral) TokenLiteralNode() token.Token
func (*StringLiteral) Type ¶ added in v0.0.4
func (sl *StringLiteral) Type() NodeType
type Subshell ¶ added in v0.0.121
type Subshell struct {
Token token.Token // The '(' token
Block *BlockStatement
}
func (*Subshell) TokenLiteral ¶ added in v0.0.121
func (*Subshell) TokenLiteralNode ¶ added in v0.0.121
type WhileLoopStatement ¶ added in v0.0.4
type WhileLoopStatement struct {
Token token.Token // The 'while' token
Condition *BlockStatement
Body *BlockStatement
}
func (*WhileLoopStatement) String ¶ added in v0.0.4
func (wls *WhileLoopStatement) String() string
func (*WhileLoopStatement) TokenLiteral ¶ added in v0.0.4
func (wls *WhileLoopStatement) TokenLiteral() string
func (*WhileLoopStatement) TokenLiteralNode ¶ added in v0.0.4
func (n *WhileLoopStatement) TokenLiteralNode() token.Token
func (*WhileLoopStatement) Type ¶ added in v0.0.4
func (wls *WhileLoopStatement) Type() NodeType
Click to show internal directories.
Click to hide internal directories.