#50: nodes stmt.Exit and stmt.Die was merged
This commit is contained in:
477
php5/php5.go
477
php5/php5.go
File diff suppressed because it is too large
Load Diff
27
php5/php5.y
27
php5/php5.y
@@ -4026,23 +4026,22 @@ expr_without_variable:
|
||||
}
|
||||
| T_EXIT exit_expr
|
||||
{
|
||||
if (strings.EqualFold($1.Value, "die")) {
|
||||
$$ = expr.NewDie(nil)
|
||||
if $2 != nil {
|
||||
$$.(*expr.Die).Expr = $2.(*expr.Exit).Expr
|
||||
}
|
||||
var e *expr.Exit;
|
||||
if $2 != nil {
|
||||
e = $2.(*expr.Exit)
|
||||
} else {
|
||||
$$ = expr.NewExit(nil)
|
||||
if $2 != nil {
|
||||
$$.(*expr.Exit).Expr = $2.(*expr.Exit).Expr
|
||||
}
|
||||
e = expr.NewExit(nil)
|
||||
}
|
||||
|
||||
$$ = e
|
||||
|
||||
if (strings.EqualFold($1.Value, "die")) {
|
||||
e.Die = true
|
||||
}
|
||||
|
||||
// save position
|
||||
if $2 == nil {
|
||||
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition($1))
|
||||
} else if yylex.(*Parser).currentToken.Value == ")" {
|
||||
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokensPosition($1, yylex.(*Parser).currentToken))
|
||||
} else {
|
||||
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2))
|
||||
}
|
||||
@@ -4696,7 +4695,11 @@ exit_expr:
|
||||
$$ = expr.NewExit($1);
|
||||
|
||||
// save position
|
||||
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodePosition($1))
|
||||
if yylex.(*Parser).currentToken.Value == ")" {
|
||||
$$.SetPosition(yylex.(*Parser).positionBuilder.NewTokenPosition(yylex.(*Parser).currentToken))
|
||||
} else {
|
||||
$$.SetPosition(yylex.(*Parser).positionBuilder.NewNodePosition($1))
|
||||
}
|
||||
|
||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||
}
|
||||
|
||||
@@ -9151,6 +9151,7 @@ func TestPhp5(t *testing.T) {
|
||||
EndPos: 4137,
|
||||
},
|
||||
Expr: &expr.Exit{
|
||||
Die: false,
|
||||
Position: &position.Position{
|
||||
StartLine: 191,
|
||||
EndLine: 191,
|
||||
@@ -9167,6 +9168,7 @@ func TestPhp5(t *testing.T) {
|
||||
EndPos: 4149,
|
||||
},
|
||||
Expr: &expr.Exit{
|
||||
Die: false,
|
||||
Position: &position.Position{
|
||||
StartLine: 192,
|
||||
EndLine: 192,
|
||||
@@ -9199,7 +9201,8 @@ func TestPhp5(t *testing.T) {
|
||||
StartPos: 4153,
|
||||
EndPos: 4158,
|
||||
},
|
||||
Expr: &expr.Die{
|
||||
Expr: &expr.Exit{
|
||||
Die: true,
|
||||
Position: &position.Position{
|
||||
StartLine: 193,
|
||||
EndLine: 193,
|
||||
@@ -9215,7 +9218,8 @@ func TestPhp5(t *testing.T) {
|
||||
StartPos: 4162,
|
||||
EndPos: 4169,
|
||||
},
|
||||
Expr: &expr.Die{
|
||||
Expr: &expr.Exit{
|
||||
Die: true,
|
||||
Position: &position.Position{
|
||||
StartLine: 194,
|
||||
EndLine: 194,
|
||||
|
||||
Reference in New Issue
Block a user