Skip to content

Commit ae2d839

Browse files
author
川石
committed
move package
1 parent 20e6a59 commit ae2d839

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

compiler/visitor.go renamed to compiler.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package compiler
1+
package expr
22

33
import (
44
"fmt"
@@ -25,6 +25,14 @@ func Compile(expr string) (Expression, error) {
2525
return p.Parse().Accept(visitor).(Expression), nil
2626
}
2727

28+
func MustCompile(expr string) Expression {
29+
exp, err := Compile(expr)
30+
if err != nil {
31+
return nil
32+
}
33+
return exp
34+
}
35+
2836
type Expression interface {
2937
Eval(vg ValueGetter) (interface{}, error)
3038
String() string

compiler/visitor_test.go renamed to compiler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package compiler
1+
package expr
22

33
import (
44
"fmt"

0 commit comments

Comments
 (0)