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,11 +1,13 @@
package binary_op
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type BinaryOp struct {
position *node.Position
comments *[]comment.Comment
Left node.Node
Right node.Node
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,7 @@
package binary_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{
BinaryOp{
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 binary_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{
BinaryOp{
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 binary_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{
BinaryOp{
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 binary_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{
BinaryOp{
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

View File

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

View File

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

View File

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