use lispexp::{code_nodes, parse, DatumKind, Options};
fn main() {
let source = r#"
(when (ready? system)
(log:info "starting")
(dispatch '(a b c)) ; '(a b c) is quoted data — skipped
(retry `(job ,(next-id) pending))) ; only (next-id) is code in the template
"#;
let parsed = parse(source, &Options::scheme());
println!("operators called in code position:");
for datum in code_nodes(&parsed.data) {
if let DatumKind::List { items, .. } = &datum.kind {
if let Some(head) = items.first().and_then(|d| d.as_symbol()) {
println!(" {head}");
}
}
}
}