rename const_list and class_const_list

This commit is contained in:
vadim 2017-12-27 16:44:19 +02:00
parent 06a15be7a2
commit b9d686eca1
4 changed files with 14 additions and 14 deletions

View File

@ -8,23 +8,23 @@ import (
"github.com/z7zmey/php-parser/token"
)
type ClassConst struct {
type ClassConstList struct {
node.SimpleNode
token token.Token
modifiers []node.Node
consts []node.Node
}
func NewClassConst(token token.Token, modifiers []node.Node, consts []node.Node) node.Node {
return ClassConst{
node.SimpleNode{Name: "ClassConst", Attributes: make(map[string]string)},
func NewClassConstList(token token.Token, modifiers []node.Node, consts []node.Node) node.Node {
return ClassConstList{
node.SimpleNode{Name: "ClassConstList", Attributes: make(map[string]string)},
token,
modifiers,
consts,
}
}
func (n ClassConst) Print(out io.Writer, indent string) {
func (n ClassConstList) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.Name, n.token.StartLine, n.token.EndLine, n.token.Value)
if n.modifiers != nil {

View File

@ -8,21 +8,21 @@ import (
"github.com/z7zmey/php-parser/token"
)
type StmtConst struct {
type ConstList struct {
node.SimpleNode
token token.Token
consts []node.Node
}
func NewStmtConst(token token.Token, consts []node.Node) node.Node {
return StmtConst{
node.SimpleNode{Name: "StmtConst", Attributes: make(map[string]string)},
func NewConstList(token token.Token, consts []node.Node) node.Node {
return ConstList{
node.SimpleNode{Name: "ConstList", Attributes: make(map[string]string)},
token,
consts,
}
}
func (n StmtConst) Print(out io.Writer, indent string) {
func (n ConstList) Print(out io.Writer, indent string) {
fmt.Fprintf(out, "\n%v%v [%d %d] %q", indent, n.Name, n.token.StartLine, n.token.EndLine, n.token.Value)
if n.consts != nil {

View File

@ -2639,7 +2639,7 @@ yydefault:
yyDollar = yyS[yypt-3 : yypt+1]
//line parser/parser.y:299
{
yyVAL.node = stmt.NewStmtConst(yyDollar[1].token, yyDollar[2].list)
yyVAL.node = stmt.NewConstList(yyDollar[1].token, yyDollar[2].list)
}
case 99:
yyDollar = yyS[yypt-1 : yypt+1]
@ -3479,7 +3479,7 @@ yydefault:
yyDollar = yyS[yypt-4 : yypt+1]
//line parser/parser.y:675
{
yyVAL.node = stmt.NewClassConst(yyDollar[2].token, yyDollar[1].list, yyDollar[3].list)
yyVAL.node = stmt.NewClassConstList(yyDollar[2].token, yyDollar[1].list, yyDollar[3].list)
}
case 242:
yyDollar = yyS[yypt-3 : yypt+1]

View File

@ -296,7 +296,7 @@ top_statement:
| T_USE use_type group_use_declaration ';' { $$ = $3.(stmt.GroupUse).SetToken($1).(stmt.GroupUse).SetUseType($2) }
| T_USE use_declarations ';' { $$ = stmt.NewUseList($1, nil, $2) }
| T_USE use_type use_declarations ';' { $$ = stmt.NewUseList($1, $2, $3) }
| T_CONST const_list ';' { $$ = stmt.NewStmtConst($1, $2) }
| T_CONST const_list ';' { $$ = stmt.NewConstList($1, $2) }
;
use_type:
@ -672,7 +672,7 @@ class_statement_list:
class_statement:
variable_modifiers property_list ';' { $$ = stmt.NewPropertyList($1, $2) }
| method_modifiers T_CONST class_const_list ';' { $$ = stmt.NewClassConst($2, $1, $3); }
| method_modifiers T_CONST class_const_list ';' { $$ = stmt.NewClassConstList($2, $1, $3); }
| T_USE name_list trait_adaptations { $$ = stmt.NewTraitUse($1, $2, $3) }
| method_modifiers T_FUNCTION returns_ref identifier '(' parameter_list ')' return_type method_body
{