-
Notifications
You must be signed in to change notification settings - Fork 153
/
helpers.go
50 lines (47 loc) · 1.23 KB
/
helpers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package ast
import (
"regexp"
"time"
)
func IntegerLiteralFromValue(v int64) *IntegerLiteral {
return &IntegerLiteral{Value: v}
}
func UnsignedIntegerLiteralFromValue(v uint64) *UnsignedIntegerLiteral {
return &UnsignedIntegerLiteral{Value: v}
}
func FloatLiteralFromValue(v float64) *FloatLiteral {
return &FloatLiteral{Value: v}
}
func StringLiteralFromValue(v string) *StringLiteral {
return &StringLiteral{Value: v}
}
func BooleanLiteralFromValue(v bool) *BooleanLiteral {
return &BooleanLiteral{Value: v}
}
func DateTimeLiteralFromValue(v time.Time) *DateTimeLiteral {
return &DateTimeLiteral{Value: v}
}
func RegexpLiteralFromValue(v *regexp.Regexp) *RegexpLiteral {
return &RegexpLiteral{Value: v}
}
func IntegerFromLiteral(lit *IntegerLiteral) int64 {
return lit.Value
}
func UnsignedIntegerFromLiteral(lit *UnsignedIntegerLiteral) uint64 {
return lit.Value
}
func FloatFromLiteral(lit *FloatLiteral) float64 {
return lit.Value
}
func StringFromLiteral(lit *StringLiteral) string {
return lit.Value
}
func BooleanFromLiteral(lit *BooleanLiteral) bool {
return lit.Value
}
func DateTimeFromLiteral(lit *DateTimeLiteral) time.Time {
return lit.Value
}
func RegexpFromLiteral(lit *RegexpLiteral) *regexp.Regexp {
return lit.Value
}