From 0dc37ae5bc10cc0669f88ab9febbc039a28f23d1 Mon Sep 17 00:00:00 2001 From: Adam Scarr Date: Sun, 13 Aug 2017 16:56:12 +1000 Subject: Remove a few allocs from Run --- parser.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'parser.go') diff --git a/parser.go b/parser.go index 87705ad..86f2e05 100644 --- a/parser.go +++ b/parser.go @@ -1,7 +1,6 @@ package goparsify import ( - "errors" "fmt" "regexp" "strings" @@ -90,11 +89,11 @@ func Run(parser Parserish, input string, ws ...VoidParser) (result interface{}, ps.AutoWS() if ps.Error.expected != "" { - return ret.Result, ps.Error + return ret.Result, &ps.Error } if ps.Get() != "" { - return ret.Result, errors.New("left unparsed: " + ps.Get()) + return ret.Result, UnparsedInputError{ps.Get()} } return ret.Result, nil -- cgit v1.2.3