MCPcopy Create free account
hub / github.com/daisy/MathCAT / is_function

Method is_function

src/xpath_functions.rs:246–265  ·  view source on GitHub ↗

fn_name ⁡ [simple arg or (simple arg)]

(mrow: Element)

Source from the content-addressed store, hash-verified

244
245 // fn_name ⁡ [simple arg or (simple arg)]
246 fn is_function(mrow: Element) -> bool {
247 assert!( is_tag(mrow, "mrow") );
248 let children = mrow.children();
249 if children.len() != 3 {
250 return false;
251 }
252 if !(is_COE_tag(&children[1], "mo") &&
253 is_equal(&children[1], '\u{2061}') ) { // invisible function application
254 return false;
255 }
256 if !is_COE_tag(&children[0], "mi") {
257 return false;
258 }
259 let function_arg = children[2].element().unwrap();
260 if IsBracketed::is_bracketed(function_arg, "(", ")", false, false) {
261 return IsNode::is_simple(function_arg.children()[1].element().unwrap());
262 } else {
263 return IsNode::is_simple(function_arg);
264 }
265 }
266 }
267
268 // Returns true if 'frac' is a common fraction

Callers

nothing calls this directly

Calls 3

is_COE_tagFunction · 0.85
is_simpleFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected