[refactoring] store halt_compiler tokens
This commit is contained in:
parent
a70e34d726
commit
45464654c6
BIN
internal/php5/php5.go
generated
BIN
internal/php5/php5.go
generated
Binary file not shown.
@ -364,17 +364,14 @@ top_statement:
|
||||
}
|
||||
| T_HALT_COMPILER '(' ')' ';'
|
||||
{
|
||||
$$ = &ast.StmtHaltCompiler{ast.Node{}, }
|
||||
$$ = &ast.StmtHaltCompiler{ast.Node{}}
|
||||
|
||||
// save position
|
||||
$$.GetNode().Position = position.NewTokensPosition($1, $4)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.Tokens)
|
||||
yylex.(*Parser).setFreeFloating($$, token.HaltCompiller, $2.Tokens)
|
||||
yylex.(*Parser).setFreeFloating($$, token.OpenParenthesisToken, $3.Tokens)
|
||||
yylex.(*Parser).setFreeFloating($$, token.CloseParenthesisToken, $4.Tokens)
|
||||
yylex.(*Parser).setToken($$, token.SemiColon, $4.Tokens)
|
||||
yylex.(*Parser).setFreeFloatingTokens($$, token.End, append($2.Tokens, append($3.Tokens, $4.Tokens...)...))
|
||||
|
||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||
}
|
||||
@ -831,17 +828,14 @@ inner_statement:
|
||||
}
|
||||
| T_HALT_COMPILER '(' ')' ';'
|
||||
{
|
||||
$$ = &ast.StmtHaltCompiler{ast.Node{}, }
|
||||
$$ = &ast.StmtHaltCompiler{ast.Node{}}
|
||||
|
||||
// save position
|
||||
$$.GetNode().Position = position.NewTokensPosition($1, $4)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.Tokens)
|
||||
yylex.(*Parser).setFreeFloating($$, token.HaltCompiller, $2.Tokens)
|
||||
yylex.(*Parser).setFreeFloating($$, token.OpenParenthesisToken, $3.Tokens)
|
||||
yylex.(*Parser).setFreeFloating($$, token.CloseParenthesisToken, $4.Tokens)
|
||||
yylex.(*Parser).setToken($$, token.SemiColon, $4.Tokens)
|
||||
yylex.(*Parser).setFreeFloatingTokens($$, token.End, append($2.Tokens, append($3.Tokens, $4.Tokens...)...))
|
||||
|
||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||
}
|
||||
|
BIN
internal/php7/php7.go
generated
BIN
internal/php7/php7.go
generated
Binary file not shown.
@ -468,10 +468,7 @@ top_statement:
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.Tokens)
|
||||
yylex.(*Parser).setFreeFloating($$, token.HaltCompiller, $2.Tokens)
|
||||
yylex.(*Parser).setFreeFloating($$, token.OpenParenthesisToken, $3.Tokens)
|
||||
yylex.(*Parser).setFreeFloating($$, token.CloseParenthesisToken, $4.Tokens)
|
||||
yylex.(*Parser).setToken($$, token.SemiColon, $4.Tokens)
|
||||
yylex.(*Parser).setFreeFloatingTokens($$, token.End, append($2.Tokens, append($3.Tokens, $4.Tokens...)...))
|
||||
|
||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||
}
|
||||
@ -930,17 +927,14 @@ inner_statement:
|
||||
}
|
||||
| T_HALT_COMPILER '(' ')' ';'
|
||||
{
|
||||
$$ = &ast.StmtHaltCompiler{ast.Node{}, }
|
||||
$$ = &ast.StmtHaltCompiler{ast.Node{}}
|
||||
|
||||
// save position
|
||||
$$.GetNode().Position = position.NewTokensPosition($1, $4)
|
||||
|
||||
// save comments
|
||||
yylex.(*Parser).setFreeFloating($$, token.Start, $1.Tokens)
|
||||
yylex.(*Parser).setFreeFloating($$, token.HaltCompiller, $2.Tokens)
|
||||
yylex.(*Parser).setFreeFloating($$, token.OpenParenthesisToken, $3.Tokens)
|
||||
yylex.(*Parser).setFreeFloating($$, token.CloseParenthesisToken, $4.Tokens)
|
||||
yylex.(*Parser).setToken($$, token.SemiColon, $4.Tokens)
|
||||
yylex.(*Parser).setFreeFloatingTokens($$, token.End, append($2.Tokens, append($3.Tokens, $4.Tokens...)...))
|
||||
|
||||
yylex.(*Parser).returnTokenToPool(yyDollar, &yyVAL)
|
||||
}
|
||||
|
@ -2753,18 +2753,8 @@ func (p *Printer) printStmtHaltCompiler(n ast.Vertex) {
|
||||
p.printFreeFloating(nn, token.Start)
|
||||
|
||||
io.WriteString(p.w, "__halt_compiler")
|
||||
p.printFreeFloating(nn, token.HaltCompiller)
|
||||
io.WriteString(p.w, "(")
|
||||
p.printFreeFloating(nn, token.OpenParenthesisToken)
|
||||
io.WriteString(p.w, ")")
|
||||
p.printFreeFloating(nn, token.CloseParenthesisToken)
|
||||
|
||||
p.printFreeFloating(nn, token.SemiColon)
|
||||
if nn.GetNode().Tokens.IsEmpty() {
|
||||
io.WriteString(p.w, ";")
|
||||
}
|
||||
|
||||
p.printFreeFloating(nn, token.End)
|
||||
p.printFreeFloatingOrDefault(nn, token.End, "();")
|
||||
}
|
||||
|
||||
func (p *Printer) printStmtIf(n ast.Vertex) {
|
||||
|
@ -25,7 +25,6 @@ const (
|
||||
True
|
||||
Cond
|
||||
|
||||
HaltCompiller
|
||||
Namespace
|
||||
Static
|
||||
Class
|
||||
|
@ -28,56 +28,55 @@ func _() {
|
||||
_ = x[IncExpr-17]
|
||||
_ = x[True-18]
|
||||
_ = x[Cond-19]
|
||||
_ = x[HaltCompiller-20]
|
||||
_ = x[Namespace-21]
|
||||
_ = x[Static-22]
|
||||
_ = x[Class-23]
|
||||
_ = x[Use-24]
|
||||
_ = x[While-25]
|
||||
_ = x[For-26]
|
||||
_ = x[Switch-27]
|
||||
_ = x[Foreach-28]
|
||||
_ = x[Declare-29]
|
||||
_ = x[Label-30]
|
||||
_ = x[Finally-31]
|
||||
_ = x[List-32]
|
||||
_ = x[Default-33]
|
||||
_ = x[If-34]
|
||||
_ = x[ElseIf-35]
|
||||
_ = x[Else-36]
|
||||
_ = x[Function-37]
|
||||
_ = x[Alias-38]
|
||||
_ = x[Equal-39]
|
||||
_ = x[Exit-40]
|
||||
_ = x[Array-41]
|
||||
_ = x[Isset-42]
|
||||
_ = x[Empty-43]
|
||||
_ = x[Eval-44]
|
||||
_ = x[Echo-45]
|
||||
_ = x[Try-46]
|
||||
_ = x[Catch-47]
|
||||
_ = x[Unset-48]
|
||||
_ = x[Stmts-49]
|
||||
_ = x[VarList-50]
|
||||
_ = x[ConstList-51]
|
||||
_ = x[NameList-52]
|
||||
_ = x[ParamList-53]
|
||||
_ = x[ModifierList-54]
|
||||
_ = x[ArrayPairList-55]
|
||||
_ = x[CaseListStart-56]
|
||||
_ = x[CaseListEnd-57]
|
||||
_ = x[ArgumentList-58]
|
||||
_ = x[PropertyList-59]
|
||||
_ = x[ParameterList-60]
|
||||
_ = x[AdaptationList-61]
|
||||
_ = x[LexicalVarList-62]
|
||||
_ = x[OpenParenthesisToken-63]
|
||||
_ = x[CloseParenthesisToken-64]
|
||||
_ = x[Namespace-20]
|
||||
_ = x[Static-21]
|
||||
_ = x[Class-22]
|
||||
_ = x[Use-23]
|
||||
_ = x[While-24]
|
||||
_ = x[For-25]
|
||||
_ = x[Switch-26]
|
||||
_ = x[Foreach-27]
|
||||
_ = x[Declare-28]
|
||||
_ = x[Label-29]
|
||||
_ = x[Finally-30]
|
||||
_ = x[List-31]
|
||||
_ = x[Default-32]
|
||||
_ = x[If-33]
|
||||
_ = x[ElseIf-34]
|
||||
_ = x[Else-35]
|
||||
_ = x[Function-36]
|
||||
_ = x[Alias-37]
|
||||
_ = x[Equal-38]
|
||||
_ = x[Exit-39]
|
||||
_ = x[Array-40]
|
||||
_ = x[Isset-41]
|
||||
_ = x[Empty-42]
|
||||
_ = x[Eval-43]
|
||||
_ = x[Echo-44]
|
||||
_ = x[Try-45]
|
||||
_ = x[Catch-46]
|
||||
_ = x[Unset-47]
|
||||
_ = x[Stmts-48]
|
||||
_ = x[VarList-49]
|
||||
_ = x[ConstList-50]
|
||||
_ = x[NameList-51]
|
||||
_ = x[ParamList-52]
|
||||
_ = x[ModifierList-53]
|
||||
_ = x[ArrayPairList-54]
|
||||
_ = x[CaseListStart-55]
|
||||
_ = x[CaseListEnd-56]
|
||||
_ = x[ArgumentList-57]
|
||||
_ = x[PropertyList-58]
|
||||
_ = x[ParameterList-59]
|
||||
_ = x[AdaptationList-60]
|
||||
_ = x[LexicalVarList-61]
|
||||
_ = x[OpenParenthesisToken-62]
|
||||
_ = x[CloseParenthesisToken-63]
|
||||
}
|
||||
|
||||
const _Position_name = "StartEndSemiColonAltEndAmpersandNameKeyVarReturnTypeCaseSeparatorLexicalVarsParamsRefCastExprInitExprCondExprIncExprTrueCondHaltCompillerNamespaceStaticClassUseWhileForSwitchForeachDeclareLabelFinallyListDefaultIfElseIfElseFunctionAliasEqualExitArrayIssetEmptyEvalEchoTryCatchUnsetStmtsVarListConstListNameListParamListModifierListArrayPairListCaseListStartCaseListEndArgumentListPropertyListParameterListAdaptationListLexicalVarListOpenParenthesisTokenCloseParenthesisToken"
|
||||
const _Position_name = "StartEndSemiColonAltEndAmpersandNameKeyVarReturnTypeCaseSeparatorLexicalVarsParamsRefCastExprInitExprCondExprIncExprTrueCondNamespaceStaticClassUseWhileForSwitchForeachDeclareLabelFinallyListDefaultIfElseIfElseFunctionAliasEqualExitArrayIssetEmptyEvalEchoTryCatchUnsetStmtsVarListConstListNameListParamListModifierListArrayPairListCaseListStartCaseListEndArgumentListPropertyListParameterListAdaptationListLexicalVarListOpenParenthesisTokenCloseParenthesisToken"
|
||||
|
||||
var _Position_index = [...]uint16{0, 5, 8, 17, 23, 32, 36, 39, 42, 52, 65, 76, 82, 85, 89, 93, 101, 109, 116, 120, 124, 137, 146, 152, 157, 160, 165, 168, 174, 181, 188, 193, 200, 204, 211, 213, 219, 223, 231, 236, 241, 245, 250, 255, 260, 264, 268, 271, 276, 281, 286, 293, 302, 310, 319, 331, 344, 357, 368, 380, 392, 405, 419, 433, 453, 474}
|
||||
var _Position_index = [...]uint16{0, 5, 8, 17, 23, 32, 36, 39, 42, 52, 65, 76, 82, 85, 89, 93, 101, 109, 116, 120, 124, 133, 139, 144, 147, 152, 155, 161, 168, 175, 180, 187, 191, 198, 200, 206, 210, 218, 223, 228, 232, 237, 242, 247, 251, 255, 258, 263, 268, 273, 280, 289, 297, 306, 318, 331, 344, 355, 367, 379, 392, 406, 420, 440, 461}
|
||||
|
||||
func (i Position) String() string {
|
||||
if i < 0 || i >= Position(len(_Position_index)-1) {
|
||||
|
Loading…
Reference in New Issue
Block a user