MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / getShellCommandTokens

Function getShellCommandTokens

tools/shell/linenoise.cpp:1444–1462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1442}
1443
1444std::vector<highlightToken> getShellCommandTokens(char* buf, size_t len) {
1445 std::vector<highlightToken> tokens;
1446
1447 // identifier token for the shell command itself
1448 highlightToken shell_token;
1449 shell_token.type = tokenType::TOKEN_KEYWORD;
1450 shell_token.start = 0;
1451 tokens.push_back(shell_token);
1452
1453 for (uint64_t i = 0; i + 1 < len; i++) {
1454 if (isspace(buf[i])) {
1455 highlightToken argument_token;
1456 argument_token.type = tokenType::TOKEN_STRING_CONSTANT;
1457 argument_token.start = i + 1;
1458 tokens.push_back(argument_token);
1459 }
1460 }
1461 return tokens;
1462}
1463
1464static tokenType convertToken(antlr4::Token* token) {
1465 auto tokenType = token->getType();

Callers 1

highlightingTokenizeFunction · 0.85

Calls 1

push_backMethod · 0.45

Tested by

no test coverage detected