Use gigaparsec.Run to run sexp parser

This commit is contained in:
Brandon Dyck 2024-09-18 13:02:23 -06:00
parent 4a13ec209d
commit a007bdd8c3

View File

@ -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
}