Add getter functions to Location
This commit is contained in:
parent
57f02ad6f6
commit
568134a7e9
@ -13,3 +13,26 @@ type Location struct {
|
|||||||
func (location Location) NewError (message string, kind ErrorKind) (err Error) {
|
func (location Location) NewError (message string, kind ErrorKind) (err Error) {
|
||||||
return NewError(location, message, kind)
|
return NewError(location, message, kind)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// File returns the file the location is in
|
||||||
|
func (location Location) File () (file *File) {
|
||||||
|
return location.file
|
||||||
|
}
|
||||||
|
|
||||||
|
// Row returns the row the location is positioned at in the file, starting at
|
||||||
|
// zero.
|
||||||
|
func (location Location) Row () (row int) {
|
||||||
|
return location.row
|
||||||
|
}
|
||||||
|
|
||||||
|
// Column returns the column the location is positioned at in the file, starting
|
||||||
|
// at zero.
|
||||||
|
func (location Location) Column () (column int) {
|
||||||
|
return location.column
|
||||||
|
}
|
||||||
|
|
||||||
|
// Width returns the amount of runes spanned by the location, starting at row
|
||||||
|
// and column.
|
||||||
|
func (location Location) Width () (width int) {
|
||||||
|
return location.width
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user