herb 0.8.6 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b5e90f240347de46b655bb07d2d6c3f73ef24c6f83e195497be57cad387474b
4
- data.tar.gz: 5b7c2ad8b27e6c2cf6510071984cf256b69c007d1afac09d3a14dd8f5677539c
3
+ metadata.gz: bb933dd69446ffdf3b6706746f99f5874a25e2e93340fef117e3064faa69cab3
4
+ data.tar.gz: fb16a7daa33801315bad9d764e26a32cff881f6368209ee0f88c25f6b06e50c3
5
5
  SHA512:
6
- metadata.gz: a5e412285b68012173497d0386780234d56a26f8d762d9d0af3a35cfbfb744ebb6c8f1c00733f16371fdaabb14ebb393bcffa392a01df23a7ed6ccb6addf10b4
7
- data.tar.gz: e9be1580f17713b58dcf5f85562813021fecdbbc120df11cba2c71c4b12268e7b0e5d40c4fdfacf10c661b5755d756b9b444fcfcf85ff5c24131bdd72d519aa2
6
+ metadata.gz: 461f888eeb0df13d8122a6e254e36e6526a3adb7d6e85386f6c922fc767103bbae81b16abc809a0cf99ef7f93b1c07607ee5b85941aa309464dc1b42b32607b8
7
+ data.tar.gz: 9d5d357bc010cb16392c1e14f7cd33d1a711d7bc9d2866b55aaf6d0c533d5b40a4bf209afdeb974d56dcc54e84646defb7f477ddcea87b60d22e4c3e3479c44a
@@ -367,7 +367,7 @@ VALUE rb_errors_array_from_c_array(hb_array_T* array) {
367
367
  VALUE rb_array = rb_ary_new();
368
368
 
369
369
  if (array) {
370
- for (size_t i = 0; i < array->size; i++) {
370
+ for (size_t i = 0; i < hb_array_size(array); i++) {
371
371
  ERROR_T* child_node = (ERROR_T*) hb_array_get(array, i);
372
372
 
373
373
  if (child_node) {
@@ -63,7 +63,7 @@ VALUE create_lex_result(hb_array_T* tokens, VALUE source) {
63
63
  VALUE warnings = rb_ary_new();
64
64
  VALUE errors = rb_ary_new();
65
65
 
66
- for (size_t i = 0; i < tokens->size; i++) {
66
+ for (size_t i = 0; i < hb_array_size(tokens); i++) {
67
67
  token_T* token = hb_array_get(tokens, i);
68
68
  if (token != NULL) { rb_ary_push(value, rb_token_from_c_struct(token)); }
69
69
  }
data/ext/herb/nodes.c CHANGED
@@ -464,7 +464,7 @@ static VALUE rb_erb_content_node_from_c_struct(AST_ERB_CONTENT_NODE_T* erb_conte
464
464
  VALUE erb_content_node_tag_opening = rb_token_from_c_struct(erb_content_node->tag_opening);
465
465
  VALUE erb_content_node_content = rb_token_from_c_struct(erb_content_node->content);
466
466
  VALUE erb_content_node_tag_closing = rb_token_from_c_struct(erb_content_node->tag_closing);
467
- /* #<Herb::Template::AnalyzedRubyField:0x00007ff3a66353e8 @name="analyzed_ruby", @options={kind: nil}> */
467
+ /* #<Herb::Template::AnalyzedRubyField:0x00007fecd1690058 @name="analyzed_ruby", @options={kind: nil}> */
468
468
  VALUE erb_content_node_analyzed_ruby = Qnil;
469
469
  VALUE erb_content_node_parsed = (erb_content_node->parsed) ? Qtrue : Qfalse;
470
470
  VALUE erb_content_node_valid = (erb_content_node->valid) ? Qtrue : Qfalse;
@@ -1091,7 +1091,7 @@ static VALUE rb_nodes_array_from_c_array(hb_array_T* array) {
1091
1091
  VALUE rb_array = rb_ary_new();
1092
1092
 
1093
1093
  if (array) {
1094
- for (size_t i = 0; i < array->size; i++) {
1094
+ for (size_t i = 0; i < hb_array_size(array); i++) {
1095
1095
  AST_NODE_T* child_node = (AST_NODE_T*) hb_array_get(array, i);
1096
1096
 
1097
1097
  if (child_node) {
data/lib/herb/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # typed: true
3
3
 
4
4
  module Herb
5
- VERSION = "0.8.6"
5
+ VERSION = "0.8.7"
6
6
  end
data/src/analyze.c CHANGED
@@ -308,7 +308,7 @@ static AST_NODE_T* create_control_node(
308
308
 
309
309
  if (end_node) {
310
310
  end_position = end_node->base.location.end;
311
- } else if (children && children->size > 0) {
311
+ } else if (hb_array_size(children) > 0) {
312
312
  AST_NODE_T* last_child = hb_array_last(children);
313
313
  end_position = last_child->location.end;
314
314
  } else if (subsequent) {
@@ -350,7 +350,7 @@ static AST_NODE_T* create_control_node(
350
350
  hb_array_T* in_conditions = hb_array_init(8);
351
351
  hb_array_T* non_when_non_in_children = hb_array_init(8);
352
352
 
353
- for (size_t i = 0; i < children->size; i++) {
353
+ for (size_t i = 0; i < hb_array_size(children); i++) {
354
354
  AST_NODE_T* child = hb_array_get(children, i);
355
355
 
356
356
  if (child && child->type == AST_ERB_WHEN_NODE) {
@@ -364,7 +364,7 @@ static AST_NODE_T* create_control_node(
364
364
 
365
365
  hb_array_free(&children);
366
366
 
367
- if (in_conditions->size > 0) {
367
+ if (hb_array_size(in_conditions) > 0) {
368
368
  hb_array_free(&when_conditions);
369
369
 
370
370
  return (AST_NODE_T*) ast_erb_case_match_node_init(
@@ -560,7 +560,7 @@ static size_t process_control_structure(
560
560
  hb_array_T* in_conditions = hb_array_init(8);
561
561
  hb_array_T* non_when_non_in_children = hb_array_init(8);
562
562
 
563
- while (index < array->size) {
563
+ while (index < hb_array_size(array)) {
564
564
  AST_NODE_T* next_node = hb_array_get(array, index);
565
565
 
566
566
  if (!next_node) { break; }
@@ -576,7 +576,7 @@ static size_t process_control_structure(
576
576
  index++;
577
577
  }
578
578
 
579
- while (index < array->size) {
579
+ while (index < hb_array_size(array)) {
580
580
  AST_NODE_T* next_node = hb_array_get(array, index);
581
581
 
582
582
  if (!next_node) { break; }
@@ -648,7 +648,7 @@ static size_t process_control_structure(
648
648
 
649
649
  AST_ERB_ELSE_NODE_T* else_clause = NULL;
650
650
 
651
- if (index < array->size) {
651
+ if (index < hb_array_size(array)) {
652
652
  AST_NODE_T* next_node = hb_array_get(array, index);
653
653
 
654
654
  if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
@@ -682,7 +682,7 @@ static size_t process_control_structure(
682
682
 
683
683
  AST_ERB_END_NODE_T* end_node = NULL;
684
684
 
685
- if (index < array->size) {
685
+ if (index < hb_array_size(array)) {
686
686
  AST_NODE_T* potential_end = hb_array_get(array, index);
687
687
 
688
688
  if (potential_end && potential_end->type == AST_ERB_CONTENT_NODE) {
@@ -715,15 +715,15 @@ static size_t process_control_structure(
715
715
  end_position = end_node->base.location.end;
716
716
  } else if (else_clause) {
717
717
  end_position = else_clause->base.location.end;
718
- } else if (when_conditions->size > 0) {
718
+ } else if (hb_array_size(when_conditions) > 0) {
719
719
  AST_NODE_T* last_when = hb_array_last(when_conditions);
720
720
  end_position = last_when->location.end;
721
- } else if (in_conditions->size > 0) {
721
+ } else if (hb_array_size(in_conditions) > 0) {
722
722
  AST_NODE_T* last_in = hb_array_last(in_conditions);
723
723
  end_position = last_in->location.end;
724
724
  }
725
725
 
726
- if (in_conditions->size > 0) {
726
+ if (hb_array_size(in_conditions) > 0) {
727
727
  hb_array_T* case_match_errors = erb_node->base.errors;
728
728
  erb_node->base.errors = NULL;
729
729
 
@@ -781,7 +781,7 @@ static size_t process_control_structure(
781
781
  AST_ERB_ELSE_NODE_T* else_clause = NULL;
782
782
  AST_ERB_ENSURE_NODE_T* ensure_clause = NULL;
783
783
 
784
- if (index < array->size) {
784
+ if (index < hb_array_size(array)) {
785
785
  AST_NODE_T* next_node = hb_array_get(array, index);
786
786
 
787
787
  if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
@@ -796,7 +796,7 @@ static size_t process_control_structure(
796
796
  }
797
797
  }
798
798
 
799
- if (index < array->size) {
799
+ if (index < hb_array_size(array)) {
800
800
  AST_NODE_T* next_node = hb_array_get(array, index);
801
801
 
802
802
  if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
@@ -828,7 +828,7 @@ static size_t process_control_structure(
828
828
  }
829
829
  }
830
830
 
831
- if (index < array->size) {
831
+ if (index < hb_array_size(array)) {
832
832
  AST_NODE_T* next_node = hb_array_get(array, index);
833
833
 
834
834
  if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
@@ -840,7 +840,7 @@ static size_t process_control_structure(
840
840
 
841
841
  index++;
842
842
 
843
- while (index < array->size) {
843
+ while (index < hb_array_size(array)) {
844
844
  AST_NODE_T* child = hb_array_get(array, index);
845
845
 
846
846
  if (!child) { break; }
@@ -876,7 +876,7 @@ static size_t process_control_structure(
876
876
 
877
877
  AST_ERB_END_NODE_T* end_node = NULL;
878
878
 
879
- if (index < array->size) {
879
+ if (index < hb_array_size(array)) {
880
880
  AST_NODE_T* potential_end = hb_array_get(array, index);
881
881
 
882
882
  if (potential_end && potential_end->type == AST_ERB_CONTENT_NODE) {
@@ -943,7 +943,7 @@ static size_t process_control_structure(
943
943
 
944
944
  AST_ERB_END_NODE_T* end_node = NULL;
945
945
 
946
- if (index < array->size) {
946
+ if (index < hb_array_size(array)) {
947
947
  AST_NODE_T* potential_close = hb_array_get(array, index);
948
948
 
949
949
  if (potential_close && potential_close->type == AST_ERB_CONTENT_NODE) {
@@ -975,7 +975,7 @@ static size_t process_control_structure(
975
975
 
976
976
  if (end_node) {
977
977
  end_position = end_node->base.location.end;
978
- } else if (children && children->size > 0) {
978
+ } else if (hb_array_size(children) > 0) {
979
979
  AST_NODE_T* last_child = hb_array_last(children);
980
980
  end_position = last_child->location.end;
981
981
  }
@@ -1005,7 +1005,7 @@ static size_t process_control_structure(
1005
1005
  AST_NODE_T* subsequent = NULL;
1006
1006
  AST_ERB_END_NODE_T* end_node = NULL;
1007
1007
 
1008
- if (index < array->size) {
1008
+ if (index < hb_array_size(array)) {
1009
1009
  AST_NODE_T* next_node = hb_array_get(array, index);
1010
1010
 
1011
1011
  if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
@@ -1018,7 +1018,7 @@ static size_t process_control_structure(
1018
1018
  }
1019
1019
  }
1020
1020
 
1021
- if (index < array->size) {
1021
+ if (index < hb_array_size(array)) {
1022
1022
  AST_NODE_T* potential_end = hb_array_get(array, index);
1023
1023
 
1024
1024
  if (potential_end && potential_end->type == AST_ERB_CONTENT_NODE) {
@@ -1080,7 +1080,7 @@ static size_t process_subsequent_block(
1080
1080
  hb_array_free(&children);
1081
1081
  }
1082
1082
 
1083
- if (index < array->size) {
1083
+ if (index < hb_array_size(array)) {
1084
1084
  AST_NODE_T* next_node = hb_array_get(array, index);
1085
1085
 
1086
1086
  if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
@@ -1138,7 +1138,7 @@ static size_t process_block_children(
1138
1138
  analyze_ruby_context_T* context,
1139
1139
  control_type_t parent_type
1140
1140
  ) {
1141
- while (index < array->size) {
1141
+ while (index < hb_array_size(array)) {
1142
1142
  AST_NODE_T* child = hb_array_get(array, index);
1143
1143
 
1144
1144
  if (!child) { break; }
@@ -1160,7 +1160,7 @@ static size_t process_block_children(
1160
1160
  hb_array_T* temp_array = hb_array_init(1);
1161
1161
  size_t new_index = process_control_structure(node, array, index, temp_array, context, child_type);
1162
1162
 
1163
- if (temp_array->size > 0) { hb_array_append(children_array, hb_array_first(temp_array)); }
1163
+ if (hb_array_size(temp_array) > 0) { hb_array_append(children_array, hb_array_first(temp_array)); }
1164
1164
 
1165
1165
  hb_array_free(&temp_array);
1166
1166
 
@@ -1176,10 +1176,10 @@ static size_t process_block_children(
1176
1176
  }
1177
1177
 
1178
1178
  hb_array_T* rewrite_node_array(AST_NODE_T* node, hb_array_T* array, analyze_ruby_context_T* context) {
1179
- hb_array_T* new_array = hb_array_init(array->size);
1179
+ hb_array_T* new_array = hb_array_init(hb_array_size(array));
1180
1180
  size_t index = 0;
1181
1181
 
1182
- while (index < array->size) {
1182
+ while (index < hb_array_size(array)) {
1183
1183
  AST_NODE_T* item = hb_array_get(array, index);
1184
1184
 
1185
1185
  if (!item) { break; }
@@ -1314,7 +1314,7 @@ static bool detect_invalid_erb_structures(const AST_NODE_T* node, void* data) {
1314
1314
  if (if_node->end_node == NULL) { check_erb_node_for_missing_end(node); }
1315
1315
 
1316
1316
  if (if_node->statements != NULL) {
1317
- for (size_t i = 0; i < if_node->statements->size; i++) {
1317
+ for (size_t i = 0; i < hb_array_size(if_node->statements); i++) {
1318
1318
  AST_NODE_T* statement = (AST_NODE_T*) hb_array_get(if_node->statements, i);
1319
1319
 
1320
1320
  if (statement != NULL) { herb_visit_node(statement, detect_invalid_erb_structures, context); }
@@ -1346,7 +1346,7 @@ static bool detect_invalid_erb_structures(const AST_NODE_T* node, void* data) {
1346
1346
  const AST_ERB_IF_NODE_T* elsif_node = (const AST_ERB_IF_NODE_T*) subsequent;
1347
1347
 
1348
1348
  if (elsif_node->statements != NULL) {
1349
- for (size_t i = 0; i < elsif_node->statements->size; i++) {
1349
+ for (size_t i = 0; i < hb_array_size(elsif_node->statements); i++) {
1350
1350
  AST_NODE_T* statement = (AST_NODE_T*) hb_array_get(elsif_node->statements, i);
1351
1351
 
1352
1352
  if (statement != NULL) { herb_visit_node(statement, detect_invalid_erb_structures, context); }
@@ -1358,7 +1358,7 @@ static bool detect_invalid_erb_structures(const AST_NODE_T* node, void* data) {
1358
1358
  const AST_ERB_ELSE_NODE_T* else_node = (const AST_ERB_ELSE_NODE_T*) subsequent;
1359
1359
 
1360
1360
  if (else_node->statements != NULL) {
1361
- for (size_t i = 0; i < else_node->statements->size; i++) {
1361
+ for (size_t i = 0; i < hb_array_size(else_node->statements); i++) {
1362
1362
  AST_NODE_T* statement = (AST_NODE_T*) hb_array_get(else_node->statements, i);
1363
1363
 
1364
1364
  if (statement != NULL) { herb_visit_node(statement, detect_invalid_erb_structures, context); }
data/src/ast_node.c CHANGED
@@ -43,7 +43,7 @@ ast_node_type_T ast_node_type(const AST_NODE_T* node) {
43
43
  }
44
44
 
45
45
  size_t ast_node_errors_count(const AST_NODE_T* node) {
46
- return node->errors->size;
46
+ return hb_array_size(node->errors);
47
47
  }
48
48
 
49
49
  hb_array_T* ast_node_errors(const AST_NODE_T* node) {