#25: save comments within node

This commit is contained in:
z7zmey
2018-06-25 15:38:31 +03:00
parent 1ebb0c6fad
commit 3cd45ecac5
183 changed files with 16743 additions and 14671 deletions

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// AltElse node
type AltElse struct {
Comments []*comment.Comment
Position *position.Position
Stmt node.Node
}
@@ -29,6 +31,17 @@ func (n *AltElse) GetPosition() *position.Position {
return n.Position
}
func (n *AltElse) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *AltElse) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *AltElse) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// AltElseIf node
type AltElseIf struct {
Comments []*comment.Comment
Position *position.Position
Cond node.Node
Stmt node.Node
@@ -31,6 +33,17 @@ func (n *AltElseIf) GetPosition() *position.Position {
return n.Position
}
func (n *AltElseIf) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *AltElseIf) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *AltElseIf) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// AltFor node
type AltFor struct {
Comments []*comment.Comment
Position *position.Position
Init []node.Node
Cond []node.Node
@@ -35,6 +37,17 @@ func (n *AltFor) GetPosition() *position.Position {
return n.Position
}
func (n *AltFor) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *AltFor) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *AltFor) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// AltForeach node
type AltForeach struct {
Comments []*comment.Comment
Position *position.Position
Expr node.Node
Key node.Node
@@ -35,6 +37,17 @@ func (n *AltForeach) GetPosition() *position.Position {
return n.Position
}
func (n *AltForeach) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *AltForeach) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *AltForeach) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// AltIf node
type AltIf struct {
Comments []*comment.Comment
Position *position.Position
Cond node.Node
Stmt node.Node
@@ -35,6 +37,17 @@ func (n *AltIf) GetPosition() *position.Position {
return n.Position
}
func (n *AltIf) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *AltIf) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *AltIf) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// AltSwitch node
type AltSwitch struct {
Comments []*comment.Comment
Position *position.Position
Cond node.Node
CaseList *CaseList
@@ -31,6 +33,17 @@ func (n *AltSwitch) GetPosition() *position.Position {
return n.Position
}
func (n *AltSwitch) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *AltSwitch) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *AltSwitch) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// AltWhile node
type AltWhile struct {
Comments []*comment.Comment
Position *position.Position
Cond node.Node
Stmt node.Node
@@ -31,6 +33,17 @@ func (n *AltWhile) GetPosition() *position.Position {
return n.Position
}
func (n *AltWhile) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *AltWhile) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *AltWhile) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Break node
type Break struct {
Comments []*comment.Comment
Position *position.Position
Expr node.Node
}
@@ -29,6 +31,17 @@ func (n *Break) GetPosition() *position.Position {
return n.Position
}
func (n *Break) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Break) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Break) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Case node
type Case struct {
Comments []*comment.Comment
Position *position.Position
Cond node.Node
Stmts []node.Node
@@ -31,6 +33,17 @@ func (n *Case) GetPosition() *position.Position {
return n.Position
}
func (n *Case) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Case) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Case) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// CaseList node
type CaseList struct {
Comments []*comment.Comment
Position *position.Position
Cases []node.Node
}
@@ -29,6 +31,17 @@ func (n *CaseList) GetPosition() *position.Position {
return n.Position
}
func (n *CaseList) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *CaseList) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *CaseList) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Catch node
type Catch struct {
Comments []*comment.Comment
Position *position.Position
Types []node.Node
Variable node.Node
@@ -33,6 +35,17 @@ func (n *Catch) GetPosition() *position.Position {
return n.Position
}
func (n *Catch) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Catch) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Catch) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Class node
type Class struct {
Comments []*comment.Comment
Position *position.Position
PhpDocComment string
ClassName node.Node
@@ -41,6 +43,17 @@ func (n *Class) GetPosition() *position.Position {
return n.Position
}
func (n *Class) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Class) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Class) Attributes() map[string]interface{} {
return map[string]interface{}{

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// ClassConstList node
type ClassConstList struct {
Comments []*comment.Comment
Position *position.Position
Modifiers []node.Node
Consts []node.Node
@@ -31,6 +33,17 @@ func (n *ClassConstList) GetPosition() *position.Position {
return n.Position
}
func (n *ClassConstList) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *ClassConstList) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *ClassConstList) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// ClassExtends node
type ClassExtends struct {
Comments []*comment.Comment
Position *position.Position
ClassName node.Node
}
@@ -29,6 +31,17 @@ func (n *ClassExtends) GetPosition() *position.Position {
return n.Position
}
func (n *ClassExtends) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *ClassExtends) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *ClassExtends) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// ClassImplements node
type ClassImplements struct {
Comments []*comment.Comment
Position *position.Position
InterfaceNames []node.Node
}
@@ -29,6 +31,17 @@ func (n *ClassImplements) GetPosition() *position.Position {
return n.Position
}
func (n *ClassImplements) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *ClassImplements) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *ClassImplements) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// ClassMethod node
type ClassMethod struct {
Comments []*comment.Comment
Position *position.Position
ReturnsRef bool
PhpDocComment string
@@ -41,6 +43,17 @@ func (n *ClassMethod) GetPosition() *position.Position {
return n.Position
}
func (n *ClassMethod) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *ClassMethod) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *ClassMethod) Attributes() map[string]interface{} {
return map[string]interface{}{

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// ConstList node
type ConstList struct {
Comments []*comment.Comment
Position *position.Position
Consts []node.Node
}
@@ -29,6 +31,17 @@ func (n *ConstList) GetPosition() *position.Position {
return n.Position
}
func (n *ConstList) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *ConstList) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *ConstList) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Constant node
type Constant struct {
Comments []*comment.Comment
Position *position.Position
PhpDocComment string
ConstantName node.Node
@@ -33,6 +35,17 @@ func (n *Constant) GetPosition() *position.Position {
return n.Position
}
func (n *Constant) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Constant) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Constant) Attributes() map[string]interface{} {
return map[string]interface{}{

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Continue node
type Continue struct {
Comments []*comment.Comment
Position *position.Position
Expr node.Node
}
@@ -29,6 +31,17 @@ func (n *Continue) GetPosition() *position.Position {
return n.Position
}
func (n *Continue) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Continue) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Continue) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Declare node
type Declare struct {
Comments []*comment.Comment
Position *position.Position
Consts []node.Node
Stmt node.Node
@@ -31,6 +33,17 @@ func (n *Declare) GetPosition() *position.Position {
return n.Position
}
func (n *Declare) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Declare) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Declare) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Default node
type Default struct {
Comments []*comment.Comment
Position *position.Position
Stmts []node.Node
}
@@ -29,6 +31,17 @@ func (n *Default) GetPosition() *position.Position {
return n.Position
}
func (n *Default) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Default) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Default) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Do node
type Do struct {
Comments []*comment.Comment
Position *position.Position
Stmt node.Node
Cond node.Node
@@ -31,6 +33,17 @@ func (n *Do) GetPosition() *position.Position {
return n.Position
}
func (n *Do) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Do) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Do) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Echo node
type Echo struct {
Comments []*comment.Comment
Position *position.Position
Exprs []node.Node
}
@@ -29,6 +31,17 @@ func (n *Echo) GetPosition() *position.Position {
return n.Position
}
func (n *Echo) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Echo) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Echo) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Else node
type Else struct {
Comments []*comment.Comment
Position *position.Position
Stmt node.Node
}
@@ -29,6 +31,17 @@ func (n *Else) GetPosition() *position.Position {
return n.Position
}
func (n *Else) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Else) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Else) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// ElseIf node
type ElseIf struct {
Comments []*comment.Comment
Position *position.Position
Cond node.Node
Stmt node.Node
@@ -31,6 +33,17 @@ func (n *ElseIf) GetPosition() *position.Position {
return n.Position
}
func (n *ElseIf) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *ElseIf) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *ElseIf) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Expression node
type Expression struct {
Comments []*comment.Comment
Position *position.Position
Expr node.Node
}
@@ -29,6 +31,17 @@ func (n *Expression) GetPosition() *position.Position {
return n.Position
}
func (n *Expression) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Expression) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Expression) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Finally node
type Finally struct {
Comments []*comment.Comment
Position *position.Position
Stmts []node.Node
}
@@ -29,6 +31,17 @@ func (n *Finally) GetPosition() *position.Position {
return n.Position
}
func (n *Finally) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Finally) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Finally) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// For node
type For struct {
Comments []*comment.Comment
Position *position.Position
Init []node.Node
Cond []node.Node
@@ -35,6 +37,17 @@ func (n *For) GetPosition() *position.Position {
return n.Position
}
func (n *For) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *For) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *For) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Foreach node
type Foreach struct {
Comments []*comment.Comment
Position *position.Position
Expr node.Node
Key node.Node
@@ -35,6 +37,17 @@ func (n *Foreach) GetPosition() *position.Position {
return n.Position
}
func (n *Foreach) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Foreach) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Foreach) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Function node
type Function struct {
Comments []*comment.Comment
Position *position.Position
ReturnsRef bool
PhpDocComment string
@@ -39,6 +41,17 @@ func (n *Function) GetPosition() *position.Position {
return n.Position
}
func (n *Function) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Function) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Function) Attributes() map[string]interface{} {
// return n.attributes

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Global node
type Global struct {
Comments []*comment.Comment
Position *position.Position
Vars []node.Node
}
@@ -29,6 +31,17 @@ func (n *Global) GetPosition() *position.Position {
return n.Position
}
func (n *Global) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Global) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Global) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Goto node
type Goto struct {
Comments []*comment.Comment
Position *position.Position
Label node.Node
}
@@ -29,6 +31,17 @@ func (n *Goto) GetPosition() *position.Position {
return n.Position
}
func (n *Goto) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Goto) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Goto) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// GroupUse node
type GroupUse struct {
Comments []*comment.Comment
Position *position.Position
UseType node.Node
Prefix node.Node
@@ -33,6 +35,17 @@ func (n *GroupUse) GetPosition() *position.Position {
return n.Position
}
func (n *GroupUse) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *GroupUse) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *GroupUse) Attributes() map[string]interface{} {
return nil

View File

@@ -1,12 +1,14 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
)
// HaltCompiler node
type HaltCompiler struct {
Comments []*comment.Comment
Position *position.Position
}
@@ -25,6 +27,17 @@ func (n *HaltCompiler) GetPosition() *position.Position {
return n.Position
}
func (n *HaltCompiler) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *HaltCompiler) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *HaltCompiler) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// If node
type If struct {
Comments []*comment.Comment
Position *position.Position
Cond node.Node
Stmt node.Node
@@ -35,6 +37,17 @@ func (n *If) GetPosition() *position.Position {
return n.Position
}
func (n *If) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *If) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *If) Attributes() map[string]interface{} {
return nil

View File

@@ -1,12 +1,14 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
)
// InlineHtml node
type InlineHtml struct {
Comments []*comment.Comment
Position *position.Position
Value string
}
@@ -28,6 +30,17 @@ func (n *InlineHtml) GetPosition() *position.Position {
return n.Position
}
func (n *InlineHtml) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *InlineHtml) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *InlineHtml) Attributes() map[string]interface{} {
return map[string]interface{}{

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Interface node
type Interface struct {
Comments []*comment.Comment
Position *position.Position
PhpDocComment string
InterfaceName node.Node
@@ -35,6 +37,17 @@ func (n *Interface) GetPosition() *position.Position {
return n.Position
}
func (n *Interface) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Interface) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Interface) Attributes() map[string]interface{} {
return map[string]interface{}{

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// InterfaceExtends node
type InterfaceExtends struct {
Comments []*comment.Comment
Position *position.Position
InterfaceNames []node.Node
}
@@ -29,6 +31,17 @@ func (n *InterfaceExtends) GetPosition() *position.Position {
return n.Position
}
func (n *InterfaceExtends) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *InterfaceExtends) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *InterfaceExtends) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Label node
type Label struct {
Comments []*comment.Comment
Position *position.Position
LabelName node.Node
}
@@ -29,6 +31,17 @@ func (n *Label) GetPosition() *position.Position {
return n.Position
}
func (n *Label) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Label) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Label) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Namespace node
type Namespace struct {
Comments []*comment.Comment
Position *position.Position
NamespaceName node.Node
Stmts []node.Node
@@ -31,6 +33,17 @@ func (n *Namespace) GetPosition() *position.Position {
return n.Position
}
func (n *Namespace) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Namespace) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Namespace) Attributes() map[string]interface{} {
return nil

View File

@@ -1,12 +1,14 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
)
// Nop node
type Nop struct {
Comments []*comment.Comment
Position *position.Position
}
@@ -25,6 +27,17 @@ func (n *Nop) GetPosition() *position.Position {
return n.Position
}
func (n *Nop) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Nop) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Nop) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Property node
type Property struct {
Comments []*comment.Comment
Position *position.Position
PhpDocComment string
Variable node.Node
@@ -33,6 +35,17 @@ func (n *Property) GetPosition() *position.Position {
return n.Position
}
func (n *Property) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Property) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Property) Attributes() map[string]interface{} {
return map[string]interface{}{

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// PropertyList node
type PropertyList struct {
Comments []*comment.Comment
Position *position.Position
Modifiers []node.Node
Properties []node.Node
@@ -31,6 +33,17 @@ func (n *PropertyList) GetPosition() *position.Position {
return n.Position
}
func (n *PropertyList) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *PropertyList) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *PropertyList) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Return node
type Return struct {
Comments []*comment.Comment
Position *position.Position
Expr node.Node
}
@@ -29,6 +31,17 @@ func (n *Return) GetPosition() *position.Position {
return n.Position
}
func (n *Return) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Return) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Return) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Static node
type Static struct {
Comments []*comment.Comment
Position *position.Position
Vars []node.Node
}
@@ -29,6 +31,17 @@ func (n *Static) GetPosition() *position.Position {
return n.Position
}
func (n *Static) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Static) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Static) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// StaticVar node
type StaticVar struct {
Comments []*comment.Comment
Position *position.Position
Variable node.Node
Expr node.Node
@@ -31,6 +33,17 @@ func (n *StaticVar) GetPosition() *position.Position {
return n.Position
}
func (n *StaticVar) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *StaticVar) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *StaticVar) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// StmtList node
type StmtList struct {
Comments []*comment.Comment
Position *position.Position
Stmts []node.Node
}
@@ -29,6 +31,17 @@ func (n *StmtList) GetPosition() *position.Position {
return n.Position
}
func (n *StmtList) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *StmtList) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *StmtList) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Switch node
type Switch struct {
Comments []*comment.Comment
Position *position.Position
Cond node.Node
CaseList *CaseList
@@ -31,6 +33,17 @@ func (n *Switch) GetPosition() *position.Position {
return n.Position
}
func (n *Switch) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Switch) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Switch) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Throw node
type Throw struct {
Comments []*comment.Comment
Position *position.Position
Expr node.Node
}
@@ -29,6 +31,17 @@ func (n *Throw) GetPosition() *position.Position {
return n.Position
}
func (n *Throw) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Throw) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Throw) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Trait node
type Trait struct {
Comments []*comment.Comment
Position *position.Position
PhpDocComment string
TraitName node.Node
@@ -33,6 +35,17 @@ func (n *Trait) GetPosition() *position.Position {
return n.Position
}
func (n *Trait) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Trait) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Trait) Attributes() map[string]interface{} {
return map[string]interface{}{

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// TraitAdaptationList node
type TraitAdaptationList struct {
Comments []*comment.Comment
Position *position.Position
Adaptations []node.Node
}
@@ -29,6 +31,17 @@ func (n *TraitAdaptationList) GetPosition() *position.Position {
return n.Position
}
func (n *TraitAdaptationList) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *TraitAdaptationList) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *TraitAdaptationList) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// TraitMethodRef node
type TraitMethodRef struct {
Comments []*comment.Comment
Position *position.Position
Trait node.Node
Method node.Node
@@ -31,6 +33,17 @@ func (n *TraitMethodRef) GetPosition() *position.Position {
return n.Position
}
func (n *TraitMethodRef) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *TraitMethodRef) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *TraitMethodRef) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// TraitUse node
type TraitUse struct {
Comments []*comment.Comment
Position *position.Position
Traits []node.Node
TraitAdaptationList *TraitAdaptationList
@@ -31,6 +33,17 @@ func (n *TraitUse) GetPosition() *position.Position {
return n.Position
}
func (n *TraitUse) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *TraitUse) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *TraitUse) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// TraitUseAlias node
type TraitUseAlias struct {
Comments []*comment.Comment
Position *position.Position
Ref node.Node
Modifier node.Node
@@ -33,6 +35,17 @@ func (n *TraitUseAlias) GetPosition() *position.Position {
return n.Position
}
func (n *TraitUseAlias) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *TraitUseAlias) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *TraitUseAlias) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// TraitUsePrecedence node
type TraitUsePrecedence struct {
Comments []*comment.Comment
Position *position.Position
Ref node.Node
Insteadof []node.Node
@@ -31,6 +33,17 @@ func (n *TraitUsePrecedence) GetPosition() *position.Position {
return n.Position
}
func (n *TraitUsePrecedence) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *TraitUsePrecedence) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *TraitUsePrecedence) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Try node
type Try struct {
Comments []*comment.Comment
Position *position.Position
Stmts []node.Node
Catches []node.Node
@@ -33,6 +35,17 @@ func (n *Try) GetPosition() *position.Position {
return n.Position
}
func (n *Try) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Try) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Try) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Unset node
type Unset struct {
Comments []*comment.Comment
Position *position.Position
Vars []node.Node
}
@@ -29,6 +31,17 @@ func (n *Unset) GetPosition() *position.Position {
return n.Position
}
func (n *Unset) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Unset) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Unset) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// Use node
type Use struct {
Comments []*comment.Comment
Position *position.Position
UseType node.Node
Use node.Node
@@ -33,6 +35,17 @@ func (n *Use) GetPosition() *position.Position {
return n.Position
}
func (n *Use) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *Use) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *Use) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// UseList node
type UseList struct {
Comments []*comment.Comment
Position *position.Position
UseType node.Node
Uses []node.Node
@@ -31,6 +33,17 @@ func (n *UseList) GetPosition() *position.Position {
return n.Position
}
func (n *UseList) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *UseList) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *UseList) Attributes() map[string]interface{} {
return nil

View File

@@ -1,6 +1,7 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/position"
"github.com/z7zmey/php-parser/walker"
@@ -8,6 +9,7 @@ import (
// While node
type While struct {
Comments []*comment.Comment
Position *position.Position
Cond node.Node
Stmt node.Node
@@ -31,6 +33,17 @@ func (n *While) GetPosition() *position.Position {
return n.Position
}
func (n *While) AddComments(cc []*comment.Comment, tn comment.TokenName) {
for _, c := range cc {
c.SetTokenName(tn)
}
n.Comments = append(n.Comments, cc...)
}
func (n *While) GetComments() []*comment.Comment {
return n.Comments
}
// Attributes returns node attributes as map
func (n *While) Attributes() map[string]interface{} {
return nil