Documentation ¶
Overview ¶
Package asth constains helper functions and types for Go package go/ast.
Index ¶
Constants ¶
Specify all possible direction of a channel type for package go/ast.
Variables ¶
This section is empty.
Functions ¶
func IsBlankIdent ¶
IsBlankIdent checks if s is Go blank identifier ("_").
func IsValidExportedIdent ¶
IsValidExportedIdent checks if s is valid exported Go ident. For blank identifier this function returns false.
func IsValidIdent ¶
IsValidIdent checks if s is valid Go ident. For blank identifier this function returns false.
func IsValidNotExportedIdent ¶
IsValidNotExportedIdent checks if s is valid not exported Go ident. For blank identifier this function returns false.
Types ¶
type PointInSource ¶
type PointInSource struct { Offset int // offset, starting at 0 Line int // line number, starting at 1 Column int // column number, starting at 1 (byte count) }
PointInSource describes an some point in source file without file itself. A Position is valid if the line number is > 0.
func TokenPositionToPoint ¶
func TokenPositionToPoint(p token.Position) PointInSource
TokenPositionToPoint convert token.Position to PointInSource.
func (PointInSource) IsValid ¶
func (p PointInSource) IsValid() bool
IsValid reports whether the point in source is valid.
func (PointInSource) String ¶
func (p PointInSource) String() string
String returns a string "line:column" or "-" if PointInSource is invalid
type Position ¶
type Position struct { Filename string Pos, End PointInSource }
Position describes position of piece of code in source file. It contains file name (if any), position of beginning and (optionally) position of end. End is the position of last character, not first character after piece of code.
func MakePosition ¶
MakePosition makes Position. pos is the first character of code. end is the first character after code. fset must be non nil (pass token.NewFileSet() instead).
func NodePosition ¶
NodePosition makes Position of ast.Node. It is just shortcut for MakePosition.
func (Position) String ¶
String returns a string in one of several forms:
file:line:column-line:column valid position with file name file:line:column valid position with file name line:column-line:column valid position without file name line:column valid position without file name file invalid position with file name - invalid position without file name