Macro sise::sise_expr[][src]

macro_rules! sise_expr {
    ([$($item : tt), *]) => { ... };
    ([$($item : tt,) *]) => { ... };
    ($node : expr) => { ... };
}
Expand description

Macro to define trees of nodes with a lighter syntax.

Example

use sise::sise_expr;

// atom
let value1 = sise::Node::Atom(String::from("atom"));
let value2 = sise_expr!("atom");
assert_eq!(value1, value2);

// ()
let value1 = sise::Node::List(vec![]);
let value2 = sise_expr!([]);
assert_eq!(value1, value2);

// (atom)
let value1 = sise::Node::List(vec![sise::Node::Atom(String::from("atom"))]);
let value2 = sise_expr!(["atom"]);
assert_eq!(value1, value2);

// (atom (1 2 3) (a b c))
let value1 = sise::Node::List(vec![
    sise::Node::Atom(String::from("atom")),
    sise::Node::List(vec![
        sise::Node::Atom(String::from("1")),
        sise::Node::Atom(String::from("2")),
        sise::Node::Atom(String::from("3")),
    ]),
    sise::Node::List(vec![
        sise::Node::Atom(String::from("a")),
        sise::Node::Atom(String::from("b")),
        sise::Node::Atom(String::from("c")),
    ]),
]);
let value2 = sise_expr!(["atom", ["1", "2", "3"], ["a", "b", "c"]]);
assert_eq!(value1, value2);