@@ -86,7 +86,7 @@ func ParseMany(targets []string) ([]*expr, error) {
86
86
return nil , err
87
87
}
88
88
if leftover != "" {
89
- panic ( fmt .Sprintf ("failed to parse %q fully. got leftover %q" , target , leftover ) )
89
+ return nil , fmt .Errorf ("failed to parse %q fully. got leftover %q" , target , leftover )
90
90
}
91
91
out = append (out , e )
92
92
}
@@ -148,6 +148,7 @@ func Parse(e string) (*expr, string, error) {
148
148
return & expr {str : name , etype : etName }, e , nil
149
149
}
150
150
151
+ // caller must assure s starts with opening paren
151
152
func parseArgList (e string ) (string , []* expr , map [string ]* expr , string , error ) {
152
153
153
154
var (
@@ -156,7 +157,7 @@ func parseArgList(e string) (string, []*expr, map[string]*expr, string, error) {
156
157
)
157
158
158
159
if e [0 ] != '(' {
159
- panic ("arg list should start with paren" )
160
+ panic ("arg list should start with paren. calling code should have asserted this " )
160
161
}
161
162
162
163
ArgString := e [1 :]
@@ -301,10 +302,11 @@ FOR:
301
302
return s [:i ], s [i :]
302
303
}
303
304
305
+ // caller must assure s starts with a single or double quote
304
306
func parseString (s string ) (string , string , error ) {
305
307
306
308
if s [0 ] != '\'' && s [0 ] != '"' {
307
- panic ("string should start with open quote" )
309
+ panic ("string should start with open quote. calling code should have asserted this " )
308
310
}
309
311
310
312
match := s [0 ]
0 commit comments