Documentation ¶
Overview ¶
Example ¶
package main import ( "fmt" "github.com/go-toolsmith/astp" "github.com/go-toolsmith/strparse" ) func main() { if astp.IsIdent(strparse.Expr(`x`)) { fmt.Println("ident") } if astp.IsBlockStmt(strparse.Stmt(`{f()}`)) { fmt.Println("block stmt") } if astp.IsGenDecl(strparse.Decl(`var x int = 10`)) { fmt.Println("gen decl") } }
Output: ident block stmt gen decl
Index ¶
- func IsArrayType(node ast.Node) bool
- func IsAssignStmt(node ast.Node) bool
- func IsBadExpr(node ast.Node) bool
- func IsBadStmt(node ast.Node) bool
- func IsBasicLit(node ast.Node) bool
- func IsBinaryExpr(node ast.Node) bool
- func IsBlockStmt(node ast.Node) bool
- func IsBranchStmt(node ast.Node) bool
- func IsCallExpr(node ast.Node) bool
- func IsCaseClause(node ast.Node) bool
- func IsChanType(node ast.Node) bool
- func IsCommClause(node ast.Node) bool
- func IsCompositeLit(node ast.Node) bool
- func IsDecl(node ast.Node) bool
- func IsDeclStmt(node ast.Node) bool
- func IsDeferStmt(node ast.Node) bool
- func IsEllipsis(node ast.Node) bool
- func IsEmptyStmt(node ast.Node) bool
- func IsExpr(node ast.Node) bool
- func IsExprStmt(node ast.Node) bool
- func IsForStmt(node ast.Node) bool
- func IsFuncDecl(node ast.Node) bool
- func IsFuncLit(node ast.Node) bool
- func IsFuncType(node ast.Node) bool
- func IsGenDecl(node ast.Node) bool
- func IsGoStmt(node ast.Node) bool
- func IsIdent(node ast.Node) bool
- func IsIfStmt(node ast.Node) bool
- func IsImportSpec(node ast.Node) bool
- func IsIncDecStmt(node ast.Node) bool
- func IsIndexExpr(node ast.Node) bool
- func IsInterfaceType(node ast.Node) bool
- func IsKeyValueExpr(node ast.Node) bool
- func IsLabeledStmt(node ast.Node) bool
- func IsMapType(node ast.Node) bool
- func IsParenExpr(node ast.Node) bool
- func IsRangeStmt(node ast.Node) bool
- func IsReturnStmt(node ast.Node) bool
- func IsSelectStmt(node ast.Node) bool
- func IsSelectorExpr(node ast.Node) bool
- func IsSendStmt(node ast.Node) bool
- func IsSliceExpr(node ast.Node) bool
- func IsStarExpr(node ast.Node) bool
- func IsStmt(node ast.Node) bool
- func IsStructType(node ast.Node) bool
- func IsSwitchStmt(node ast.Node) bool
- func IsTypeAssertExpr(node ast.Node) bool
- func IsTypeSpec(node ast.Node) bool
- func IsTypeSwitchStmt(node ast.Node) bool
- func IsUnaryExpr(node ast.Node) bool
- func IsValueSpec(node ast.Node) bool
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsArrayType ¶
IsArrayType reports whether a given ast.Node is an array or slice type (*ast.IsArrayType).
func IsAssignStmt ¶
IsAssignStmt reports whether a given ast.Node is an assignment statement(*ast.AssignStmt)
func IsBasicLit ¶
IsBasicLit reports whether a given ast.Node is a literal of basic type (*ast.IsBasicLit).
func IsBinaryExpr ¶
IsBinaryExpr reports whether a given ast.Node is a binary expression (*ast.IsBinaryExpr).
func IsBlockStmt ¶
IsBlockStmt reports whether a given ast.Node is a block statement(*ast.BlockStmt)
func IsBranchStmt ¶
IsBranchStmt reports whether a given ast.Node is a branch(goto/continue/break/fallthrough)statement(*ast.BranchStmt)
func IsCallExpr ¶
IsCallExpr reports whether a given ast.Node is an expression followed by an argument list (*ast.IsCallExpr).
func IsCaseClause ¶
IsCaseClause reports whether a given ast.Node is a case statement(*ast.CaseClause)
func IsChanType ¶
IsChanType reports whether a given ast.Node is a channel type (*ast.IsChanType).
func IsCommClause ¶
IsCommClause reports whether a given ast.Node is a select statement(*ast.CommClause)
func IsCompositeLit ¶
IsCompositeLit reports whether a given ast.Node is a composite literal (*ast.IsCompositeLit).
func IsDeclStmt ¶
IsDeclStmt reports whether a given ast.Node is a declaration statement(*ast.DeclStmt)
func IsDeferStmt ¶
IsDeferStmt reports whether a given ast.Node is a defer statement(*ast.DeferStmt)
func IsEllipsis ¶
IsEllipsis reports whether a given ast.Node is an `...` (ellipsis) (*ast.IsEllipsis).
func IsEmptyStmt ¶
IsEmptyStmt reports whether a given ast.Node is an empty statement(*ast.EmptyStmt)
func IsExprStmt ¶
IsExprStmt reports whether a given ast.Node is an expression statement(*ast.ExprStmt)
func IsFuncDecl ¶
IsFuncDecl reports whether a given ast.Node is a function declaration (*ast.FuncDecl).
func IsFuncType ¶
IsFuncType reports whether a given ast.Node is a function type (*ast.IsFuncType).
func IsGenDecl ¶
IsGenDecl reports whether a given ast.Node is a generic declaration (*ast.GenDecl).
func IsImportSpec ¶
IsImportSpec reports whether a given ast.Node is an import declaration (*ast.ImportSpec).
func IsIncDecStmt ¶
IsIncDecStmt reports whether a given ast.Node is a increment/decrement statement(*ast.IncDecStmt)
func IsIndexExpr ¶
IsIndexExpr reports whether a given ast.Node is an index expression (*ast.IsIndexExpr).
func IsInterfaceType ¶
IsInterfaceType reports whether a given ast.Node is an interface type (*ast.IsInterfaceType).
func IsKeyValueExpr ¶
IsKeyValueExpr reports whether a given ast.Node is a (key:value) pair (*ast.IsKeyValueExpr).
func IsLabeledStmt ¶
IsLabeledStmt reports whether a given ast.Node is a label statement(*ast.LabeledStmt)
func IsParenExpr ¶
IsParenExpr reports whether a given ast.Node is a parenthesized expression (*ast.IsParenExpr).
func IsRangeStmt ¶
IsRangeStmt reports whether a given ast.Node is a range statement(*ast.RangeStmt)
func IsReturnStmt ¶
IsReturnStmt reports whether a given ast.Node is a return statement(*ast.ReturnStmt)
func IsSelectStmt ¶
IsSelectStmt reports whether a given ast.Node is a selection statement(*ast.SelectStmt)
func IsSelectorExpr ¶
IsSelectorExpr reports whether a given ast.Node is a selector expression (*ast.IsSelectorExpr).
func IsSendStmt ¶
IsSendStmt reports whether a given ast.Node is a send to chan statement(*ast.SendStmt)
func IsSliceExpr ¶
IsSliceExpr reports whether a given ast.Node is a slice expression (*ast.IsSliceExpr).
func IsStarExpr ¶
IsStarExpr reports whether a given ast.Node is a star expression(unary "*" or apointer) (*ast.IsStarExpr)
func IsStructType ¶
IsStructType reports whether a given ast.Node is a struct type (*ast.IsStructType).
func IsSwitchStmt ¶
IsSwitchStmt reports whether a given ast.Node is a switch statement(*ast.SwitchStmt)
func IsTypeAssertExpr ¶
IsTypeAssertExpr reports whether a given ast.Node is a type assert expression (*ast.IsTypeAssertExpr).
func IsTypeSpec ¶
IsTypeSpec reports whether a given ast.Node is a type declaration (*ast.TypeSpec).
func IsTypeSwitchStmt ¶
IsTypeSwitchStmt reports whether a given ast.Node is a type switch statement(*ast.TypeSwitchStmt)
func IsUnaryExpr ¶
IsUnaryExpr reports whether a given ast.Node is a unary expression (*ast.IsUnaryExpr).
func IsValueSpec ¶
IsValueSpec reports whether a given ast.Node is a value declaration (*ast.ValueSpec).
Types ¶
This section is empty.