This commit is contained in:
z7zmey
2017-12-28 01:23:32 +02:00
parent 32a285b437
commit 79d3bb1674
159 changed files with 1659 additions and 1015 deletions

View File

@@ -1,14 +1,11 @@
package scalar
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
func(n Dnumber) Name() string {
func (n Dnumber) Name() string {
return "Dnumber"
}
@@ -24,6 +21,10 @@ func NewDnumber(token token.Token) node.Node {
}
}
func (n Dnumber) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.name, n.token.StartLine, n.token.EndLine, n.token.Value)
func (n Dnumber) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
v.Scalar("token", n.token.Value)
}

View File

@@ -1,14 +1,11 @@
package scalar
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
func(n Encapsed) Name() string {
func (n Encapsed) Name() string {
return "Encapsed"
}
@@ -28,13 +25,15 @@ func NewEncapsed(startToken token.Token, parts []node.Node, endToken token.Token
}
}
func (n Encapsed) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d]", indent, n.name, n.startToken.StartLine, n.endToken.EndLine)
func (n Encapsed) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
if n.parts != nil {
fmt.Fprintf(out, "\n%vparts:", indent+" ")
vv := v.Children("parts")
for _, nn := range n.parts {
nn.Print(out, indent+" ")
nn.Walk(vv)
}
}
}

View File

@@ -1,14 +1,11 @@
package scalar
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
func(n EncapsedStringPart) Name() string {
func (n EncapsedStringPart) Name() string {
return "EncapsedStringPart"
}
@@ -24,6 +21,10 @@ func NewEncapsedStringPart(t token.Token) node.Node {
}
}
func (n EncapsedStringPart) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.name, n.token.StartLine, n.token.EndLine, n.token.Value)
func (n EncapsedStringPart) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
v.Scalar("token", n.token.Value)
}

View File

@@ -1,14 +1,11 @@
package scalar
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
func(n Lnumber) Name() string {
func (n Lnumber) Name() string {
return "Lnumber"
}
@@ -24,6 +21,10 @@ func NewLnumber(token token.Token) node.Node {
}
}
func (n Lnumber) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.name, n.token.StartLine, n.token.EndLine, n.token.Value)
func (n Lnumber) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
v.Scalar("token", n.token.Value)
}

View File

@@ -1,14 +1,11 @@
package scalar
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
func(n MagicConstant) Name() string {
func (n MagicConstant) Name() string {
return "MagicConstant"
}
@@ -24,6 +21,10 @@ func NewMagicConstant(token token.Token) node.Node {
}
}
func (n MagicConstant) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.name, n.token.StartLine, n.token.EndLine, n.token.Value)
func (n MagicConstant) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
v.Scalar("token", n.token.Value)
}

View File

@@ -1,14 +1,11 @@
package scalar
import (
"fmt"
"io"
"github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/token"
)
func(n String) Name() string {
func (n String) Name() string {
return "String"
}
@@ -24,6 +21,10 @@ func NewString(token token.Token) node.Node {
}
}
func (n String) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.name, n.token.StartLine, n.token.EndLine, n.token.Value)
func (n String) Walk(v node.Visitor) {
if v.Visit(n) == false {
return
}
v.Scalar("token", n.token.Value)
}