#56: now, __halt_compiler(); terminates parsing process

This commit is contained in:
z7zmey
2018-07-24 21:49:26 +03:00
parent 1a495d615b
commit 623a90a418
9 changed files with 1011 additions and 969 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -472,6 +472,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 ';'
{

View File

@@ -137,7 +137,6 @@ func TestPhp7(t *testing.T) {
global $a, $b;
a:
goto a;
__halt_compiler();
if ($a) {}
if ($a) {} elseif ($b) {}
if ($a) {} else {}
@@ -379,6 +378,10 @@ func TestPhp7(t *testing.T) {
$foo->{$bar[0]};
[1=>&$a, 2=>list($b)];
__halt_compiler();
parsing process must be terminated
`
expectedParams := []node.Node{
@@ -1231,7 +1234,6 @@ func TestPhp7(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{}},
@@ -3218,6 +3220,7 @@ func TestPhp7(t *testing.T) {
},
},
},
&stmt.HaltCompiler{},
},
}