Skip to content

Commit 07f49a4

Browse files
committed
refactoring: move internal nodes
1 parent bd47900 commit 07f49a4

File tree

7 files changed

+1226
-1136
lines changed

7 files changed

+1226
-1136
lines changed

internal/php5/node.go

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package php5
2+
3+
import (
4+
"github.com/z7zmey/php-parser/pkg/ast"
5+
"github.com/z7zmey/php-parser/pkg/position"
6+
"github.com/z7zmey/php-parser/pkg/token"
7+
)
8+
9+
type ParserBrackets struct {
10+
Position *position.Position
11+
OpenBracketTkn *token.Token
12+
Child ast.Vertex
13+
CloseBracketTkn *token.Token
14+
}
15+
16+
func (n *ParserBrackets) Accept(v ast.Visitor) {
17+
// do nothing
18+
}
19+
20+
func (n *ParserBrackets) GetPosition() *position.Position {
21+
return n.Position
22+
}
23+
24+
type ParserSeparatedList struct {
25+
Position *position.Position
26+
Items []ast.Vertex
27+
SeparatorTkns []*token.Token
28+
}
29+
30+
func (n *ParserSeparatedList) Accept(v ast.Visitor) {
31+
// do nothing
32+
}
33+
34+
func (n *ParserSeparatedList) GetPosition() *position.Position {
35+
return n.Position
36+
}
37+
38+
// TraitAdaptationList node
39+
type TraitAdaptationList struct {
40+
Position *position.Position
41+
OpenCurlyBracketTkn *token.Token
42+
Adaptations []ast.Vertex
43+
CloseCurlyBracketTkn *token.Token
44+
}
45+
46+
func (n *TraitAdaptationList) Accept(v ast.Visitor) {
47+
// do nothing
48+
}
49+
50+
func (n *TraitAdaptationList) GetPosition() *position.Position {
51+
return n.Position
52+
}
53+
54+
// ArgumentList node
55+
type ArgumentList struct {
56+
Position *position.Position
57+
OpenParenthesisTkn *token.Token
58+
Arguments []ast.Vertex
59+
SeparatorTkns []*token.Token
60+
CloseParenthesisTkn *token.Token
61+
}
62+
63+
func (n *ArgumentList) Accept(v ast.Visitor) {
64+
// do nothing
65+
}
66+
67+
func (n *ArgumentList) GetPosition() *position.Position {
68+
return n.Position
69+
}
70+
71+
// TraitMethodRef node
72+
type TraitMethodRef struct {
73+
Position *position.Position
74+
Trait ast.Vertex
75+
DoubleColonTkn *token.Token
76+
Method ast.Vertex
77+
}
78+
79+
func (n *TraitMethodRef) Accept(v ast.Visitor) {
80+
// do nothing
81+
}
82+
83+
func (n *TraitMethodRef) GetPosition() *position.Position {
84+
return n.Position
85+
}

internal/php5/php5.go

Lines changed: 301 additions & 301 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/php5/php5.y

Lines changed: 301 additions & 301 deletions
Large diffs are not rendered by default.

internal/php7/node.go

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package php7
2+
3+
import (
4+
"github.com/z7zmey/php-parser/pkg/ast"
5+
"github.com/z7zmey/php-parser/pkg/position"
6+
"github.com/z7zmey/php-parser/pkg/token"
7+
)
8+
9+
type ParserBrackets struct {
10+
Position *position.Position
11+
OpenBracketTkn *token.Token
12+
Child ast.Vertex
13+
CloseBracketTkn *token.Token
14+
}
15+
16+
func (n *ParserBrackets) Accept(v ast.Visitor) {
17+
// do nothing
18+
}
19+
20+
func (n *ParserBrackets) GetPosition() *position.Position {
21+
return n.Position
22+
}
23+
24+
type ParserSeparatedList struct {
25+
Position *position.Position
26+
Items []ast.Vertex
27+
SeparatorTkns []*token.Token
28+
}
29+
30+
func (n *ParserSeparatedList) Accept(v ast.Visitor) {
31+
// do nothing
32+
}
33+
34+
func (n *ParserSeparatedList) GetPosition() *position.Position {
35+
return n.Position
36+
}
37+
38+
// TraitAdaptationList node
39+
type TraitAdaptationList struct {
40+
Position *position.Position
41+
OpenCurlyBracketTkn *token.Token
42+
Adaptations []ast.Vertex
43+
CloseCurlyBracketTkn *token.Token
44+
}
45+
46+
func (n *TraitAdaptationList) Accept(v ast.Visitor) {
47+
// do nothing
48+
}
49+
50+
func (n *TraitAdaptationList) GetPosition() *position.Position {
51+
return n.Position
52+
}
53+
54+
// ArgumentList node
55+
type ArgumentList struct {
56+
Position *position.Position
57+
OpenParenthesisTkn *token.Token
58+
Arguments []ast.Vertex
59+
SeparatorTkns []*token.Token
60+
CloseParenthesisTkn *token.Token
61+
}
62+
63+
func (n *ArgumentList) Accept(v ast.Visitor) {
64+
// do nothing
65+
}
66+
67+
func (n *ArgumentList) GetPosition() *position.Position {
68+
return n.Position
69+
}
70+
71+
type ReturnType struct {
72+
Position *position.Position
73+
ColonTkn *token.Token
74+
Type ast.Vertex
75+
}
76+
77+
func (n *ReturnType) Accept(v ast.Visitor) {
78+
// do nothing
79+
}
80+
81+
func (n *ReturnType) GetPosition() *position.Position {
82+
return n.Position
83+
}
84+
85+
// TraitMethodRef node
86+
type TraitMethodRef struct {
87+
Position *position.Position
88+
Trait ast.Vertex
89+
DoubleColonTkn *token.Token
90+
Method ast.Vertex
91+
}
92+
93+
func (n *TraitMethodRef) Accept(v ast.Visitor) {
94+
// do nothing
95+
}
96+
97+
func (n *TraitMethodRef) GetPosition() *position.Position {
98+
return n.Position
99+
}

0 commit comments

Comments
 (0)