| 278 | }; |
| 279 | |
| 280 | static std::string TokenToString(int t) { |
| 281 | static const char * const tokens[] = { |
| 282 | #define FLATBUFFERS_TOKEN(NAME, VALUE, STRING) STRING, |
| 283 | FLATBUFFERS_GEN_TOKENS(FLATBUFFERS_TOKEN) |
| 284 | #undef FLATBUFFERS_TOKEN |
| 285 | #define FLATBUFFERS_TD(ENUM, IDLTYPE, ...) \ |
| 286 | IDLTYPE, |
| 287 | FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD) |
| 288 | #undef FLATBUFFERS_TD |
| 289 | }; |
| 290 | if (t < 256) { // A single ascii char token. |
| 291 | std::string s; |
| 292 | s.append(1, static_cast<char>(t)); |
| 293 | return s; |
| 294 | } else { // Other tokens. |
| 295 | return tokens[t - 256]; |
| 296 | } |
| 297 | } |
| 298 | // clang-format on |
| 299 | |
| 300 | std::string Parser::TokenToStringId(int t) const { |
no outgoing calls
no test coverage detected