2017-12-03 18:49:18 +00:00
|
|
|
package node
|
|
|
|
|
2018-01-05 11:01:14 +00:00
|
|
|
import "fmt"
|
2018-01-05 15:03:59 +00:00
|
|
|
import "github.com/z7zmey/php-parser/comment"
|
2018-01-05 11:01:14 +00:00
|
|
|
|
2017-12-31 10:59:22 +00:00
|
|
|
type Node interface {
|
|
|
|
Positioner
|
2018-01-05 15:03:59 +00:00
|
|
|
Commenter
|
2017-12-31 09:57:55 +00:00
|
|
|
Attributes() map[string]interface{}
|
2018-01-04 20:09:48 +00:00
|
|
|
Walk(v Visitor)
|
2017-12-31 09:57:55 +00:00
|
|
|
}
|
|
|
|
|
2018-01-05 15:03:59 +00:00
|
|
|
type Commenter interface {
|
|
|
|
Comments() *[]comment.Comment
|
|
|
|
SetComments([]comment.Comment) Node
|
|
|
|
}
|
|
|
|
|
2017-12-31 10:59:22 +00:00
|
|
|
type Positioner interface {
|
|
|
|
Position() *Position
|
|
|
|
SetPosition(p *Position) Node
|
|
|
|
}
|
|
|
|
|
|
|
|
type Position struct {
|
|
|
|
StartLine int
|
|
|
|
EndLine int
|
2018-01-05 11:01:14 +00:00
|
|
|
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)
|
2017-12-03 18:49:18 +00:00
|
|
|
}
|