#56: now, __halt_compiler(); terminates parsing process
This commit is contained in:
1024
php5/php5.go
1024
php5/php5.go
File diff suppressed because it is too large
Load Diff
@@ -373,6 +373,8 @@ top_statement:
|
||||
yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken)
|
||||
|
||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||
|
||||
yylex.(*Parser).Begin(scanner.HALT_COMPILER)
|
||||
}
|
||||
| T_NAMESPACE namespace_name ';'
|
||||
{
|
||||
|
||||
@@ -120,7 +120,6 @@ func TestPhp5(t *testing.T) {
|
||||
function foo() {}
|
||||
|
||||
function foo() {
|
||||
__halt_compiler();
|
||||
function bar() {}
|
||||
class Baz {}
|
||||
return $a;
|
||||
@@ -132,7 +131,6 @@ func TestPhp5(t *testing.T) {
|
||||
global $a, $b, $$c, ${foo()};
|
||||
a:
|
||||
goto a;
|
||||
__halt_compiler();
|
||||
if ($a) {}
|
||||
if ($a) {} elseif ($b) {}
|
||||
if ($a) {} else {}
|
||||
@@ -411,6 +409,10 @@ func TestPhp5(t *testing.T) {
|
||||
${$a};
|
||||
$foo::{$bar}();
|
||||
$foo::bar;
|
||||
|
||||
__halt_compiler();
|
||||
|
||||
parsing process must be terminated
|
||||
`
|
||||
|
||||
expectedParams := []node.Node{
|
||||
@@ -1093,7 +1095,6 @@ func TestPhp5(t *testing.T) {
|
||||
PhpDocComment: "",
|
||||
FunctionName: &node.Identifier{Value: "foo"},
|
||||
Stmts: []node.Node{
|
||||
&stmt.HaltCompiler{},
|
||||
&stmt.Function{
|
||||
ReturnsRef: false,
|
||||
PhpDocComment: "",
|
||||
@@ -1171,7 +1172,6 @@ func TestPhp5(t *testing.T) {
|
||||
&stmt.Goto{
|
||||
Label: &node.Identifier{Value: "a"},
|
||||
},
|
||||
&stmt.HaltCompiler{},
|
||||
&stmt.If{
|
||||
Cond: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
|
||||
Stmt: &stmt.StmtList{Stmts: []node.Node{}},
|
||||
@@ -3634,6 +3634,7 @@ func TestPhp5(t *testing.T) {
|
||||
ConstantName: &node.Identifier{Value: "bar"},
|
||||
},
|
||||
},
|
||||
&stmt.HaltCompiler{},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user