handle comments

This commit is contained in:
vadim
2018-01-05 17:03:59 +02:00
parent cd34d41218
commit 21c0c7c86e
167 changed files with 3547 additions and 1567 deletions

View File

@@ -11,6 +11,7 @@ type FullyQualified struct {
func NewFullyQualified(Parts []node.Node) node.Node {
return &FullyQualified{
Name{
nil,
nil,
Parts,
},

View File

@@ -1,16 +1,19 @@
package name
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Name struct {
position *node.Position
comments *[]comment.Comment
Parts []node.Node
}
func NewName(Parts []node.Node) node.Node {
return &Name{
nil,
nil,
Parts,
}
@@ -29,6 +32,15 @@ func (n Name) SetPosition(p *node.Position) node.Node {
return n
}
func (n Name) Comments() *[]comment.Comment {
return n.comments
}
func (n Name) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Name) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,16 +1,19 @@
package name
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type NamePart struct {
position *node.Position
comments *[]comment.Comment
Value string
}
func NewNamePart(Value string) node.Node {
return &NamePart{
nil,
nil,
Value,
}
@@ -31,6 +34,15 @@ func (n NamePart) SetPosition(p *node.Position) node.Node {
return n
}
func (n NamePart) Comments() *[]comment.Comment {
return n.comments
}
func (n NamePart) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n NamePart) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -11,6 +11,7 @@ type Relative struct {
func NewRelative(Parts []node.Node) node.Node {
return &Relative{
Name{
nil,
nil,
Parts,
},