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

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

View File

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

View File

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

View File

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

View File

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

View File

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