mathlex 0.4.1

Mathematical expression parser for LaTeX and plain text notation, producing a language-agnostic AST
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Helpers for collecting function names from an expression tree.

use crate::ast::{ExprKind, Expression};
use std::collections::HashSet;

use super::walker::for_each_child;

pub(super) fn cf_core(expr: &Expression, fns: &mut HashSet<String>) {
    if let ExprKind::Function { name, .. } = &expr.kind {
        fns.insert(name.clone());
    }
    for_each_child(expr, |child| cf_core(child, fns));
}