* Get token from name. */
| 442 | * Get token from name. |
| 443 | */ |
| 444 | Token Parser::getTokenFromName(const char *name) |
| 445 | { |
| 446 | bool reg = (name[0] == '%' && name[1] != '\0'); |
| 447 | if (reg) |
| 448 | name++; |
| 449 | const TokenInfo *info = getTokenInfo(name); |
| 450 | if (info == nullptr) |
| 451 | return TOKEN_ERROR; |
| 452 | if (reg && info->token != TOKEN_REGISTER) |
| 453 | return TOKEN_ERROR; |
| 454 | i = info->value; |
| 455 | return info->token; |
| 456 | } |
| 457 | |
| 458 | /* |
| 459 | * Get the next token. |
no test coverage detected