add comments

This commit is contained in:
z7zmey
2018-01-11 19:33:25 +02:00
parent 0676e0cb5a
commit e814483f37
158 changed files with 771 additions and 2 deletions

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// AltElse node
type AltElse struct {
Stmt node.Node
}
// NewAltElse node constuctor
func NewAltElse(Stmt node.Node) *AltElse {
return &AltElse{
Stmt,
}
}
// Attributes returns node attributes as map
func (n *AltElse) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *AltElse) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,11 +4,13 @@ import (
"github.com/z7zmey/php-parser/node"
)
// AltElseIf node
type AltElseIf struct {
Cond node.Node
Stmt node.Node
}
// NewAltElseIf node constuctor
func NewAltElseIf(Cond node.Node, Stmt node.Node) *AltElseIf {
return &AltElseIf{
Cond,
@@ -16,10 +18,13 @@ func NewAltElseIf(Cond node.Node, Stmt node.Node) *AltElseIf {
}
}
// Attributes returns node attributes as map
func (n *AltElseIf) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *AltElseIf) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,6 +4,7 @@ import (
"github.com/z7zmey/php-parser/node"
)
// AltIf node
type AltIf struct {
Cond node.Node
Stmt node.Node
@@ -11,6 +12,7 @@ type AltIf struct {
_else node.Node
}
// NewAltIf node constuctor
func NewAltIf(Cond node.Node, Stmt node.Node) *AltIf {
return &AltIf{
Cond,
@@ -20,6 +22,7 @@ func NewAltIf(Cond node.Node, Stmt node.Node) *AltIf {
}
}
// Attributes returns node attributes as map
func (n *AltIf) Attributes() map[string]interface{} {
return nil
}
@@ -40,6 +43,8 @@ func (n *AltIf) SetElse(_else node.Node) node.Node {
return n
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *AltIf) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Break node
type Break struct {
Expr node.Node
}
// NewBreak node constuctor
func NewBreak(Expr node.Node) *Break {
return &Break{
Expr,
}
}
// Attributes returns node attributes as map
func (n *Break) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Break) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,11 +4,13 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Case node
type Case struct {
Cond node.Node
Stmts []node.Node
}
// NewCase node constuctor
func NewCase(Cond node.Node, Stmts []node.Node) *Case {
return &Case{
Cond,
@@ -16,10 +18,13 @@ func NewCase(Cond node.Node, Stmts []node.Node) *Case {
}
}
// Attributes returns node attributes as map
func (n *Case) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Case) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,12 +4,14 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Catch node
type Catch struct {
Types []node.Node
Variable node.Node
Stmts []node.Node
}
// NewCatch node constuctor
func NewCatch(Types []node.Node, Variable node.Node, Stmts []node.Node) *Catch {
return &Catch{
Types,
@@ -18,10 +20,13 @@ func NewCatch(Types []node.Node, Variable node.Node, Stmts []node.Node) *Catch {
}
}
// Attributes returns node attributes as map
func (n *Catch) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Catch) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,6 +4,7 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Class node
type Class struct {
PhpDocComment string
ClassName node.Node
@@ -14,6 +15,7 @@ type Class struct {
Stmts []node.Node
}
// NewClass node constuctor
func NewClass(ClassName node.Node, Modifiers []node.Node, args []node.Node, Extends node.Node, Implements []node.Node, Stmts []node.Node, PhpDocComment string) *Class {
return &Class{
PhpDocComment,
@@ -26,12 +28,15 @@ func NewClass(ClassName node.Node, Modifiers []node.Node, args []node.Node, Exte
}
}
// Attributes returns node attributes as map
func (n *Class) Attributes() map[string]interface{} {
return map[string]interface{}{
"PhpDocComment": n.PhpDocComment,
}
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Class) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,11 +4,13 @@ import (
"github.com/z7zmey/php-parser/node"
)
// ClassConstList node
type ClassConstList struct {
Modifiers []node.Node
Consts []node.Node
}
// NewClassConstList node constuctor
func NewClassConstList(Modifiers []node.Node, Consts []node.Node) *ClassConstList {
return &ClassConstList{
Modifiers,
@@ -16,10 +18,13 @@ func NewClassConstList(Modifiers []node.Node, Consts []node.Node) *ClassConstLis
}
}
// Attributes returns node attributes as map
func (n *ClassConstList) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ClassConstList) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,6 +4,7 @@ import (
"github.com/z7zmey/php-parser/node"
)
// ClassMethod node
type ClassMethod struct {
ReturnsRef bool
PhpDocComment string
@@ -14,6 +15,7 @@ type ClassMethod struct {
Stmts []node.Node
}
// NewClassMethod node constuctor
func NewClassMethod(MethodName node.Node, Modifiers []node.Node, ReturnsRef bool, Params []node.Node, ReturnType node.Node, Stmts []node.Node, PhpDocComment string) *ClassMethod {
return &ClassMethod{
ReturnsRef,
@@ -26,6 +28,7 @@ func NewClassMethod(MethodName node.Node, Modifiers []node.Node, ReturnsRef bool
}
}
// Attributes returns node attributes as map
func (n *ClassMethod) Attributes() map[string]interface{} {
return map[string]interface{}{
"ReturnsRef": n.ReturnsRef,
@@ -33,6 +36,8 @@ func (n *ClassMethod) Attributes() map[string]interface{} {
}
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ClassMethod) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// ConstList node
type ConstList struct {
Consts []node.Node
}
// NewConstList node constuctor
func NewConstList(Consts []node.Node) *ConstList {
return &ConstList{
Consts,
}
}
// Attributes returns node attributes as map
func (n *ConstList) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ConstList) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,12 +4,14 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Constant node
type Constant struct {
PhpDocComment string
ConstantName node.Node
Expr node.Node
}
// NewConstant node constuctor
func NewConstant(ConstantName node.Node, Expr node.Node, PhpDocComment string) *Constant {
return &Constant{
PhpDocComment,
@@ -18,12 +20,15 @@ func NewConstant(ConstantName node.Node, Expr node.Node, PhpDocComment string) *
}
}
// Attributes returns node attributes as map
func (n *Constant) Attributes() map[string]interface{} {
return map[string]interface{}{
"PhpDocComment": n.PhpDocComment,
}
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Constant) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Continue node
type Continue struct {
Expr node.Node
}
// NewContinue node constuctor
func NewContinue(Expr node.Node) *Continue {
return &Continue{
Expr,
}
}
// Attributes returns node attributes as map
func (n *Continue) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Continue) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,11 +4,13 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Declare node
type Declare struct {
Consts []node.Node
Stmt node.Node
}
// NewDeclare node constuctor
func NewDeclare(Consts []node.Node, Stmt node.Node) *Declare {
return &Declare{
Consts,
@@ -16,10 +18,13 @@ func NewDeclare(Consts []node.Node, Stmt node.Node) *Declare {
}
}
// Attributes returns node attributes as map
func (n *Declare) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Declare) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Default node
type Default struct {
Stmts []node.Node
}
// NewDefault node constuctor
func NewDefault(Stmts []node.Node) *Default {
return &Default{
Stmts,
}
}
// Attributes returns node attributes as map
func (n *Default) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Default) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,11 +4,13 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Do node
type Do struct {
Stmt node.Node
Cond node.Node
}
// NewDo node constuctor
func NewDo(Stmt node.Node, Cond node.Node) *Do {
return &Do{
Stmt,
@@ -16,10 +18,13 @@ func NewDo(Stmt node.Node, Cond node.Node) *Do {
}
}
// Attributes returns node attributes as map
func (n *Do) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Do) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Echo node
type Echo struct {
Exprs []node.Node
}
// NewEcho node constuctor
func NewEcho(Exprs []node.Node) *Echo {
return &Echo{
Exprs,
}
}
// Attributes returns node attributes as map
func (n *Echo) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Echo) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Else node
type Else struct {
Stmt node.Node
}
// NewElse node constuctor
func NewElse(Stmt node.Node) *Else {
return &Else{
Stmt,
}
}
// Attributes returns node attributes as map
func (n *Else) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Else) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,11 +4,13 @@ import (
"github.com/z7zmey/php-parser/node"
)
// ElseIf node
type ElseIf struct {
Cond node.Node
Stmt node.Node
}
// NewElseIf node constuctor
func NewElseIf(Cond node.Node, Stmt node.Node) *ElseIf {
return &ElseIf{
Cond,
@@ -16,10 +18,13 @@ func NewElseIf(Cond node.Node, Stmt node.Node) *ElseIf {
}
}
// Attributes returns node attributes as map
func (n *ElseIf) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *ElseIf) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Expression node
type Expression struct {
Expr node.Node
}
// NewExpression node constuctor
func NewExpression(Expr node.Node) *Expression {
return &Expression{
Expr,
}
}
// Attributes returns node attributes as map
func (n *Expression) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Expression) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Finally node
type Finally struct {
Stmts []node.Node
}
// NewFinally node constuctor
func NewFinally(Stmts []node.Node) *Finally {
return &Finally{
Stmts,
}
}
// Attributes returns node attributes as map
func (n *Finally) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Finally) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,6 +4,7 @@ import (
"github.com/z7zmey/php-parser/node"
)
// For node
type For struct {
Init []node.Node
Cond []node.Node
@@ -11,6 +12,7 @@ type For struct {
Stmt node.Node
}
// NewFor node constuctor
func NewFor(Init []node.Node, Cond []node.Node, Loop []node.Node, Stmt node.Node) *For {
return &For{
Init,
@@ -20,10 +22,13 @@ func NewFor(Init []node.Node, Cond []node.Node, Loop []node.Node, Stmt node.Node
}
}
// Attributes returns node attributes as map
func (n *For) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *For) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,6 +4,7 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Foreach node
type Foreach struct {
ByRef bool
Expr node.Node
@@ -12,6 +13,7 @@ type Foreach struct {
Stmt node.Node
}
// NewForeach node constuctor
func NewForeach(Expr node.Node, Key node.Node, Variable node.Node, Stmt node.Node, ByRef bool) *Foreach {
return &Foreach{
ByRef,
@@ -22,12 +24,15 @@ func NewForeach(Expr node.Node, Key node.Node, Variable node.Node, Stmt node.Nod
}
}
// Attributes returns node attributes as map
func (n *Foreach) Attributes() map[string]interface{} {
return map[string]interface{}{
"ByRef": n.ByRef,
}
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Foreach) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,6 +4,7 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Function node
type Function struct {
ReturnsRef bool
PhpDocComment string
@@ -13,6 +14,7 @@ type Function struct {
Stmts []node.Node
}
// NewFunction node constuctor
func NewFunction(FunctionName node.Node, ReturnsRef bool, Params []node.Node, ReturnType node.Node, Stmts []node.Node, PhpDocComment string) *Function {
return &Function{
ReturnsRef,
@@ -24,6 +26,7 @@ func NewFunction(FunctionName node.Node, ReturnsRef bool, Params []node.Node, Re
}
}
// Attributes returns node attributes as map
func (n *Function) Attributes() map[string]interface{} {
// return n.attributes
return map[string]interface{}{
@@ -32,6 +35,8 @@ func (n *Function) Attributes() map[string]interface{} {
}
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Function) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Global node
type Global struct {
Vars []node.Node
}
// NewGlobal node constuctor
func NewGlobal(Vars []node.Node) *Global {
return &Global{
Vars,
}
}
// Attributes returns node attributes as map
func (n *Global) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Global) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Goto node
type Goto struct {
Label node.Node
}
// NewGoto node constuctor
func NewGoto(Label node.Node) *Goto {
return &Goto{
Label,
}
}
// Attributes returns node attributes as map
func (n *Goto) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Goto) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,12 +4,14 @@ import (
"github.com/z7zmey/php-parser/node"
)
// GroupUse node
type GroupUse struct {
UseType node.Node
pRefix node.Node
UseList []node.Node
}
// NewGroupUse node constuctor
func NewGroupUse(UseType node.Node, pRefix node.Node, UseList []node.Node) *GroupUse {
return &GroupUse{
UseType,
@@ -18,6 +20,7 @@ func NewGroupUse(UseType node.Node, pRefix node.Node, UseList []node.Node) *Grou
}
}
// Attributes returns node attributes as map
func (n *GroupUse) Attributes() map[string]interface{} {
return nil
}
@@ -27,6 +30,8 @@ func (n *GroupUse) SetUseType(UseType node.Node) node.Node {
return n
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *GroupUse) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,17 +4,22 @@ import (
"github.com/z7zmey/php-parser/node"
)
// HaltCompiler node
type HaltCompiler struct {
}
// NewHaltCompiler node constuctor
func NewHaltCompiler() *HaltCompiler {
return &HaltCompiler{}
}
// Attributes returns node attributes as map
func (n *HaltCompiler) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *HaltCompiler) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,6 +4,7 @@ import (
"github.com/z7zmey/php-parser/node"
)
// If node
type If struct {
Cond node.Node
Stmt node.Node
@@ -11,6 +12,7 @@ type If struct {
_else node.Node
}
// NewIf node constuctor
func NewIf(Cond node.Node, Stmt node.Node) *If {
return &If{
Cond,
@@ -20,6 +22,7 @@ func NewIf(Cond node.Node, Stmt node.Node) *If {
}
}
// Attributes returns node attributes as map
func (n *If) Attributes() map[string]interface{} {
return nil
}
@@ -40,6 +43,8 @@ func (n *If) SetElse(_else node.Node) node.Node {
return n
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *If) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,22 +4,27 @@ import (
"github.com/z7zmey/php-parser/node"
)
// InlineHtml node
type InlineHtml struct {
Value string
}
// NewInlineHtml node constuctor
func NewInlineHtml(Value string) *InlineHtml {
return &InlineHtml{
Value,
}
}
// Attributes returns node attributes as map
func (n *InlineHtml) Attributes() map[string]interface{} {
return map[string]interface{}{
"Value": n.Value,
}
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *InlineHtml) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,6 +4,7 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Interface node
type Interface struct {
PhpDocComment string
InterfaceName node.Node
@@ -11,6 +12,7 @@ type Interface struct {
Stmts []node.Node
}
// NewInterface node constuctor
func NewInterface(InterfaceName node.Node, Extends []node.Node, Stmts []node.Node, PhpDocComment string) *Interface {
return &Interface{
PhpDocComment,
@@ -20,12 +22,15 @@ func NewInterface(InterfaceName node.Node, Extends []node.Node, Stmts []node.Nod
}
}
// Attributes returns node attributes as map
func (n *Interface) Attributes() map[string]interface{} {
return map[string]interface{}{
"PhpDocComment": n.PhpDocComment,
}
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Interface) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Label node
type Label struct {
LabelName node.Node
}
// NewLabel node constuctor
func NewLabel(LabelName node.Node) *Label {
return &Label{
LabelName,
}
}
// Attributes returns node attributes as map
func (n *Label) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Label) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,11 +4,13 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Namespace node
type Namespace struct {
NamespaceName node.Node
Stmts []node.Node
}
// NewNamespace node constuctor
func NewNamespace(NamespaceName node.Node, Stmts []node.Node) *Namespace {
return &Namespace{
NamespaceName,
@@ -16,10 +18,13 @@ func NewNamespace(NamespaceName node.Node, Stmts []node.Node) *Namespace {
}
}
// Attributes returns node attributes as map
func (n *Namespace) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Namespace) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,17 +4,22 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Nop node
type Nop struct {
}
// NewNop node constuctor
func NewNop() *Nop {
return &Nop{}
}
// Attributes returns node attributes as map
func (n *Nop) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Nop) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,12 +4,14 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Property node
type Property struct {
PhpDocComment string
Variable node.Node
Expr node.Node
}
// NewProperty node constuctor
func NewProperty(Variable node.Node, Expr node.Node, PhpDocComment string) *Property {
return &Property{
PhpDocComment,
@@ -17,12 +19,16 @@ func NewProperty(Variable node.Node, Expr node.Node, PhpDocComment string) *Prop
Expr,
}
}
// Attributes returns node attributes as map
func (n *Property) Attributes() map[string]interface{} {
return map[string]interface{}{
"PhpDocComment": n.PhpDocComment,
}
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Property) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,11 +4,13 @@ import (
"github.com/z7zmey/php-parser/node"
)
// PropertyList node
type PropertyList struct {
Modifiers []node.Node
Properties []node.Node
}
// NewPropertyList node constuctor
func NewPropertyList(Modifiers []node.Node, Properties []node.Node) *PropertyList {
return &PropertyList{
Modifiers,
@@ -16,10 +18,13 @@ func NewPropertyList(Modifiers []node.Node, Properties []node.Node) *PropertyLis
}
}
// Attributes returns node attributes as map
func (n *PropertyList) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *PropertyList) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Return node
type Return struct {
Expr node.Node
}
// NewReturn node constuctor
func NewReturn(Expr node.Node) *Return {
return &Return{
Expr,
}
}
// Attributes returns node attributes as map
func (n *Return) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Return) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Static node
type Static struct {
Vars []node.Node
}
// NewStatic node constuctor
func NewStatic(Vars []node.Node) *Static {
return &Static{
Vars,
}
}
// Attributes returns node attributes as map
func (n *Static) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Static) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,11 +4,13 @@ import (
"github.com/z7zmey/php-parser/node"
)
// StaticVar node
type StaticVar struct {
Variable node.Node
Expr node.Node
}
// NewStaticVar node constuctor
func NewStaticVar(Variable node.Node, Expr node.Node) *StaticVar {
return &StaticVar{
Variable,
@@ -16,10 +18,13 @@ func NewStaticVar(Variable node.Node, Expr node.Node) *StaticVar {
}
}
// Attributes returns node attributes as map
func (n *StaticVar) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *StaticVar) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// StmtList node
type StmtList struct {
Stmts []node.Node
}
// NewStmtList node constuctor
func NewStmtList(Stmts []node.Node) *StmtList {
return &StmtList{
Stmts,
}
}
// Attributes returns node attributes as map
func (n *StmtList) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *StmtList) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -5,12 +5,14 @@ import (
"github.com/z7zmey/php-parser/token"
)
// Switch node
type Switch struct {
token token.Token
Cond node.Node
cases []node.Node
}
// NewSwitch node constuctor
func NewSwitch(token token.Token, Cond node.Node, cases []node.Node) *Switch {
return &Switch{
token,
@@ -19,10 +21,13 @@ func NewSwitch(token token.Token, Cond node.Node, cases []node.Node) *Switch {
}
}
// Attributes returns node attributes as map
func (n *Switch) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Switch) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Throw node
type Throw struct {
Expr node.Node
}
// NewThrow node constuctor
func NewThrow(Expr node.Node) *Throw {
return &Throw{
Expr,
}
}
// Attributes returns node attributes as map
func (n *Throw) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Throw) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,12 +4,14 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Trait node
type Trait struct {
PhpDocComment string
TraitName node.Node
Stmts []node.Node
}
// NewTrait node constuctor
func NewTrait(TraitName node.Node, Stmts []node.Node, PhpDocComment string) *Trait {
return &Trait{
PhpDocComment,
@@ -18,12 +20,15 @@ func NewTrait(TraitName node.Node, Stmts []node.Node, PhpDocComment string) *Tra
}
}
// Attributes returns node attributes as map
func (n *Trait) Attributes() map[string]interface{} {
return map[string]interface{}{
"PhpDocComment": n.PhpDocComment,
}
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Trait) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,11 +4,13 @@ import (
"github.com/z7zmey/php-parser/node"
)
// TraitMethodRef node
type TraitMethodRef struct {
Trait node.Node
Method node.Node
}
// NewTraitMethodRef node constuctor
func NewTraitMethodRef(Trait node.Node, Method node.Node) *TraitMethodRef {
return &TraitMethodRef{
Trait,
@@ -16,10 +18,13 @@ func NewTraitMethodRef(Trait node.Node, Method node.Node) *TraitMethodRef {
}
}
// Attributes returns node attributes as map
func (n *TraitMethodRef) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *TraitMethodRef) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,11 +4,13 @@ import (
"github.com/z7zmey/php-parser/node"
)
// TraitUse node
type TraitUse struct {
Traits []node.Node
Adaptations []node.Node
}
// NewTraitUse node constuctor
func NewTraitUse(Traits []node.Node, Adaptations []node.Node) *TraitUse {
return &TraitUse{
Traits,
@@ -16,10 +18,13 @@ func NewTraitUse(Traits []node.Node, Adaptations []node.Node) *TraitUse {
}
}
// Attributes returns node attributes as map
func (n *TraitUse) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *TraitUse) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,12 +4,14 @@ import (
"github.com/z7zmey/php-parser/node"
)
// TraitUseAlias node
type TraitUseAlias struct {
Ref node.Node
Modifier node.Node
Alias node.Node
}
// NewTraitUseAlias node constuctor
func NewTraitUseAlias(Ref node.Node, Modifier node.Node, Alias node.Node) *TraitUseAlias {
return &TraitUseAlias{
Ref,
@@ -18,10 +20,13 @@ func NewTraitUseAlias(Ref node.Node, Modifier node.Node, Alias node.Node) *Trait
}
}
// Attributes returns node attributes as map
func (n *TraitUseAlias) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *TraitUseAlias) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,11 +4,13 @@ import (
"github.com/z7zmey/php-parser/node"
)
// TraitUsePrecedence node
type TraitUsePrecedence struct {
Ref node.Node
Insteadof node.Node
}
// NewTraitUsePrecedence node constuctor
func NewTraitUsePrecedence(Ref node.Node, Insteadof node.Node) *TraitUsePrecedence {
return &TraitUsePrecedence{
Ref,
@@ -16,10 +18,13 @@ func NewTraitUsePrecedence(Ref node.Node, Insteadof node.Node) *TraitUsePreceden
}
}
// Attributes returns node attributes as map
func (n *TraitUsePrecedence) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *TraitUsePrecedence) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,12 +4,14 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Try node
type Try struct {
Stmts []node.Node
Catches []node.Node
Finally node.Node
}
// NewTry node constuctor
func NewTry(Stmts []node.Node, Catches []node.Node, Finally node.Node) *Try {
return &Try{
Stmts,
@@ -18,10 +20,13 @@ func NewTry(Stmts []node.Node, Catches []node.Node, Finally node.Node) *Try {
}
}
// Attributes returns node attributes as map
func (n *Try) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Try) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,20 +4,25 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Unset node
type Unset struct {
Vars []node.Node
}
// NewUnset node constuctor
func NewUnset(Vars []node.Node) *Unset {
return &Unset{
Vars,
}
}
// Attributes returns node attributes as map
func (n *Unset) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Unset) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,12 +4,14 @@ import (
"github.com/z7zmey/php-parser/node"
)
// Use node
type Use struct {
UseType node.Node
Use node.Node
Alias node.Node
}
// NewUse node constuctor
func NewUse(UseType node.Node, use node.Node, Alias node.Node) *Use {
return &Use{
UseType,
@@ -18,6 +20,7 @@ func NewUse(UseType node.Node, use node.Node, Alias node.Node) *Use {
}
}
// Attributes returns node attributes as map
func (n *Use) Attributes() map[string]interface{} {
return nil
}
@@ -27,6 +30,8 @@ func (n *Use) SetUseType(UseType node.Node) node.Node {
return n
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *Use) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -4,11 +4,13 @@ import (
"github.com/z7zmey/php-parser/node"
)
// UseList node
type UseList struct {
UseType node.Node
Uses []node.Node
}
// NewUseList node constuctor
func NewUseList(UseType node.Node, Uses []node.Node) *UseList {
return &UseList{
UseType,
@@ -16,10 +18,13 @@ func NewUseList(UseType node.Node, Uses []node.Node) *UseList {
}
}
// Attributes returns node attributes as map
func (n *UseList) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *UseList) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return

View File

@@ -5,12 +5,14 @@ import (
"github.com/z7zmey/php-parser/token"
)
// While node
type While struct {
Token token.Token
Cond node.Node
Stmt node.Node
}
// NewWhile node constuctor
func NewWhile(Token token.Token, Cond node.Node, Stmt node.Node) *While {
return &While{
Token,
@@ -19,10 +21,13 @@ func NewWhile(Token token.Token, Cond node.Node, Stmt node.Node) *While {
}
}
// Attributes returns node attributes as map
func (n *While) Attributes() map[string]interface{} {
return nil
}
// Walk traverses nodes
// Walk is invoked recursively until v.EnterNode returns true
func (n *While) Walk(v node.Visitor) {
if v.EnterNode(n) == false {
return