extract positions package

This commit is contained in:
z7zmey
2018-01-09 15:51:32 +02:00
parent 23d938df99
commit 2078a6cde6
166 changed files with 2060 additions and 3030 deletions

24
position/position.go Normal file
View 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
}