MCPcopy Create free account
hub / github.com/NanoMichael/MicroTeX / getCommandWithArgs

Method getCommandWithArgs

src/core/parser.cpp:339–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337}
338
339wstring TeXParser::getCommandWithArgs(const wstring& command) {
340 if (command == L"left") return getGroup(L"\\left", L"\\right");
341
342 auto it = MacroInfo::_commands.find(command);
343 if (it == MacroInfo::_commands.end()) return L"\\" + command;
344
345 MacroInfo* mac = it->second;
346 int mac_opts = mac->_posOpts;
347
348 // return as format: \cmd[opt][...]{arg}{...}
349
350 vector<wstring> mac_args;
351 getOptsArgs(mac->_nbArgs, mac_opts, mac_args);
352 wstring mac_arg(L"\\");
353 mac_arg.append(command);
354 for (int j = 0; j < mac->_posOpts; j++) {
355 wstring arg_t = mac_args[mac->_nbArgs + j + 1];
356 if (!arg_t.empty()) {
357 mac_arg.append(L"[");
358 mac_arg.append(arg_t);
359 mac_arg.append(L"]");
360 }
361 }
362
363 for (int j = 0; j < mac->_nbArgs; j++) {
364 wstring arg_t = mac_args[j + 1];
365 if (!arg_t.empty()) {
366 mac_arg.append(L"{");
367 mac_arg.append(arg_t);
368 mac_arg.append(L"}");
369 }
370 }
371
372 return mac_arg;
373}
374
375void TeXParser::skipWhiteSpace() {
376 wchar_t c;

Callers

nothing calls this directly

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected