refactor php7
This commit is contained in:
@@ -189,4 +189,9 @@ type NodeVisitor interface {
|
||||
ScalarLnumber(n *ScalarLnumber)
|
||||
ScalarMagicConstant(n *ScalarMagicConstant)
|
||||
ScalarString(n *ScalarString)
|
||||
|
||||
NameName(n *NameName)
|
||||
NameFullyQualified(n *NameFullyQualified)
|
||||
NameRelative(n *NameRelative)
|
||||
NameNamePart(n *NameNamePart)
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ type testVisitor struct {
|
||||
depth int
|
||||
}
|
||||
|
||||
|
||||
func (v *testVisitor) Enter(key string, _ bool) {
|
||||
v.depth++
|
||||
fmt.Fprint(os.Stdout, "=>", strings.Repeat(" ", v.depth), key, ":\n")
|
||||
@@ -90,14 +89,14 @@ func (v *testVisitor) Identifier(_ *ast.Identifier) {
|
||||
fmt.Fprintln(os.Stdout, "=>", strings.Repeat(" ", v.depth-1), "*ast.Identifier")
|
||||
}
|
||||
|
||||
func (v *testVisitor) ArgumentList(_ *ast.ArgumentList) {
|
||||
func (v *testVisitor) ArgumentList(_ *ast.ArgumentList) {
|
||||
fmt.Fprintln(os.Stdout, "=>", strings.Repeat(" ", v.depth-1), "*ast.ArgumentList")
|
||||
}
|
||||
|
||||
func (v *testVisitor) Argument(_ *ast.Argument) {
|
||||
func (v *testVisitor) Argument(_ *ast.Argument) {
|
||||
fmt.Fprintln(os.Stdout, "=>", strings.Repeat(" ", v.depth-1), "*ast.Argument")
|
||||
}
|
||||
|
||||
func (v *testVisitor) ScalarDnumber(_ *ast.ScalarDnumber) {
|
||||
func (v *testVisitor) ScalarDnumber(_ *ast.ScalarDnumber) {
|
||||
fmt.Fprintln(os.Stdout, "=>", strings.Repeat(" ", v.depth-1), "*ast.ScalarDnumber")
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
type Node struct {
|
||||
StartTokens []token.Token
|
||||
EndTokens []token.Token
|
||||
Tokens token.Collection
|
||||
Position *position.Position
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ func (n *Parameter) Accept(v NodeVisitor) {
|
||||
// Identifier node
|
||||
type Identifier struct {
|
||||
Node
|
||||
Value string
|
||||
Value []byte
|
||||
}
|
||||
|
||||
func (n *Identifier) Accept(v NodeVisitor) {
|
||||
@@ -84,7 +85,7 @@ func (n *Argument) Accept(v NodeVisitor) {
|
||||
// ScalarDnumber node
|
||||
type ScalarDnumber struct {
|
||||
Node
|
||||
Value string
|
||||
Value []byte
|
||||
}
|
||||
|
||||
func (n *ScalarDnumber) Accept(v NodeVisitor) {
|
||||
@@ -104,7 +105,7 @@ func (n *ScalarEncapsed) Accept(v NodeVisitor) {
|
||||
// ScalarEncapsedStringPart node
|
||||
type ScalarEncapsedStringPart struct {
|
||||
Node
|
||||
Value string
|
||||
Value []byte
|
||||
}
|
||||
|
||||
func (n *ScalarEncapsedStringPart) Accept(v NodeVisitor) {
|
||||
@@ -114,7 +115,7 @@ func (n *ScalarEncapsedStringPart) Accept(v NodeVisitor) {
|
||||
// ScalarHeredoc node
|
||||
type ScalarHeredoc struct {
|
||||
Node
|
||||
Label string
|
||||
Label []byte
|
||||
Parts []Vertex
|
||||
}
|
||||
|
||||
@@ -125,7 +126,7 @@ func (n *ScalarHeredoc) Accept(v NodeVisitor) {
|
||||
// ScalarLnumber node
|
||||
type ScalarLnumber struct {
|
||||
Node
|
||||
Value string
|
||||
Value []byte
|
||||
}
|
||||
|
||||
func (n *ScalarLnumber) Accept(v NodeVisitor) {
|
||||
@@ -135,7 +136,7 @@ func (n *ScalarLnumber) Accept(v NodeVisitor) {
|
||||
// ScalarMagicConstant node
|
||||
type ScalarMagicConstant struct {
|
||||
Node
|
||||
Value string
|
||||
Value []byte
|
||||
}
|
||||
|
||||
func (n *ScalarMagicConstant) Accept(v NodeVisitor) {
|
||||
@@ -145,7 +146,7 @@ func (n *ScalarMagicConstant) Accept(v NodeVisitor) {
|
||||
// ScalarString node
|
||||
type ScalarString struct {
|
||||
Node
|
||||
Value string
|
||||
Value []byte
|
||||
}
|
||||
|
||||
func (n *ScalarString) Accept(v NodeVisitor) {
|
||||
@@ -550,7 +551,7 @@ func (n *StmtIf) Accept(v NodeVisitor) {
|
||||
// StmtInlineHtml node
|
||||
type StmtInlineHtml struct {
|
||||
Node
|
||||
Value string
|
||||
Value []byte
|
||||
}
|
||||
|
||||
func (n *StmtInlineHtml) Accept(v NodeVisitor) {
|
||||
@@ -1803,3 +1804,39 @@ type ExprBinarySpaceship struct {
|
||||
func (n *ExprBinarySpaceship) Accept(v NodeVisitor) {
|
||||
v.ExprBinarySpaceship(n)
|
||||
}
|
||||
|
||||
type NameName struct {
|
||||
Node
|
||||
Parts []Vertex
|
||||
}
|
||||
|
||||
func (n *NameName) Accept(v NodeVisitor) {
|
||||
v.NameName(n)
|
||||
}
|
||||
|
||||
type NameFullyQualified struct {
|
||||
Node
|
||||
Parts []Vertex
|
||||
}
|
||||
|
||||
func (n *NameFullyQualified) Accept(v NodeVisitor) {
|
||||
v.NameFullyQualified(n)
|
||||
}
|
||||
|
||||
type NameRelative struct {
|
||||
Node
|
||||
Parts []Vertex
|
||||
}
|
||||
|
||||
func (n *NameRelative) Accept(v NodeVisitor) {
|
||||
v.NameRelative(n)
|
||||
}
|
||||
|
||||
type NameNamePart struct {
|
||||
Node
|
||||
Value []byte
|
||||
}
|
||||
|
||||
func (n *NameNamePart) Accept(v NodeVisitor) {
|
||||
v.NameNamePart(n)
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ func (v *Dump) EnterNode(n ast.Vertex) bool {
|
||||
}
|
||||
|
||||
n.Accept(v)
|
||||
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,7 @@ func ExampleDump() {
|
||||
&ast.Identifier{},
|
||||
&ast.Parameter{
|
||||
Variadic: true,
|
||||
Var: &ast.ExprVariable{
|
||||
},
|
||||
Var: &ast.ExprVariable{},
|
||||
},
|
||||
&ast.StmtInlineHtml{
|
||||
Value: "foo",
|
||||
|
||||
Reference in New Issue
Block a user