remove SimpleNode
This commit is contained in:
@@ -2,28 +2,28 @@ package scalar
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
func(n Dnumber) Name() string {
|
||||
return "Dnumber"
|
||||
}
|
||||
|
||||
type Dnumber struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
token token.Token
|
||||
}
|
||||
|
||||
|
||||
func NewDnumber(token token.Token) node.Node {
|
||||
return Dnumber{
|
||||
node.SimpleNode{Name: "Dnumber", Attributes: make(map[string]string)},
|
||||
"Dnumber",
|
||||
token,
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
for _, nn := range n.Children {
|
||||
nn.Print(out, indent+" ")
|
||||
}
|
||||
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.name, n.token.StartLine, n.token.EndLine, n.token.Value)
|
||||
}
|
||||
|
||||
@@ -2,23 +2,26 @@ package scalar
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
|
||||
type Encapsed struct {
|
||||
node.SimpleNode
|
||||
startToken token.Token
|
||||
endToken token.Token
|
||||
parts []node.Node
|
||||
func(n Encapsed) Name() string {
|
||||
return "Encapsed"
|
||||
}
|
||||
|
||||
type Encapsed struct {
|
||||
name string
|
||||
startToken token.Token
|
||||
endToken token.Token
|
||||
parts []node.Node
|
||||
}
|
||||
|
||||
func NewEncapsed(startToken token.Token, parts []node.Node, endToken token.Token) node.Node {
|
||||
return Encapsed{
|
||||
node.SimpleNode{Name: "Encapsed", Attributes: make(map[string]string)},
|
||||
"Encapsed",
|
||||
startToken,
|
||||
endToken,
|
||||
parts,
|
||||
@@ -26,9 +29,12 @@ 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)
|
||||
fmt.Fprintf(out, "\n%vparts:", indent+" ",)
|
||||
for _, nn := range n.parts {
|
||||
nn.Print(out, indent+" ")
|
||||
fmt.Fprintf(out, "\n%v%v [%d %d]", indent, n.name, n.startToken.StartLine, n.endToken.EndLine)
|
||||
|
||||
if n.parts != nil {
|
||||
fmt.Fprintf(out, "\n%vparts:", indent+" ")
|
||||
for _, nn := range n.parts {
|
||||
nn.Print(out, indent+" ")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,27 +2,28 @@ package scalar
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
func(n EncapsedStringPart) Name() string {
|
||||
return "EncapsedStringPart"
|
||||
}
|
||||
|
||||
type EncapsedStringPart struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
token token.Token
|
||||
}
|
||||
|
||||
|
||||
func NewEncapsedStringPart(t token.Token) node.Node {
|
||||
return EncapsedStringPart{
|
||||
node.SimpleNode{Name: "EncapsedStringPart", Attributes: make(map[string]string)},
|
||||
"EncapsedStringPart",
|
||||
t,
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
for _, nn := range n.Children {
|
||||
nn.Print(out, indent+" ")
|
||||
}
|
||||
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.name, n.token.StartLine, n.token.EndLine, n.token.Value)
|
||||
}
|
||||
|
||||
@@ -2,28 +2,28 @@ package scalar
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
func(n Lnumber) Name() string {
|
||||
return "Lnumber"
|
||||
}
|
||||
|
||||
type Lnumber struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
token token.Token
|
||||
}
|
||||
|
||||
|
||||
func NewLnumber(token token.Token) node.Node {
|
||||
return Lnumber{
|
||||
node.SimpleNode{Name: "Lnumber", Attributes: make(map[string]string)},
|
||||
"Lnumber",
|
||||
token,
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
for _, nn := range n.Children {
|
||||
nn.Print(out, indent+" ")
|
||||
}
|
||||
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.name, n.token.StartLine, n.token.EndLine, n.token.Value)
|
||||
}
|
||||
|
||||
@@ -2,28 +2,28 @@ package scalar
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
func(n MagicConstant) Name() string {
|
||||
return "MagicConstant"
|
||||
}
|
||||
|
||||
type MagicConstant struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
token token.Token
|
||||
}
|
||||
|
||||
|
||||
func NewMagicConstant(token token.Token) node.Node {
|
||||
return String{
|
||||
node.SimpleNode{Name: "MagicConstant", Attributes: make(map[string]string)},
|
||||
return MagicConstant{
|
||||
"MagicConstant",
|
||||
token,
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
for _, nn := range n.Children {
|
||||
nn.Print(out, indent+" ")
|
||||
}
|
||||
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.name, n.token.StartLine, n.token.EndLine, n.token.Value)
|
||||
}
|
||||
|
||||
@@ -2,28 +2,28 @@ package scalar
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
func(n String) Name() string {
|
||||
return "String"
|
||||
}
|
||||
|
||||
type String struct {
|
||||
node.SimpleNode
|
||||
name string
|
||||
token token.Token
|
||||
}
|
||||
|
||||
|
||||
func NewString(token token.Token) node.Node {
|
||||
return String{
|
||||
node.SimpleNode{Name: "String", Attributes: make(map[string]string)},
|
||||
"String",
|
||||
token,
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
for _, nn := range n.Children {
|
||||
nn.Print(out, indent+" ")
|
||||
}
|
||||
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.name, n.token.StartLine, n.token.EndLine, n.token.Value)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user