[refactoring] fix typo

This commit is contained in:
Vadym Slizov 2020-12-11 17:29:22 +02:00
parent 45ded326d0
commit 5291529a37
No known key found for this signature in database
GPG Key ID: AEA2A9388EF42A4A
8 changed files with 149 additions and 149 deletions

BIN
internal/php5/php5.go generated

Binary file not shown.

View File

@ -366,9 +366,9 @@ top_statement:
Parts: $2.(*ast.ParserSeparatedList).Items,
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
},
OpenCurlyBracket: $3,
OpenCurlyBracketTkn: $3,
Stmts: $4,
CloseCurlyBracket: $5,
CloseCurlyBracketTkn: $5,
}
}
| T_NAMESPACE '{' top_statement_list '}'
@ -376,9 +376,9 @@ top_statement:
$$ = &ast.StmtNamespace{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $4),
NsTkn: $1,
OpenCurlyBracket: $2,
OpenCurlyBracketTkn: $2,
Stmts: $3,
CloseCurlyBracket: $4,
CloseCurlyBracketTkn: $4,
}
}
| T_USE use_declarations ';'
@ -769,9 +769,9 @@ unticked_statement:
{
$$ = &ast.StmtStmtList{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $3),
OpenCurlyBracket: $1,
OpenCurlyBracketTkn: $1,
Stmts: $2,
CloseCurlyBracket: $3,
CloseCurlyBracketTkn: $3,
}
}
| T_IF parenthesis_expr statement elseif_list else_single
@ -1046,9 +1046,9 @@ unticked_statement:
$$ = &ast.StmtTry{
Position: pos,
TryTkn: $1,
OpenCurlyBracket: $2,
OpenCurlyBracketTkn: $2,
Stmts: $3,
CloseCurlyBracket: $4,
CloseCurlyBracketTkn: $4,
Catches: $5,
Finally: $6,
}
@ -2353,9 +2353,9 @@ method_body:
{
$$ = &ast.StmtStmtList{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $3),
OpenCurlyBracket: $1,
OpenCurlyBracketTkn: $1,
Stmts: $2,
CloseCurlyBracket: $3,
CloseCurlyBracketTkn: $3,
}
}
;
@ -4498,9 +4498,9 @@ scalar:
{
$$ = &ast.ScalarEncapsed{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $3),
OpenQoteTkn: $1,
OpenQuoteTkn: $1,
Parts: $2,
CloseQoteTkn: $3,
CloseQuoteTkn: $3,
}
}
| T_START_HEREDOC encaps_list T_END_HEREDOC

BIN
internal/php7/php7.go generated

Binary file not shown.

View File

@ -450,9 +450,9 @@ top_statement:
Parts: $2.(*ast.ParserSeparatedList).Items,
SeparatorTkns: $2.(*ast.ParserSeparatedList).SeparatorTkns,
},
OpenCurlyBracket: $3,
OpenCurlyBracketTkn: $3,
Stmts: $4,
CloseCurlyBracket: $5,
CloseCurlyBracketTkn: $5,
}
}
| T_NAMESPACE '{' top_statement_list '}'
@ -460,7 +460,7 @@ top_statement:
$$ = &ast.StmtNamespace{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $4),
NsTkn: $1,
OpenCurlyBracket: $2,
OpenCurlyBracketTkn: $2,
Stmts: $3,
CloseCurlyBracket: $4,
}
@ -813,9 +813,9 @@ statement:
{
$$ = &ast.StmtStmtList{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $3),
OpenCurlyBracket: $1,
OpenCurlyBracketTkn: $1,
Stmts: $2,
CloseCurlyBracket: $3,
CloseCurlyBracketTkn: $3,
}
}
| if_stmt
@ -1010,9 +1010,9 @@ statement:
$$ = &ast.StmtTry{
Position: pos,
TryTkn: $1,
OpenCurlyBracket: $2,
OpenCurlyBracketTkn: $2,
Stmts: $3,
CloseCurlyBracket: $4,
CloseCurlyBracketTkn: $4,
Catches: $5,
Finally: $6,
}
@ -1196,9 +1196,9 @@ class_declaration_statement:
},
Extends: $4,
Implements: $5,
OpenCurlyBracket: $7,
OpenCurlyBracketTkn: $7,
Stmts: $8,
CloseCurlyBracket: $9,
CloseCurlyBracketTkn: $9,
}
}
| T_CLASS T_STRING extends_from implements_list backup_doc_comment '{' class_statement_list '}'
@ -1213,9 +1213,9 @@ class_declaration_statement:
},
Extends: $3,
Implements: $4,
OpenCurlyBracket: $6,
OpenCurlyBracketTkn: $6,
Stmts: $7,
CloseCurlyBracket: $8,
CloseCurlyBracketTkn: $8,
}
}
;
@ -1261,9 +1261,9 @@ trait_declaration_statement:
IdentifierTkn: $2,
Value: $2.Value,
},
OpenCurlyBracket: $4,
OpenCurlyBracketTkn: $4,
Stmts: $5,
CloseCurlyBracket: $6,
CloseCurlyBracketTkn: $6,
}
}
;
@ -2191,9 +2191,9 @@ method_body:
{
$$ = &ast.StmtStmtList{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $3),
OpenCurlyBracket: $1,
OpenCurlyBracketTkn: $1,
Stmts: $2,
CloseCurlyBracket: $3,
CloseCurlyBracketTkn: $3,
}
}
;
@ -2448,9 +2448,9 @@ anonymous_class:
CloseParenthesisTkn: $2.(*ast.ArgumentList).CloseParenthesisTkn,
Extends: $3,
Implements: $4,
OpenCurlyBracket: $6,
OpenCurlyBracketTkn: $6,
Stmts: $7,
CloseCurlyBracket: $8,
CloseCurlyBracketTkn: $8,
}
}
;
@ -3550,9 +3550,9 @@ scalar:
{
$$ = &ast.ScalarEncapsed{
Position: yylex.(*Parser).builder.NewTokensPosition($1, $3),
OpenQoteTkn: $1,
OpenQuoteTkn: $1,
Parts: $2,
CloseQoteTkn: $3,
CloseQuoteTkn: $3,
}
}
| T_START_HEREDOC encaps_list T_END_HEREDOC

View File

@ -103,9 +103,9 @@ func (n *ScalarDnumber) GetPosition() *position.Position {
// ScalarEncapsed node
type ScalarEncapsed struct {
Position *position.Position
OpenQoteTkn *token.Token
OpenQuoteTkn *token.Token
Parts []Vertex
CloseQoteTkn *token.Token
CloseQuoteTkn *token.Token
}
func (n *ScalarEncapsed) Accept(v NodeVisitor) {
@ -260,9 +260,9 @@ type StmtClass struct {
CloseParenthesisTkn *token.Token
Extends Vertex
Implements Vertex
OpenCurlyBracket *token.Token
OpenCurlyBracketTkn *token.Token
Stmts []Vertex
CloseCurlyBracket *token.Token
CloseCurlyBracketTkn *token.Token
}
func (n *StmtClass) Accept(v NodeVisitor) {
@ -764,9 +764,9 @@ type StmtNamespace struct {
Position *position.Position
NsTkn *token.Token
Name Vertex
OpenCurlyBracket *token.Token
OpenCurlyBracketTkn *token.Token
Stmts []Vertex
CloseCurlyBracket *token.Token
CloseCurlyBracketTkn *token.Token
SemiColonTkn *token.Token
}
@ -878,9 +878,9 @@ func (n *StmtStaticVar) GetPosition() *position.Position {
// StmtStmtList node
type StmtStmtList struct {
Position *position.Position
OpenCurlyBracket *token.Token
OpenCurlyBracketTkn *token.Token
Stmts []Vertex
CloseCurlyBracket *token.Token
CloseCurlyBracketTkn *token.Token
}
func (n *StmtStmtList) Accept(v NodeVisitor) {
@ -939,9 +939,9 @@ type StmtTrait struct {
TraitName Vertex
Extends Vertex
Implements Vertex
OpenCurlyBracket *token.Token
OpenCurlyBracketTkn *token.Token
Stmts []Vertex
CloseCurlyBracket *token.Token
CloseCurlyBracketTkn *token.Token
}
func (n *StmtTrait) Accept(v NodeVisitor) {
@ -1041,9 +1041,9 @@ func (n *StmtTraitUsePrecedence) GetPosition() *position.Position {
type StmtTry struct {
Position *position.Position
TryTkn *token.Token
OpenCurlyBracket *token.Token
OpenCurlyBracketTkn *token.Token
Stmts []Vertex
CloseCurlyBracket *token.Token
CloseCurlyBracketTkn *token.Token
Catches []Vertex
Finally Vertex
}

View File

@ -288,9 +288,9 @@ func (v *Dump) StmtClass(n *ast.StmtClass) {
v.dumpToken("CloseParenthesisTkn", n.CloseParenthesisTkn)
v.dumpVertex("Extends", n.Extends)
v.dumpVertex("Implements", n.Implements)
v.dumpToken("OpenCurlyBracket", n.OpenCurlyBracket)
v.dumpToken("OpenCurlyBracketTkn", n.OpenCurlyBracketTkn)
v.dumpVertexList("Stmts", n.Stmts)
v.dumpToken("CloseCurlyBracket", n.CloseCurlyBracket)
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
v.indent--
v.print(v.indent, "},\n")
@ -706,9 +706,9 @@ func (v *Dump) StmtNamespace(n *ast.StmtNamespace) {
v.dumpPosition(n.Position)
v.dumpToken("NsTkn", n.NsTkn)
v.dumpVertex("Name", n.Name)
v.dumpToken("OpenCurlyBracket", n.OpenCurlyBracket)
v.dumpToken("OpenCurlyBracketTkn", n.OpenCurlyBracketTkn)
v.dumpVertexList("Stmts", n.Stmts)
v.dumpToken("CloseCurlyBracket", n.CloseCurlyBracket)
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
v.dumpToken("SemiColonTkn", n.SemiColonTkn)
v.indent--
@ -799,9 +799,9 @@ func (v *Dump) StmtStmtList(n *ast.StmtStmtList) {
v.indent++
v.dumpPosition(n.Position)
v.dumpToken("OpenCurlyBracket", n.OpenCurlyBracket)
v.dumpToken("OpenCurlyBracketTkn", n.OpenCurlyBracketTkn)
v.dumpVertexList("Stmts", n.Stmts)
v.dumpToken("CloseCurlyBracket", n.CloseCurlyBracket)
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
v.indent--
v.print(v.indent, "},\n")
@ -850,9 +850,9 @@ func (v *Dump) StmtTrait(n *ast.StmtTrait) {
v.dumpVertex("TraitName", n.TraitName)
v.dumpVertex("Extends", n.Extends)
v.dumpVertex("Implements", n.Implements)
v.dumpToken("OpenCurlyBracket", n.OpenCurlyBracket)
v.dumpToken("OpenCurlyBracketTkn", n.OpenCurlyBracketTkn)
v.dumpVertexList("Stmts", n.Stmts)
v.dumpToken("CloseCurlyBracket", n.CloseCurlyBracket)
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
v.indent--
v.print(v.indent, "},\n")
@ -934,9 +934,9 @@ func (v *Dump) StmtTry(n *ast.StmtTry) {
v.dumpPosition(n.Position)
v.dumpToken("TryTkn", n.TryTkn)
v.dumpToken("OpenCurlyBracket", n.OpenCurlyBracket)
v.dumpToken("OpenCurlyBracketTkn", n.OpenCurlyBracketTkn)
v.dumpVertexList("Stmts", n.Stmts)
v.dumpToken("CloseCurlyBracket", n.CloseCurlyBracket)
v.dumpToken("CloseCurlyBracketTkn", n.CloseCurlyBracketTkn)
v.dumpVertexList("Catches", n.Catches)
v.dumpVertex("Finally", n.Finally)
@ -2236,9 +2236,9 @@ func (v *Dump) ScalarEncapsed(n *ast.ScalarEncapsed) {
v.indent++
v.dumpPosition(n.Position)
v.dumpToken("OpenQoteTkn", n.OpenQoteTkn)
v.dumpToken("OpenQuoteTkn", n.OpenQuoteTkn)
v.dumpVertexList("Parts", n.Parts)
v.dumpToken("CloseQoteTkn", n.CloseQoteTkn)
v.dumpToken("CloseQuoteTkn", n.CloseQuoteTkn)
v.indent--
v.print(v.indent, "},\n")

View File

@ -13,7 +13,7 @@ import (
func TestDumper_root(t *testing.T) {
o := bytes.NewBufferString("")
p := visitor.NewDump(o)
p := visitor.NewDump(o).WithTokens().WithPositions()
n := &ast.Root{
Position: &position.Position{
StartLine: 1,

View File

@ -196,9 +196,9 @@ func (p *printer) StmtClass(n *ast.StmtClass) {
p.printToken(n.CloseParenthesisTkn, p.ifNodeList(n.Arguments, []byte(")")))
p.printNode(n.Extends)
p.printNode(n.Implements)
p.printToken(n.OpenCurlyBracket, []byte("{"))
p.printToken(n.OpenCurlyBracketTkn, []byte("{"))
p.printList(n.Stmts)
p.printToken(n.CloseCurlyBracket, []byte("}"))
p.printToken(n.CloseCurlyBracketTkn, []byte("}"))
}
func (p *printer) StmtClassConstList(n *ast.StmtClassConstList) {
@ -256,9 +256,9 @@ func (p *printer) StmtDeclare(n *ast.StmtDeclare) {
p.printToken(n.CloseParenthesisTkn, []byte(")"))
p.printToken(n.ColonTkn, nil)
if stmt, ok := n.Stmt.(*ast.StmtStmtList); ok && n.ColonTkn != nil {
p.printToken(stmt.OpenCurlyBracket, nil)
p.printToken(stmt.OpenCurlyBracketTkn, nil)
p.printList(stmt.Stmts)
p.printToken(stmt.CloseCurlyBracket, nil)
p.printToken(stmt.CloseCurlyBracketTkn, nil)
} else {
p.printNode(n.Stmt)
}
@ -293,9 +293,9 @@ func (p *printer) StmtElse(n *ast.StmtElse) {
p.printToken(n.ElseTkn, []byte("else"))
p.printToken(n.ColonTkn, nil)
if stmt, ok := n.Stmt.(*ast.StmtStmtList); ok && n.ColonTkn != nil {
p.printToken(stmt.OpenCurlyBracket, nil)
p.printToken(stmt.OpenCurlyBracketTkn, nil)
p.printList(stmt.Stmts)
p.printToken(stmt.CloseCurlyBracket, nil)
p.printToken(stmt.CloseCurlyBracketTkn, nil)
} else {
p.printNode(n.Stmt)
}
@ -308,9 +308,9 @@ func (p *printer) StmtElseIf(n *ast.StmtElseIf) {
p.printToken(n.CloseParenthesisTkn, []byte(")"))
p.printToken(n.ColonTkn, nil)
if stmt, ok := n.Stmt.(*ast.StmtStmtList); ok && n.ColonTkn != nil {
p.printToken(stmt.OpenCurlyBracket, nil)
p.printToken(stmt.OpenCurlyBracketTkn, nil)
p.printList(stmt.Stmts)
p.printToken(stmt.CloseCurlyBracket, nil)
p.printToken(stmt.CloseCurlyBracketTkn, nil)
} else {
p.printNode(n.Stmt)
}
@ -339,9 +339,9 @@ func (p *printer) StmtFor(n *ast.StmtFor) {
p.printToken(n.CloseParenthesisTkn, []byte(")"))
p.printToken(n.ColonTkn, nil)
if stmt, ok := n.Stmt.(*ast.StmtStmtList); ok && n.ColonTkn != nil {
p.printToken(stmt.OpenCurlyBracket, nil)
p.printToken(stmt.OpenCurlyBracketTkn, nil)
p.printList(stmt.Stmts)
p.printToken(stmt.CloseCurlyBracket, nil)
p.printToken(stmt.CloseCurlyBracketTkn, nil)
} else {
p.printNode(n.Stmt)
}
@ -360,9 +360,9 @@ func (p *printer) StmtForeach(n *ast.StmtForeach) {
p.printToken(n.CloseParenthesisTkn, []byte(")"))
p.printToken(n.ColonTkn, nil)
if stmt, ok := n.Stmt.(*ast.StmtStmtList); ok && n.ColonTkn != nil {
p.printToken(stmt.OpenCurlyBracket, nil)
p.printToken(stmt.OpenCurlyBracketTkn, nil)
p.printList(stmt.Stmts)
p.printToken(stmt.CloseCurlyBracket, nil)
p.printToken(stmt.CloseCurlyBracketTkn, nil)
} else {
p.printNode(n.Stmt)
}
@ -410,9 +410,9 @@ func (p *printer) StmtIf(n *ast.StmtIf) {
p.printToken(n.CloseParenthesisTkn, []byte(")"))
p.printToken(n.ColonTkn, nil)
if stmt, ok := n.Stmt.(*ast.StmtStmtList); ok && n.ColonTkn != nil {
p.printToken(stmt.OpenCurlyBracket, nil)
p.printToken(stmt.OpenCurlyBracketTkn, nil)
p.printList(stmt.Stmts)
p.printToken(stmt.CloseCurlyBracket, nil)
p.printToken(stmt.CloseCurlyBracketTkn, nil)
} else {
p.printNode(n.Stmt)
}
@ -454,9 +454,9 @@ func (p *printer) StmtLabel(n *ast.StmtLabel) {
func (p *printer) StmtNamespace(n *ast.StmtNamespace) {
p.printToken(n.NsTkn, []byte("namespace"))
p.printNode(n.Name)
p.printToken(n.OpenCurlyBracket, p.ifNodeList(n.Stmts, []byte("{")))
p.printToken(n.OpenCurlyBracketTkn, p.ifNodeList(n.Stmts, []byte("{")))
p.printList(n.Stmts)
p.printToken(n.CloseCurlyBracket, p.ifNodeList(n.Stmts, []byte("}")))
p.printToken(n.CloseCurlyBracketTkn, p.ifNodeList(n.Stmts, []byte("}")))
p.printToken(n.SemiColonTkn, p.ifNotNodeList(n.Stmts, []byte(";")))
}
@ -496,9 +496,9 @@ func (p *printer) StmtStaticVar(n *ast.StmtStaticVar) {
}
func (p *printer) StmtStmtList(n *ast.StmtStmtList) {
p.printToken(n.OpenCurlyBracket, []byte("{"))
p.printToken(n.OpenCurlyBracketTkn, []byte("{"))
p.printList(n.Stmts)
p.printToken(n.CloseCurlyBracket, []byte("}"))
p.printToken(n.CloseCurlyBracketTkn, []byte("}"))
}
func (p *printer) StmtSwitch(n *ast.StmtSwitch) {
@ -526,9 +526,9 @@ func (p *printer) StmtTrait(n *ast.StmtTrait) {
p.printNode(n.TraitName)
p.printNode(n.Extends)
p.printNode(n.Implements)
p.printToken(n.OpenCurlyBracket, []byte("{"))
p.printToken(n.OpenCurlyBracketTkn, []byte("{"))
p.printList(n.Stmts)
p.printToken(n.CloseCurlyBracket, []byte("}"))
p.printToken(n.CloseCurlyBracketTkn, []byte("}"))
}
func (p *printer) StmtTraitAdaptationList(n *ast.StmtTraitAdaptationList) {
@ -566,9 +566,9 @@ func (p *printer) StmtTraitUsePrecedence(n *ast.StmtTraitUsePrecedence) {
func (p *printer) StmtTry(n *ast.StmtTry) {
p.printToken(n.TryTkn, []byte("try"))
p.printToken(n.OpenCurlyBracket, []byte("{"))
p.printToken(n.OpenCurlyBracketTkn, []byte("{"))
p.printList(n.Stmts)
p.printToken(n.CloseCurlyBracket, []byte("}"))
p.printToken(n.CloseCurlyBracketTkn, []byte("}"))
p.printList(n.Catches)
p.printNode(n.Finally)
}
@ -615,9 +615,9 @@ func (p *printer) StmtWhile(n *ast.StmtWhile) {
p.printToken(n.CloseParenthesisTkn, []byte(")"))
p.printToken(n.ColonTkn, nil)
if stmt, ok := n.Stmt.(*ast.StmtStmtList); ok && n.ColonTkn != nil {
p.printToken(stmt.OpenCurlyBracket, nil)
p.printToken(stmt.OpenCurlyBracketTkn, nil)
p.printList(stmt.Stmts)
p.printToken(stmt.CloseCurlyBracket, nil)
p.printToken(stmt.CloseCurlyBracketTkn, nil)
} else {
p.printNode(n.Stmt)
}
@ -1181,9 +1181,9 @@ func (p *printer) ScalarDnumber(n *ast.ScalarDnumber) {
}
func (p *printer) ScalarEncapsed(n *ast.ScalarEncapsed) {
p.printToken(n.OpenQoteTkn, []byte("\""))
p.printToken(n.OpenQuoteTkn, []byte("\""))
p.printList(n.Parts)
p.printToken(n.CloseQoteTkn, []byte("\""))
p.printToken(n.CloseQuoteTkn, []byte("\""))
}
func (p *printer) ScalarEncapsedStringPart(n *ast.ScalarEncapsedStringPart) {