File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ const (
2626)
2727
2828var (
29- genReg = regexp .MustCompile (`(?P<func_name>\w+)\((?P<args>(?:\w+=[0-9\.]+,?\s*)*)\)\s+as\s+(?P<type_name>[\w:]+)` )
30- argsReg = regexp .MustCompile (`(\w+)=([0-9\.]+)` )
29+ genReg = regexp .MustCompile (`(?P<func_name>\w+)\((?P<args>(?:\w+=-? [0-9\.]+,?\s*)*)\)\s+as\s+(?P<type_name>[\w:]+)` )
30+ argsReg = regexp .MustCompile (`(\w+)=(-? [0-9\.]+)` )
3131)
3232
3333// ParseDef parses generator function definitions from a string format.
Original file line number Diff line number Diff line change @@ -49,6 +49,15 @@ func TestParseDef(t *testing.T) {
4949 },
5050 err : "" ,
5151 },
52+ {
53+ in : "foo(a=-1) as int" ,
54+ exp : & Func {
55+ Name : "foo" ,
56+ Args : map [string ]float64 {"a" : - 1 },
57+ Type : "int" ,
58+ },
59+ err : "" ,
60+ },
5261 {
5362 in : "foo(a=bar) as int" ,
5463 exp : nil ,
You can’t perform that action at this time.
0 commit comments