split Switch and AltSwitch nodes

This commit is contained in:
z7zmey
2018-02-18 20:39:41 +02:00
parent d0296f78e3
commit e75a625528
9 changed files with 897 additions and 824 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -629,7 +629,11 @@ unticked_statement:
}
| T_SWITCH parenthesis_expr switch_case_list
{
$$ = stmt.NewSwitch($2, $3.nodes)
if ($3.endToken.Value == ";") {
$$ = stmt.NewAltSwitch($2, $3.nodes)
} else {
$$ = stmt.NewSwitch($2, $3.nodes)
}
positions.AddPosition($$, positionBuilder.NewTokensPosition($1, $3.endToken))
comments.AddComments($$, $1.Comments())
}

View File

@@ -1400,7 +1400,7 @@ CAD;
},
},
},
&stmt.Switch{
&stmt.AltSwitch{
Cond: &scalar.Lnumber{Value: "1"},
Cases: []node.Node{
&stmt.Case{
@@ -1416,7 +1416,7 @@ CAD;
},
},
},
&stmt.Switch{
&stmt.AltSwitch{
Cond: &scalar.Lnumber{Value: "1"},
Cases: []node.Node{
&stmt.Case{