extract positions package
This commit is contained in:
24
position/position.go
Normal file
24
position/position.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package position
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
type Position struct {
|
||||
StartLine int
|
||||
EndLine int
|
||||
StartPos int
|
||||
EndPos int
|
||||
}
|
||||
|
||||
func (p Position) String() string {
|
||||
return fmt.Sprintf("Pos{Line: %d-%d Pos: %d-%d}", p.StartLine, p.EndLine, p.StartPos, p.EndPos)
|
||||
}
|
||||
|
||||
type Positions map[node.Node]*Position
|
||||
|
||||
func (p Positions) AddPosition(node node.Node, position *Position) {
|
||||
p[node] = position
|
||||
}
|
||||
Reference in New Issue
Block a user