Documentation ¶
Overview ¶
Package location provides a standard way of recording an indexed location in some source. For instance a line in a file.
The caller can set the source and then, as the entries are processed, the index can be incremented. The content of the current location can be added along with any notes. It is also possible to construct chains of locations to reflect a series of file include directives. This chain can be checked to ensure there are no loops.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Err ¶
Err wraps a message and a location into a single struct this allows for a more structured error message
type L ¶
type L struct {
// contains filtered or unexported fields
}
L represents a location - a named source and the index into that source. For instance, this might be used to represent a file and a line number or a database table and a row number. You can also record the content of the location but this is not done routinely and so is only reported if it has been set. Similarly you can add a note to the location and this is only reported if it is not empty.
func (L) Error ¶
Error constructs a location Err setting the Msg to the passed value and the Loc to the location
func (L) Errorf ¶
Errorf constructs a location Err setting the Msg to the results of formatting the arguments and the Loc to the location
func (*L) Incr ¶
func (l *L) Incr()
Incr increments the location index and marks the location as having no content
func (*L) SetContent ¶
SetContent sets the content and marks the location as having content
type LocChain ¶
type LocChain []L
LocChain represents a chain of locations. This might be used to record a string of included files.
func NewChain ¶
func NewChain() LocChain
NewChain returns a new (empty but non-nil) instance of a LocChain