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 stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type AltElse struct {
position *node.Position
comments *[]comment.Comment
Stmt node.Node
}
func NewAltElse(Stmt node.Node) node.Node {
return &AltElse{
nil,
nil,
Stmt,
}
@@ -29,6 +32,15 @@ func (n AltElse) SetPosition(p *node.Position) node.Node {
return n
}
func (n AltElse) Comments() *[]comment.Comment {
return n.comments
}
func (n AltElse) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n AltElse) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,17 +1,20 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type AltElseIf struct {
position *node.Position
comments *[]comment.Comment
Cond node.Node
Stmt node.Node
}
func NewAltElseIf(Cond node.Node, Stmt node.Node) node.Node {
return &AltElseIf{
nil,
nil,
Cond,
Stmt,
@@ -31,6 +34,15 @@ func (n AltElseIf) SetPosition(p *node.Position) node.Node {
return n
}
func (n AltElseIf) Comments() *[]comment.Comment {
return n.comments
}
func (n AltElseIf) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n AltElseIf) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type AltIf struct {
position *node.Position
comments *[]comment.Comment
Cond node.Node
Stmt node.Node
ElseIf []node.Node
@@ -14,6 +16,7 @@ type AltIf struct {
func NewAltIf(Cond node.Node, Stmt node.Node) node.Node {
return &AltIf{
nil,
nil,
Cond,
Stmt,
@@ -35,6 +38,15 @@ func (n AltIf) SetPosition(p *node.Position) node.Node {
return n
}
func (n AltIf) Comments() *[]comment.Comment {
return n.comments
}
func (n AltIf) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n AltIf) AddElseIf(ElseIf node.Node) node.Node {
if n.ElseIf == nil {
n.ElseIf = make([]node.Node, 0)

View File

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

View File

@@ -1,17 +1,20 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Case struct {
position *node.Position
comments *[]comment.Comment
Cond node.Node
Stmts []node.Node
}
func NewCase(Cond node.Node, Stmts []node.Node) node.Node {
return &Case{
nil,
nil,
Cond,
Stmts,
@@ -31,6 +34,15 @@ func (n Case) SetPosition(p *node.Position) node.Node {
return n
}
func (n Case) Comments() *[]comment.Comment {
return n.comments
}
func (n Case) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Case) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Catch struct {
position *node.Position
comments *[]comment.Comment
Types []node.Node
Variable node.Node
Stmts []node.Node
@@ -13,6 +15,7 @@ type Catch struct {
func NewCatch(Types []node.Node, Variable node.Node, Stmts []node.Node) node.Node {
return &Catch{
nil,
nil,
Types,
Variable,
@@ -33,6 +36,15 @@ func (n Catch) SetPosition(p *node.Position) node.Node {
return n
}
func (n Catch) Comments() *[]comment.Comment {
return n.comments
}
func (n Catch) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Catch) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Class struct {
position *node.Position
comments *[]comment.Comment
PhpDocComment string
ClassName node.Node
Modifiers []node.Node
@@ -17,6 +19,7 @@ type Class struct {
func NewClass(ClassName node.Node, Modifiers []node.Node, args []node.Node, Extends node.Node, Implements []node.Node, Stmts []node.Node, PhpDocComment string) node.Node {
return &Class{
nil,
nil,
PhpDocComment,
ClassName,
@@ -43,6 +46,15 @@ func (n Class) SetPosition(p *node.Position) node.Node {
return n
}
func (n Class) Comments() *[]comment.Comment {
return n.comments
}
func (n Class) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Class) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,17 +1,20 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type ClassConstList struct {
position *node.Position
comments *[]comment.Comment
Modifiers []node.Node
Consts []node.Node
}
func NewClassConstList(Modifiers []node.Node, Consts []node.Node) node.Node {
return &ClassConstList{
nil,
nil,
Modifiers,
Consts,
@@ -31,6 +34,15 @@ func (n ClassConstList) SetPosition(p *node.Position) node.Node {
return n
}
func (n ClassConstList) Comments() *[]comment.Comment {
return n.comments
}
func (n ClassConstList) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n ClassConstList) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type ClassMethod struct {
position *node.Position
comments *[]comment.Comment
ReturnsRef bool
PhpDocComment string
MethodName node.Node
@@ -17,6 +19,7 @@ type ClassMethod struct {
func NewClassMethod(MethodName node.Node, Modifiers []node.Node, ReturnsRef bool, Params []node.Node, ReturnType node.Node, Stmts []node.Node, PhpDocComment string) node.Node {
return &ClassMethod{
nil,
nil,
ReturnsRef,
PhpDocComment,
@@ -44,6 +47,15 @@ func (n ClassMethod) SetPosition(p *node.Position) node.Node {
return n
}
func (n ClassMethod) Comments() *[]comment.Comment {
return n.comments
}
func (n ClassMethod) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n ClassMethod) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

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

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Constant struct {
position *node.Position
comments *[]comment.Comment
PhpDocComment string
ConstantName node.Node
Expr node.Node
@@ -13,6 +15,7 @@ type Constant struct {
func NewConstant(ConstantName node.Node, Expr node.Node, PhpDocComment string) node.Node {
return &Constant{
nil,
nil,
PhpDocComment,
ConstantName,
@@ -35,6 +38,15 @@ func (n Constant) SetPosition(p *node.Position) node.Node {
return n
}
func (n Constant) Comments() *[]comment.Comment {
return n.comments
}
func (n Constant) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Constant) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

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

View File

@@ -1,17 +1,20 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Declare struct {
position *node.Position
comments *[]comment.Comment
Consts []node.Node
Stmt node.Node
}
func NewDeclare(Consts []node.Node, Stmt node.Node) node.Node {
return &Declare{
nil,
nil,
Consts,
Stmt,
@@ -31,6 +34,15 @@ func (n Declare) SetPosition(p *node.Position) node.Node {
return n
}
func (n Declare) Comments() *[]comment.Comment {
return n.comments
}
func (n Declare) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Declare) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

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

View File

@@ -1,17 +1,20 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Do struct {
position *node.Position
comments *[]comment.Comment
Stmt node.Node
Cond node.Node
}
func NewDo(Stmt node.Node, Cond node.Node) node.Node {
return &Do{
nil,
nil,
Stmt,
Cond,
@@ -31,6 +34,15 @@ func (n Do) SetPosition(p *node.Position) node.Node {
return n
}
func (n Do) Comments() *[]comment.Comment {
return n.comments
}
func (n Do) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Do) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

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

View File

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

View File

@@ -1,17 +1,20 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type ElseIf struct {
position *node.Position
comments *[]comment.Comment
Cond node.Node
Stmt node.Node
}
func NewElseIf(Cond node.Node, Stmt node.Node) node.Node {
return &ElseIf{
nil,
nil,
Cond,
Stmt,
@@ -31,6 +34,15 @@ func (n ElseIf) SetPosition(p *node.Position) node.Node {
return n
}
func (n ElseIf) Comments() *[]comment.Comment {
return n.comments
}
func (n ElseIf) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n ElseIf) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,25 +1,26 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Expression struct {
attributes map[string]interface{}
position *node.Position
Expr node.Node
position *node.Position
comments *[]comment.Comment
Expr node.Node
}
func NewExpression(Expr node.Node) node.Node {
return &Expression{
map[string]interface{}{},
nil,
nil,
Expr,
}
}
func (n Expression) Attributes() map[string]interface{} {
return n.attributes
return nil
}
func (n Expression) Position() *node.Position {
@@ -31,6 +32,15 @@ func (n Expression) SetPosition(p *node.Position) node.Node {
return n
}
func (n Expression) Comments() *[]comment.Comment {
return n.comments
}
func (n Expression) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Expression) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

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

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type For struct {
position *node.Position
comments *[]comment.Comment
Init []node.Node
Cond []node.Node
Loop []node.Node
@@ -14,6 +16,7 @@ type For struct {
func NewFor(Init []node.Node, Cond []node.Node, Loop []node.Node, Stmt node.Node) node.Node {
return &For{
nil,
nil,
Init,
Cond,
@@ -35,6 +38,15 @@ func (n For) SetPosition(p *node.Position) node.Node {
return n
}
func (n For) Comments() *[]comment.Comment {
return n.comments
}
func (n For) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n For) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Foreach struct {
position *node.Position
comments *[]comment.Comment
ByRef bool
Expr node.Node
Key node.Node
@@ -15,6 +17,7 @@ type Foreach struct {
func NewForeach(Expr node.Node, Key node.Node, Variable node.Node, Stmt node.Node, ByRef bool) node.Node {
return &Foreach{
nil,
nil,
ByRef,
Expr,
@@ -39,6 +42,15 @@ func (n Foreach) SetPosition(p *node.Position) node.Node {
return n
}
func (n Foreach) Comments() *[]comment.Comment {
return n.comments
}
func (n Foreach) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Foreach) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Function struct {
position *node.Position
comments *[]comment.Comment
ReturnsRef bool
PhpDocComment string
FunctionName node.Node
@@ -16,6 +18,7 @@ type Function struct {
func NewFunction(FunctionName node.Node, ReturnsRef bool, Params []node.Node, ReturnType node.Node, Stmts []node.Node, PhpDocComment string) node.Node {
return &Function{
nil,
nil,
ReturnsRef,
PhpDocComment,
@@ -43,6 +46,15 @@ func (n Function) SetPosition(p *node.Position) node.Node {
return n
}
func (n Function) Comments() *[]comment.Comment {
return n.comments
}
func (n Function) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Function) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

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

View File

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

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type GroupUse struct {
position *node.Position
comments *[]comment.Comment
UseType node.Node
pRefix node.Node
UseList []node.Node
@@ -13,6 +15,7 @@ type GroupUse struct {
func NewGroupUse(UseType node.Node, pRefix node.Node, UseList []node.Node) node.Node {
return &GroupUse{
nil,
nil,
UseType,
pRefix,
@@ -33,6 +36,15 @@ func (n GroupUse) SetPosition(p *node.Position) node.Node {
return n
}
func (n GroupUse) Comments() *[]comment.Comment {
return n.comments
}
func (n GroupUse) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n GroupUse) SetUseType(UseType node.Node) node.Node {
n.UseType = UseType
return n

View File

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

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type If struct {
position *node.Position
comments *[]comment.Comment
Cond node.Node
Stmt node.Node
ElseIf []node.Node
@@ -14,6 +16,7 @@ type If struct {
func NewIf(Cond node.Node, Stmt node.Node) node.Node {
return &If{
nil,
nil,
Cond,
Stmt,
@@ -35,6 +38,15 @@ func (n If) SetPosition(p *node.Position) node.Node {
return n
}
func (n If) Comments() *[]comment.Comment {
return n.comments
}
func (n If) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n If) AddElseIf(ElseIf node.Node) node.Node {
if n.ElseIf == nil {
n.ElseIf = make([]node.Node, 0)

View File

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

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Interface struct {
position *node.Position
comments *[]comment.Comment
PhpDocComment string
InterfaceName node.Node
Extends []node.Node
@@ -14,6 +16,7 @@ type Interface struct {
func NewInterface(InterfaceName node.Node, Extends []node.Node, Stmts []node.Node, PhpDocComment string) node.Node {
return &Interface{
nil,
nil,
PhpDocComment,
InterfaceName,
@@ -37,6 +40,15 @@ func (n Interface) SetPosition(p *node.Position) node.Node {
return n
}
func (n Interface) Comments() *[]comment.Comment {
return n.comments
}
func (n Interface) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Interface) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

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

View File

@@ -1,17 +1,20 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Namespace struct {
position *node.Position
comments *[]comment.Comment
NamespaceName node.Node
Stmts []node.Node
}
func NewNamespace(NamespaceName node.Node, Stmts []node.Node) node.Node {
return &Namespace{
nil,
nil,
NamespaceName,
Stmts,
@@ -31,6 +34,15 @@ func (n Namespace) SetPosition(p *node.Position) node.Node {
return n
}
func (n Namespace) Comments() *[]comment.Comment {
return n.comments
}
func (n Namespace) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Namespace) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

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

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Property struct {
position *node.Position
comments *[]comment.Comment
PhpDocComment string
Variable node.Node
Expr node.Node
@@ -13,6 +15,7 @@ type Property struct {
func NewProperty(Variable node.Node, Expr node.Node, PhpDocComment string) node.Node {
return &Property{
nil,
nil,
PhpDocComment,
Variable,
@@ -34,6 +37,15 @@ func (n Property) SetPosition(p *node.Position) node.Node {
return n
}
func (n Property) Comments() *[]comment.Comment {
return n.comments
}
func (n Property) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Property) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,17 +1,20 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type PropertyList struct {
position *node.Position
comments *[]comment.Comment
Modifiers []node.Node
Properties []node.Node
}
func NewPropertyList(Modifiers []node.Node, Properties []node.Node) node.Node {
return &PropertyList{
nil,
nil,
Modifiers,
Properties,
@@ -31,6 +34,15 @@ func (n PropertyList) SetPosition(p *node.Position) node.Node {
return n
}
func (n PropertyList) Comments() *[]comment.Comment {
return n.comments
}
func (n PropertyList) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n PropertyList) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

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

View File

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

View File

@@ -1,17 +1,20 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type StaticVar struct {
position *node.Position
comments *[]comment.Comment
Variable node.Node
Expr node.Node
}
func NewStaticVar(Variable node.Node, Expr node.Node) node.Node {
return &StaticVar{
nil,
nil,
Variable,
Expr,
@@ -31,6 +34,15 @@ func (n StaticVar) SetPosition(p *node.Position) node.Node {
return n
}
func (n StaticVar) Comments() *[]comment.Comment {
return n.comments
}
func (n StaticVar) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n StaticVar) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

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

View File

@@ -1,12 +1,14 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
type Switch struct {
position *node.Position
comments *[]comment.Comment
token token.Token
Cond node.Node
cases []node.Node
@@ -14,6 +16,7 @@ type Switch struct {
func NewSwitch(token token.Token, Cond node.Node, cases []node.Node) node.Node {
return &Switch{
nil,
nil,
token,
Cond,
@@ -34,6 +37,15 @@ func (n Switch) SetPosition(p *node.Position) node.Node {
return n
}
func (n Switch) Comments() *[]comment.Comment {
return n.comments
}
func (n Switch) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Switch) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

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

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Trait struct {
position *node.Position
comments *[]comment.Comment
PhpDocComment string
TraitName node.Node
Stmts []node.Node
@@ -13,6 +15,7 @@ type Trait struct {
func NewTrait(TraitName node.Node, Stmts []node.Node, PhpDocComment string) node.Node {
return &Trait{
nil,
nil,
PhpDocComment,
TraitName,
@@ -35,6 +38,15 @@ func (n Trait) SetPosition(p *node.Position) node.Node {
return n
}
func (n Trait) Comments() *[]comment.Comment {
return n.comments
}
func (n Trait) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Trait) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,17 +1,20 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type TraitMethodRef struct {
position *node.Position
comments *[]comment.Comment
Trait node.Node
Method node.Node
}
func NewTraitMethodRef(Trait node.Node, Method node.Node) node.Node {
return &TraitMethodRef{
nil,
nil,
Trait,
Method,
@@ -31,6 +34,15 @@ func (n TraitMethodRef) SetPosition(p *node.Position) node.Node {
return n
}
func (n TraitMethodRef) Comments() *[]comment.Comment {
return n.comments
}
func (n TraitMethodRef) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n TraitMethodRef) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,17 +1,20 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type TraitUse struct {
position *node.Position
comments *[]comment.Comment
Traits []node.Node
Adaptations []node.Node
}
func NewTraitUse(Traits []node.Node, Adaptations []node.Node) node.Node {
return &TraitUse{
nil,
nil,
Traits,
Adaptations,
@@ -31,6 +34,15 @@ func (n TraitUse) SetPosition(p *node.Position) node.Node {
return n
}
func (n TraitUse) Comments() *[]comment.Comment {
return n.comments
}
func (n TraitUse) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n TraitUse) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type TraitUseAlias struct {
position *node.Position
comments *[]comment.Comment
Ref node.Node
Modifier node.Node
Alias node.Node
@@ -13,6 +15,7 @@ type TraitUseAlias struct {
func NewTraitUseAlias(Ref node.Node, Modifier node.Node, Alias node.Node) node.Node {
return &TraitUseAlias{
nil,
nil,
Ref,
Modifier,
@@ -33,6 +36,15 @@ func (n TraitUseAlias) SetPosition(p *node.Position) node.Node {
return n
}
func (n TraitUseAlias) Comments() *[]comment.Comment {
return n.comments
}
func (n TraitUseAlias) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n TraitUseAlias) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,17 +1,20 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type TraitUsePrecedence struct {
position *node.Position
comments *[]comment.Comment
Ref node.Node
Insteadof node.Node
}
func NewTraitUsePrecedence(Ref node.Node, Insteadof node.Node) node.Node {
return &TraitUsePrecedence{
nil,
nil,
Ref,
Insteadof,
@@ -31,6 +34,15 @@ func (n TraitUsePrecedence) SetPosition(p *node.Position) node.Node {
return n
}
func (n TraitUsePrecedence) Comments() *[]comment.Comment {
return n.comments
}
func (n TraitUsePrecedence) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n TraitUsePrecedence) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Try struct {
position *node.Position
comments *[]comment.Comment
Stmts []node.Node
Catches []node.Node
Finally node.Node
@@ -13,6 +15,7 @@ type Try struct {
func NewTry(Stmts []node.Node, Catches []node.Node, Finally node.Node) node.Node {
return &Try{
nil,
nil,
Stmts,
Catches,
@@ -33,6 +36,15 @@ func (n Try) SetPosition(p *node.Position) node.Node {
return n
}
func (n Try) Comments() *[]comment.Comment {
return n.comments
}
func (n Try) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Try) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

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

View File

@@ -1,11 +1,13 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type Use struct {
position *node.Position
comments *[]comment.Comment
UseType node.Node
Use node.Node
Alias node.Node
@@ -13,6 +15,7 @@ type Use struct {
func NewUse(UseType node.Node, use node.Node, Alias node.Node) node.Node {
return &Use{
nil,
nil,
UseType,
use,
@@ -33,6 +36,15 @@ func (n Use) SetPosition(p *node.Position) node.Node {
return n
}
func (n Use) Comments() *[]comment.Comment {
return n.comments
}
func (n Use) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n Use) SetUseType(UseType node.Node) node.Node {
n.UseType = UseType
return n

View File

@@ -1,17 +1,20 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
type UseList struct {
position *node.Position
comments *[]comment.Comment
UseType node.Node
Uses []node.Node
}
func NewUseList(UseType node.Node, Uses []node.Node) node.Node {
return &UseList{
nil,
nil,
UseType,
Uses,
@@ -31,6 +34,15 @@ func (n UseList) SetPosition(p *node.Position) node.Node {
return n
}
func (n UseList) Comments() *[]comment.Comment {
return n.comments
}
func (n UseList) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n UseList) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -1,12 +1,14 @@
package stmt
import (
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
type While struct {
position *node.Position
comments *[]comment.Comment
Token token.Token
Cond node.Node
Stmt node.Node
@@ -14,6 +16,7 @@ type While struct {
func NewWhile(Token token.Token, Cond node.Node, Stmt node.Node) node.Node {
return &While{
nil,
nil,
Token,
Cond,
@@ -34,6 +37,15 @@ func (n While) SetPosition(p *node.Position) node.Node {
return n
}
func (n While) Comments() *[]comment.Comment {
return n.comments
}
func (n While) SetComments(c []comment.Comment) node.Node {
n.comments = &c
return n
}
func (n While) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return