main
Raw Download raw file
 1package ssh_config
 2
 3import "fmt"
 4
 5// Position of a document element within a SSH document.
 6//
 7// Line and Col are both 1-indexed positions for the element's line number and
 8// column number, respectively.  Values of zero or less will cause Invalid(),
 9// to return true.
10type Position struct {
11	Line int // line within the document
12	Col  int // column within the line
13}
14
15// String representation of the position.
16// Displays 1-indexed line and column numbers.
17func (p Position) String() string {
18	return fmt.Sprintf("(%d, %d)", p.Line, p.Col)
19}
20
21// Invalid returns whether or not the position is valid (i.e. with negative or
22// null values)
23func (p Position) Invalid() bool {
24	return p.Line <= 0 || p.Col <= 0
25}