Documentation
¶
Overview ¶
Package highlight maps Go source code to syntax-highlighted byte ranges.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Kind ¶
type Kind int
Kind identifies the syntax class of a highlighted range.
const ( // KindKeyword is a Go keyword. KindKeyword Kind = iota // KindString is a string or character literal. KindString // KindNumber is an integer, floating-point, or imaginary literal. KindNumber // KindComment is a line or general comment. KindComment // KindDeclName is the identifier immediately following the func or type // keyword. KindDeclName )
type Range ¶
type Range struct {
// StartInBytes is the inclusive start byte offset of the range.
StartInBytes int
// EndInBytes is the exclusive end byte offset of the range.
EndInBytes int
// Kind is the syntax class of the range.
Kind Kind
}
Range is a byte range of source code with a syntax class.
func AppendRanges ¶
AppendRanges appends the highlighted ranges of the Go source code src to ranges and returns the extended slice. The appended ranges are in ascending order of StartInBytes and do not overlap. Scan errors are ignored so that incomplete code still yields ranges.
Click to show internal directories.
Click to hide internal directories.