refactor position package
This commit is contained in:
parent
60f171bfa1
commit
3b9ef2b56d
27
pkg/position/position.go
Normal file
27
pkg/position/position.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package position
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Position represents node position
|
||||||
|
type Position struct {
|
||||||
|
StartLine int
|
||||||
|
EndLine int
|
||||||
|
StartPos int
|
||||||
|
EndPos int
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPosition Position constructor
|
||||||
|
func NewPosition(StartLine int, EndLine int, StartPos int, EndPos int) *Position {
|
||||||
|
return &Position{
|
||||||
|
StartLine: StartLine,
|
||||||
|
EndLine: EndLine,
|
||||||
|
StartPos: StartPos,
|
||||||
|
EndPos: EndPos,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p Position) String() string {
|
||||||
|
return fmt.Sprintf("Pos{Line: %d-%d Pos: %d-%d}", p.StartLine, p.EndLine, p.StartPos, p.EndPos)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user