prism 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
data/src/prettyprint.c CHANGED
@@ -157,6 +157,9 @@ prettyprint_node(pm_buffer_t *buffer, pm_parser_t *parser, pm_node_t *node) {
157
157
  }
158
158
  case PM_BACK_REFERENCE_READ_NODE: {
159
159
  pm_buffer_append_str(buffer, "BackReferenceReadNode(", 22);
160
+ char name_buffer[12];
161
+ snprintf(name_buffer, sizeof(name_buffer), "%u", ((pm_back_reference_read_node_t *)node)->name);
162
+ pm_buffer_append_str(buffer, name_buffer, strlen(name_buffer));
160
163
  pm_buffer_append_str(buffer, ")", 1);
161
164
  break;
162
165
  }
@@ -311,21 +314,6 @@ prettyprint_node(pm_buffer_t *buffer, pm_parser_t *parser, pm_node_t *node) {
311
314
  } else {
312
315
  prettyprint_location(buffer, parser, &((pm_call_and_write_node_t *)node)->message_loc);
313
316
  }
314
- pm_buffer_append_str(buffer, ", ", 2); if (((pm_call_and_write_node_t *)node)->opening_loc.start == NULL) {
315
- pm_buffer_append_str(buffer, "nil", 3);
316
- } else {
317
- prettyprint_location(buffer, parser, &((pm_call_and_write_node_t *)node)->opening_loc);
318
- }
319
- pm_buffer_append_str(buffer, ", ", 2); if (((pm_call_and_write_node_t *)node)->arguments == NULL) {
320
- pm_buffer_append_str(buffer, "nil", 3);
321
- } else {
322
- prettyprint_node(buffer, parser, (pm_node_t *)((pm_call_and_write_node_t *)node)->arguments);
323
- }
324
- pm_buffer_append_str(buffer, ", ", 2); if (((pm_call_and_write_node_t *)node)->closing_loc.start == NULL) {
325
- pm_buffer_append_str(buffer, "nil", 3);
326
- } else {
327
- prettyprint_location(buffer, parser, &((pm_call_and_write_node_t *)node)->closing_loc);
328
- }
329
317
  pm_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
330
318
  snprintf(flags_buffer, sizeof(flags_buffer), "+%d", (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
331
319
  pm_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
@@ -403,21 +391,6 @@ prettyprint_node(pm_buffer_t *buffer, pm_parser_t *parser, pm_node_t *node) {
403
391
  } else {
404
392
  prettyprint_location(buffer, parser, &((pm_call_operator_write_node_t *)node)->message_loc);
405
393
  }
406
- pm_buffer_append_str(buffer, ", ", 2); if (((pm_call_operator_write_node_t *)node)->opening_loc.start == NULL) {
407
- pm_buffer_append_str(buffer, "nil", 3);
408
- } else {
409
- prettyprint_location(buffer, parser, &((pm_call_operator_write_node_t *)node)->opening_loc);
410
- }
411
- pm_buffer_append_str(buffer, ", ", 2); if (((pm_call_operator_write_node_t *)node)->arguments == NULL) {
412
- pm_buffer_append_str(buffer, "nil", 3);
413
- } else {
414
- prettyprint_node(buffer, parser, (pm_node_t *)((pm_call_operator_write_node_t *)node)->arguments);
415
- }
416
- pm_buffer_append_str(buffer, ", ", 2); if (((pm_call_operator_write_node_t *)node)->closing_loc.start == NULL) {
417
- pm_buffer_append_str(buffer, "nil", 3);
418
- } else {
419
- prettyprint_location(buffer, parser, &((pm_call_operator_write_node_t *)node)->closing_loc);
420
- }
421
394
  pm_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
422
395
  snprintf(flags_buffer, sizeof(flags_buffer), "+%d", (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
423
396
  pm_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
@@ -452,21 +425,6 @@ prettyprint_node(pm_buffer_t *buffer, pm_parser_t *parser, pm_node_t *node) {
452
425
  } else {
453
426
  prettyprint_location(buffer, parser, &((pm_call_or_write_node_t *)node)->message_loc);
454
427
  }
455
- pm_buffer_append_str(buffer, ", ", 2); if (((pm_call_or_write_node_t *)node)->opening_loc.start == NULL) {
456
- pm_buffer_append_str(buffer, "nil", 3);
457
- } else {
458
- prettyprint_location(buffer, parser, &((pm_call_or_write_node_t *)node)->opening_loc);
459
- }
460
- pm_buffer_append_str(buffer, ", ", 2); if (((pm_call_or_write_node_t *)node)->arguments == NULL) {
461
- pm_buffer_append_str(buffer, "nil", 3);
462
- } else {
463
- prettyprint_node(buffer, parser, (pm_node_t *)((pm_call_or_write_node_t *)node)->arguments);
464
- }
465
- pm_buffer_append_str(buffer, ", ", 2); if (((pm_call_or_write_node_t *)node)->closing_loc.start == NULL) {
466
- pm_buffer_append_str(buffer, "nil", 3);
467
- } else {
468
- prettyprint_location(buffer, parser, &((pm_call_or_write_node_t *)node)->closing_loc);
469
- }
470
428
  pm_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
471
429
  snprintf(flags_buffer, sizeof(flags_buffer), "+%d", (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
472
430
  pm_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
@@ -1116,6 +1074,105 @@ prettyprint_node(pm_buffer_t *buffer, pm_parser_t *parser, pm_node_t *node) {
1116
1074
  pm_buffer_append_str(buffer, ")", 1);
1117
1075
  break;
1118
1076
  }
1077
+ case PM_INDEX_AND_WRITE_NODE: {
1078
+ pm_buffer_append_str(buffer, "IndexAndWriteNode(", 18);
1079
+ if (((pm_index_and_write_node_t *)node)->receiver == NULL) {
1080
+ pm_buffer_append_str(buffer, "nil", 3);
1081
+ } else {
1082
+ prettyprint_node(buffer, parser, (pm_node_t *)((pm_index_and_write_node_t *)node)->receiver);
1083
+ }
1084
+ pm_buffer_append_str(buffer, ", ", 2); if (((pm_index_and_write_node_t *)node)->call_operator_loc.start == NULL) {
1085
+ pm_buffer_append_str(buffer, "nil", 3);
1086
+ } else {
1087
+ prettyprint_location(buffer, parser, &((pm_index_and_write_node_t *)node)->call_operator_loc);
1088
+ }
1089
+ pm_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((pm_index_and_write_node_t *)node)->opening_loc);
1090
+ pm_buffer_append_str(buffer, ", ", 2); if (((pm_index_and_write_node_t *)node)->arguments == NULL) {
1091
+ pm_buffer_append_str(buffer, "nil", 3);
1092
+ } else {
1093
+ prettyprint_node(buffer, parser, (pm_node_t *)((pm_index_and_write_node_t *)node)->arguments);
1094
+ }
1095
+ pm_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((pm_index_and_write_node_t *)node)->closing_loc);
1096
+ pm_buffer_append_str(buffer, ", ", 2); if (((pm_index_and_write_node_t *)node)->block == NULL) {
1097
+ pm_buffer_append_str(buffer, "nil", 3);
1098
+ } else {
1099
+ prettyprint_node(buffer, parser, (pm_node_t *)((pm_index_and_write_node_t *)node)->block);
1100
+ }
1101
+ pm_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
1102
+ snprintf(flags_buffer, sizeof(flags_buffer), "+%d", (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1103
+ pm_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
1104
+ pm_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((pm_index_and_write_node_t *)node)->operator_loc);
1105
+ pm_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (pm_node_t *)((pm_index_and_write_node_t *)node)->value);
1106
+ pm_buffer_append_str(buffer, ")", 1);
1107
+ break;
1108
+ }
1109
+ case PM_INDEX_OPERATOR_WRITE_NODE: {
1110
+ pm_buffer_append_str(buffer, "IndexOperatorWriteNode(", 23);
1111
+ if (((pm_index_operator_write_node_t *)node)->receiver == NULL) {
1112
+ pm_buffer_append_str(buffer, "nil", 3);
1113
+ } else {
1114
+ prettyprint_node(buffer, parser, (pm_node_t *)((pm_index_operator_write_node_t *)node)->receiver);
1115
+ }
1116
+ pm_buffer_append_str(buffer, ", ", 2); if (((pm_index_operator_write_node_t *)node)->call_operator_loc.start == NULL) {
1117
+ pm_buffer_append_str(buffer, "nil", 3);
1118
+ } else {
1119
+ prettyprint_location(buffer, parser, &((pm_index_operator_write_node_t *)node)->call_operator_loc);
1120
+ }
1121
+ pm_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((pm_index_operator_write_node_t *)node)->opening_loc);
1122
+ pm_buffer_append_str(buffer, ", ", 2); if (((pm_index_operator_write_node_t *)node)->arguments == NULL) {
1123
+ pm_buffer_append_str(buffer, "nil", 3);
1124
+ } else {
1125
+ prettyprint_node(buffer, parser, (pm_node_t *)((pm_index_operator_write_node_t *)node)->arguments);
1126
+ }
1127
+ pm_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((pm_index_operator_write_node_t *)node)->closing_loc);
1128
+ pm_buffer_append_str(buffer, ", ", 2); if (((pm_index_operator_write_node_t *)node)->block == NULL) {
1129
+ pm_buffer_append_str(buffer, "nil", 3);
1130
+ } else {
1131
+ prettyprint_node(buffer, parser, (pm_node_t *)((pm_index_operator_write_node_t *)node)->block);
1132
+ }
1133
+ pm_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
1134
+ snprintf(flags_buffer, sizeof(flags_buffer), "+%d", (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1135
+ pm_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
1136
+ pm_buffer_append_str(buffer, ", ", 2); char operator_buffer[12];
1137
+ snprintf(operator_buffer, sizeof(operator_buffer), "%u", ((pm_index_operator_write_node_t *)node)->operator);
1138
+ pm_buffer_append_str(buffer, operator_buffer, strlen(operator_buffer));
1139
+ pm_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((pm_index_operator_write_node_t *)node)->operator_loc);
1140
+ pm_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (pm_node_t *)((pm_index_operator_write_node_t *)node)->value);
1141
+ pm_buffer_append_str(buffer, ")", 1);
1142
+ break;
1143
+ }
1144
+ case PM_INDEX_OR_WRITE_NODE: {
1145
+ pm_buffer_append_str(buffer, "IndexOrWriteNode(", 17);
1146
+ if (((pm_index_or_write_node_t *)node)->receiver == NULL) {
1147
+ pm_buffer_append_str(buffer, "nil", 3);
1148
+ } else {
1149
+ prettyprint_node(buffer, parser, (pm_node_t *)((pm_index_or_write_node_t *)node)->receiver);
1150
+ }
1151
+ pm_buffer_append_str(buffer, ", ", 2); if (((pm_index_or_write_node_t *)node)->call_operator_loc.start == NULL) {
1152
+ pm_buffer_append_str(buffer, "nil", 3);
1153
+ } else {
1154
+ prettyprint_location(buffer, parser, &((pm_index_or_write_node_t *)node)->call_operator_loc);
1155
+ }
1156
+ pm_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((pm_index_or_write_node_t *)node)->opening_loc);
1157
+ pm_buffer_append_str(buffer, ", ", 2); if (((pm_index_or_write_node_t *)node)->arguments == NULL) {
1158
+ pm_buffer_append_str(buffer, "nil", 3);
1159
+ } else {
1160
+ prettyprint_node(buffer, parser, (pm_node_t *)((pm_index_or_write_node_t *)node)->arguments);
1161
+ }
1162
+ pm_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((pm_index_or_write_node_t *)node)->closing_loc);
1163
+ pm_buffer_append_str(buffer, ", ", 2); if (((pm_index_or_write_node_t *)node)->block == NULL) {
1164
+ pm_buffer_append_str(buffer, "nil", 3);
1165
+ } else {
1166
+ prettyprint_node(buffer, parser, (pm_node_t *)((pm_index_or_write_node_t *)node)->block);
1167
+ }
1168
+ pm_buffer_append_str(buffer, ", ", 2); char flags_buffer[12];
1169
+ snprintf(flags_buffer, sizeof(flags_buffer), "+%d", (uint32_t)(node->flags & ~PM_NODE_FLAG_COMMON_MASK));
1170
+ pm_buffer_append_str(buffer, flags_buffer, strlen(flags_buffer));
1171
+ pm_buffer_append_str(buffer, ", ", 2); prettyprint_location(buffer, parser, &((pm_index_or_write_node_t *)node)->operator_loc);
1172
+ pm_buffer_append_str(buffer, ", ", 2); prettyprint_node(buffer, parser, (pm_node_t *)((pm_index_or_write_node_t *)node)->value);
1173
+ pm_buffer_append_str(buffer, ")", 1);
1174
+ break;
1175
+ }
1119
1176
  case PM_INSTANCE_VARIABLE_AND_WRITE_NODE: {
1120
1177
  pm_buffer_append_str(buffer, "InstanceVariableAndWriteNode(", 29);
1121
1178
  char name_buffer[12];