| 1442 | } |
| 1443 | |
| 1444 | std::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 | |
| 1464 | static tokenType convertToken(antlr4::Token* token) { |
| 1465 | auto tokenType = token->getType(); |
no test coverage detected