Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
 - func IsLValue(expr Expr) bool
 - func SpecialVarIndex(name string) int
 - func SpecialVarName(index int) string
 - type Action
 - type ArrayExpr
 - type AssignExpr
 - type AugAssignExpr
 - type BinaryExpr
 - type BlockStmt
 - type BreakStmt
 - type CallExpr
 - type CondExpr
 - type ContinueStmt
 - type DeleteStmt
 - type DoWhileStmt
 - type ExitStmt
 - type Expr
 - type ExprStmt
 - type FieldExpr
 - type ForInStmt
 - type ForStmt
 - type Function
 - type GetlineExpr
 - type IfStmt
 - type InExpr
 - type IncrExpr
 - type IndexExpr
 - type MultiExpr
 - type NamedFieldExpr
 - type NextStmt
 - type NumExpr
 - type PrintStmt
 - type PrintfStmt
 - type Program
 - type RegExpr
 - type ReturnStmt
 - type Stmt
 - type Stmts
 - type StrExpr
 - type UnaryExpr
 - type UserCallExpr
 - type VarExpr
 - type VarScope
 - type WhileStmt
 
Constants ¶
const ( V_ILLEGAL = iota V_ARGC V_CONVFMT V_FILENAME V_FNR V_FS V_INPUTMODE V_NF V_NR V_OFMT V_OFS V_ORS V_OUTPUTMODE V_RLENGTH V_RS V_RSTART V_RT V_SUBSEP V_LAST = V_SUBSEP )
Variables ¶
This section is empty.
Functions ¶
func IsLValue ¶
IsLValue returns true if the given expression can be used as an lvalue (on the left-hand side of an assignment, in a ++ or -- operation, or as the third argument to sub or gsub).
func SpecialVarIndex ¶
SpecialVarIndex returns the "index" of the special variable, or 0 if it's not a special variable.
func SpecialVarName ¶ added in v1.15.0
SpecialVarName returns the name of the special variable by index.
Types ¶
type ArrayExpr ¶
ArrayExpr is an array reference. Not really a stand-alone expression, except as an argument to split() or a user function call.
type AssignExpr ¶
AssignExpr is an expression like x = 1234.
func (*AssignExpr) String ¶
func (e *AssignExpr) String() string
type AugAssignExpr ¶
AugAssignExpr is an assignment expression like x += 5.
func (*AugAssignExpr) String ¶
func (e *AugAssignExpr) String() string
type BinaryExpr ¶
BinaryExpr is an expression like 1 + 2.
func (*BinaryExpr) String ¶
func (e *BinaryExpr) String() string
type BlockStmt ¶
type BlockStmt struct {
	Body Stmts
}
    BlockStmt is a stand-alone block like { print "x" }.
type CallExpr ¶
type CallExpr struct {
	Func Token
	Args []Expr
}
    CallExpr is a builtin function call like length($1).
type ContinueStmt ¶
type ContinueStmt struct{}
    ContinueStmt is a continue statement.
func (*ContinueStmt) String ¶
func (s *ContinueStmt) String() string
type DeleteStmt ¶
DeleteStmt is a statement like delete a[k].
func (*DeleteStmt) String ¶
func (s *DeleteStmt) String() string
type DoWhileStmt ¶
DoWhileStmt is a do-while loop.
func (*DoWhileStmt) String ¶
func (s *DoWhileStmt) String() string
type Expr ¶
type Expr interface {
	String() string
	// contains filtered or unexported methods
}
    Expr is the abstract syntax tree for any AWK expression.
type ExprStmt ¶
type ExprStmt struct {
	Expr Expr
}
    ExprStmt is statement like a bare function call: my_func(x).
type GetlineExpr ¶
GetlineExpr is an expression read from file or pipe input.
func (*GetlineExpr) String ¶
func (e *GetlineExpr) String() string
type MultiExpr ¶
type MultiExpr struct {
	Exprs []Expr
}
    MultiExpr isn't an interpretable expression, but it's used as a pseudo-expression for print[f] parsing.
type NamedFieldExpr ¶ added in v1.17.0
type NamedFieldExpr struct {
	Field Expr
}
    NamedFieldExpr is an expression like @"name".
func (*NamedFieldExpr) String ¶ added in v1.17.0
func (e *NamedFieldExpr) String() string
type PrintfStmt ¶
PrintfStmt is a statement like printf "%3d", 1234.
func (*PrintfStmt) String ¶
func (s *PrintfStmt) String() string
type Program ¶ added in v1.15.0
type Program struct {
	Begin     []Stmts
	Actions   []Action
	End       []Stmts
	Functions []Function
	Scalars   map[string]int
	Arrays    map[string]int
}
    Program is an entire AWK program.
type RegExpr ¶
type RegExpr struct {
	Regex string
}
    RegExpr is a stand-alone regex expression, equivalent to: $0 ~ /regex/.
type ReturnStmt ¶
type ReturnStmt struct {
	Value Expr
}
    ReturnStmt is a return statement.
func (*ReturnStmt) String ¶
func (s *ReturnStmt) String() string
type Stmt ¶
type Stmt interface {
	String() string
	// contains filtered or unexported methods
}
    Stmt is the abstract syntax tree for any AWK statement.
type UnaryExpr ¶
type UnaryExpr struct {
	Op    Token
	Value Expr
}
    UnaryExpr is an expression like -1234.
type UserCallExpr ¶
type UserCallExpr struct {
	Native bool // false = AWK-defined function, true = native Go func
	Index  int
	Name   string
	Args   []Expr
}
    UserCallExpr is a user-defined function call like my_func(1, 2, 3)
Index is the resolved function index used by the interpreter; Name is the original name used by String().
func (*UserCallExpr) String ¶
func (e *UserCallExpr) String() string