-
Hi. I have multiple parsers, they are all in choice(). One of them gets an invalid argument error, but the main parser with choice() ends up getting a "multiple errors" error. Also, it identifies the correct span where the error occurred, but displays "multiple errors". How can i get the output of invalid argument errors. I have read that in this case chumsky tries to get the most informative error, but for some reason it does not work for me. Errors occured here: let hlarg = num_arg
.try_map(|n, s| Hl::try_from(n).map_err(|e| Rich::custom(s, e))); Parsing of tag with this parser: let h = just(Token::H)
.ignore_then(hlarg)
.then(text_body)
.map(|(level, body)| H(body, level)); Main parser: choice((
el, h, p, br, ul, ol, row, link, navlink, btn, navbtn, img, table, tcol, tpcol, hr, b,
i, bq, footlnk, footn, a, s, sup, sub, disc,
))
.or(choice((block, carousel, code, pre, meta)))
.or(choice((el_text, el_tags, paragraph))) Source: https://github.com/TxtDot/dalet-rs/blob/main/src/daleth/parser/mod.rs |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
When you say 'displays multiple errors', what do you mean? Are you seeing this variant? |
Beta Was this translation helpful? Give feedback.
When you say 'displays multiple errors', what do you mean? Are you seeing this variant?