ratex_parser/functions/
lap.rs1use std::collections::HashMap;
2
3use crate::error::ParseResult;
4use crate::functions::{define_function_full, FunctionContext, FunctionSpec};
5use crate::parse_node::ParseNode;
6
7pub fn register(map: &mut HashMap<&'static str, FunctionSpec>) {
8 define_function_full(
9 map,
10 &["\\mathllap", "\\mathrlap", "\\mathclap"],
11 "lap",
12 1, 0, None,
13 false,
14 true, true,
15 false, false,
16 handle_lap,
17 );
18}
19
20fn handle_lap(
21 ctx: &mut FunctionContext,
22 args: Vec<ParseNode>,
23 _opt_args: Vec<Option<ParseNode>>,
24) -> ParseResult<ParseNode> {
25 let alignment = ctx.func_name[5..].to_string();
26
27 Ok(ParseNode::Lap {
28 mode: ctx.parser.mode,
29 alignment,
30 body: Box::new(args.into_iter().next().unwrap()),
31 loc: None,
32 })
33}