#80 implement Ragel based lexer
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,6 @@
|
||||
package cast_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestArray(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestArray(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &cast.Array{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -62,12 +61,12 @@ func TestArray(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -80,7 +79,7 @@ func TestBool(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -88,28 +87,28 @@ func TestBool(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Expr: &cast.Bool{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -120,12 +119,12 @@ func TestBool(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -138,7 +137,7 @@ func TestBoolShort(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -146,28 +145,28 @@ func TestBoolShort(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &cast.Bool{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -178,12 +177,12 @@ func TestBoolShort(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -196,7 +195,7 @@ func TestDouble(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -204,28 +203,28 @@ func TestDouble(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &cast.Double{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -236,12 +235,12 @@ func TestDouble(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -254,7 +253,7 @@ func TestCastFloat(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -262,28 +261,28 @@ func TestCastFloat(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &cast.Double{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -294,12 +293,12 @@ func TestCastFloat(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -312,7 +311,7 @@ func TestInt(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -320,28 +319,28 @@ func TestInt(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Expr: &cast.Int{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -352,12 +351,12 @@ func TestInt(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -370,7 +369,7 @@ func TestIntShort(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -378,28 +377,28 @@ func TestIntShort(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &cast.Int{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 10,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -410,12 +409,12 @@ func TestIntShort(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -428,7 +427,7 @@ func TestObject(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -436,28 +435,28 @@ func TestObject(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &cast.Object{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -468,12 +467,12 @@ func TestObject(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -486,7 +485,7 @@ func TestString(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -494,28 +493,28 @@ func TestString(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &cast.String{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -526,12 +525,12 @@ func TestString(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -544,7 +543,7 @@ func TestBinaryString(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -552,28 +551,28 @@ func TestBinaryString(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &cast.String{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -584,12 +583,12 @@ func TestBinaryString(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -602,7 +601,7 @@ func TestUnset(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -610,28 +609,28 @@ func TestUnset(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &cast.Unset{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -642,12 +641,12 @@ func TestUnset(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestArrayDimFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 9,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestArrayDimFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 9,
|
||||
},
|
||||
Expr: &expr.ArrayDimFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -61,7 +60,7 @@ func TestArrayDimFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 7,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -71,12 +70,12 @@ func TestArrayDimFetch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -89,7 +88,7 @@ func TestArrayDimFetchNested(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -97,35 +96,35 @@ func TestArrayDimFetchNested(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.ArrayDimFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Variable: &expr.ArrayDimFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -135,7 +134,7 @@ func TestArrayDimFetchNested(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 7,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -145,7 +144,7 @@ func TestArrayDimFetchNested(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "2",
|
||||
@@ -155,12 +154,12 @@ func TestArrayDimFetchNested(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestArray(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,14 +29,14 @@ func TestArray(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &expr.Array{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 10,
|
||||
},
|
||||
Items: []node.Node{},
|
||||
@@ -46,12 +45,12 @@ func TestArray(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -64,7 +63,7 @@ func TestArrayItem(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -72,14 +71,14 @@ func TestArrayItem(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.Array{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -87,14 +86,14 @@ func TestArrayItem(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 10,
|
||||
},
|
||||
Val: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -106,12 +105,12 @@ func TestArrayItem(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -124,7 +123,7 @@ func TestArrayItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 21,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -132,14 +131,14 @@ func TestArrayItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 21,
|
||||
},
|
||||
Expr: &expr.Array{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 20,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -147,14 +146,14 @@ func TestArrayItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 13,
|
||||
},
|
||||
Key: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -163,7 +162,7 @@ func TestArrayItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -173,28 +172,28 @@ func TestArrayItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 18,
|
||||
},
|
||||
Val: &expr.Reference{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 18,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -209,12 +208,12 @@ func TestArrayItems(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestBitwiseNot(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestBitwiseNot(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Expr: &expr.BitwiseNot{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -62,12 +61,12 @@ func TestBitwiseNot(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestBooleanNot(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestBooleanNot(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Expr: &expr.BooleanNot{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -62,12 +61,12 @@ func TestBooleanNot(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -24,7 +23,7 @@ func TestClassConstFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -32,21 +31,21 @@ func TestClassConstFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.ClassConstFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Class: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -54,7 +53,7 @@ func TestClassConstFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -65,7 +64,7 @@ func TestClassConstFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "Bar",
|
||||
@@ -75,12 +74,12 @@ func TestClassConstFetch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -93,7 +92,7 @@ func TestStaticClassConstFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -101,21 +100,21 @@ func TestStaticClassConstFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Expr: &expr.ClassConstFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Class: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 9,
|
||||
},
|
||||
Value: "static",
|
||||
@@ -124,7 +123,7 @@ func TestStaticClassConstFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -134,12 +133,12 @@ func TestStaticClassConstFetch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestCloneBrackets(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestCloneBrackets(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Clone{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -62,12 +61,12 @@ func TestCloneBrackets(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -80,7 +79,7 @@ func TestClone(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -88,28 +87,28 @@ func TestClone(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.Clone{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -120,12 +119,12 @@ func TestClone(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -24,7 +23,7 @@ func TestClosure(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -32,14 +31,14 @@ func TestClosure(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Expr: &expr.Closure{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
ReturnsRef: false,
|
||||
@@ -51,12 +50,12 @@ func TestClosure(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -69,7 +68,7 @@ func TestClosureUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 37,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -77,14 +76,14 @@ func TestClosureUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 37,
|
||||
},
|
||||
Expr: &expr.Closure{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 36,
|
||||
},
|
||||
ReturnsRef: false,
|
||||
@@ -95,7 +94,7 @@ func TestClosureUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Variadic: false,
|
||||
@@ -104,14 +103,14 @@ func TestClosureUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -122,7 +121,7 @@ func TestClosureUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
ByRef: false,
|
||||
@@ -131,14 +130,14 @@ func TestClosureUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -150,7 +149,7 @@ func TestClosureUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 33,
|
||||
},
|
||||
Uses: []node.Node{
|
||||
@@ -158,14 +157,14 @@ func TestClosureUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 27,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "c",
|
||||
@@ -175,21 +174,21 @@ func TestClosureUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 30,
|
||||
StartPos: 29,
|
||||
EndPos: 32,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 32,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 32,
|
||||
},
|
||||
Value: "d",
|
||||
@@ -204,12 +203,12 @@ func TestClosureUse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -222,7 +221,7 @@ func TestClosureUse2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 37,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -230,14 +229,14 @@ func TestClosureUse2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 37,
|
||||
},
|
||||
Expr: &expr.Closure{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 36,
|
||||
},
|
||||
ReturnsRef: false,
|
||||
@@ -248,7 +247,7 @@ func TestClosureUse2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
ByRef: false,
|
||||
@@ -257,14 +256,14 @@ func TestClosureUse2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -275,7 +274,7 @@ func TestClosureUse2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
ByRef: false,
|
||||
@@ -284,14 +283,14 @@ func TestClosureUse2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -303,7 +302,7 @@ func TestClosureUse2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 33,
|
||||
},
|
||||
Uses: []node.Node{
|
||||
@@ -311,21 +310,21 @@ func TestClosureUse2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 28,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 27,
|
||||
StartPos: 26,
|
||||
EndPos: 28,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 27,
|
||||
StartPos: 26,
|
||||
EndPos: 28,
|
||||
},
|
||||
Value: "c",
|
||||
@@ -336,14 +335,14 @@ func TestClosureUse2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 32,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 32,
|
||||
},
|
||||
Value: "d",
|
||||
@@ -357,12 +356,12 @@ func TestClosureUse2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -375,7 +374,7 @@ func TestClosureReturnType(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 23,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -383,14 +382,14 @@ func TestClosureReturnType(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 23,
|
||||
},
|
||||
Expr: &expr.Closure{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 22,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -400,7 +399,7 @@ func TestClosureReturnType(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 19,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -408,7 +407,7 @@ func TestClosureReturnType(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 19,
|
||||
},
|
||||
Value: "void",
|
||||
@@ -421,7 +420,7 @@ func TestClosureReturnType(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -24,7 +23,7 @@ func TestConstFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -32,21 +31,21 @@ func TestConstFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Expr: &expr.ConstFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Constant: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -54,7 +53,7 @@ func TestConstFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -66,12 +65,12 @@ func TestConstFetch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -84,7 +83,7 @@ func TestConstFetchRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -92,21 +91,21 @@ func TestConstFetchRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Expr: &expr.ConstFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Constant: &name.Relative{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -114,7 +113,7 @@ func TestConstFetchRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -126,12 +125,12 @@ func TestConstFetchRelative(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -144,7 +143,7 @@ func TestConstFetchFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -152,21 +151,21 @@ func TestConstFetchFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Expr: &expr.ConstFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Constant: &name.FullyQualified{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -174,7 +173,7 @@ func TestConstFetchFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 7,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -186,12 +185,12 @@ func TestConstFetchFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Empty{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -62,12 +61,12 @@ func TestEmpty(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestErrorSuppress(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestErrorSuppress(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Expr: &expr.ErrorSuppress{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -62,12 +61,12 @@ func TestErrorSuppress(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestEval(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestEval(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.Eval{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -62,12 +61,12 @@ func TestEval(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestExit(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,7 +29,7 @@ func TestExit(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Expr: &expr.Exit{
|
||||
@@ -38,7 +37,7 @@ func TestExit(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
},
|
||||
@@ -46,12 +45,12 @@ func TestExit(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -64,7 +63,7 @@ func TestExitEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 10,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -72,7 +71,7 @@ func TestExitEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 10,
|
||||
},
|
||||
Expr: &expr.Exit{
|
||||
@@ -80,7 +79,7 @@ func TestExitEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 9,
|
||||
},
|
||||
},
|
||||
@@ -88,12 +87,12 @@ func TestExitEmpty(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -106,7 +105,7 @@ func TestExitExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -114,7 +113,7 @@ func TestExitExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.Exit{
|
||||
@@ -122,21 +121,21 @@ func TestExitExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -147,12 +146,12 @@ func TestExitExpr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -165,7 +164,7 @@ func TestDie(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -173,7 +172,7 @@ func TestDie(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Expr: &expr.Exit{
|
||||
@@ -181,7 +180,7 @@ func TestDie(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
},
|
||||
@@ -189,12 +188,12 @@ func TestDie(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -207,7 +206,7 @@ func TestDieEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 9,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -215,7 +214,7 @@ func TestDieEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 9,
|
||||
},
|
||||
Expr: &expr.Exit{
|
||||
@@ -223,7 +222,7 @@ func TestDieEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
},
|
||||
@@ -231,12 +230,12 @@ func TestDieEmpty(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -249,7 +248,7 @@ func TestDieExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -257,7 +256,7 @@ func TestDieExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &expr.Exit{
|
||||
@@ -265,21 +264,21 @@ func TestDieExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 10,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -290,12 +289,12 @@ func TestDieExpr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -27,7 +26,7 @@ func TestFunctionCall(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 9,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -35,21 +34,21 @@ func TestFunctionCall(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 9,
|
||||
},
|
||||
Expr: &expr.FunctionCall{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Function: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -57,7 +56,7 @@ func TestFunctionCall(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -68,7 +67,7 @@ func TestFunctionCall(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 8,
|
||||
},
|
||||
},
|
||||
@@ -77,12 +76,12 @@ func TestFunctionCall(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -95,7 +94,7 @@ func TestFunctionCallRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -103,21 +102,21 @@ func TestFunctionCallRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Expr: &expr.FunctionCall{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Function: &name.Relative{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -125,7 +124,7 @@ func TestFunctionCallRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -136,7 +135,7 @@ func TestFunctionCallRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
},
|
||||
@@ -145,12 +144,12 @@ func TestFunctionCallRelative(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -163,7 +162,7 @@ func TestFunctionFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -171,21 +170,21 @@ func TestFunctionFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.FunctionCall{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Function: &name.FullyQualified{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -193,7 +192,7 @@ func TestFunctionFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 7,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -204,7 +203,7 @@ func TestFunctionFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 11,
|
||||
},
|
||||
Arguments: []node.Node{
|
||||
@@ -212,7 +211,7 @@ func TestFunctionFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Variadic: false,
|
||||
@@ -221,7 +220,7 @@ func TestFunctionFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Items: []node.Node{},
|
||||
@@ -234,12 +233,12 @@ func TestFunctionFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -252,7 +251,7 @@ func TestFunctionCallVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -260,28 +259,28 @@ func TestFunctionCallVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Expr: &expr.FunctionCall{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Function: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -291,7 +290,7 @@ func TestFunctionCallVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 17,
|
||||
},
|
||||
Arguments: []node.Node{
|
||||
@@ -299,7 +298,7 @@ func TestFunctionCallVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 16,
|
||||
},
|
||||
Variadic: false,
|
||||
@@ -308,21 +307,21 @@ func TestFunctionCallVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -337,12 +336,12 @@ func TestFunctionCallVar(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -355,7 +354,7 @@ func TestFunctionCallExprArg(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -363,21 +362,21 @@ func TestFunctionCallExprArg(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Expr: &expr.FunctionCall{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Function: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -385,7 +384,7 @@ func TestFunctionCallExprArg(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Value: "ceil",
|
||||
@@ -396,7 +395,7 @@ func TestFunctionCallExprArg(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 15,
|
||||
},
|
||||
Arguments: []node.Node{
|
||||
@@ -404,7 +403,7 @@ func TestFunctionCallExprArg(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 14,
|
||||
},
|
||||
Variadic: false,
|
||||
@@ -413,21 +412,21 @@ func TestFunctionCallExprArg(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 14,
|
||||
},
|
||||
Left: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -437,7 +436,7 @@ func TestFunctionCallExprArg(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "3",
|
||||
@@ -451,12 +450,12 @@ func TestFunctionCallExprArg(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestPostDec(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestPostDec(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Expr: &expr.PostDec{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -62,12 +61,12 @@ func TestPostDec(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -80,7 +79,7 @@ func TestPostInc(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -88,28 +87,28 @@ func TestPostInc(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Expr: &expr.PostInc{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -120,12 +119,12 @@ func TestPostInc(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -138,7 +137,7 @@ func TestPreDec(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -146,28 +145,28 @@ func TestPreDec(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Expr: &expr.PreDec{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 6,
|
||||
StartPos: 5,
|
||||
EndPos: 7,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 6,
|
||||
StartPos: 5,
|
||||
EndPos: 7,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -178,12 +177,12 @@ func TestPreDec(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -196,7 +195,7 @@ func TestPreInc(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -204,28 +203,28 @@ func TestPreInc(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Expr: &expr.PreInc{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 6,
|
||||
StartPos: 5,
|
||||
EndPos: 7,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 6,
|
||||
StartPos: 5,
|
||||
EndPos: 7,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -236,12 +235,12 @@ func TestPreInc(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestInclude(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestInclude(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &expr.Include{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -62,12 +61,12 @@ func TestInclude(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -80,7 +79,7 @@ func TestIncludeOnce(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -88,28 +87,28 @@ func TestIncludeOnce(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Expr: &expr.IncludeOnce{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -120,12 +119,12 @@ func TestIncludeOnce(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -138,7 +137,7 @@ func TestRequire(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -146,28 +145,28 @@ func TestRequire(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &expr.Require{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -178,12 +177,12 @@ func TestRequire(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -196,7 +195,7 @@ func TestRequireOnce(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -204,28 +203,28 @@ func TestRequireOnce(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Expr: &expr.RequireOnce{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -236,12 +235,12 @@ func TestRequireOnce(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -24,7 +23,7 @@ func TestInstanceOf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 21,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -32,28 +31,28 @@ func TestInstanceOf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 21,
|
||||
},
|
||||
Expr: &expr.InstanceOf{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 20,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -63,7 +62,7 @@ func TestInstanceOf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 20,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -71,7 +70,7 @@ func TestInstanceOf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -83,12 +82,12 @@ func TestInstanceOf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -101,7 +100,7 @@ func TestInstanceOfRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 31,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -109,28 +108,28 @@ func TestInstanceOfRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 31,
|
||||
},
|
||||
Expr: &expr.InstanceOf{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 30,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -140,7 +139,7 @@ func TestInstanceOfRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 30,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -148,7 +147,7 @@ func TestInstanceOfRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 28,
|
||||
StartPos: 27,
|
||||
EndPos: 30,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -160,12 +159,12 @@ func TestInstanceOfRelative(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -178,7 +177,7 @@ func TestInstanceOfFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 22,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -186,28 +185,28 @@ func TestInstanceOfFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 22,
|
||||
},
|
||||
Expr: &expr.InstanceOf{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 21,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -217,7 +216,7 @@ func TestInstanceOfFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 21,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -225,7 +224,7 @@ func TestInstanceOfFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 21,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -237,12 +236,12 @@ func TestInstanceOfFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestIsset(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,14 +29,14 @@ func TestIsset(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Isset{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Variables: []node.Node{
|
||||
@@ -45,14 +44,14 @@ func TestIsset(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -64,12 +63,12 @@ func TestIsset(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -82,7 +81,7 @@ func TestIssetVariables(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -90,14 +89,14 @@ func TestIssetVariables(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Expr: &expr.Isset{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Variables: []node.Node{
|
||||
@@ -105,14 +104,14 @@ func TestIssetVariables(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -122,14 +121,14 @@ func TestIssetVariables(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -141,12 +140,12 @@ func TestIssetVariables(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestEmptyList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,21 +29,21 @@ func TestEmptyList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Expr: &assign.Assign{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Variable: &expr.List{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 9,
|
||||
},
|
||||
Items: []node.Node{},
|
||||
@@ -53,14 +52,14 @@ func TestEmptyList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -71,12 +70,12 @@ func TestEmptyList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -89,7 +88,7 @@ func TestList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -97,21 +96,21 @@ func TestList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Expr: &assign.Assign{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Variable: &expr.List{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -119,21 +118,21 @@ func TestList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Val: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -146,14 +145,14 @@ func TestList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -164,12 +163,12 @@ func TestList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -182,7 +181,7 @@ func TestListArrayIndex(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -190,21 +189,21 @@ func TestListArrayIndex(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Expr: &assign.Assign{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Variable: &expr.List{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -212,28 +211,28 @@ func TestListArrayIndex(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 12,
|
||||
},
|
||||
Val: &expr.ArrayDimFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 12,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -247,14 +246,14 @@ func TestListArrayIndex(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -265,12 +264,12 @@ func TestListArrayIndex(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -283,7 +282,7 @@ func TestListList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 23,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -291,21 +290,21 @@ func TestListList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 23,
|
||||
},
|
||||
Expr: &assign.Assign{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 22,
|
||||
},
|
||||
Variable: &expr.List{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -313,14 +312,14 @@ func TestListList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 16,
|
||||
},
|
||||
Val: &expr.List{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 16,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -328,21 +327,21 @@ func TestListList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
Val: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -358,14 +357,14 @@ func TestListList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 22,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 22,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -376,12 +375,12 @@ func TestListList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -394,7 +393,7 @@ func TestListEmptyItem(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -402,21 +401,21 @@ func TestListEmptyItem(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Expr: &assign.Assign{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Variable: &expr.List{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -425,21 +424,21 @@ func TestListEmptyItem(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Val: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -452,14 +451,14 @@ func TestListEmptyItem(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -470,12 +469,12 @@ func TestListEmptyItem(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -488,7 +487,7 @@ func TestListEmptyItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 23,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -496,21 +495,21 @@ func TestListEmptyItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 23,
|
||||
},
|
||||
Expr: &assign.Assign{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 22,
|
||||
},
|
||||
Variable: &expr.List{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -520,21 +519,21 @@ func TestListEmptyItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Val: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -548,14 +547,14 @@ func TestListEmptyItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 22,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 22,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -566,12 +565,12 @@ func TestListEmptyItems(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestMethodCall(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestMethodCall(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.MethodCall{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -61,7 +60,7 @@ func TestMethodCall(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -70,7 +69,7 @@ func TestMethodCall(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
},
|
||||
@@ -79,12 +78,12 @@ func TestMethodCall(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -24,7 +23,7 @@ func TestNew(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -32,21 +31,21 @@ func TestNew(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &expr.New{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 10,
|
||||
},
|
||||
Class: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 10,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -54,7 +53,7 @@ func TestNew(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -66,12 +65,12 @@ func TestNew(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -84,7 +83,7 @@ func TestNewRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 23,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -92,21 +91,21 @@ func TestNewRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 23,
|
||||
},
|
||||
Expr: &expr.New{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 22,
|
||||
},
|
||||
Class: &name.Relative{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 20,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -114,7 +113,7 @@ func TestNewRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -125,7 +124,7 @@ func TestNewRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 22,
|
||||
},
|
||||
},
|
||||
@@ -134,12 +133,12 @@ func TestNewRelative(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -152,7 +151,7 @@ func TestNewFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -160,21 +159,21 @@ func TestNewFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &expr.New{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Class: &name.FullyQualified{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 11,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -182,7 +181,7 @@ func TestNewFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -193,7 +192,7 @@ func TestNewFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
},
|
||||
@@ -202,12 +201,12 @@ func TestNewFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -220,7 +219,7 @@ func TestNewAnonymous(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 28,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -228,21 +227,21 @@ func TestNewAnonymous(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 28,
|
||||
},
|
||||
Expr: &expr.New{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 27,
|
||||
},
|
||||
Class: &stmt.Class{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 27,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -250,7 +249,7 @@ func TestNewAnonymous(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 24,
|
||||
},
|
||||
Arguments: []node.Node{
|
||||
@@ -258,7 +257,7 @@ func TestNewAnonymous(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
Variadic: false,
|
||||
@@ -267,14 +266,14 @@ func TestNewAnonymous(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -285,7 +284,7 @@ func TestNewAnonymous(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 23,
|
||||
},
|
||||
IsReference: false,
|
||||
@@ -294,14 +293,14 @@ func TestNewAnonymous(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 22,
|
||||
StartPos: 21,
|
||||
EndPos: 23,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 22,
|
||||
StartPos: 21,
|
||||
EndPos: 23,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -317,7 +316,7 @@ func TestNewAnonymous(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestPrint(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestPrint(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Print{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -62,12 +61,12 @@ func TestPrint(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestPropertyFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestPropertyFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &expr.PropertyFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 10,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -61,7 +60,7 @@ func TestPropertyFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -71,12 +70,12 @@ func TestPropertyFetch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -23,7 +22,7 @@ func TestForeachWithRef(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 31,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -31,21 +30,21 @@ func TestForeachWithRef(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 31,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -55,14 +54,14 @@ func TestForeachWithRef(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "k",
|
||||
@@ -72,21 +71,21 @@ func TestForeachWithRef(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 27,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 27,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "v",
|
||||
@@ -97,7 +96,7 @@ func TestForeachWithRef(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 30,
|
||||
StartPos: 29,
|
||||
EndPos: 31,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -106,12 +105,12 @@ func TestForeachWithRef(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -24,7 +23,7 @@ func TestShellExec(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -32,14 +31,14 @@ func TestShellExec(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.ShellExec{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -47,7 +46,7 @@ func TestShellExec(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 8,
|
||||
},
|
||||
Value: "cmd ",
|
||||
@@ -56,14 +55,14 @@ func TestShellExec(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -75,12 +74,12 @@ func TestShellExec(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestShortArray(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,14 +29,14 @@ func TestShortArray(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Expr: &expr.ShortArray{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Items: []node.Node{},
|
||||
@@ -46,12 +45,12 @@ func TestShortArray(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -64,7 +63,7 @@ func TestShortArrayItem(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -72,14 +71,14 @@ func TestShortArrayItem(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Expr: &expr.ShortArray{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -87,14 +86,14 @@ func TestShortArrayItem(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 5,
|
||||
},
|
||||
Val: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -106,12 +105,12 @@ func TestShortArrayItem(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -124,7 +123,7 @@ func TestShortArrayItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -132,14 +131,14 @@ func TestShortArrayItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Expr: &expr.ShortArray{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -147,14 +146,14 @@ func TestShortArrayItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 8,
|
||||
},
|
||||
Key: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -163,7 +162,7 @@ func TestShortArrayItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 8,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -173,28 +172,28 @@ func TestShortArrayItems(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 13,
|
||||
},
|
||||
Val: &expr.Reference{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 13,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -209,12 +208,12 @@ func TestShortArrayItems(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -21,7 +20,7 @@ func TestShortList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -29,21 +28,21 @@ func TestShortList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &assign.Assign{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Variable: &expr.ShortList{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -51,21 +50,21 @@ func TestShortList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
Val: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -78,14 +77,14 @@ func TestShortList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -96,7 +95,7 @@ func TestShortList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -109,7 +108,7 @@ func TestShortListArrayIndex(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -117,21 +116,21 @@ func TestShortListArrayIndex(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Expr: &assign.Assign{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Variable: &expr.ShortList{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 9,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -139,28 +138,28 @@ func TestShortListArrayIndex(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 8,
|
||||
},
|
||||
Val: &expr.ArrayDimFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 8,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -174,14 +173,14 @@ func TestShortListArrayIndex(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -192,7 +191,7 @@ func TestShortListArrayIndex(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -205,7 +204,7 @@ func TestShortListList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -213,21 +212,21 @@ func TestShortListList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Expr: &assign.Assign{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Variable: &expr.ShortList{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -235,14 +234,14 @@ func TestShortListList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 12,
|
||||
},
|
||||
Val: &expr.List{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 12,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -250,21 +249,21 @@ func TestShortListList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Val: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -280,14 +279,14 @@ func TestShortListList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -298,7 +297,7 @@ func TestShortListList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -24,7 +23,7 @@ func TestStaticCall(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -32,21 +31,21 @@ func TestStaticCall(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &expr.StaticCall{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Class: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -54,7 +53,7 @@ func TestStaticCall(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -65,7 +64,7 @@ func TestStaticCall(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -74,7 +73,7 @@ func TestStaticCall(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
},
|
||||
@@ -83,12 +82,12 @@ func TestStaticCall(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -101,7 +100,7 @@ func TestStaticCallRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 24,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -109,21 +108,21 @@ func TestStaticCallRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 24,
|
||||
},
|
||||
Expr: &expr.StaticCall{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 23,
|
||||
},
|
||||
Class: &name.Relative{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -131,7 +130,7 @@ func TestStaticCallRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -142,7 +141,7 @@ func TestStaticCallRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 21,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -151,7 +150,7 @@ func TestStaticCallRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 22,
|
||||
StartPos: 21,
|
||||
EndPos: 23,
|
||||
},
|
||||
},
|
||||
@@ -160,12 +159,12 @@ func TestStaticCallRelative(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -178,7 +177,7 @@ func TestStaticCallFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -186,21 +185,21 @@ func TestStaticCallFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Expr: &expr.StaticCall{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Class: &name.FullyQualified{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -208,7 +207,7 @@ func TestStaticCallFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 7,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -219,7 +218,7 @@ func TestStaticCallFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -228,7 +227,7 @@ func TestStaticCallFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
},
|
||||
@@ -237,12 +236,12 @@ func TestStaticCallFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -255,7 +254,7 @@ func TestStaticCallVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -263,21 +262,21 @@ func TestStaticCallVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Expr: &expr.StaticCall{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Class: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -285,7 +284,7 @@ func TestStaticCallVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -296,14 +295,14 @@ func TestStaticCallVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -313,7 +312,7 @@ func TestStaticCallVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
},
|
||||
@@ -322,12 +321,12 @@ func TestStaticCallVar(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -340,7 +339,7 @@ func TestStaticCallVarVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -348,28 +347,28 @@ func TestStaticCallVarVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Expr: &expr.StaticCall{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Class: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -379,14 +378,14 @@ func TestStaticCallVarVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 13,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -396,7 +395,7 @@ func TestStaticCallVarVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
},
|
||||
@@ -405,12 +404,12 @@ func TestStaticCallVarVar(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -23,7 +22,7 @@ func TestStaticPropertyFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -31,21 +30,21 @@ func TestStaticPropertyFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.StaticPropertyFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Class: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -53,7 +52,7 @@ func TestStaticPropertyFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -64,14 +63,14 @@ func TestStaticPropertyFetch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -82,12 +81,12 @@ func TestStaticPropertyFetch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -100,7 +99,7 @@ func TestStaticPropertyFetchRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 23,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -108,21 +107,21 @@ func TestStaticPropertyFetchRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 23,
|
||||
},
|
||||
Expr: &expr.StaticPropertyFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 22,
|
||||
},
|
||||
Class: &name.Relative{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -130,7 +129,7 @@ func TestStaticPropertyFetchRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -141,14 +140,14 @@ func TestStaticPropertyFetchRelative(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 22,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 22,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -159,12 +158,12 @@ func TestStaticPropertyFetchRelative(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -177,7 +176,7 @@ func TestStaticPropertyFetchFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -185,21 +184,21 @@ func TestStaticPropertyFetchFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Expr: &expr.StaticPropertyFetch{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Class: &name.FullyQualified{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -207,7 +206,7 @@ func TestStaticPropertyFetchFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 7,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -218,14 +217,14 @@ func TestStaticPropertyFetchFullyQualified(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 13,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -236,12 +235,12 @@ func TestStaticPropertyFetchFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestTernary(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestTernary(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Expr: &expr.Ternary{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Condition: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -61,14 +60,14 @@ func TestTernary(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -78,14 +77,14 @@ func TestTernary(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "c",
|
||||
@@ -96,12 +95,12 @@ func TestTernary(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -114,7 +113,7 @@ func TestTernarySimple(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -122,28 +121,28 @@ func TestTernarySimple(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Expr: &expr.Ternary{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Condition: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -153,14 +152,14 @@ func TestTernarySimple(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "c",
|
||||
@@ -171,12 +170,12 @@ func TestTernarySimple(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -189,7 +188,7 @@ func TestTernaryNestedTrue(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 26,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -197,28 +196,28 @@ func TestTernaryNestedTrue(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 26,
|
||||
},
|
||||
Expr: &expr.Ternary{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 25,
|
||||
},
|
||||
Condition: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -228,21 +227,21 @@ func TestTernaryNestedTrue(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 20,
|
||||
},
|
||||
Condition: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -252,14 +251,14 @@ func TestTernaryNestedTrue(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "c",
|
||||
@@ -269,14 +268,14 @@ func TestTernaryNestedTrue(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "d",
|
||||
@@ -287,14 +286,14 @@ func TestTernaryNestedTrue(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 24,
|
||||
StartPos: 23,
|
||||
EndPos: 25,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 24,
|
||||
StartPos: 23,
|
||||
EndPos: 25,
|
||||
},
|
||||
Value: "e",
|
||||
@@ -305,12 +304,12 @@ func TestTernaryNestedTrue(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -323,7 +322,7 @@ func TestTernaryNestedCond(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 26,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -331,35 +330,35 @@ func TestTernaryNestedCond(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 26,
|
||||
},
|
||||
Expr: &expr.Ternary{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 25,
|
||||
},
|
||||
Condition: &expr.Ternary{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Condition: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -369,14 +368,14 @@ func TestTernaryNestedCond(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -386,14 +385,14 @@ func TestTernaryNestedCond(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "c",
|
||||
@@ -404,14 +403,14 @@ func TestTernaryNestedCond(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "d",
|
||||
@@ -421,14 +420,14 @@ func TestTernaryNestedCond(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 24,
|
||||
StartPos: 23,
|
||||
EndPos: 25,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 24,
|
||||
StartPos: 23,
|
||||
EndPos: 25,
|
||||
},
|
||||
Value: "e",
|
||||
@@ -439,12 +438,12 @@ func TestTernaryNestedCond(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestUnaryMinus(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,28 +29,28 @@ func TestUnaryMinus(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Expr: &expr.UnaryMinus{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -62,12 +61,12 @@ func TestUnaryMinus(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -80,7 +79,7 @@ func TestUnaryPlus(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -88,28 +87,28 @@ func TestUnaryPlus(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Expr: &expr.UnaryPlus{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -120,12 +119,12 @@ func TestUnaryPlus(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestVariable(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,21 +29,21 @@ func TestVariable(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -54,12 +53,12 @@ func TestVariable(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -72,7 +71,7 @@ func TestVariableVariable(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -80,28 +79,28 @@ func TestVariableVariable(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 7,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 6,
|
||||
},
|
||||
VarName: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 5,
|
||||
StartPos: 4,
|
||||
EndPos: 6,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -112,12 +111,12 @@ func TestVariableVariable(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package expr_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -23,7 +22,7 @@ func TestYield(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 9,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -31,14 +30,14 @@ func TestYield(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 9,
|
||||
},
|
||||
Expr: &expr.Yield{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
},
|
||||
@@ -46,12 +45,12 @@ func TestYield(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -64,7 +63,7 @@ func TestYieldVal(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -72,28 +71,28 @@ func TestYieldVal(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.Yield{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -104,12 +103,12 @@ func TestYieldVal(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -122,7 +121,7 @@ func TestYieldKeyVal(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -130,28 +129,28 @@ func TestYieldKeyVal(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Expr: &expr.Yield{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Key: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -161,14 +160,14 @@ func TestYieldKeyVal(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 17,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 17,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -179,12 +178,12 @@ func TestYieldKeyVal(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -197,7 +196,7 @@ func TestYieldExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -205,21 +204,21 @@ func TestYieldExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Expr: &expr.Yield{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -229,12 +228,12 @@ func TestYieldExpr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -247,7 +246,7 @@ func TestYieldKeyExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -255,28 +254,28 @@ func TestYieldKeyExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Expr: &expr.Yield{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Key: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -286,7 +285,7 @@ func TestYieldKeyExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -296,12 +295,12 @@ func TestYieldKeyExpr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -314,7 +313,7 @@ func TestYieldFrom(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -322,28 +321,28 @@ func TestYieldFrom(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Expr: &expr.YieldFrom{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 16,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -354,7 +353,7 @@ func TestYieldFrom(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
Reference in New Issue
Block a user