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,10 +1,12 @@
package cast
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Cast struct {
position *node.Position
comments *[]comment.Comment
Expr node.Node
}

View File

@@ -1,6 +1,7 @@
package cast
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type CastArray struct {
func NewCastArray(Expr node.Node) node.Node {
return &CastArray{
Cast{
nil,
nil,
Expr,
},
@@ -30,6 +32,15 @@ func (n CastArray) SetPosition(p *node.Position) node.Node {
return n
}
func (n CastArray) Comments() *[]comment.Comment {
return n.comments
}
func (n CastArray) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n CastArray) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package cast
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type CastBool struct {
func NewCastBool(Expr node.Node) node.Node {
return &CastBool{
Cast{
nil,
nil,
Expr,
},
@@ -30,6 +32,15 @@ func (n CastBool) SetPosition(p *node.Position) node.Node {
return n
}
func (n CastBool) Comments() *[]comment.Comment {
return n.comments
}
func (n CastBool) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n CastBool) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package cast
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type CastDouble struct {
func NewCastDouble(Expr node.Node) node.Node {
return &CastDouble{
Cast{
nil,
nil,
Expr,
},
@@ -30,6 +32,15 @@ func (n CastDouble) SetPosition(p *node.Position) node.Node {
return n
}
func (n CastDouble) Comments() *[]comment.Comment {
return n.comments
}
func (n CastDouble) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n CastDouble) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package cast
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type CastInt struct {
func NewCastInt(Expr node.Node) node.Node {
return &CastInt{
Cast{
nil,
nil,
Expr,
},
@@ -30,6 +32,15 @@ func (n CastInt) SetPosition(p *node.Position) node.Node {
return n
}
func (n CastInt) Comments() *[]comment.Comment {
return n.comments
}
func (n CastInt) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n CastInt) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package cast
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type CastObject struct {
func NewCastObject(Expr node.Node) node.Node {
return &CastObject{
Cast{
nil,
nil,
Expr,
},
@@ -30,6 +32,15 @@ func (n CastObject) SetPosition(p *node.Position) node.Node {
return n
}
func (n CastObject) Comments() *[]comment.Comment {
return n.comments
}
func (n CastObject) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n CastObject) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package cast
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type CastString struct {
func NewCastString(Expr node.Node) node.Node {
return &CastString{
Cast{
nil,
nil,
Expr,
},
@@ -30,6 +32,15 @@ func (n CastString) SetPosition(p *node.Position) node.Node {
return n
}
func (n CastString) Comments() *[]comment.Comment {
return n.comments
}
func (n CastString) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n CastString) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package cast
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type CastUnset struct {
func NewCastUnset(Expr node.Node) node.Node {
return &CastUnset{
Cast{
nil,
nil,
Expr,
},
@@ -30,6 +32,15 @@ func (n CastUnset) SetPosition(p *node.Position) node.Node {
return n
}
func (n CastUnset) Comments() *[]comment.Comment {
return n.comments
}
func (n CastUnset) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n CastUnset) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return