Documentation ¶
Overview ¶
Package location defines locations in Rego source code.
Index ¶
- type Location
- func (loc *Location) Compare(other *Location) int
- func (loc *Location) Equal(other *Location) bool
- func (loc *Location) Errorf(f string, a ...interface{}) error
- func (loc *Location) Format(f string, a ...interface{}) string
- func (loc *Location) MarshalJSON() ([]byte, error)
- func (loc *Location) String() string
- func (loc *Location) Wrapf(err error, f string, a ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Location ¶
type Location struct { Text []byte `json:"-"` // The original text fragment from the source. File string `json:"file"` // The name of the source file (which may be empty). Row int `json:"row"` // The line in the source. Col int `json:"col"` // The column in the row. Offset int `json:"-"` // The byte offset for the location in the source. // JSONOptions specifies options for marshaling and unmarshalling of locations JSONOptions astJSON.Options Tabs []int `json:"-"` // The column offsets of tabs in the source. }
Location records a position in source code
func NewLocation ¶
NewLocation returns a new Location object.
func (*Location) Compare ¶
Compare returns -1, 0, or 1 to indicate if this loc is less than, equal to, or greater than the other. Comparison is performed on the file, row, and column of the Location (but not on the text.) Nil locations are greater than non-nil locations.
func (*Location) Errorf ¶
Errorf returns a new error value with a message formatted to include the location info (e.g., line, column, filename, etc.)
func (*Location) MarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.