[#82] handle php version
This commit is contained in:
		
							parent
							
								
									6afa2a089b
								
							
						
					
					
						commit
						ec6be0d9bd
					
				
							
								
								
									
										15
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								main.go
									
									
									
									
									
								
							| @ -15,14 +15,12 @@ import ( | ||||
| 	"github.com/pkg/profile" | ||||
| 	"github.com/yookoala/realpath" | ||||
| 	"github.com/z7zmey/php-parser/parser" | ||||
| 	"github.com/z7zmey/php-parser/php5" | ||||
| 	"github.com/z7zmey/php-parser/php7" | ||||
| 	"github.com/z7zmey/php-parser/printer" | ||||
| 	"github.com/z7zmey/php-parser/visitor" | ||||
| ) | ||||
| 
 | ||||
| var wg sync.WaitGroup | ||||
| var usePhp5 *bool | ||||
| var phpVersion string | ||||
| var dumpType string | ||||
| var profiler string | ||||
| var withFreeFloating *bool | ||||
| @ -40,12 +38,12 @@ type result struct { | ||||
| } | ||||
| 
 | ||||
| func main() { | ||||
| 	usePhp5 = flag.Bool("php5", false, "parse as PHP5") | ||||
| 	withFreeFloating = flag.Bool("ff", false, "parse and show free floating strings") | ||||
| 	showResolvedNs = flag.Bool("r", false, "resolve names") | ||||
| 	printBack = flag.Bool("pb", false, "print AST back into the parsed file") | ||||
| 	flag.StringVar(&dumpType, "d", "", "dump format: [custom, go, json, pretty_json]") | ||||
| 	flag.StringVar(&profiler, "prof", "", "start profiler: [cpu, mem, trace]") | ||||
| 	flag.StringVar(&phpVersion, "phpver", "7.4", "php version") | ||||
| 
 | ||||
| 	flag.Parse() | ||||
| 
 | ||||
| @ -104,18 +102,15 @@ func processPath(pathList []string, fileCh chan<- *file) { | ||||
| } | ||||
| 
 | ||||
| func parserWorker(fileCh <-chan *file, r chan<- result) { | ||||
| 	var parserWorker parser.Parser | ||||
| 
 | ||||
| 	for { | ||||
| 		f, ok := <-fileCh | ||||
| 		if !ok { | ||||
| 			return | ||||
| 		} | ||||
| 
 | ||||
| 		if *usePhp5 { | ||||
| 			parserWorker = php5.NewParser(f.content) | ||||
| 		} else { | ||||
| 			parserWorker = php7.NewParser(f.content) | ||||
| 		parserWorker, err := parser.NewParser(f.content, phpVersion) | ||||
| 		if err != nil { | ||||
| 			panic(err.Error()) | ||||
| 		} | ||||
| 
 | ||||
| 		if *withFreeFloating { | ||||
|  | ||||
| @ -80,12 +80,12 @@ func TestReference(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -165,12 +165,12 @@ func TestReferenceNew(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -287,12 +287,12 @@ func TestReferenceArgs(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -362,12 +362,12 @@ func TestAssign(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -437,12 +437,12 @@ func TestBitwiseAnd(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -512,12 +512,12 @@ func TestBitwiseOr(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -587,12 +587,12 @@ func TestBitwiseXor(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -662,12 +662,12 @@ func TestConcat(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -737,12 +737,12 @@ func TestDiv(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -812,12 +812,12 @@ func TestMinus(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -887,12 +887,12 @@ func TestMod(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -962,12 +962,12 @@ func TestMul(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1037,12 +1037,12 @@ func TestPlus(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1112,12 +1112,12 @@ func TestPow(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1187,12 +1187,12 @@ func TestShiftLeft(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1262,12 +1262,12 @@ func TestShiftRight(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -78,12 +78,12 @@ func TestBitwiseAnd(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -153,12 +153,12 @@ func TestBitwiseOr(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -228,12 +228,12 @@ func TestBitwiseXor(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -303,12 +303,12 @@ func TestBooleanAnd(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -378,12 +378,12 @@ func TestBooleanOr(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -453,7 +453,7 @@ func TestCoalesce(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -523,12 +523,12 @@ func TestConcat(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -598,12 +598,12 @@ func TestDiv(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -673,12 +673,12 @@ func TestEqual(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -748,12 +748,12 @@ func TestGreaterOrEqual(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -823,12 +823,12 @@ func TestGreater(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -898,12 +898,12 @@ func TestIdentical(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -973,12 +973,12 @@ func TestLogicalAnd(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1048,12 +1048,12 @@ func TestLogicalOr(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1123,12 +1123,12 @@ func TestLogicalXor(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1198,12 +1198,12 @@ func TestMinus(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1273,12 +1273,12 @@ func TestMod(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1348,12 +1348,12 @@ func TestMul(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1423,12 +1423,12 @@ func TestNotEqual(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1498,12 +1498,12 @@ func TestNotIdentical(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1573,12 +1573,12 @@ func TestPlus(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1648,12 +1648,12 @@ func TestPow(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1723,12 +1723,12 @@ func TestShiftLeft(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1798,12 +1798,12 @@ func TestShiftRight(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1873,12 +1873,12 @@ func TestSmallerOrEqual(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1948,12 +1948,12 @@ func TestSmaller(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -2023,7 +2023,7 @@ func TestSpaceship(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -61,12 +61,12 @@ func TestArray(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -119,12 +119,12 @@ func TestBool(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -177,12 +177,12 @@ func TestBoolShort(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -235,12 +235,12 @@ func TestDouble(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -293,12 +293,12 @@ func TestCastFloat(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -351,12 +351,12 @@ func TestInt(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -409,12 +409,12 @@ func TestIntShort(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -467,12 +467,12 @@ func TestObject(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -525,12 +525,12 @@ func TestString(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -583,12 +583,12 @@ func TestBinaryString(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -641,12 +641,12 @@ func TestUnset(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -70,12 +70,12 @@ func TestArrayDimFetch(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -154,12 +154,12 @@ func TestArrayDimFetchNested(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -45,12 +45,12 @@ func TestArray(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -105,12 +105,12 @@ func TestArrayItem(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -208,12 +208,12 @@ func TestArrayItems(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -61,12 +61,12 @@ func TestBitwiseNot(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -61,12 +61,12 @@ func TestBooleanNot(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -74,12 +74,12 @@ func TestClassConstFetch(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -133,12 +133,12 @@ func TestStaticClassConstFetch(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -61,12 +61,12 @@ func TestCloneBrackets(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -119,12 +119,12 @@ func TestClone(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -50,12 +50,12 @@ func TestClosure(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -203,12 +203,12 @@ func TestClosureUse(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -356,12 +356,12 @@ func TestClosureUse2(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -420,7 +420,7 @@ func TestClosureReturnType(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -65,12 +65,12 @@ func TestConstFetch(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -125,12 +125,12 @@ func TestConstFetchRelative(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -185,12 +185,12 @@ func TestConstFetchFullyQualified(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -61,12 +61,12 @@ func TestEmpty(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -61,12 +61,12 @@ func TestErrorSuppress(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -61,12 +61,12 @@ func TestEval(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -45,12 +45,12 @@ func TestExit(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -87,12 +87,12 @@ func TestExitEmpty(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -146,12 +146,12 @@ func TestExitExpr(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -188,12 +188,12 @@ func TestDie(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -230,12 +230,12 @@ func TestDieEmpty(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -289,12 +289,12 @@ func TestDieExpr(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -76,12 +76,12 @@ func TestFunctionCall(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -144,12 +144,12 @@ func TestFunctionCallRelative(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -233,12 +233,12 @@ func TestFunctionFullyQualified(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -336,12 +336,12 @@ func TestFunctionCallVar(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -450,12 +450,12 @@ func TestFunctionCallExprArg(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -61,12 +61,12 @@ func TestPostDec(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -119,12 +119,12 @@ func TestPostInc(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -177,12 +177,12 @@ func TestPreDec(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -235,12 +235,12 @@ func TestPreInc(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -61,12 +61,12 @@ func TestInclude(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -119,12 +119,12 @@ func TestIncludeOnce(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -177,12 +177,12 @@ func TestRequire(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -235,12 +235,12 @@ func TestRequireOnce(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -82,12 +82,12 @@ func TestInstanceOf(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -159,12 +159,12 @@ func TestInstanceOfRelative(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -236,12 +236,12 @@ func TestInstanceOfFullyQualified(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -63,12 +63,12 @@ func TestIsset(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -140,12 +140,12 @@ func TestIssetVariables(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -70,12 +70,12 @@ func TestEmptyList(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -163,12 +163,12 @@ func TestList(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -264,12 +264,12 @@ func TestListArrayIndex(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -375,12 +375,12 @@ func TestListList(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -469,12 +469,12 @@ func TestListEmptyItem(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -565,12 +565,12 @@ func TestListEmptyItems(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -78,12 +78,12 @@ func TestMethodCall(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -65,12 +65,12 @@ func TestNew(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -133,12 +133,12 @@ func TestNewRelative(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -201,12 +201,12 @@ func TestNewFullyQualified(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -316,7 +316,7 @@ func TestNewAnonymous(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -61,12 +61,12 @@ func TestPrint(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -70,12 +70,12 @@ func TestPropertyFetch(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -105,12 +105,12 @@ func TestForeachWithRef(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -74,12 +74,12 @@ func TestShellExec(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -45,12 +45,12 @@ func TestShortArray(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -105,12 +105,12 @@ func TestShortArrayItem(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -208,12 +208,12 @@ func TestShortArrayItems(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -95,7 +95,7 @@ func TestShortList(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -191,7 +191,7 @@ func TestShortListArrayIndex(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -297,7 +297,7 @@ func TestShortListList(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -82,12 +82,12 @@ func TestStaticCall(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -159,12 +159,12 @@ func TestStaticCallRelative(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -236,12 +236,12 @@ func TestStaticCallFullyQualified(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -321,12 +321,12 @@ func TestStaticCallVar(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -404,12 +404,12 @@ func TestStaticCallVarVar(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -81,12 +81,12 @@ func TestStaticPropertyFetch(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -158,12 +158,12 @@ func TestStaticPropertyFetchRelative(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -235,12 +235,12 @@ func TestStaticPropertyFetchFullyQualified(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -95,12 +95,12 @@ func TestTernary(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -170,12 +170,12 @@ func TestTernarySimple(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -304,12 +304,12 @@ func TestTernaryNestedTrue(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -438,12 +438,12 @@ func TestTernaryNestedCond(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -61,12 +61,12 @@ func TestUnaryMinus(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -119,12 +119,12 @@ func TestUnaryPlus(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -53,12 +53,12 @@ func TestVariable(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -111,12 +111,12 @@ func TestVariableVariable(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -45,12 +45,12 @@ func TestYield(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -103,12 +103,12 @@ func TestYieldVal(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -178,12 +178,12 @@ func TestYieldKeyVal(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -228,12 +228,12 @@ func TestYieldExpr(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -295,12 +295,12 @@ func TestYieldKeyExpr(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -353,7 +353,7 @@ func TestYieldFrom(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -72,12 +72,12 @@ func TestName(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -140,12 +140,12 @@ func TestFullyQualified(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -208,12 +208,12 @@ func TestRelative(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -73,12 +73,12 @@ func TestSimpleVar(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -142,12 +142,12 @@ func TestSimpleVarOneChar(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -220,12 +220,12 @@ func TestSimpleVarEndsEcapsed(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -306,12 +306,12 @@ func TestStringVarCurveOpen(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -401,12 +401,12 @@ func TestSimpleVarPropertyFetch(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -470,12 +470,12 @@ func TestDollarOpenCurlyBraces(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -556,12 +556,12 @@ func TestDollarOpenCurlyBracesDimNumber(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -650,12 +650,12 @@ func TestCurlyOpenMethodCall(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -86,12 +86,12 @@ LBL; | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -168,12 +168,12 @@ LBL; | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -224,12 +224,12 @@ LBL; | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -268,12 +268,12 @@ CAD; | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -324,12 +324,12 @@ CAD; | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -45,12 +45,12 @@ func TestMagicConstant(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -44,12 +44,12 @@ func TestLNumber(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -86,12 +86,12 @@ func TestDNumber(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -128,12 +128,12 @@ func TestFloat(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -170,12 +170,12 @@ func TestBinaryLNumber(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -212,12 +212,12 @@ func TestBinaryDNumber(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -254,12 +254,12 @@ func TestHLNumber(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -296,12 +296,12 @@ func TestHDNumber(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -44,12 +44,12 @@ func TestDoubleQuotedScalarString(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -86,12 +86,12 @@ func TestDoubleQuotedScalarStringWithEscapedVar(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -130,12 +130,12 @@ func TestMultilineDoubleQuotedScalarString(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -172,12 +172,12 @@ func TestSingleQuotedScalarString(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -216,12 +216,12 @@ func TestMultilineSingleQuotedScalarString(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -64,12 +64,12 @@ func TestAltIf(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -163,12 +163,12 @@ func TestAltElseIf(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -243,12 +243,12 @@ func TestAltElse(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -395,12 +395,12 @@ func TestAltElseElseIf(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -123,7 +123,7 @@ func TestClassConstList(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -227,12 +227,12 @@ func TestClassConstListWithoutModifiers(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -76,12 +76,12 @@ func TestSimpleClassMethod(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -208,12 +208,12 @@ func TestPrivateProtectedClassMethod(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -301,7 +301,7 @@ func TestPhp5ClassMethod(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual := php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -408,7 +408,7 @@ func TestPhp7ClassMethod(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -506,12 +506,12 @@ func TestAbstractClassMethod(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -619,7 +619,7 @@ func TestPhp7AbstractClassMethod(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -48,12 +48,12 @@ func TestSimpleClass(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -103,12 +103,12 @@ func TestAbstractClass(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -185,12 +185,12 @@ func TestClassExtends(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -269,12 +269,12 @@ func TestClassImplement(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -372,12 +372,12 @@ func TestClassImplements(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -506,7 +506,7 @@ func TestAnonimousClass(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -92,12 +92,12 @@ func TestConstList(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -63,12 +63,12 @@ func TestContinueEmpty(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -132,12 +132,12 @@ func TestContinueLight(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -201,12 +201,12 @@ func TestContinue(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -73,12 +73,12 @@ func TestDeclare(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -171,12 +171,12 @@ func TestDeclareStmts(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -243,12 +243,12 @@ func TestAltDeclare(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -54,12 +54,12 @@ func TestDo(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -66,12 +66,12 @@ func TestSimpleEcho(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -118,12 +118,12 @@ func TestEcho(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -45,12 +45,12 @@ func TestExpression(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -174,12 +174,12 @@ func TestFor(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -279,12 +279,12 @@ func TestAltFor(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -79,12 +79,12 @@ func TestForeach(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -147,12 +147,12 @@ func TestForeachExpr(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -223,12 +223,12 @@ func TestAltForeach(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -316,12 +316,12 @@ func TestForeachWithKey(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -401,12 +401,12 @@ func TestForeachExprWithKey(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -502,12 +502,12 @@ func TestForeachWithRef(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -613,12 +613,12 @@ func TestForeachWithList(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -50,12 +50,12 @@ func TestSimpleFunction(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -104,12 +104,12 @@ func TestFunctionReturn(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -249,12 +249,12 @@ func TestFunctionReturnVar(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -312,12 +312,12 @@ func TestRefFunction(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -376,7 +376,7 @@ func TestReturnTypeFunction(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -55,12 +55,12 @@ func TestGlobal(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -192,12 +192,12 @@ func TestGlobalVars(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -60,12 +60,12 @@ func TestGotoLabel(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -34,12 +34,12 @@ func TestHaltCompiler(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -62,12 +62,12 @@ func TestIf(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -157,12 +157,12 @@ func TestElseIf(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -233,12 +233,12 @@ func TestElse(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -379,12 +379,12 @@ func TestElseElseIf(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -533,12 +533,12 @@ func TestElseIfElseIfElse(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -43,12 +43,12 @@ func TestInlineHtml(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -47,12 +47,12 @@ func TestInterface(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -120,12 +120,12 @@ func TestInterfaceExtend(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -212,12 +212,12 @@ func TestInterfaceExtends(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -55,12 +55,12 @@ func TestNamespace(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -108,12 +108,12 @@ func TestNamespaceStmts(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -142,12 +142,12 @@ func TestAnonymousNamespace(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -96,12 +96,12 @@ func TestProperty(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -232,12 +232,12 @@ func TestProperties(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -368,12 +368,12 @@ func TestProperties2(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -63,12 +63,12 @@ func TestStaticVar(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -157,12 +157,12 @@ func TestStaticVars(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -251,12 +251,12 @@ func TestStaticVars2(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -106,12 +106,12 @@ func TestAltSwitch(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -199,12 +199,12 @@ func TestAltSwitchSemicolon(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -310,12 +310,12 @@ func TestSwitch(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -421,12 +421,12 @@ func TestSwitchSemicolon(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -52,12 +52,12 @@ func TestThrow(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -45,12 +45,12 @@ func TestTrait(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -85,12 +85,12 @@ func TestTraitUse(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -186,12 +186,12 @@ func TestTraitsUse(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -287,12 +287,12 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -424,12 +424,12 @@ func TestTraitsUseModifier(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -570,12 +570,12 @@ func TestTraitsUseAliasModifier(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -810,12 +810,12 @@ func TestTraitsUseAdaptions(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -41,12 +41,12 @@ func TestTry(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -126,12 +126,12 @@ func TestTryCatch(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -230,7 +230,7 @@ func TestPhp7TryCatch(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -357,12 +357,12 @@ func TestTryCatchCatch(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -451,12 +451,12 @@ func TestTryCatchFinally(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -628,12 +628,12 @@ func TestTryCatchCatchCatch(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -54,12 +54,12 @@ func TestUnset(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -123,12 +123,12 @@ func TestUnsetVars(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -192,7 +192,7 @@ func TestUnsetTrailingComma(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -65,12 +65,12 @@ func TestSimpleUse(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -127,12 +127,12 @@ func TestUseFullyQualified(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -198,12 +198,12 @@ func TestUseFullyQualifiedAlias(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -287,12 +287,12 @@ func TestUseList(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -385,12 +385,12 @@ func TestUseListAlias(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -483,12 +483,12 @@ func TestUseListFunctionType(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -599,12 +599,12 @@ func TestUseListFunctionTypeAliases(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -697,12 +697,12 @@ func TestUseListConstType(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -813,12 +813,12 @@ func TestUseListConstTypeAliases(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -921,7 +921,7 @@ func TestGroupUse(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1033,7 +1033,7 @@ func TestGroupUseAlias(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1145,7 +1145,7 @@ func TestFunctionGroupUse(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1257,7 +1257,7 @@ func TestConstGroupUse(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1378,7 +1378,7 @@ func TestMixedGroupUse(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -63,12 +63,12 @@ func TestBreakEmpty(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -132,12 +132,12 @@ func TestBreakLight(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -201,12 +201,12 @@ func TestBreak(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -55,12 +55,12 @@ func TestIdentifier(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -794,7 +794,7 @@ func TestPhp7ArgumentNode(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -1436,7 +1436,7 @@ func TestPhp5ArgumentNode(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual := php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -2096,7 +2096,7 @@ func TestPhp7ParameterNode(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -2724,7 +2724,7 @@ func TestPhp5ParameterNode(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual := php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -2743,12 +2743,12 @@ func TestCommentEndFile(t *testing.T) { | ||||
| 		Stmts: []node.Node{}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual = php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -3,6 +3,9 @@ package parser | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/errors" | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/php5" | ||||
| 	"github.com/z7zmey/php-parser/php7" | ||||
| 	"github.com/z7zmey/php-parser/version" | ||||
| ) | ||||
| 
 | ||||
| // Parser interface | ||||
| @ -12,3 +15,20 @@ type Parser interface { | ||||
| 	GetErrors() []*errors.Error | ||||
| 	WithFreeFloating() | ||||
| } | ||||
| 
 | ||||
| func NewParser(src []byte, v string) (Parser, error) { | ||||
| 	var parser Parser | ||||
| 
 | ||||
| 	r, err := version.Compare(v, "7.0") | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
| 
 | ||||
| 	if r == -1 { | ||||
| 		parser = php5.NewParser(src, v) | ||||
| 	} else { | ||||
| 		parser = php7.NewParser(src, v) | ||||
| 	} | ||||
| 
 | ||||
| 	return parser, nil | ||||
| } | ||||
|  | ||||
| @ -6,8 +6,8 @@ import ( | ||||
| 	"github.com/z7zmey/php-parser/errors" | ||||
| 	"github.com/z7zmey/php-parser/freefloating" | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/parser" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/positionbuilder" | ||||
| 	"github.com/z7zmey/php-parser/scanner" | ||||
| ) | ||||
| 
 | ||||
| @ -19,13 +19,14 @@ func (lval *yySymType) Token(t *scanner.Token) { | ||||
| type Parser struct { | ||||
| 	Lexer           scanner.Scanner | ||||
| 	currentToken    *scanner.Token | ||||
| 	positionBuilder *parser.PositionBuilder | ||||
| 	positionBuilder *positionbuilder.PositionBuilder | ||||
| 	rootNode        node.Node | ||||
| } | ||||
| 
 | ||||
| // NewParser creates and returns new Parser | ||||
| func NewParser(src []byte) *Parser { | ||||
| func NewParser(src []byte, v string) *Parser { | ||||
| 	lexer := scanner.NewLexer(src) | ||||
| 	lexer.PHPVersion = v | ||||
| 
 | ||||
| 	return &Parser{ | ||||
| 		lexer, | ||||
| @ -62,7 +63,7 @@ func (l *Parser) Parse() int { | ||||
| 	// init | ||||
| 	l.Lexer.SetErrors(nil) | ||||
| 	l.rootNode = nil | ||||
| 	l.positionBuilder = &parser.PositionBuilder{} | ||||
| 	l.positionBuilder = &positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	// parse | ||||
| 
 | ||||
|  | ||||
| @ -413,7 +413,7 @@ CAD; | ||||
| 	` | ||||
| 
 | ||||
| 	for n := 0; n < b.N; n++ { | ||||
| 		php5parser := php5.NewParser([]byte(src)) | ||||
| 		php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 		php5parser.Parse() | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -18401,7 +18401,7 @@ func TestPhp5(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual := php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -18516,7 +18516,7 @@ func TestPhp5Strings(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual := php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -18706,7 +18706,7 @@ CAD; | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual := php5parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -18726,7 +18726,7 @@ func TestPhp5ControlCharsErrors(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.Parse() | ||||
| 	actual := php5parser.GetErrors() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -6,8 +6,8 @@ import ( | ||||
| 	"github.com/z7zmey/php-parser/errors" | ||||
| 	"github.com/z7zmey/php-parser/freefloating" | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/parser" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/positionbuilder" | ||||
| 	"github.com/z7zmey/php-parser/scanner" | ||||
| ) | ||||
| 
 | ||||
| @ -19,13 +19,14 @@ func (lval *yySymType) Token(t *scanner.Token) { | ||||
| type Parser struct { | ||||
| 	Lexer           scanner.Scanner | ||||
| 	currentToken    *scanner.Token | ||||
| 	positionBuilder *parser.PositionBuilder | ||||
| 	positionBuilder *positionbuilder.PositionBuilder | ||||
| 	rootNode        node.Node | ||||
| } | ||||
| 
 | ||||
| // NewParser creates and returns new Parser | ||||
| func NewParser(src []byte) *Parser { | ||||
| func NewParser(src []byte, v string) *Parser { | ||||
| 	lexer := scanner.NewLexer(src) | ||||
| 	lexer.PHPVersion = v | ||||
| 
 | ||||
| 	return &Parser{ | ||||
| 		lexer, | ||||
| @ -61,7 +62,7 @@ func (l *Parser) Parse() int { | ||||
| 	// init | ||||
| 	l.Lexer.SetErrors(nil) | ||||
| 	l.rootNode = nil | ||||
| 	l.positionBuilder = &parser.PositionBuilder{} | ||||
| 	l.positionBuilder = &positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	// parse | ||||
| 
 | ||||
|  | ||||
| @ -381,7 +381,7 @@ CAD; | ||||
| 	` | ||||
| 
 | ||||
| 	for n := 0; n < b.N; n++ { | ||||
| 		php7parser := php7.NewParser([]byte(src)) | ||||
| 		php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 		php7parser.Parse() | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -16118,7 +16118,7 @@ func TestPhp7(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -16233,7 +16233,7 @@ func TestPhp5Strings(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -16423,7 +16423,7 @@ CAD; | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetRootNode() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
| @ -16443,7 +16443,7 @@ func TestPhp7ControlCharsErrors(t *testing.T) { | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.Parse() | ||||
| 	actual := php7parser.GetErrors() | ||||
| 	assert.DeepEqual(t, expected, actual) | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| package parser | ||||
| package positionbuilder | ||||
| 
 | ||||
| import ( | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| @ -1,17 +1,17 @@ | ||||
| package parser_test | ||||
| package positionbuilder_test | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| 
 | ||||
| 	"github.com/z7zmey/php-parser/node" | ||||
| 	"github.com/z7zmey/php-parser/parser" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/positionbuilder" | ||||
| 
 | ||||
| 	"github.com/z7zmey/php-parser/scanner" | ||||
| ) | ||||
| 
 | ||||
| func TestNewTokenPosition(t *testing.T) { | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	tkn := &scanner.Token{ | ||||
| 		Value:     `foo`, | ||||
| @ -29,7 +29,7 @@ func TestNewTokenPosition(t *testing.T) { | ||||
| } | ||||
| 
 | ||||
| func TestNewTokensPosition(t *testing.T) { | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	token1 := &scanner.Token{ | ||||
| 		Value:     `foo`, | ||||
| @ -62,7 +62,7 @@ func TestNewNodePosition(t *testing.T) { | ||||
| 		EndPos:    3, | ||||
| 	}) | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewNodePosition(n) | ||||
| 
 | ||||
| @ -87,7 +87,7 @@ func TestNewTokenNodePosition(t *testing.T) { | ||||
| 		EndPos:    12, | ||||
| 	}) | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewTokenNodePosition(tkn, n) | ||||
| 
 | ||||
| @ -113,7 +113,7 @@ func TestNewNodeTokenPosition(t *testing.T) { | ||||
| 		EndPos:    12, | ||||
| 	} | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewNodeTokenPosition(n, tkn) | ||||
| 
 | ||||
| @ -139,7 +139,7 @@ func TestNewNodeListPosition(t *testing.T) { | ||||
| 		EndPos:    19, | ||||
| 	}) | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewNodeListPosition([]node.Node{n1, n2}) | ||||
| 
 | ||||
| @ -165,7 +165,7 @@ func TestNewNodesPosition(t *testing.T) { | ||||
| 		EndPos:    19, | ||||
| 	}) | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewNodesPosition(n1, n2) | ||||
| 
 | ||||
| @ -199,7 +199,7 @@ func TestNewNodeListTokenPosition(t *testing.T) { | ||||
| 		EndPos:    22, | ||||
| 	} | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewNodeListTokenPosition([]node.Node{n1, n2}, tkn) | ||||
| 
 | ||||
| @ -233,7 +233,7 @@ func TestNewTokenNodeListPosition(t *testing.T) { | ||||
| 		EndPos:    20, | ||||
| 	}) | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewTokenNodeListPosition(tkn, []node.Node{n1, n2}) | ||||
| 
 | ||||
| @ -267,7 +267,7 @@ func TestNewNodeNodeListPosition(t *testing.T) { | ||||
| 		EndPos:    26, | ||||
| 	}) | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewNodeNodeListPosition(n1, []node.Node{n2, n3}) | ||||
| 
 | ||||
| @ -299,7 +299,7 @@ func TestNewNodeListNodePosition(t *testing.T) { | ||||
| 		EndPos:    26, | ||||
| 	}) | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewNodeListNodePosition([]node.Node{n1, n2}, n3) | ||||
| 
 | ||||
| @ -309,7 +309,7 @@ func TestNewNodeListNodePosition(t *testing.T) { | ||||
| } | ||||
| 
 | ||||
| func TestNewOptionalListTokensPosition(t *testing.T) { | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	token1 := &scanner.Token{ | ||||
| 		Value:     `foo`, | ||||
| @ -356,7 +356,7 @@ func TestNewOptionalListTokensPosition2(t *testing.T) { | ||||
| 		EndPos:    26, | ||||
| 	}) | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	token1 := &scanner.Token{ | ||||
| 		Value:     `foo`, | ||||
| @ -381,7 +381,7 @@ func TestNewOptionalListTokensPosition2(t *testing.T) { | ||||
| } | ||||
| 
 | ||||
| func TestNilNodePos(t *testing.T) { | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewNodesPosition(nil, nil) | ||||
| 
 | ||||
| @ -399,7 +399,7 @@ func TestNilNodeListPos(t *testing.T) { | ||||
| 		EndPos:    8, | ||||
| 	}) | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewNodeNodeListPosition(n1, nil) | ||||
| 
 | ||||
| @ -417,7 +417,7 @@ func TestNilNodeListTokenPos(t *testing.T) { | ||||
| 		EndPos:    3, | ||||
| 	} | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewNodeListTokenPosition(nil, token) | ||||
| 
 | ||||
| @ -435,7 +435,7 @@ func TestEmptyNodeListPos(t *testing.T) { | ||||
| 		EndPos:    8, | ||||
| 	}) | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewNodeNodeListPosition(n1, []node.Node{}) | ||||
| 
 | ||||
| @ -453,7 +453,7 @@ func TestEmptyNodeListTokenPos(t *testing.T) { | ||||
| 		EndPos:    3, | ||||
| 	} | ||||
| 
 | ||||
| 	builder := parser.PositionBuilder{} | ||||
| 	builder := positionbuilder.PositionBuilder{} | ||||
| 
 | ||||
| 	pos := builder.NewNodeListTokenPosition([]node.Node{}, token) | ||||
| 
 | ||||
| @ -10,7 +10,7 @@ import ( | ||||
| ) | ||||
| 
 | ||||
| func parsePhp5(src string) node.Node { | ||||
| 	php5parser := php5.NewParser([]byte(src)) | ||||
| 	php5parser := php5.NewParser([]byte(src), "5.6") | ||||
| 	php5parser.WithFreeFloating() | ||||
| 	php5parser.Parse() | ||||
| 
 | ||||
|  | ||||
| @ -29,7 +29,7 @@ abstract class Bar extends Baz | ||||
| 
 | ||||
| 	// parse | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.WithFreeFloating() | ||||
| 	php7parser.Parse() | ||||
| 
 | ||||
| @ -61,7 +61,7 @@ abstract class Bar extends Baz | ||||
| } | ||||
| 
 | ||||
| func parse(src string) node.Node { | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.WithFreeFloating() | ||||
| 	php7parser.Parse() | ||||
| 
 | ||||
|  | ||||
| @ -7,6 +7,7 @@ import ( | ||||
| 	"github.com/z7zmey/php-parser/errors" | ||||
| 	"github.com/z7zmey/php-parser/freefloating" | ||||
| 	"github.com/z7zmey/php-parser/position" | ||||
| 	"github.com/z7zmey/php-parser/version" | ||||
| ) | ||||
| 
 | ||||
| type Scanner interface { | ||||
| @ -133,11 +134,12 @@ func (lex *Lexer) isNotStringEnd(s byte) bool { | ||||
| } | ||||
| 
 | ||||
| func (lex *Lexer) isHeredocEnd(p int) bool { | ||||
| 	if lex.PHPVersion == "" { | ||||
| 	r, err := version.Compare(lex.PHPVersion, "7.3") | ||||
| 	if err != nil { | ||||
| 		return lex.isHeredocEndSince73(p) | ||||
| 	} | ||||
| 
 | ||||
| 	if comparePHPVersion(lex.PHPVersion, "7.3") == -1 { | ||||
| 	if r == -1 { | ||||
| 		return lex.isHeredocEndBefore73(p) | ||||
| 	} | ||||
| 
 | ||||
| @ -271,26 +273,3 @@ func isValidVarNameStart(r byte) bool { | ||||
| func isValidVarName(r byte) bool { | ||||
| 	return (r >= 'A' && r <= 'Z') || (r >= 'a' && r <= 'z') || (r >= '0' && r <= '9') || r == '_' || (r >= 0x80 && r <= 0xff) | ||||
| } | ||||
| 
 | ||||
| func comparePHPVersion(a string, b string) int { | ||||
| 	first := strings.Split(a, ".") | ||||
| 	second := strings.Split(b, ".") | ||||
| 
 | ||||
| 	if first[0] < second[0] { | ||||
| 		return -1 | ||||
| 	} | ||||
| 
 | ||||
| 	if first[0] > second[0] { | ||||
| 		return 1 | ||||
| 	} | ||||
| 
 | ||||
| 	if first[1] < second[1] { | ||||
| 		return -1 | ||||
| 	} | ||||
| 
 | ||||
| 	if first[1] > second[1] { | ||||
| 		return 1 | ||||
| 	} | ||||
| 
 | ||||
| 	return 0 | ||||
| } | ||||
|  | ||||
							
								
								
									
										61
									
								
								version/version.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								version/version.go
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,61 @@ | ||||
| package version | ||||
| 
 | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| ) | ||||
| 
 | ||||
| type version struct { | ||||
| 	major int | ||||
| 	minor int | ||||
| } | ||||
| 
 | ||||
| func Compare(a string, b string) (int, error) { | ||||
| 	first, err := parse(a) | ||||
| 	if err != nil { | ||||
| 		return 0, err | ||||
| 	} | ||||
| 
 | ||||
| 	second, err := parse(b) | ||||
| 	if err != nil { | ||||
| 		return 0, err | ||||
| 	} | ||||
| 
 | ||||
| 	if first.major < second.major { | ||||
| 		return -1, nil | ||||
| 	} | ||||
| 
 | ||||
| 	if first.major > second.major { | ||||
| 		return 1, nil | ||||
| 	} | ||||
| 
 | ||||
| 	if first.minor < second.minor { | ||||
| 		return -1, nil | ||||
| 	} | ||||
| 
 | ||||
| 	if first.minor > second.minor { | ||||
| 		return 1, nil | ||||
| 	} | ||||
| 
 | ||||
| 	return 0, nil | ||||
| } | ||||
| 
 | ||||
| func parse(v string) (version, error) { | ||||
| 	parts := strings.Split(v, ".") | ||||
| 	if len(parts) != 2 { | ||||
| 		return version{}, errors.New("version must contain major and minor parts") | ||||
| 	} | ||||
| 
 | ||||
| 	major, err := strconv.Atoi(parts[0]) | ||||
| 	if err != nil { | ||||
| 		return version{}, err | ||||
| 	} | ||||
| 
 | ||||
| 	minor, err := strconv.Atoi(parts[1]) | ||||
| 	if err != nil { | ||||
| 		return version{}, err | ||||
| 	} | ||||
| 
 | ||||
| 	return version{major, minor}, nil | ||||
| } | ||||
| @ -20,7 +20,7 @@ func ExampleDumper() { | ||||
| 			} | ||||
| 		}` | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.WithFreeFloating() | ||||
| 	php7parser.Parse() | ||||
| 	nodes := php7parser.GetRootNode() | ||||
|  | ||||
| @ -20,7 +20,7 @@ func ExampleGoDumper() { | ||||
| 			} | ||||
| 		}` | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.WithFreeFloating() | ||||
| 	php7parser.Parse() | ||||
| 	nodes := php7parser.GetRootNode() | ||||
|  | ||||
| @ -22,7 +22,7 @@ func ExampleJsonDumper() { | ||||
| 			} | ||||
| 		}` | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.WithFreeFloating() | ||||
| 	php7parser.Parse() | ||||
| 	nodes := php7parser.GetRootNode() | ||||
|  | ||||
| @ -26,7 +26,7 @@ func ExamplePrettyJsonDumper() { | ||||
| 		} | ||||
| 		` | ||||
| 
 | ||||
| 	php7parser := php7.NewParser([]byte(src)) | ||||
| 	php7parser := php7.NewParser([]byte(src), "7.4") | ||||
| 	php7parser.WithFreeFloating() | ||||
| 	php7parser.Parse() | ||||
| 	nodes := php7parser.GetRootNode() | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user