| 495 | } |
| 496 | |
| 497 | std::string TokenFunc::toString(const Token& token) { |
| 498 | std::string result; |
| 499 | if (token.type == Token_OPERATOR) { |
| 500 | result.push_back(token.value_char); |
| 501 | } else if (token.type == Token_INT) { |
| 502 | result = std::to_string(token.value_int); |
| 503 | } else if (token.type == Token_BOOL) { |
| 504 | if (token.value_int == 1) { |
| 505 | result = ".T."; |
| 506 | } else if (token.value_int == 0) { |
| 507 | result = ".F."; |
| 508 | } else { |
| 509 | result = ".U."; |
| 510 | } |
| 511 | } else if (token.type == Token_FLOAT) { |
| 512 | std::ostringstream oss; |
| 513 | oss << std::setprecision(15) << token.value_double; |
| 514 | result = oss.str(); |
| 515 | } else { |
| 516 | token.lexer->TokenString(token.startPos, result); |
| 517 | } |
| 518 | return result; |
| 519 | } |
| 520 | |
| 521 | // |
| 522 | // Reads the arguments from a list of token |
no test coverage detected