1 // Position support for go-toml
9 // Position of a document element within a TOML document.
11 // Line and Col are both 1-indexed positions for the element's line number and
12 // column number, respectively. Values of zero or less will cause Invalid(),
14 type Position struct {
15 Line int // line within the document
16 Col int // column within the line
19 // String representation of the position.
20 // Displays 1-indexed line and column numbers.
21 func (p Position) String() string {
22 return fmt.Sprintf("(%d, %d)", p.Line, p.Col)
25 // Invalid returns whether or not the position is valid (i.e. with negative or
27 func (p Position) Invalid() bool {
28 return p.Line <= 0 || p.Col <= 0