Which parser combinator crate would be most suitable for parsing error messages generated by `rustc?
Code which engages in type-level programming tends to produce compiler error messages unfit for human consumption.
uom produces compiler error messages containing (many occurrences of) beauties such as this:
Quantity<(dyn Dimension<L = PInt<UInt<UTerm, B1>>, J = Z0, Kind = (dyn Kind + 'static), N = Z0, T = NInt<UInt<UInt<UTerm, B1>, B0>>, M = Z0, Th = Z0, I = Z0> + 'static), (dyn uom::si::Units<f32, luminous_intensity = uom::si::luminous_intensity::candela, mass = uom::si::mass::kilogram, length = uom::si::length::meter, time = uom::si::time::second, thermodynamic_temperature = uom::si::thermodynamic_temperature::kelvin, amount_of_substance = uom::si::amount_of_substance::mole, electric_current = uom::si::electric_current::ampere> + 'static), f32>
To make this digestible by humans, the tiny portion of signal among all that noise should be extractend and presented as something like this
Quantity<m^1 s^-2, Kind, f32>
or, in relatively rare cases where more detail is needed, maybe something like this
Quantity<m^1 s^-2, Kind, f32; L=meter M=kilogram T=second I=ampere Th=kelvin N=mole J=candela>
NInt<UInt<UInt<UTerm, B1>, B0>>->
tnfilt is simply a parser written in
nom into which you pipe the output of
I would like to write a similar tool for
uom, but have no idea which of the many parser combinator crates available in Rust I should use for this task (which seems much more involved than the trivial transformation performed by
tnfilt). Can you provide any information that might help me choose one?
I would prefer to avoid parsing text at altogether, by getting some higher-level information from
rustc. Is this possible, somehow?