remove Cast prefix from node names
This commit is contained in:
parent
37ebee14a6
commit
d19b16e161
@ -5,26 +5,26 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CastArray node
|
// Array node
|
||||||
type CastArray struct {
|
type Array struct {
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCastArray node constuctor
|
// NewArray node constructor
|
||||||
func NewCastArray(Expr node.Node) *CastArray {
|
func NewArray(Expr node.Node) *Array {
|
||||||
return &CastArray{
|
return &Array{
|
||||||
Expr,
|
Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
func (n *CastArray) Attributes() map[string]interface{} {
|
func (n *Array) Attributes() map[string]interface{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Walk traverses nodes
|
// Walk traverses nodes
|
||||||
// Walk is invoked recursively until v.EnterNode returns true
|
// Walk is invoked recursively until v.EnterNode returns true
|
||||||
func (n *CastArray) Walk(v walker.Visitor) {
|
func (n *Array) Walk(v walker.Visitor) {
|
||||||
if v.EnterNode(n) == false {
|
if v.EnterNode(n) == false {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -5,26 +5,26 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CastBool node
|
// Bool node
|
||||||
type CastBool struct {
|
type Bool struct {
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCastBool node constuctor
|
// NewBool node constructor
|
||||||
func NewCastBool(Expr node.Node) *CastBool {
|
func NewBool(Expr node.Node) *Bool {
|
||||||
return &CastBool{
|
return &Bool{
|
||||||
Expr,
|
Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
func (n *CastBool) Attributes() map[string]interface{} {
|
func (n *Bool) Attributes() map[string]interface{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Walk traverses nodes
|
// Walk traverses nodes
|
||||||
// Walk is invoked recursively until v.EnterNode returns true
|
// Walk is invoked recursively until v.EnterNode returns true
|
||||||
func (n *CastBool) Walk(v walker.Visitor) {
|
func (n *Bool) Walk(v walker.Visitor) {
|
||||||
if v.EnterNode(n) == false {
|
if v.EnterNode(n) == false {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -5,26 +5,26 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CastDouble node
|
// Double node
|
||||||
type CastDouble struct {
|
type Double struct {
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCastDouble node constuctor
|
// NewDouble node constructor
|
||||||
func NewCastDouble(Expr node.Node) *CastDouble {
|
func NewDouble(Expr node.Node) *Double {
|
||||||
return &CastDouble{
|
return &Double{
|
||||||
Expr,
|
Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
func (n *CastDouble) Attributes() map[string]interface{} {
|
func (n *Double) Attributes() map[string]interface{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Walk traverses nodes
|
// Walk traverses nodes
|
||||||
// Walk is invoked recursively until v.EnterNode returns true
|
// Walk is invoked recursively until v.EnterNode returns true
|
||||||
func (n *CastDouble) Walk(v walker.Visitor) {
|
func (n *Double) Walk(v walker.Visitor) {
|
||||||
if v.EnterNode(n) == false {
|
if v.EnterNode(n) == false {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -5,26 +5,26 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CastInt node
|
// Int node
|
||||||
type CastInt struct {
|
type Int struct {
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCastInt node constuctor
|
// NewInt node constructor
|
||||||
func NewCastInt(Expr node.Node) *CastInt {
|
func NewInt(Expr node.Node) *Int {
|
||||||
return &CastInt{
|
return &Int{
|
||||||
Expr,
|
Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
func (n *CastInt) Attributes() map[string]interface{} {
|
func (n *Int) Attributes() map[string]interface{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Walk traverses nodes
|
// Walk traverses nodes
|
||||||
// Walk is invoked recursively until v.EnterNode returns true
|
// Walk is invoked recursively until v.EnterNode returns true
|
||||||
func (n *CastInt) Walk(v walker.Visitor) {
|
func (n *Int) Walk(v walker.Visitor) {
|
||||||
if v.EnterNode(n) == false {
|
if v.EnterNode(n) == false {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -5,26 +5,26 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CastObject node
|
// Object node
|
||||||
type CastObject struct {
|
type Object struct {
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCastObject node constuctor
|
// NewObject node constructor
|
||||||
func NewCastObject(Expr node.Node) *CastObject {
|
func NewObject(Expr node.Node) *Object {
|
||||||
return &CastObject{
|
return &Object{
|
||||||
Expr,
|
Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
func (n *CastObject) Attributes() map[string]interface{} {
|
func (n *Object) Attributes() map[string]interface{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Walk traverses nodes
|
// Walk traverses nodes
|
||||||
// Walk is invoked recursively until v.EnterNode returns true
|
// Walk is invoked recursively until v.EnterNode returns true
|
||||||
func (n *CastObject) Walk(v walker.Visitor) {
|
func (n *Object) Walk(v walker.Visitor) {
|
||||||
if v.EnterNode(n) == false {
|
if v.EnterNode(n) == false {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -5,26 +5,26 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CastString node
|
// String node
|
||||||
type CastString struct {
|
type String struct {
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCastString node constuctor
|
// NewString node constructor
|
||||||
func NewCastString(Expr node.Node) *CastString {
|
func NewString(Expr node.Node) *String {
|
||||||
return &CastString{
|
return &String{
|
||||||
Expr,
|
Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
func (n *CastString) Attributes() map[string]interface{} {
|
func (n *String) Attributes() map[string]interface{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Walk traverses nodes
|
// Walk traverses nodes
|
||||||
// Walk is invoked recursively until v.EnterNode returns true
|
// Walk is invoked recursively until v.EnterNode returns true
|
||||||
func (n *CastString) Walk(v walker.Visitor) {
|
func (n *String) Walk(v walker.Visitor) {
|
||||||
if v.EnterNode(n) == false {
|
if v.EnterNode(n) == false {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -5,26 +5,26 @@ import (
|
|||||||
"github.com/z7zmey/php-parser/walker"
|
"github.com/z7zmey/php-parser/walker"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CastUnset node
|
// Unset node
|
||||||
type CastUnset struct {
|
type Unset struct {
|
||||||
Expr node.Node
|
Expr node.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCastUnset node constuctor
|
// NewUnset node constructor
|
||||||
func NewCastUnset(Expr node.Node) *CastUnset {
|
func NewUnset(Expr node.Node) *Unset {
|
||||||
return &CastUnset{
|
return &Unset{
|
||||||
Expr,
|
Expr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes returns node attributes as map
|
// Attributes returns node attributes as map
|
||||||
func (n *CastUnset) Attributes() map[string]interface{} {
|
func (n *Unset) Attributes() map[string]interface{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Walk traverses nodes
|
// Walk traverses nodes
|
||||||
// Walk is invoked recursively until v.EnterNode returns true
|
// Walk is invoked recursively until v.EnterNode returns true
|
||||||
func (n *CastUnset) Walk(v walker.Visitor) {
|
func (n *Unset) Walk(v walker.Visitor) {
|
||||||
if v.EnterNode(n) == false {
|
if v.EnterNode(n) == false {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -27,13 +27,13 @@ func assertEqual(t *testing.T, expected interface{}, actual interface{}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCastArray(t *testing.T) {
|
func TestArray(t *testing.T) {
|
||||||
src := `<? (array)$a;`
|
src := `<? (array)$a;`
|
||||||
|
|
||||||
expected := &stmt.StmtList{
|
expected := &stmt.StmtList{
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastArray{
|
Expr: &cast.Array{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -47,13 +47,13 @@ func TestCastArray(t *testing.T) {
|
|||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCastBool(t *testing.T) {
|
func TestBool(t *testing.T) {
|
||||||
src := `<? (boolean)$a;`
|
src := `<? (boolean)$a;`
|
||||||
|
|
||||||
expected := &stmt.StmtList{
|
expected := &stmt.StmtList{
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastBool{
|
Expr: &cast.Bool{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -67,13 +67,13 @@ func TestCastBool(t *testing.T) {
|
|||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCastBoolShort(t *testing.T) {
|
func TestBoolShort(t *testing.T) {
|
||||||
src := `<? (bool)$a;`
|
src := `<? (bool)$a;`
|
||||||
|
|
||||||
expected := &stmt.StmtList{
|
expected := &stmt.StmtList{
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastBool{
|
Expr: &cast.Bool{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -87,13 +87,13 @@ func TestCastBoolShort(t *testing.T) {
|
|||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCastDouble(t *testing.T) {
|
func TestDouble(t *testing.T) {
|
||||||
src := `<? (double)$a;`
|
src := `<? (double)$a;`
|
||||||
|
|
||||||
expected := &stmt.StmtList{
|
expected := &stmt.StmtList{
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastDouble{
|
Expr: &cast.Double{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -113,7 +113,7 @@ func TestCastFloat(t *testing.T) {
|
|||||||
expected := &stmt.StmtList{
|
expected := &stmt.StmtList{
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastDouble{
|
Expr: &cast.Double{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -127,13 +127,13 @@ func TestCastFloat(t *testing.T) {
|
|||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCastInt(t *testing.T) {
|
func TestInt(t *testing.T) {
|
||||||
src := `<? (integer)$a;`
|
src := `<? (integer)$a;`
|
||||||
|
|
||||||
expected := &stmt.StmtList{
|
expected := &stmt.StmtList{
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastInt{
|
Expr: &cast.Int{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -147,13 +147,13 @@ func TestCastInt(t *testing.T) {
|
|||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCastIntShort(t *testing.T) {
|
func TestIntShort(t *testing.T) {
|
||||||
src := `<? (int)$a;`
|
src := `<? (int)$a;`
|
||||||
|
|
||||||
expected := &stmt.StmtList{
|
expected := &stmt.StmtList{
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastInt{
|
Expr: &cast.Int{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -167,13 +167,13 @@ func TestCastIntShort(t *testing.T) {
|
|||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCastObject(t *testing.T) {
|
func TestObject(t *testing.T) {
|
||||||
src := `<? (object)$a;`
|
src := `<? (object)$a;`
|
||||||
|
|
||||||
expected := &stmt.StmtList{
|
expected := &stmt.StmtList{
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastObject{
|
Expr: &cast.Object{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -187,13 +187,13 @@ func TestCastObject(t *testing.T) {
|
|||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCastString(t *testing.T) {
|
func TestString(t *testing.T) {
|
||||||
src := `<? (string)$a;`
|
src := `<? (string)$a;`
|
||||||
|
|
||||||
expected := &stmt.StmtList{
|
expected := &stmt.StmtList{
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastString{
|
Expr: &cast.String{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -207,13 +207,13 @@ func TestCastString(t *testing.T) {
|
|||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCastUnset(t *testing.T) {
|
func TestUnset(t *testing.T) {
|
||||||
src := `<? (unset)$a;`
|
src := `<? (unset)$a;`
|
||||||
|
|
||||||
expected := &stmt.StmtList{
|
expected := &stmt.StmtList{
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastUnset{
|
Expr: &cast.Unset{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -18,49 +18,49 @@ var nodesToTest = []struct {
|
|||||||
expectedAttributes map[string]interface{}
|
expectedAttributes map[string]interface{}
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
&cast.CastArray{
|
&cast.Array{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
map[string]interface{}{},
|
map[string]interface{}{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&cast.CastBool{
|
&cast.Bool{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
map[string]interface{}{},
|
map[string]interface{}{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&cast.CastDouble{
|
&cast.Double{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
map[string]interface{}{},
|
map[string]interface{}{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&cast.CastInt{
|
&cast.Int{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
map[string]interface{}{},
|
map[string]interface{}{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&cast.CastObject{
|
&cast.Object{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
map[string]interface{}{},
|
map[string]interface{}{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&cast.CastString{
|
&cast.String{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
map[string]interface{}{},
|
map[string]interface{}{},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
&cast.CastUnset{
|
&cast.Unset{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
[]string{"Expr"},
|
[]string{"Expr"},
|
||||||
|
14
php5/php5.go
14
php5/php5.go
@ -4720,7 +4720,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php5/php5.y:2213
|
//line php5/php5.y:2213
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastInt(yyDollar[2].node)
|
yyVAL.node = cast.NewInt(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
@ -4728,7 +4728,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php5/php5.y:2219
|
//line php5/php5.y:2219
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastDouble(yyDollar[2].node)
|
yyVAL.node = cast.NewDouble(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
@ -4736,7 +4736,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php5/php5.y:2225
|
//line php5/php5.y:2225
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastString(yyDollar[2].node)
|
yyVAL.node = cast.NewString(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
@ -4744,7 +4744,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php5/php5.y:2231
|
//line php5/php5.y:2231
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastArray(yyDollar[2].node)
|
yyVAL.node = cast.NewArray(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
@ -4752,7 +4752,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php5/php5.y:2237
|
//line php5/php5.y:2237
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastObject(yyDollar[2].node)
|
yyVAL.node = cast.NewObject(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
@ -4760,7 +4760,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php5/php5.y:2243
|
//line php5/php5.y:2243
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastBool(yyDollar[2].node)
|
yyVAL.node = cast.NewBool(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
@ -4768,7 +4768,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php5/php5.y:2249
|
//line php5/php5.y:2249
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastUnset(yyDollar[2].node)
|
yyVAL.node = cast.NewUnset(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
|
14
php5/php5.y
14
php5/php5.y
@ -2211,43 +2211,43 @@ expr_without_variable:
|
|||||||
{ $$ = $1 }
|
{ $$ = $1 }
|
||||||
| T_INT_CAST expr
|
| T_INT_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastInt($2)
|
$$ = cast.NewInt($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
| T_DOUBLE_CAST expr
|
| T_DOUBLE_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastDouble($2)
|
$$ = cast.NewDouble($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
| T_STRING_CAST expr
|
| T_STRING_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastString($2)
|
$$ = cast.NewString($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
| T_ARRAY_CAST expr
|
| T_ARRAY_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastArray($2)
|
$$ = cast.NewArray($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
| T_OBJECT_CAST expr
|
| T_OBJECT_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastObject($2)
|
$$ = cast.NewObject($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
| T_BOOL_CAST expr
|
| T_BOOL_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastBool($2)
|
$$ = cast.NewBool($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
| T_UNSET_CAST expr
|
| T_UNSET_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastUnset($2)
|
$$ = cast.NewUnset($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
|
@ -2649,52 +2649,52 @@ CAD;
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastArray{
|
Expr: &cast.Array{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastBool{
|
Expr: &cast.Bool{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastBool{
|
Expr: &cast.Bool{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastDouble{
|
Expr: &cast.Double{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastDouble{
|
Expr: &cast.Double{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastInt{
|
Expr: &cast.Int{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastInt{
|
Expr: &cast.Int{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastObject{
|
Expr: &cast.Object{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastString{
|
Expr: &cast.String{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastUnset{
|
Expr: &cast.Unset{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
14
php7/php7.go
14
php7/php7.go
@ -4657,7 +4657,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php7/php7.y:1827
|
//line php7/php7.y:1827
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastInt(yyDollar[2].node)
|
yyVAL.node = cast.NewInt(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
@ -4665,7 +4665,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php7/php7.y:1833
|
//line php7/php7.y:1833
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastDouble(yyDollar[2].node)
|
yyVAL.node = cast.NewDouble(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
@ -4673,7 +4673,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php7/php7.y:1839
|
//line php7/php7.y:1839
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastString(yyDollar[2].node)
|
yyVAL.node = cast.NewString(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
@ -4681,7 +4681,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php7/php7.y:1845
|
//line php7/php7.y:1845
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastArray(yyDollar[2].node)
|
yyVAL.node = cast.NewArray(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
@ -4689,7 +4689,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php7/php7.y:1851
|
//line php7/php7.y:1851
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastObject(yyDollar[2].node)
|
yyVAL.node = cast.NewObject(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
@ -4697,7 +4697,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php7/php7.y:1857
|
//line php7/php7.y:1857
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastBool(yyDollar[2].node)
|
yyVAL.node = cast.NewBool(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
@ -4705,7 +4705,7 @@ yydefault:
|
|||||||
yyDollar = yyS[yypt-2 : yypt+1]
|
yyDollar = yyS[yypt-2 : yypt+1]
|
||||||
//line php7/php7.y:1863
|
//line php7/php7.y:1863
|
||||||
{
|
{
|
||||||
yyVAL.node = cast.NewCastUnset(yyDollar[2].node)
|
yyVAL.node = cast.NewUnset(yyDollar[2].node)
|
||||||
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
positions.AddPosition(yyVAL.node, positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node))
|
||||||
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
comments.AddComments(yyVAL.node, yyDollar[1].token.Comments())
|
||||||
}
|
}
|
||||||
|
14
php7/php7.y
14
php7/php7.y
@ -1825,43 +1825,43 @@ expr_without_variable:
|
|||||||
| internal_functions_in_yacc { $$ = $1}
|
| internal_functions_in_yacc { $$ = $1}
|
||||||
| T_INT_CAST expr
|
| T_INT_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastInt($2)
|
$$ = cast.NewInt($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
| T_DOUBLE_CAST expr
|
| T_DOUBLE_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastDouble($2)
|
$$ = cast.NewDouble($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
| T_STRING_CAST expr
|
| T_STRING_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastString($2)
|
$$ = cast.NewString($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
| T_ARRAY_CAST expr
|
| T_ARRAY_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastArray($2)
|
$$ = cast.NewArray($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
| T_OBJECT_CAST expr
|
| T_OBJECT_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastObject($2)
|
$$ = cast.NewObject($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
| T_BOOL_CAST expr
|
| T_BOOL_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastBool($2)
|
$$ = cast.NewBool($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
| T_UNSET_CAST expr
|
| T_UNSET_CAST expr
|
||||||
{
|
{
|
||||||
$$ = cast.NewCastUnset($2)
|
$$ = cast.NewUnset($2)
|
||||||
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
positions.AddPosition($$, positionBuilder.NewTokenNodePosition($1, $2))
|
||||||
comments.AddComments($$, $1.Comments())
|
comments.AddComments($$, $1.Comments())
|
||||||
}
|
}
|
||||||
|
@ -2678,52 +2678,52 @@ CAD;
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastArray{
|
Expr: &cast.Array{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastBool{
|
Expr: &cast.Bool{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastBool{
|
Expr: &cast.Bool{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastDouble{
|
Expr: &cast.Double{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastDouble{
|
Expr: &cast.Double{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastInt{
|
Expr: &cast.Int{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastInt{
|
Expr: &cast.Int{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastObject{
|
Expr: &cast.Object{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastString{
|
Expr: &cast.String{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &cast.CastUnset{
|
Expr: &cast.Unset{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -76,7 +76,7 @@ func (p *Printer) printNode(n node.Node) {
|
|||||||
case *node.Argument:
|
case *node.Argument:
|
||||||
p.printNodeArgument(n)
|
p.printNodeArgument(n)
|
||||||
|
|
||||||
// name
|
// name
|
||||||
|
|
||||||
case *name.NamePart:
|
case *name.NamePart:
|
||||||
p.printNameNamePart(n)
|
p.printNameNamePart(n)
|
||||||
@ -87,7 +87,7 @@ func (p *Printer) printNode(n node.Node) {
|
|||||||
case *name.Relative:
|
case *name.Relative:
|
||||||
p.printNameRelative(n)
|
p.printNameRelative(n)
|
||||||
|
|
||||||
// scalar
|
// scalar
|
||||||
|
|
||||||
case *scalar.Lnumber:
|
case *scalar.Lnumber:
|
||||||
p.printScalarLNumber(n)
|
p.printScalarLNumber(n)
|
||||||
@ -102,7 +102,7 @@ func (p *Printer) printNode(n node.Node) {
|
|||||||
case *scalar.MagicConstant:
|
case *scalar.MagicConstant:
|
||||||
p.printScalarMagicConstant(n)
|
p.printScalarMagicConstant(n)
|
||||||
|
|
||||||
// assign
|
// assign
|
||||||
|
|
||||||
case *assign.Assign:
|
case *assign.Assign:
|
||||||
p.printAssign(n)
|
p.printAssign(n)
|
||||||
@ -133,7 +133,7 @@ func (p *Printer) printNode(n node.Node) {
|
|||||||
case *assign.ShiftRight:
|
case *assign.ShiftRight:
|
||||||
p.printAssignShiftRight(n)
|
p.printAssignShiftRight(n)
|
||||||
|
|
||||||
// binary
|
// binary
|
||||||
|
|
||||||
case *binary.BitwiseAnd:
|
case *binary.BitwiseAnd:
|
||||||
p.printBinaryBitwiseAnd(n)
|
p.printBinaryBitwiseAnd(n)
|
||||||
@ -190,24 +190,24 @@ func (p *Printer) printNode(n node.Node) {
|
|||||||
case *binary.Spaceship:
|
case *binary.Spaceship:
|
||||||
p.printBinarySpaceship(n)
|
p.printBinarySpaceship(n)
|
||||||
|
|
||||||
// cast
|
// cast
|
||||||
|
|
||||||
case *cast.CastArray:
|
case *cast.Array:
|
||||||
p.printCastArray(n)
|
p.printArray(n)
|
||||||
case *cast.CastBool:
|
case *cast.Bool:
|
||||||
p.printCastBool(n)
|
p.printBool(n)
|
||||||
case *cast.CastDouble:
|
case *cast.Double:
|
||||||
p.printCastDouble(n)
|
p.printDouble(n)
|
||||||
case *cast.CastInt:
|
case *cast.Int:
|
||||||
p.printCastInt(n)
|
p.printInt(n)
|
||||||
case *cast.CastObject:
|
case *cast.Object:
|
||||||
p.printCastObject(n)
|
p.printObject(n)
|
||||||
case *cast.CastString:
|
case *cast.String:
|
||||||
p.printCastString(n)
|
p.printString(n)
|
||||||
case *cast.CastUnset:
|
case *cast.Unset:
|
||||||
p.printCastUnset(n)
|
p.printUnset(n)
|
||||||
|
|
||||||
// expr
|
// expr
|
||||||
|
|
||||||
case *expr.ArrayDimFetch:
|
case *expr.ArrayDimFetch:
|
||||||
p.printExprArrayDimFetch(n)
|
p.printExprArrayDimFetch(n)
|
||||||
@ -294,7 +294,7 @@ func (p *Printer) printNode(n node.Node) {
|
|||||||
case *expr.Yield:
|
case *expr.Yield:
|
||||||
p.printExprYield(n)
|
p.printExprYield(n)
|
||||||
|
|
||||||
// stmt
|
// stmt
|
||||||
|
|
||||||
case *stmt.AltElseIf:
|
case *stmt.AltElseIf:
|
||||||
p.printStmtAltElseIf(n)
|
p.printStmtAltElseIf(n)
|
||||||
@ -855,50 +855,50 @@ func (p *Printer) printBinarySpaceship(n node.Node) {
|
|||||||
|
|
||||||
// cast
|
// cast
|
||||||
|
|
||||||
func (p *Printer) printCastArray(n node.Node) {
|
func (p *Printer) printArray(n node.Node) {
|
||||||
nn := n.(*cast.CastArray)
|
nn := n.(*cast.Array)
|
||||||
|
|
||||||
io.WriteString(p.w, "(array)")
|
io.WriteString(p.w, "(array)")
|
||||||
p.Print(nn.Expr)
|
p.Print(nn.Expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Printer) printCastBool(n node.Node) {
|
func (p *Printer) printBool(n node.Node) {
|
||||||
nn := n.(*cast.CastBool)
|
nn := n.(*cast.Bool)
|
||||||
|
|
||||||
io.WriteString(p.w, "(bool)")
|
io.WriteString(p.w, "(bool)")
|
||||||
p.Print(nn.Expr)
|
p.Print(nn.Expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Printer) printCastDouble(n node.Node) {
|
func (p *Printer) printDouble(n node.Node) {
|
||||||
nn := n.(*cast.CastDouble)
|
nn := n.(*cast.Double)
|
||||||
|
|
||||||
io.WriteString(p.w, "(float)")
|
io.WriteString(p.w, "(float)")
|
||||||
p.Print(nn.Expr)
|
p.Print(nn.Expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Printer) printCastInt(n node.Node) {
|
func (p *Printer) printInt(n node.Node) {
|
||||||
nn := n.(*cast.CastInt)
|
nn := n.(*cast.Int)
|
||||||
|
|
||||||
io.WriteString(p.w, "(int)")
|
io.WriteString(p.w, "(int)")
|
||||||
p.Print(nn.Expr)
|
p.Print(nn.Expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Printer) printCastObject(n node.Node) {
|
func (p *Printer) printObject(n node.Node) {
|
||||||
nn := n.(*cast.CastObject)
|
nn := n.(*cast.Object)
|
||||||
|
|
||||||
io.WriteString(p.w, "(object)")
|
io.WriteString(p.w, "(object)")
|
||||||
p.Print(nn.Expr)
|
p.Print(nn.Expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Printer) printCastString(n node.Node) {
|
func (p *Printer) printString(n node.Node) {
|
||||||
nn := n.(*cast.CastString)
|
nn := n.(*cast.String)
|
||||||
|
|
||||||
io.WriteString(p.w, "(string)")
|
io.WriteString(p.w, "(string)")
|
||||||
p.Print(nn.Expr)
|
p.Print(nn.Expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Printer) printCastUnset(n node.Node) {
|
func (p *Printer) printUnset(n node.Node) {
|
||||||
nn := n.(*cast.CastUnset)
|
nn := n.(*cast.Unset)
|
||||||
|
|
||||||
io.WriteString(p.w, "(unset)")
|
io.WriteString(p.w, "(unset)")
|
||||||
p.Print(nn.Expr)
|
p.Print(nn.Expr)
|
||||||
|
@ -972,11 +972,11 @@ func TestPrintBinarySpaceship(t *testing.T) {
|
|||||||
|
|
||||||
// cast
|
// cast
|
||||||
|
|
||||||
func TestPrintCastArray(t *testing.T) {
|
func TestPrintArray(t *testing.T) {
|
||||||
o := bytes.NewBufferString("")
|
o := bytes.NewBufferString("")
|
||||||
|
|
||||||
p := printer.NewPrinter(o, " ")
|
p := printer.NewPrinter(o, " ")
|
||||||
p.Print(&cast.CastArray{
|
p.Print(&cast.Array{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -988,11 +988,11 @@ func TestPrintCastArray(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPrintCastBool(t *testing.T) {
|
func TestPrintBool(t *testing.T) {
|
||||||
o := bytes.NewBufferString("")
|
o := bytes.NewBufferString("")
|
||||||
|
|
||||||
p := printer.NewPrinter(o, " ")
|
p := printer.NewPrinter(o, " ")
|
||||||
p.Print(&cast.CastBool{
|
p.Print(&cast.Bool{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1004,11 +1004,11 @@ func TestPrintCastBool(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPrintCastDouble(t *testing.T) {
|
func TestPrintDouble(t *testing.T) {
|
||||||
o := bytes.NewBufferString("")
|
o := bytes.NewBufferString("")
|
||||||
|
|
||||||
p := printer.NewPrinter(o, " ")
|
p := printer.NewPrinter(o, " ")
|
||||||
p.Print(&cast.CastDouble{
|
p.Print(&cast.Double{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1020,11 +1020,11 @@ func TestPrintCastDouble(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPrintCastInt(t *testing.T) {
|
func TestPrintInt(t *testing.T) {
|
||||||
o := bytes.NewBufferString("")
|
o := bytes.NewBufferString("")
|
||||||
|
|
||||||
p := printer.NewPrinter(o, " ")
|
p := printer.NewPrinter(o, " ")
|
||||||
p.Print(&cast.CastInt{
|
p.Print(&cast.Int{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1036,11 +1036,11 @@ func TestPrintCastInt(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPrintCastObject(t *testing.T) {
|
func TestPrintObject(t *testing.T) {
|
||||||
o := bytes.NewBufferString("")
|
o := bytes.NewBufferString("")
|
||||||
|
|
||||||
p := printer.NewPrinter(o, " ")
|
p := printer.NewPrinter(o, " ")
|
||||||
p.Print(&cast.CastObject{
|
p.Print(&cast.Object{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1052,11 +1052,11 @@ func TestPrintCastObject(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPrintCastString(t *testing.T) {
|
func TestPrintString(t *testing.T) {
|
||||||
o := bytes.NewBufferString("")
|
o := bytes.NewBufferString("")
|
||||||
|
|
||||||
p := printer.NewPrinter(o, " ")
|
p := printer.NewPrinter(o, " ")
|
||||||
p.Print(&cast.CastString{
|
p.Print(&cast.String{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1068,11 +1068,11 @@ func TestPrintCastString(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPrintCastUnset(t *testing.T) {
|
func TestPrintUnset(t *testing.T) {
|
||||||
o := bytes.NewBufferString("")
|
o := bytes.NewBufferString("")
|
||||||
|
|
||||||
p := printer.NewPrinter(o, " ")
|
p := printer.NewPrinter(o, " ")
|
||||||
p.Print(&cast.CastUnset{
|
p.Print(&cast.Unset{
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user