diff --git a/.gitignore b/.gitignore index b67e7f0..94f331c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ # Binaries php2go +# Generated files during testing +fixtures/**.json + # .. diff --git a/fixtures/0001.php.parse.json b/fixtures/0001.php.parse.json deleted file mode 100644 index 938a94b..0000000 --- a/fixtures/0001.php.parse.json +++ /dev/null @@ -1,1168 +0,0 @@ -{ - "type": "*node.Root", - "position": { - "startPos": 7, - "endPos": 400, - "startLine": 3, - "endLine": 30 - }, - "Stmts": [ - { - "type": "*stmt.Class", - "position": { - "startPos": 7, - "endPos": 250, - "startLine": 3, - "endLine": 19 - }, - "PhpDocComment": "", - "ClassName": { - "type": "*node.Identifier", - "position": { - "startPos": 13, - "endPos": 16, - "startLine": 3, - "endLine": 3 - }, - "Value": "Bar" - }, - "Stmts": [ - { - "type": "*stmt.PropertyList", - "position": { - "startPos": 20, - "endPos": 41, - "startLine": 4, - "endLine": 4 - }, - "Modifiers": [ - { - "type": "*node.Identifier", - "position": { - "startPos": 20, - "endPos": 29, - "startLine": 4, - "endLine": 4 - }, - "Value": "protected" - } - ], - "Properties": [ - { - "type": "*stmt.Property", - "position": { - "startPos": 30, - "endPos": 40, - "startLine": 4, - "endLine": 4 - }, - "PhpDocComment": "", - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 30, - "endPos": 33, - "startLine": 4, - "endLine": 4 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 30, - "endPos": 33, - "startLine": 4, - "endLine": 4 - }, - "Value": "mX" - } - }, - "Expr": { - "type": "*expr.ConstFetch", - "position": { - "startPos": 36, - "endPos": 40, - "startLine": 4, - "endLine": 4 - }, - "Constant": { - "type": "*name.Name", - "position": { - "startPos": 36, - "endPos": 40, - "startLine": 4, - "endLine": 4 - }, - "Parts": [ - { - "type": "*name.NamePart", - "position": { - "startPos": 36, - "endPos": 40, - "startLine": 4, - "endLine": 4 - }, - "Value": "null" - } - ] - } - } - } - ] - }, - { - "type": "*stmt.PropertyList", - "position": { - "startPos": 43, - "endPos": 61, - "startLine": 5, - "endLine": 5 - }, - "Modifiers": [ - { - "type": "*node.Identifier", - "position": { - "startPos": 43, - "endPos": 52, - "startLine": 5, - "endLine": 5 - }, - "Value": "protected" - } - ], - "Properties": [ - { - "type": "*stmt.Property", - "position": { - "startPos": 53, - "endPos": 60, - "startLine": 5, - "endLine": 5 - }, - "PhpDocComment": "", - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 53, - "endPos": 56, - "startLine": 5, - "endLine": 5 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 53, - "endPos": 56, - "startLine": 5, - "endLine": 5 - }, - "Value": "mY" - } - }, - "Expr": { - "type": "*scalar.Lnumber", - "position": { - "startPos": 59, - "endPos": 60, - "startLine": 5, - "endLine": 5 - }, - "Value": "3" - } - } - ] - }, - { - "type": "*stmt.ClassMethod", - "position": { - "startPos": 65, - "endPos": 119, - "startLine": 7, - "endLine": 9 - }, - "PhpDocComment": "", - "ReturnsRef": false, - "MethodName": { - "type": "*node.Identifier", - "position": { - "startPos": 74, - "endPos": 85, - "startLine": 7, - "endLine": 7 - }, - "Value": "__construct" - }, - "Params": [ - { - "type": "*node.Parameter", - "position": { - "startPos": 86, - "endPos": 95, - "startLine": 7, - "endLine": 7 - }, - "ByRef": false, - "Variadic": false, - "VariableType": { - "type": "*name.Name", - "position": { - "startPos": 86, - "endPos": 92, - "startLine": 7, - "endLine": 7 - }, - "Parts": [ - { - "type": "*name.NamePart", - "position": { - "startPos": 86, - "endPos": 92, - "startLine": 7, - "endLine": 7 - }, - "Value": "string" - } - ] - }, - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 93, - "endPos": 95, - "startLine": 7, - "endLine": 7 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 93, - "endPos": 95, - "startLine": 7, - "endLine": 7 - }, - "Value": "x" - } - } - } - ], - "Stmt": { - "type": "*stmt.StmtList", - "position": { - "startPos": 97, - "endPos": 119, - "startLine": 7, - "endLine": 9 - }, - "Stmts": [ - { - "type": "*stmt.Expression", - "position": { - "startPos": 101, - "endPos": 116, - "startLine": 8, - "endLine": 8 - }, - "Expr": { - "type": "*assign.Assign", - "position": { - "startPos": 101, - "endPos": 115, - "startLine": 8, - "endLine": 8 - }, - "Variable": { - "type": "*expr.PropertyFetch", - "position": { - "startPos": 101, - "endPos": 110, - "startLine": 8, - "endLine": 8 - }, - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 101, - "endPos": 106, - "startLine": 8, - "endLine": 8 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 101, - "endPos": 106, - "startLine": 8, - "endLine": 8 - }, - "Value": "this" - } - }, - "Property": { - "type": "*node.Identifier", - "position": { - "startPos": 108, - "endPos": 110, - "startLine": 8, - "endLine": 8 - }, - "Value": "mX" - } - }, - "Expression": { - "type": "*expr.Variable", - "position": { - "startPos": 113, - "endPos": 115, - "startLine": 8, - "endLine": 8 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 113, - "endPos": 115, - "startLine": 8, - "endLine": 8 - }, - "Value": "x" - } - } - } - } - ] - } - }, - { - "type": "*stmt.ClassMethod", - "position": { - "startPos": 123, - "endPos": 200, - "startLine": 11, - "endLine": 14 - }, - "PhpDocComment": "", - "ReturnsRef": false, - "MethodName": { - "type": "*node.Identifier", - "position": { - "startPos": 132, - "endPos": 137, - "startLine": 11, - "endLine": 11 - }, - "Value": "hello" - }, - "Stmt": { - "type": "*stmt.StmtList", - "position": { - "startPos": 140, - "endPos": 200, - "startLine": 11, - "endLine": 14 - }, - "Stmts": [ - { - "type": "*stmt.Echo", - "position": { - "startPos": 144, - "endPos": 166, - "startLine": 12, - "endLine": 12 - }, - "Exprs": [ - { - "type": "*binary.Concat", - "position": { - "startPos": 149, - "endPos": 165, - "startLine": 12, - "endLine": 12 - }, - "Left": { - "type": "*expr.PropertyFetch", - "position": { - "startPos": 149, - "endPos": 158, - "startLine": 12, - "endLine": 12 - }, - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 149, - "endPos": 154, - "startLine": 12, - "endLine": 12 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 149, - "endPos": 154, - "startLine": 12, - "endLine": 12 - }, - "Value": "this" - } - }, - "Property": { - "type": "*node.Identifier", - "position": { - "startPos": 156, - "endPos": 158, - "startLine": 12, - "endLine": 12 - }, - "Value": "mX" - } - }, - "Right": { - "type": "*scalar.String", - "position": { - "startPos": 161, - "endPos": 165, - "startLine": 12, - "endLine": 12 - }, - "Value": "\"\\n\"" - } - } - ] - }, - { - "type": "*stmt.Throw", - "position": { - "startPos": 169, - "endPos": 197, - "startLine": 13, - "endLine": 13 - }, - "Expr": { - "type": "*expr.New", - "position": { - "startPos": 175, - "endPos": 196, - "startLine": 13, - "endLine": 13 - }, - "Class": { - "type": "*name.Name", - "position": { - "startPos": 179, - "endPos": 188, - "startLine": 13, - "endLine": 13 - }, - "Parts": [ - { - "type": "*name.NamePart", - "position": { - "startPos": 179, - "endPos": 188, - "startLine": 13, - "endLine": 13 - }, - "Value": "Exception" - } - ] - }, - "ArgumentList": { - "type": "*node.ArgumentList", - "position": { - "startPos": 188, - "endPos": 196, - "startLine": 13, - "endLine": 13 - }, - "Arguments": [ - { - "type": "*node.Argument", - "position": { - "startPos": 189, - "endPos": 195, - "startLine": 13, - "endLine": 13 - }, - "Variadic": false, - "IsReference": false, - "Expr": { - "type": "*scalar.String", - "position": { - "startPos": 189, - "endPos": 195, - "startLine": 13, - "endLine": 13 - }, - "Value": "\"asdf\"" - } - } - ] - } - } - } - ] - } - }, - { - "type": "*stmt.ClassMethod", - "position": { - "startPos": 204, - "endPos": 248, - "startLine": 16, - "endLine": 18 - }, - "ReturnsRef": false, - "PhpDocComment": "", - "MethodName": { - "type": "*node.Identifier", - "position": { - "startPos": 213, - "endPos": 226, - "startLine": 16, - "endLine": 16 - }, - "Value": "scalarThrower" - }, - "Stmt": { - "type": "*stmt.StmtList", - "position": { - "startPos": 229, - "endPos": 248, - "startLine": 16, - "endLine": 18 - }, - "Stmts": [ - { - "type": "*stmt.Throw", - "position": { - "startPos": 233, - "endPos": 245, - "startLine": 17, - "endLine": 17 - }, - "Expr": { - "type": "*scalar.String", - "position": { - "startPos": 239, - "endPos": 244, - "startLine": 17, - "endLine": 17 - }, - "Value": "\"str\"" - } - } - ] - } - } - ] - }, - { - "type": "*stmt.Function", - "position": { - "startPos": 252, - "endPos": 306, - "startLine": 21, - "endLine": 23 - }, - "PhpDocComment": "", - "ReturnsRef": false, - "FunctionName": { - "type": "*node.Identifier", - "position": { - "startPos": 261, - "endPos": 264, - "startLine": 21, - "endLine": 21 - }, - "Value": "foo" - }, - "Params": [ - { - "type": "*node.Parameter", - "position": { - "startPos": 265, - "endPos": 267, - "startLine": 21, - "endLine": 21 - }, - "Variadic": false, - "ByRef": false, - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 265, - "endPos": 267, - "startLine": 21, - "endLine": 21 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 265, - "endPos": 267, - "startLine": 21, - "endLine": 21 - }, - "Value": "a" - } - } - }, - { - "type": "*node.Parameter", - "position": { - "startPos": 269, - "endPos": 275, - "startLine": 21, - "endLine": 21 - }, - "Variadic": false, - "ByRef": false, - "VariableType": { - "type": "*name.Name", - "position": { - "startPos": 269, - "endPos": 272, - "startLine": 21, - "endLine": 21 - }, - "Parts": [ - { - "type": "*name.NamePart", - "position": { - "startPos": 269, - "endPos": 272, - "startLine": 21, - "endLine": 21 - }, - "Value": "int" - } - ] - }, - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 273, - "endPos": 275, - "startLine": 21, - "endLine": 21 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 273, - "endPos": 275, - "startLine": 21, - "endLine": 21 - }, - "Value": "b" - } - } - } - ], - "ReturnType": { - "type": "*name.Name", - "position": { - "startPos": 278, - "endPos": 281, - "startLine": 21, - "endLine": 21 - }, - "Parts": [ - { - "type": "*name.NamePart", - "position": { - "startPos": 278, - "endPos": 281, - "startLine": 21, - "endLine": 21 - }, - "Value": "int" - } - ] - }, - "Stmts": [ - { - "type": "*stmt.Return", - "position": { - "startPos": 285, - "endPos": 304, - "startLine": 22, - "endLine": 22 - }, - "Expr": { - "type": "*binary.Plus", - "position": { - "startPos": 292, - "endPos": 303, - "startLine": 22, - "endLine": 22 - }, - "Left": { - "type": "*binary.Plus", - "position": { - "startPos": 292, - "endPos": 298, - "startLine": 22, - "endLine": 22 - }, - "Left": { - "type": "*scalar.Lnumber", - "position": { - "startPos": 292, - "endPos": 293, - "startLine": 22, - "endLine": 22 - }, - "Value": "3" - }, - "Right": { - "type": "*expr.Variable", - "position": { - "startPos": 296, - "endPos": 298, - "startLine": 22, - "endLine": 22 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 296, - "endPos": 298, - "startLine": 22, - "endLine": 22 - }, - "Value": "a" - } - } - }, - "Right": { - "type": "*expr.Variable", - "position": { - "startPos": 301, - "endPos": 303, - "startLine": 22, - "endLine": 22 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 301, - "endPos": 303, - "startLine": 22, - "endLine": 22 - }, - "Value": "b" - } - } - } - } - ] - }, - { - "type": "*stmt.For", - "position": { - "startPos": 308, - "endPos": 361, - "startLine": 25, - "endLine": 27 - }, - "Init": [ - { - "type": "*assign.Assign", - "position": { - "startPos": 313, - "endPos": 319, - "startLine": 25, - "endLine": 25 - }, - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 313, - "endPos": 315, - "startLine": 25, - "endLine": 25 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 313, - "endPos": 315, - "startLine": 25, - "endLine": 25 - }, - "Value": "i" - } - }, - "Expression": { - "type": "*scalar.Lnumber", - "position": { - "startPos": 318, - "endPos": 319, - "startLine": 25, - "endLine": 25 - }, - "Value": "0" - } - } - ], - "Cond": [ - { - "type": "*binary.Smaller", - "position": { - "startPos": 321, - "endPos": 327, - "startLine": 25, - "endLine": 25 - }, - "Left": { - "type": "*expr.Variable", - "position": { - "startPos": 321, - "endPos": 323, - "startLine": 25, - "endLine": 25 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 321, - "endPos": 323, - "startLine": 25, - "endLine": 25 - }, - "Value": "i" - } - }, - "Right": { - "type": "*scalar.Lnumber", - "position": { - "startPos": 326, - "endPos": 327, - "startLine": 25, - "endLine": 25 - }, - "Value": "3" - } - } - ], - "Loop": [ - { - "type": "*expr.PreInc", - "position": { - "startPos": 329, - "endPos": 333, - "startLine": 25, - "endLine": 25 - }, - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 331, - "endPos": 333, - "startLine": 25, - "endLine": 25 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 331, - "endPos": 333, - "startLine": 25, - "endLine": 25 - }, - "Value": "i" - } - } - } - ], - "Stmt": { - "type": "*stmt.StmtList", - "position": { - "startPos": 335, - "endPos": 361, - "startLine": 25, - "endLine": 27 - }, - "Stmts": [ - { - "type": "*stmt.Echo", - "position": { - "startPos": 338, - "endPos": 359, - "startLine": 26, - "endLine": 26 - }, - "Exprs": [ - { - "type": "*binary.Concat", - "position": { - "startPos": 343, - "endPos": 358, - "startLine": 26, - "endLine": 26 - }, - "Left": { - "type": "*expr.FunctionCall", - "position": { - "startPos": 343, - "endPos": 353, - "startLine": 26, - "endLine": 26 - }, - "Function": { - "type": "*name.Name", - "position": { - "startPos": 343, - "endPos": 346, - "startLine": 26, - "endLine": 26 - }, - "Parts": [ - { - "type": "*name.NamePart", - "position": { - "startPos": 343, - "endPos": 346, - "startLine": 26, - "endLine": 26 - }, - "Value": "foo" - } - ] - }, - "ArgumentList": { - "type": "*node.ArgumentList", - "position": { - "startPos": 346, - "endPos": 353, - "startLine": 26, - "endLine": 26 - }, - "Arguments": [ - { - "type": "*node.Argument", - "position": { - "startPos": 347, - "endPos": 349, - "startLine": 26, - "endLine": 26 - }, - "Variadic": false, - "IsReference": false, - "Expr": { - "type": "*expr.Variable", - "position": { - "startPos": 347, - "endPos": 349, - "startLine": 26, - "endLine": 26 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 347, - "endPos": 349, - "startLine": 26, - "endLine": 26 - }, - "Value": "i" - } - } - }, - { - "type": "*node.Argument", - "position": { - "startPos": 351, - "endPos": 352, - "startLine": 26, - "endLine": 26 - }, - "Variadic": false, - "IsReference": false, - "Expr": { - "type": "*scalar.Lnumber", - "position": { - "startPos": 351, - "endPos": 352, - "startLine": 26, - "endLine": 26 - }, - "Value": "2" - } - } - ] - } - }, - "Right": { - "type": "*scalar.String", - "position": { - "startPos": 354, - "endPos": 358, - "startLine": 26, - "endLine": 26 - }, - "Value": "\"\\n\"" - } - } - ] - } - ] - } - }, - { - "type": "*stmt.Expression", - "position": { - "startPos": 363, - "endPos": 386, - "startLine": 29, - "endLine": 29 - }, - "Expr": { - "type": "*assign.Assign", - "position": { - "startPos": 363, - "endPos": 385, - "startLine": 29, - "endLine": 29 - }, - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 363, - "endPos": 366, - "startLine": 29, - "endLine": 29 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 363, - "endPos": 366, - "startLine": 29, - "endLine": 29 - }, - "Value": "bb" - } - }, - "Expression": { - "type": "*expr.New", - "position": { - "startPos": 369, - "endPos": 385, - "startLine": 29, - "endLine": 29 - }, - "Class": { - "type": "*name.Name", - "position": { - "startPos": 373, - "endPos": 376, - "startLine": 29, - "endLine": 29 - }, - "Parts": [ - { - "type": "*name.NamePart", - "position": { - "startPos": 373, - "endPos": 376, - "startLine": 29, - "endLine": 29 - }, - "Value": "Bar" - } - ] - }, - "ArgumentList": { - "type": "*node.ArgumentList", - "position": { - "startPos": 376, - "endPos": 385, - "startLine": 29, - "endLine": 29 - }, - "Arguments": [ - { - "type": "*node.Argument", - "position": { - "startPos": 377, - "endPos": 384, - "startLine": 29, - "endLine": 29 - }, - "Variadic": false, - "IsReference": false, - "Expr": { - "type": "*scalar.String", - "position": { - "startPos": 377, - "endPos": 384, - "startLine": 29, - "endLine": 29 - }, - "Value": "\"hello\"" - } - } - ] - } - } - } - }, - { - "type": "*stmt.Expression", - "position": { - "startPos": 387, - "endPos": 400, - "startLine": 30, - "endLine": 30 - }, - "Expr": { - "type": "*expr.MethodCall", - "position": { - "startPos": 387, - "endPos": 399, - "startLine": 30, - "endLine": 30 - }, - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 387, - "endPos": 390, - "startLine": 30, - "endLine": 30 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 387, - "endPos": 390, - "startLine": 30, - "endLine": 30 - }, - "Value": "bb" - } - }, - "Method": { - "type": "*node.Identifier", - "position": { - "startPos": 392, - "endPos": 397, - "startLine": 30, - "endLine": 30 - }, - "Value": "hello" - }, - "ArgumentList": { - "type": "*node.ArgumentList", - "position": { - "startPos": 397, - "endPos": 399, - "startLine": 30, - "endLine": 30 - } - } - } - } - ] -} \ No newline at end of file diff --git a/fixtures/0002-loops.php.parse.json b/fixtures/0002-loops.php.parse.json deleted file mode 100644 index 57748ed..0000000 --- a/fixtures/0002-loops.php.parse.json +++ /dev/null @@ -1,437 +0,0 @@ -{ - "type": "*node.Root", - "position": { - "startPos": 44, - "endPos": 254, - "startLine": 4, - "endLine": 21 - }, - "Stmts": [ - { - "type": "*stmt.For", - "position": { - "startPos": 44, - "endPos": 186, - "startLine": 4, - "endLine": 18 - }, - "Init": [ - { - "type": "*assign.Assign", - "position": { - "startPos": 48, - "endPos": 54, - "startLine": 4, - "endLine": 4 - }, - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 48, - "endPos": 50, - "startLine": 4, - "endLine": 4 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 48, - "endPos": 50, - "startLine": 4, - "endLine": 4 - }, - "Value": "i" - } - }, - "Expression": { - "type": "*scalar.Lnumber", - "position": { - "startPos": 53, - "endPos": 54, - "startLine": 4, - "endLine": 4 - }, - "Value": "0" - } - } - ], - "Cond": [ - { - "type": "*binary.Smaller", - "position": { - "startPos": 56, - "endPos": 62, - "startLine": 4, - "endLine": 4 - }, - "Left": { - "type": "*expr.Variable", - "position": { - "startPos": 56, - "endPos": 58, - "startLine": 4, - "endLine": 4 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 56, - "endPos": 58, - "startLine": 4, - "endLine": 4 - }, - "Value": "i" - } - }, - "Right": { - "type": "*scalar.Lnumber", - "position": { - "startPos": 61, - "endPos": 62, - "startLine": 4, - "endLine": 4 - }, - "Value": "3" - } - } - ], - "Loop": [ - { - "type": "*expr.PreInc", - "position": { - "startPos": 64, - "endPos": 68, - "startLine": 4, - "endLine": 4 - }, - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 66, - "endPos": 68, - "startLine": 4, - "endLine": 4 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 66, - "endPos": 68, - "startLine": 4, - "endLine": 4 - }, - "Value": "i" - } - } - } - ], - "Stmt": { - "type": "*stmt.StmtList", - "position": { - "startPos": 70, - "endPos": 186, - "startLine": 4, - "endLine": 18 - }, - "Stmts": [ - { - "type": "*stmt.Foreach", - "position": { - "startPos": 75, - "endPos": 105, - "startLine": 6, - "endLine": 7 - }, - "Expr": { - "type": "*expr.Variable", - "position": { - "startPos": 83, - "endPos": 87, - "startLine": 6, - "endLine": 6 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 83, - "endPos": 87, - "startLine": 6, - "endLine": 6 - }, - "Value": "foo" - } - }, - "Key": { - "type": "*expr.Variable", - "position": { - "startPos": 91, - "endPos": 93, - "startLine": 6, - "endLine": 6 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 91, - "endPos": 93, - "startLine": 6, - "endLine": 6 - }, - "Value": "k" - } - }, - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 97, - "endPos": 99, - "startLine": 6, - "endLine": 6 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 97, - "endPos": 99, - "startLine": 6, - "endLine": 6 - }, - "Value": "v" - } - }, - "Stmt": { - "type": "*stmt.StmtList", - "position": { - "startPos": 101, - "endPos": 105, - "startLine": 6, - "endLine": 7 - }, - "Stmts": [ - - ] - } - } { - "type": "*stmt.Foreach", - "position": { - "startPos": 109, - "endPos": 135, - "startLine": 9, - "endLine": 10 - }, - "Expr": { - "type": "*expr.Variable", - "position": { - "startPos": 117, - "endPos": 122, - "startLine": 9, - "endLine": 9 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 117, - "endPos": 122, - "startLine": 9, - "endLine": 9 - }, - "Value": "foo2" - } - }, - "Variable": { - "type": "*expr.Variable", - "position": { - "startPos": 126, - "endPos": 129, - "startLine": 9, - "endLine": 9 - }, - "VarName": { - "type": "*node.Identifier", - "position": { - "startPos": 126, - "endPos": 129, - "startLine": 9, - "endLine": 9 - }, - "Value": "v2" - } - }, - "Stmt": { - "type": "*stmt.StmtList", - "position": { - "startPos": 131, - "endPos": 135, - "startLine": 9, - "endLine": 10 - }, - "Stmts": [ - - ] - } - } { - "type": "*stmt.While", - "position": { - "startPos": 139, - "endPos": 155, - "startLine": 12, - "endLine": 13 - }, - "Cond": { - "type": "*expr.ConstFetch", - "position": { - "startPos": 145, - "endPos": 149, - "startLine": 12, - "endLine": 12 - }, - "Constant": { - "type": "*name.Name", - "position": { - "startPos": 145, - "endPos": 149, - "startLine": 12, - "endLine": 12 - }, - "Parts": [ - { - "type": "*name.NamePart", - "position": { - "startPos": 145, - "endPos": 149, - "startLine": 12, - "endLine": 12 - }, - "Value": "true" - } - ] - } - }, - "Stmt": { - "type": "*stmt.StmtList", - "position": { - "startPos": 151, - "endPos": 155, - "startLine": 12, - "endLine": 13 - }, - "Stmts": [ - - ] - } - } { - "type": "*stmt.Do", - "position": { - "startPos": 159, - "endPos": 182, - "startLine": 15, - "endLine": 16 - }, - "Stmt": { - "type": "*stmt.StmtList", - "position": { - "startPos": 162, - "endPos": 168, - "startLine": 15, - "endLine": 16 - }, - "Stmts": [ - - ] - }, - "Cond": { - "type": "*expr.ConstFetch", - "position": { - "startPos": 176, - "endPos": 180, - "startLine": 16, - "endLine": 16 - }, - "Constant": { - "type": "*name.Name", - "position": { - "startPos": 176, - "endPos": 180, - "startLine": 16, - "endLine": 16 - }, - "Parts": [ - { - "type": "*name.NamePart", - "position": { - "startPos": 176, - "endPos": 180, - "startLine": 16, - "endLine": 16 - }, - "Value": "true" - } - ] - } - } - } - ] - } - }, - { - "type": "*stmt.While", - "position": { - "startPos": 228, - "endPos": 254, - "startLine": 21, - "endLine": 21 - }, - "Cond": { - "type": "*expr.ConstFetch", - "position": { - "startPos": 235, - "endPos": 239, - "startLine": 21, - "endLine": 21 - }, - "Constant": { - "type": "*name.Name", - "position": { - "startPos": 235, - "endPos": 239, - "startLine": 21, - "endLine": 21 - }, - "Parts": [ - { - "type": "*name.NamePart", - "position": { - "startPos": 235, - "endPos": 239, - "startLine": 21, - "endLine": 21 - }, - "Value": "true" - } - ] - } - }, - "Stmt": { - "type": "*stmt.Echo", - "position": { - "startPos": 241, - "endPos": 254, - "startLine": 21, - "endLine": 21 - }, - "Exprs": [ - { - "type": "*scalar.String", - "position": { - "startPos": 246, - "endPos": 253, - "startLine": 21, - "endLine": 21 - }, - "Value": "\"hello\"" - } - ] - } - } - ] -} \ No newline at end of file