Open
Description
Hey all,
I'm currently working on a transpiler from another language into VRL. All other parts of the AST implement Display in a way that is valid syntactically to parse it again i.e. parse <-> display (formatting not withstanding). However the implementation of Display for abort
incorrectly places a colon in its output.
The following kind of test succeeds for all other expressions in VRL.
#[test]
fn abort_isomorphism_failure() {
let expression = r#"abort "error message""#;
assert_eq!(
format!("{expression}\n"),
vrl::parser::parse(expression).unwrap().to_string()
)
}
I don't know if this kind of isomorphism via std::fmt::Display
is a guarantee the project is looking to provide, but beyond transpilers it's also very useful for pretty printers since printing from the parsed AST canonicalizes the formatting.
Metadata
Metadata
Assignees
Labels
No labels