/
node_dnumber.go
53 lines (44 loc) · 1.07 KB
/
node_dnumber.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package scalar
import (
"github.com/i582/php2go/src/php/freefloating"
"github.com/i582/php2go/src/php/position"
"github.com/i582/php2go/src/php/walker"
)
// Dnumber node
type Dnumber struct {
FreeFloating freefloating.Collection
Position *position.Position
Value string
}
// NewDnumber node constructor
func NewDnumber(Value string) *Dnumber {
return &Dnumber{
FreeFloating: nil,
Value: Value,
}
}
// SetPosition sets node position
func (n *Dnumber) SetPosition(p *position.Position) {
n.Position = p
}
// GetPosition returns node positions
func (n *Dnumber) GetPosition() *position.Position {
return n.Position
}
func (n *Dnumber) GetFreeFloating() *freefloating.Collection {
return &n.FreeFloating
}
// Attributes returns node attributes as map
func (n *Dnumber) Attributes() map[string]interface{} {
return map[string]interface{}{
"Value": n.Value,
}
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Dnumber) Walk(v walker.Visitor) {
if v.EnterNode(n) == false {
return
}
v.LeaveNode(n)
}