Orange-OpenSource / hurl

Hurl, run and test HTTP requests with plain text.
https://hurl.dev
Apache License 2.0
12.89k stars 482 forks source link

Extract combinator from Hurl parser and use generic for Error. #2985

Closed jcamiel closed 3 months ago

jcamiel commented 3 months ago

Combinators have been extracted from Hurl parser and exposed in hurl_core.

There is some generics on error to make it usable for other parser (for instance JSONPath parser).

Signature of of combinator:

pub fn zero_or_more<T, E>(f: ParseFunc<T, E>, reader: &mut Reader) -> Result<Vec<T>, E>
where
    E: ParseError,

The new thing is the trait bound E: ParseError on error, where ParseError is:

pub trait ParseError {
    fn is_recoverable(&self) -> bool;
    fn to_recoverable(self) -> Self;
    fn to_non_recoverable(self) -> Self;
}
fabricereix commented 3 months ago

/accept

hurl-bot commented 3 months ago

🕗 /accept is running, please wait for completion.

hurl-bot commented 3 months ago

✅ Pull request merged and closed by fabricereix with fast forward merge..

# List of commits merged from Orange-OpenSource/hurl/extract-combinator-from-hurl-parser branch into Orange-OpenSource/hurl/master branch: