Skip to content

Commit d08eedd

Browse files
committed
Refactor helper package to file package
1 parent 03ace18 commit d08eedd

File tree

13 files changed

+93
-93
lines changed

13 files changed

+93
-93
lines changed

ast/location.go

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,165 @@
11
package ast
22

33
import (
4-
"github.com/antonmedv/expr/internal/helper"
4+
"github.com/antonmedv/expr/internal/file"
55
)
66

7-
func (n *NilNode) SetLocation(l helper.Location) {
7+
func (n *NilNode) SetLocation(l file.Location) {
88
n.l = l
99
}
1010

11-
func (n *NilNode) GetLocation() helper.Location {
11+
func (n *NilNode) GetLocation() file.Location {
1212
return n.l
1313
}
1414

15-
func (n *IdentifierNode) SetLocation(l helper.Location) {
15+
func (n *IdentifierNode) SetLocation(l file.Location) {
1616
n.l = l
1717
}
1818

19-
func (n *IdentifierNode) GetLocation() helper.Location {
19+
func (n *IdentifierNode) GetLocation() file.Location {
2020
return n.l
2121
}
2222

23-
func (n *IntegerNode) SetLocation(l helper.Location) {
23+
func (n *IntegerNode) SetLocation(l file.Location) {
2424
n.l = l
2525
}
2626

27-
func (n *IntegerNode) GetLocation() helper.Location {
27+
func (n *IntegerNode) GetLocation() file.Location {
2828
return n.l
2929
}
3030

31-
func (n *FloatNode) SetLocation(l helper.Location) {
31+
func (n *FloatNode) SetLocation(l file.Location) {
3232
n.l = l
3333
}
3434

35-
func (n *FloatNode) GetLocation() helper.Location {
35+
func (n *FloatNode) GetLocation() file.Location {
3636
return n.l
3737
}
3838

39-
func (n *BoolNode) SetLocation(l helper.Location) {
39+
func (n *BoolNode) SetLocation(l file.Location) {
4040
n.l = l
4141
}
4242

43-
func (n *BoolNode) GetLocation() helper.Location {
43+
func (n *BoolNode) GetLocation() file.Location {
4444
return n.l
4545
}
4646

47-
func (n *StringNode) SetLocation(l helper.Location) {
47+
func (n *StringNode) SetLocation(l file.Location) {
4848
n.l = l
4949
}
5050

51-
func (n *StringNode) GetLocation() helper.Location {
51+
func (n *StringNode) GetLocation() file.Location {
5252
return n.l
5353
}
5454

55-
func (n *UnaryNode) SetLocation(l helper.Location) {
55+
func (n *UnaryNode) SetLocation(l file.Location) {
5656
n.l = l
5757
}
5858

59-
func (n *UnaryNode) GetLocation() helper.Location {
59+
func (n *UnaryNode) GetLocation() file.Location {
6060
return n.l
6161
}
6262

63-
func (n *BinaryNode) SetLocation(l helper.Location) {
63+
func (n *BinaryNode) SetLocation(l file.Location) {
6464
n.l = l
6565
}
6666

67-
func (n *BinaryNode) GetLocation() helper.Location {
67+
func (n *BinaryNode) GetLocation() file.Location {
6868
return n.l
6969
}
7070

71-
func (n *MatchesNode) SetLocation(l helper.Location) {
71+
func (n *MatchesNode) SetLocation(l file.Location) {
7272
n.l = l
7373
}
7474

75-
func (n *MatchesNode) GetLocation() helper.Location {
75+
func (n *MatchesNode) GetLocation() file.Location {
7676
return n.l
7777
}
7878

79-
func (n *PropertyNode) SetLocation(l helper.Location) {
79+
func (n *PropertyNode) SetLocation(l file.Location) {
8080
n.l = l
8181
}
8282

83-
func (n *PropertyNode) GetLocation() helper.Location {
83+
func (n *PropertyNode) GetLocation() file.Location {
8484
return n.l
8585
}
8686

87-
func (n *IndexNode) SetLocation(l helper.Location) {
87+
func (n *IndexNode) SetLocation(l file.Location) {
8888
n.l = l
8989
}
9090

91-
func (n *IndexNode) GetLocation() helper.Location {
91+
func (n *IndexNode) GetLocation() file.Location {
9292
return n.l
9393
}
9494

95-
func (n *MethodNode) SetLocation(l helper.Location) {
95+
func (n *MethodNode) SetLocation(l file.Location) {
9696
n.l = l
9797
}
9898

99-
func (n *MethodNode) GetLocation() helper.Location {
99+
func (n *MethodNode) GetLocation() file.Location {
100100
return n.l
101101
}
102102

103-
func (n *FunctionNode) SetLocation(l helper.Location) {
103+
func (n *FunctionNode) SetLocation(l file.Location) {
104104
n.l = l
105105
}
106106

107-
func (n *FunctionNode) GetLocation() helper.Location {
107+
func (n *FunctionNode) GetLocation() file.Location {
108108
return n.l
109109
}
110110

111-
func (n *BuiltinNode) SetLocation(l helper.Location) {
111+
func (n *BuiltinNode) SetLocation(l file.Location) {
112112
n.l = l
113113
}
114114

115-
func (n *BuiltinNode) GetLocation() helper.Location {
115+
func (n *BuiltinNode) GetLocation() file.Location {
116116
return n.l
117117
}
118118

119-
func (n *ClosureNode) SetLocation(l helper.Location) {
119+
func (n *ClosureNode) SetLocation(l file.Location) {
120120
n.l = l
121121
}
122122

123-
func (n *ClosureNode) GetLocation() helper.Location {
123+
func (n *ClosureNode) GetLocation() file.Location {
124124
return n.l
125125
}
126126

127-
func (n *PointerNode) SetLocation(l helper.Location) {
127+
func (n *PointerNode) SetLocation(l file.Location) {
128128
n.l = l
129129
}
130130

131-
func (n *PointerNode) GetLocation() helper.Location {
131+
func (n *PointerNode) GetLocation() file.Location {
132132
return n.l
133133
}
134134

135-
func (n *ConditionalNode) SetLocation(l helper.Location) {
135+
func (n *ConditionalNode) SetLocation(l file.Location) {
136136
n.l = l
137137
}
138138

139-
func (n *ConditionalNode) GetLocation() helper.Location {
139+
func (n *ConditionalNode) GetLocation() file.Location {
140140
return n.l
141141
}
142142

143-
func (n *ArrayNode) SetLocation(l helper.Location) {
143+
func (n *ArrayNode) SetLocation(l file.Location) {
144144
n.l = l
145145
}
146146

147-
func (n *ArrayNode) GetLocation() helper.Location {
147+
func (n *ArrayNode) GetLocation() file.Location {
148148
return n.l
149149
}
150150

151-
func (n *MapNode) SetLocation(l helper.Location) {
151+
func (n *MapNode) SetLocation(l file.Location) {
152152
n.l = l
153153
}
154154

155-
func (n *MapNode) GetLocation() helper.Location {
155+
func (n *MapNode) GetLocation() file.Location {
156156
return n.l
157157
}
158158

159-
func (n *PairNode) GetLocation() helper.Location {
159+
func (n *PairNode) GetLocation() file.Location {
160160
return n.l
161161
}
162162

163-
func (n *PairNode) SetLocation(l helper.Location) {
163+
func (n *PairNode) SetLocation(l file.Location) {
164164
n.l = l
165165
}

ast/node.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,70 @@
11
package ast
22

33
import (
4-
"github.com/antonmedv/expr/internal/helper"
4+
"github.com/antonmedv/expr/internal/file"
55
"reflect"
66
"regexp"
77
)
88

99
// Node represents items of abstract syntax tree.
1010
type Node interface {
11-
GetLocation() helper.Location
12-
SetLocation(helper.Location)
11+
GetLocation() file.Location
12+
SetLocation(file.Location)
1313
GetType() reflect.Type
1414
SetType(reflect.Type)
1515
}
1616

1717
type NilNode struct {
18-
l helper.Location
18+
l file.Location
1919
t reflect.Type
2020
}
2121

2222
type IdentifierNode struct {
23-
l helper.Location
23+
l file.Location
2424
t reflect.Type
2525

2626
Value string
2727
}
2828

2929
type IntegerNode struct {
30-
l helper.Location
30+
l file.Location
3131
t reflect.Type
3232

3333
Value int
3434
Certain bool
3535
}
3636

3737
type FloatNode struct {
38-
l helper.Location
38+
l file.Location
3939
t reflect.Type
4040

4141
Value float64
4242
}
4343

4444
type BoolNode struct {
45-
l helper.Location
45+
l file.Location
4646
t reflect.Type
4747

4848
Value bool
4949
}
5050

5151
type StringNode struct {
52-
l helper.Location
52+
l file.Location
5353
t reflect.Type
5454

5555
Value string
5656
}
5757

5858
type UnaryNode struct {
59-
l helper.Location
59+
l file.Location
6060
t reflect.Type
6161

6262
Operator string
6363
Node Node
6464
}
6565

6666
type BinaryNode struct {
67-
l helper.Location
67+
l file.Location
6868
t reflect.Type
6969

7070
Operator string
@@ -73,7 +73,7 @@ type BinaryNode struct {
7373
}
7474

7575
type MatchesNode struct {
76-
l helper.Location
76+
l file.Location
7777
t reflect.Type
7878

7979
Regexp *regexp.Regexp
@@ -82,23 +82,23 @@ type MatchesNode struct {
8282
}
8383

8484
type PropertyNode struct {
85-
l helper.Location
85+
l file.Location
8686
t reflect.Type
8787

8888
Node Node
8989
Property string
9090
}
9191

9292
type IndexNode struct {
93-
l helper.Location
93+
l file.Location
9494
t reflect.Type
9595

9696
Node Node
9797
Index Node
9898
}
9999

100100
type MethodNode struct {
101-
l helper.Location
101+
l file.Location
102102
t reflect.Type
103103

104104
Node Node
@@ -107,35 +107,35 @@ type MethodNode struct {
107107
}
108108

109109
type FunctionNode struct {
110-
l helper.Location
110+
l file.Location
111111
t reflect.Type
112112

113113
Name string
114114
Arguments []Node
115115
}
116116

117117
type BuiltinNode struct {
118-
l helper.Location
118+
l file.Location
119119
t reflect.Type
120120

121121
Name string
122122
Arguments []Node
123123
}
124124

125125
type ClosureNode struct {
126-
l helper.Location
126+
l file.Location
127127
t reflect.Type
128128

129129
Node Node
130130
}
131131

132132
type PointerNode struct {
133-
l helper.Location
133+
l file.Location
134134
t reflect.Type
135135
}
136136

137137
type ConditionalNode struct {
138-
l helper.Location
138+
l file.Location
139139
t reflect.Type
140140

141141
Cond Node
@@ -144,21 +144,21 @@ type ConditionalNode struct {
144144
}
145145

146146
type ArrayNode struct {
147-
l helper.Location
147+
l file.Location
148148
t reflect.Type
149149

150150
Nodes []Node
151151
}
152152

153153
type MapNode struct {
154-
l helper.Location
154+
l file.Location
155155
t reflect.Type
156156

157157
Pairs []*PairNode
158158
}
159159

160160
type PairNode struct {
161-
l helper.Location
161+
l file.Location
162162
t reflect.Type
163163

164164
Key Node

0 commit comments

Comments
 (0)