php-parser/position/position.go

25 lines
428 B
Go
Raw Normal View History

2018-01-09 13:51:32 +00:00
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
}