exit node: handle upper case die

This commit is contained in:
z7zmey 2017-12-17 22:48:18 +02:00
parent 3bbac39c9c
commit 3c6e40fbeb
2 changed files with 488 additions and 486 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@ package parser
import ( import (
"io" "io"
"fmt" "fmt"
"strings"
"github.com/z7zmey/php-parser/token" "github.com/z7zmey/php-parser/token"
"github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node"
"github.com/z7zmey/php-parser/node/scalar" "github.com/z7zmey/php-parser/node/scalar"
@ -876,7 +877,7 @@ expr_without_variable:
| T_OBJECT_CAST expr { $$ = cast.NewCastObject($2) } | T_OBJECT_CAST expr { $$ = cast.NewCastObject($2) }
| T_BOOL_CAST expr { $$ = cast.NewCastBool($2) } | T_BOOL_CAST expr { $$ = cast.NewCastBool($2) }
| T_UNSET_CAST expr { $$ = cast.NewCastUnset($2) } | T_UNSET_CAST expr { $$ = cast.NewCastUnset($2) }
| T_EXIT exit_expr { $$ = expr.NewExit($2, $1.Value == "die") } | T_EXIT exit_expr { $$ = expr.NewExit($2, strings.EqualFold($1.Value, "die")) }
| '@' expr { $$ = node.NewSimpleNode("Silence").Append($2); } | '@' expr { $$ = node.NewSimpleNode("Silence").Append($2); }
| scalar { $$ = $1; } | scalar { $$ = $1; }
| '`' backticks_expr '`' { $$ = node.NewNodeExprShellExec($1, $2, $3) } | '`' backticks_expr '`' { $$ = node.NewNodeExprShellExec($1, $2, $3) }