From a007bdd8c3bde57fc9f212e86bf3706fa62efabc Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Wed, 18 Sep 2024 13:02:23 -0600 Subject: [PATCH] Use gigaparsec.Run to run sexp parser --- csexp/sexp.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/csexp/sexp.go b/csexp/sexp.go index 9876293..69791cc 100644 --- a/csexp/sexp.go +++ b/csexp/sexp.go @@ -152,13 +152,9 @@ func Parse(data []byte) (Sexp, error) { gigaparsec.End[byte](), func(s Sexp, _ struct{}) Sexp { return s }, ) - result, err := parser(gigaparsec.MakeState(cursor.NewSlice(data))) + result, err := gigaparsec.Run(parser, cursor.NewSlice(data)) if err != nil { return nil, fmt.Errorf("csexp.Parse: %w", err) } - if failed, _, msg := result.Failed(); failed { - return nil, fmt.Errorf("csexp.Parse: %v", msg) - } - _, _, sexp, _, _ := result.Succeeded() - return sexp, nil + return result, nil }