Use gigaparsec.Run to run sexp parser
This commit is contained in:
parent
4a13ec209d
commit
a007bdd8c3
@ -152,13 +152,9 @@ func Parse(data []byte) (Sexp, error) {
|
|||||||
gigaparsec.End[byte](),
|
gigaparsec.End[byte](),
|
||||||
func(s Sexp, _ struct{}) Sexp { return s },
|
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 {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("csexp.Parse: %w", err)
|
return nil, fmt.Errorf("csexp.Parse: %w", err)
|
||||||
}
|
}
|
||||||
if failed, _, msg := result.Failed(); failed {
|
return result, nil
|
||||||
return nil, fmt.Errorf("csexp.Parse: %v", msg)
|
|
||||||
}
|
|
||||||
_, _, sexp, _, _ := result.Succeeded()
|
|
||||||
return sexp, nil
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user