string nodes
This commit is contained in:
33
node/node_expr_shellexec.go
Normal file
33
node/node_expr_shellexec.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
"io"
|
||||
)
|
||||
|
||||
|
||||
type NodeExprShellExec struct {
|
||||
*simpleNode
|
||||
startToken token.Token
|
||||
endToken token.Token
|
||||
parts []Node
|
||||
}
|
||||
|
||||
|
||||
func NewNodeExprShellExec(startToken token.Token, parts []Node, endToken token.Token) Node {
|
||||
return NodeExprShellExec{
|
||||
&simpleNode{name: "NodeExprShellExec", attributes: make(map[string]string)},
|
||||
startToken,
|
||||
endToken,
|
||||
parts,
|
||||
}
|
||||
}
|
||||
|
||||
func (n NodeExprShellExec) 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+" ")
|
||||
}
|
||||
}
|
||||
33
node/node_scalar_encapsed.go
Normal file
33
node/node_scalar_encapsed.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
"io"
|
||||
)
|
||||
|
||||
|
||||
type NodeScalarEncapsed struct {
|
||||
*simpleNode
|
||||
startToken token.Token
|
||||
endToken token.Token
|
||||
parts []Node
|
||||
}
|
||||
|
||||
|
||||
func NewNodeScalarEncapsed(startToken token.Token, parts []Node, endToken token.Token) Node {
|
||||
return NodeScalarEncapsed{
|
||||
&simpleNode{name: "NodeScalarEncapsed", attributes: make(map[string]string)},
|
||||
startToken,
|
||||
endToken,
|
||||
parts,
|
||||
}
|
||||
}
|
||||
|
||||
func (n NodeScalarEncapsed) 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+" ")
|
||||
}
|
||||
}
|
||||
27
node/node_scalar_encapsed_string_part.go
Normal file
27
node/node_scalar_encapsed_string_part.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
"io"
|
||||
)
|
||||
|
||||
type NodeScalarEncapsedStringPart struct {
|
||||
*simpleNode
|
||||
token token.Token
|
||||
}
|
||||
|
||||
|
||||
func NewNodeScalarEncapsedStringPart(t token.Token) Node {
|
||||
return NodeScalarEncapsedStringPart{
|
||||
&simpleNode{name: "NodeScalarEncapsedStringPart", attributes: make(map[string]string)},
|
||||
t,
|
||||
}
|
||||
}
|
||||
|
||||
func (n NodeScalarEncapsedStringPart) 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+" ")
|
||||
}
|
||||
}
|
||||
28
node/node_scalar_string.go
Normal file
28
node/node_scalar_string.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
"io"
|
||||
)
|
||||
|
||||
|
||||
type NodeScalarString struct {
|
||||
*simpleNode
|
||||
token token.Token
|
||||
}
|
||||
|
||||
|
||||
func NewNodeScalarString(t token.Token) Node {
|
||||
return NodeScalarString{
|
||||
&simpleNode{name: "NodeScalarString", attributes: make(map[string]string)},
|
||||
t,
|
||||
}
|
||||
}
|
||||
|
||||
func (n NodeScalarString) 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+" ")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user