macro_rules! tree_with {
($($tt:tt)*) => { ... };
}
Expand description
Helper macro for building a tree in place with a custom span.
ยงExamples
use syntree::{Empty, EmptyVec, Tree, TreeIndex};
syntree::flavor! {
struct FlavorEmpty {
type Index = Empty;
type Indexes = EmptyVec<TreeIndex<Self>>;
}
};
let tree: Tree<_, FlavorEmpty> = syntree::tree_with! {
"root" => {
"child" => {
"token"
},
"child2"
}
};
let expected: Tree<_, FlavorEmpty> = syntree::tree_with! {
"root" => {
"child" => {
("token", Empty)
},
"child2"
}
};
assert_eq!(tree, expected);