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,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type Assign struct {
func NewAssign(Variable node.Node, Expression node.Node) node.Node {
return &Assign{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n Assign) SetPosition(p *node.Position) node.Node {
return n
}
func (n Assign) Comments() *[]comment.Comment {
return n.comments
}
func (n Assign) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Assign) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,11 +1,13 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type AssignOp struct {
position *node.Position
comments *[]comment.Comment
Variable node.Node
Expression node.Node
}

View File

@@ -1,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type AssignRef struct {
func NewAssignRef(Variable node.Node, Expression node.Node) node.Node {
return &AssignRef{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n AssignRef) SetPosition(p *node.Position) node.Node {
return n
}
func (n AssignRef) Comments() *[]comment.Comment {
return n.comments
}
func (n AssignRef) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n AssignRef) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type BitwiseAnd struct {
func NewBitwiseAnd(Variable node.Node, Expression node.Node) node.Node {
return &BitwiseAnd{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n BitwiseAnd) SetPosition(p *node.Position) node.Node {
return n
}
func (n BitwiseAnd) Comments() *[]comment.Comment {
return n.comments
}
func (n BitwiseAnd) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n BitwiseAnd) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type BitwiseOr struct {
func NewBitwiseOr(Variable node.Node, Expression node.Node) node.Node {
return &BitwiseOr{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n BitwiseOr) SetPosition(p *node.Position) node.Node {
return n
}
func (n BitwiseOr) Comments() *[]comment.Comment {
return n.comments
}
func (n BitwiseOr) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n BitwiseOr) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type BitwiseXor struct {
func NewBitwiseXor(Variable node.Node, Expression node.Node) node.Node {
return &BitwiseXor{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n BitwiseXor) SetPosition(p *node.Position) node.Node {
return n
}
func (n BitwiseXor) Comments() *[]comment.Comment {
return n.comments
}
func (n BitwiseXor) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n BitwiseXor) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type Concat struct {
func NewConcat(Variable node.Node, Expression node.Node) node.Node {
return &Concat{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n Concat) SetPosition(p *node.Position) node.Node {
return n
}
func (n Concat) Comments() *[]comment.Comment {
return n.comments
}
func (n Concat) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Concat) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type Div struct {
func NewDiv(Variable node.Node, Expression node.Node) node.Node {
return &Div{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n Div) SetPosition(p *node.Position) node.Node {
return n
}
func (n Div) Comments() *[]comment.Comment {
return n.comments
}
func (n Div) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Div) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type Minus struct {
func NewMinus(Variable node.Node, Expression node.Node) node.Node {
return &Minus{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n Minus) SetPosition(p *node.Position) node.Node {
return n
}
func (n Minus) Comments() *[]comment.Comment {
return n.comments
}
func (n Minus) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Minus) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type Mod struct {
func NewMod(Variable node.Node, Expression node.Node) node.Node {
return &Mod{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n Mod) SetPosition(p *node.Position) node.Node {
return n
}
func (n Mod) Comments() *[]comment.Comment {
return n.comments
}
func (n Mod) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Mod) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type Mul struct {
func NewMul(Variable node.Node, Expression node.Node) node.Node {
return &Mul{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n Mul) SetPosition(p *node.Position) node.Node {
return n
}
func (n Mul) Comments() *[]comment.Comment {
return n.comments
}
func (n Mul) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Mul) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type Plus struct {
func NewPlus(Variable node.Node, Expression node.Node) node.Node {
return &Plus{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n Plus) SetPosition(p *node.Position) node.Node {
return n
}
func (n Plus) Comments() *[]comment.Comment {
return n.comments
}
func (n Plus) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Plus) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type Pow struct {
func NewPow(Variable node.Node, Expression node.Node) node.Node {
return &Pow{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n Pow) SetPosition(p *node.Position) node.Node {
return n
}
func (n Pow) Comments() *[]comment.Comment {
return n.comments
}
func (n Pow) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Pow) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type ShiftLeft struct {
func NewShiftLeft(Variable node.Node, Expression node.Node) node.Node {
return &ShiftLeft{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n ShiftLeft) SetPosition(p *node.Position) node.Node {
return n
}
func (n ShiftLeft) Comments() *[]comment.Comment {
return n.comments
}
func (n ShiftLeft) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n ShiftLeft) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,6 +1,7 @@
package assign_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
@@ -11,6 +12,7 @@ type ShiftRight struct {
func NewShiftRight(Variable node.Node, Expression node.Node) node.Node {
return &ShiftRight{
AssignOp{
nil,
nil,
Variable,
Expression,
@@ -31,6 +33,15 @@ func (n ShiftRight) SetPosition(p *node.Position) node.Node {
return n
}
func (n ShiftRight) Comments() *[]comment.Comment {
return n.comments
}
func (n ShiftRight) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n ShiftRight) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return