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

Function build_arguments

src/infer_intent.rs:331–351  ·  view source on GitHub ↗

process all the args of a function Start state: after '(' End state: on ')'

(
            rules_with_context: &'r mut SpeechRulesWithContext<'c,'s,'m>,
            lex_state: &mut LexState<'b>,
            mathml: Element<'c>)

Source from the content-addressed store, hash-verified

329// Start state: after '('
330// End state: on ')'
331fn build_arguments<'b, 'r, 'c, 's:'c, 'm:'c>(
332 rules_with_context: &'r mut SpeechRulesWithContext<'c,'s,'m>,
333 lex_state: &mut LexState<'b>,
334 mathml: Element<'c>) -> Result<Vec<Element<'m>>> {
335 // arguments := intent ( ',' intent )*'
336 // debug!(" start build_args state: {}", lex_state);
337
338 // there is at least one arg
339 let mut children = Vec::with_capacity(lex_state.remaining_str.len()/3 + 1); // conservative estimate ('3' - "$x,");
340 children.push( build_intent(rules_with_context, lex_state, mathml)? ); // arg before ','
341 // debug!(" build_args: # children {}; state: {}", children.len(), lex_state);
342
343 while lex_state.is_terminal(",") {
344 lex_state.get_next()?;
345 children.push( build_intent(rules_with_context, lex_state, mathml)? ); // arg before ','
346 // debug!(" build_args, # children {}; state: {}", children.len(), lex_state);
347 }
348
349 // debug!(" end build_args, # children {}; state: {}", children.len(), lex_state);
350 return Ok(children);
351}
352
353/// lift the children up to LITERAL_NAME
354fn lift_function_name<'m>(doc: Document<'m>, function_name: Element<'m>, children: Vec<Element<'m>>) -> Element<'m> {

Callers 1

build_functionFunction · 0.85

Calls 5

build_intentFunction · 0.85
lenMethod · 0.80
is_terminalMethod · 0.80
get_nextMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected