2018-01-09 13:51:32 +00:00
|
|
|
package position
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2018-01-12 06:23:58 +00:00
|
|
|
// Position represents node position
|
2018-01-09 13:51:32 +00:00
|
|
|
type Position struct {
|
|
|
|
StartLine int
|
|
|
|
EndLine int
|
|
|
|
StartPos int
|
|
|
|
EndPos int
|
|
|
|
}
|
|
|
|
|
2018-04-15 18:39:26 +00:00
|
|
|
// NewPosition Position constructor
|
|
|
|
func NewPosition(StartLine int, EndLine int, StartPos int, EndPos int) *Position {
|
|
|
|
return &Position{
|
|
|
|
StartLine: StartLine,
|
|
|
|
EndLine: EndLine,
|
|
|
|
StartPos: StartPos,
|
|
|
|
EndPos: EndPos,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-09 13:51:32 +00:00
|
|
|
func (p Position) String() string {
|
|
|
|
return fmt.Sprintf("Pos{Line: %d-%d Pos: %d-%d}", p.StartLine, p.EndLine, p.StartPos, p.EndPos)
|
|
|
|
}
|