| 224 | |
| 225 | #if SCRIPT_DUMP_SEGMENTS |
| 226 | static struct splice_script_error *dump_segments(const tal_t *ctx, |
| 227 | struct token **tokens) |
| 228 | { |
| 229 | struct splice_script_error *error = tal(ctx, |
| 230 | struct splice_script_error); |
| 231 | |
| 232 | error->type = DEBUG_DUMP; |
| 233 | error->script_index = 0; |
| 234 | error->message = tal_strdup(error, ""); |
| 235 | |
| 236 | for (size_t i = 0; i < tal_count(tokens); i++) { |
| 237 | if (tokens[i]->type == TOK_SEGMENT) { |
| 238 | dump_token_shallow(&error->message, tokens[i]->left, |
| 239 | ""); |
| 240 | dump_token_shallow(&error->message, tokens[i]->middle, |
| 241 | " -> "); |
| 242 | if (tokens[i]->right) |
| 243 | dump_token_shallow(&error->message, |
| 244 | tokens[i]->right, " -> "); |
| 245 | } |
| 246 | else { |
| 247 | tal_append_fmt(&error->message, "Invalid token!! "); |
| 248 | dump_token_shallow(&error->message, tokens[i], ""); |
| 249 | } |
| 250 | tal_append_fmt(&error->message, "\n"); |
| 251 | } |
| 252 | |
| 253 | return error; |
| 254 | } |
| 255 | #endif /* SCRIPT_DUMP_SEGMENTS */ |
| 256 | |
| 257 | static struct splice_script_error *new_error_offset(const tal_t *ctx, |
no test coverage detected