Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
func NewCursor ¶
NewCursor returns a cursor for the given scanner. The scanner should not be used outside of the cursor.
func (*Cursor) InsideBrace ¶
func (*Cursor) InsideParen ¶
type Section ¶
type Section struct {
// contains filtered or unexported fields
}
Section defines a section within a Go source file
func Index ¶
Index parses the given go source into sections. A section can be - comment - import - type - func If a comment is coupled to e.g. a func it's included in that section.
Example ¶
src := []byte(`package x // Greet returns a greeting func Greet() string { return "hello" }`) for _, s := range Index(src) { fmt.Println(s.String()) }
Output: 0 10 1 package x 10 76 3 func Greet() string
func (*Section) Grab ¶
Grab returns the the sections src[From:To]
Example ¶
src := []byte(`package x // Greet returns a greeting func Greet() string { return "hello" }`) sections := Index(src) os.Stdout.Write(sections[1].Grab(src))
Output: // Greet returns a greeting func Greet() string { return "hello" }
func (*Section) IsEmpty ¶
IsEmpty returns true if the sections has no characters after bytes.TrimSpace has been applied.
func (*Section) Label ¶ added in v0.4.0
Label returns short value of this section, e.g. for funcs only the signature
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
goto
Command goto opens file on specific line
|
Command goto opens file on specific line |
gotoi
Command goto opens file on specific line
|
Command goto opens file on specific line |
grab
Command grab extracts sections from a file by byte range
|
Command grab extracts sections from a file by byte range |
index
Command index indexes source files into sections
|
Command index indexes source files into sections |
Click to show internal directories.
Click to hide internal directories.