herb 0.8.5-arm-linux-gnu → 0.8.7-arm-linux-gnu
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 +4 -4
- data/ext/herb/error_helpers.c +1 -1
- data/ext/herb/extension_helpers.c +1 -1
- data/ext/herb/nodes.c +2 -2
- data/lib/herb/3.0/herb.so +0 -0
- data/lib/herb/3.1/herb.so +0 -0
- data/lib/herb/3.2/herb.so +0 -0
- data/lib/herb/3.3/herb.so +0 -0
- data/lib/herb/3.4/herb.so +0 -0
- data/lib/herb/4.0/herb.so +0 -0
- data/lib/herb/version.rb +1 -1
- data/src/analyze.c +40 -30
- data/src/ast_node.c +1 -1
- data/src/ast_nodes.c +53 -157
- data/src/errors.c +5 -5
- data/src/extract.c +2 -2
- data/src/herb.c +2 -2
- data/src/include/util/hb_narray.h +30 -0
- data/src/include/version.h +1 -1
- data/src/parser.c +9 -9
- data/src/parser_helpers.c +4 -4
- data/src/pretty_print.c +6 -6
- data/src/util/hb_array.c +1 -0
- data/src/util/hb_narray.c +81 -0
- data/src/visitor.c +26 -26
- data/templates/ext/herb/error_helpers.c.erb +1 -1
- data/templates/ext/herb/nodes.c.erb +1 -1
- data/templates/java/error_helpers.c.erb +1 -1
- data/templates/java/nodes.c.erb +2 -2
- data/templates/javascript/packages/node/extension/error_helpers.cpp.erb +1 -1
- data/templates/javascript/packages/node/extension/nodes.cpp.erb +1 -1
- data/templates/rust/src/ast/nodes.rs.erb +2 -2
- data/templates/src/ast_nodes.c.erb +3 -7
- data/templates/src/errors.c.erb +5 -5
- data/templates/src/visitor.c.erb +1 -1
- data/templates/wasm/error_helpers.cpp.erb +1 -1
- data/templates/wasm/nodes.cpp.erb +1 -1
- data/vendor/prism/config.yml +28 -3
- data/vendor/prism/include/prism/ast.h +54 -20
- data/vendor/prism/include/prism/diagnostic.h +2 -0
- data/vendor/prism/include/prism/options.h +8 -2
- data/vendor/prism/include/prism/parser.h +3 -0
- data/vendor/prism/include/prism/version.h +2 -2
- data/vendor/prism/include/prism.h +1 -1
- data/vendor/prism/src/diagnostic.c +5 -1
- data/vendor/prism/src/encoding.c +172 -67
- data/vendor/prism/src/node.c +9 -0
- data/vendor/prism/src/options.c +17 -7
- data/vendor/prism/src/prettyprint.c +16 -0
- data/vendor/prism/src/prism.c +1192 -1895
- data/vendor/prism/src/serialize.c +7 -1
- data/vendor/prism/src/token_type.c +2 -2
- data/vendor/prism/src/util/pm_constant_pool.c +1 -1
- data/vendor/prism/templates/include/prism/ast.h.erb +26 -16
- data/vendor/prism/templates/java/org/prism/Loader.java.erb +1 -1
- data/vendor/prism/templates/javascript/src/deserialize.js.erb +1 -1
- data/vendor/prism/templates/lib/prism/serialize.rb.erb +1 -1
- data/vendor/prism/templates/src/diagnostic.c.erb +2 -0
- data/vendor/prism/templates/src/serialize.c.erb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 04c9974395e64244b6549257cccfb6cae3918d68f70cffef874630060ad44040
|
|
4
|
+
data.tar.gz: b71976d6fa2650d536a847237b14f31132b357c3f7c0b12cd05cef9480e56a6b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5afcffbecec30596938472c2f5fc53eb51af534ba707202fc6f7f4d21c0ec5a265193e87db45806b38150c62b9820aed311ea561b495ae4e96545c45851f3159
|
|
7
|
+
data.tar.gz: 131948ad81b0e6975273a7bde373a1e50488fecb2893fc4613561cca89b429c385df037362a74c052d6331b26134284db134b8e323493f038ee3ac1db8f80fbe
|
data/ext/herb/error_helpers.c
CHANGED
|
@@ -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
|
|
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
|
|
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:
|
|
467
|
+
/* #<Herb::Template::AnalyzedRubyField:0x00007f628ee62a88 @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
|
|
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/3.0/herb.so
CHANGED
|
Binary file
|
data/lib/herb/3.1/herb.so
CHANGED
|
Binary file
|
data/lib/herb/3.2/herb.so
CHANGED
|
Binary file
|
data/lib/herb/3.3/herb.so
CHANGED
|
Binary file
|
data/lib/herb/3.4/herb.so
CHANGED
|
Binary file
|
|
Binary file
|
data/lib/herb/version.rb
CHANGED
data/src/analyze.c
CHANGED
|
@@ -192,9 +192,19 @@ static bool find_earliest_control_keyword_walker(const pm_node_t* node, void* da
|
|
|
192
192
|
case PM_CALL_NODE: {
|
|
193
193
|
pm_call_node_t* call = (pm_call_node_t*) node;
|
|
194
194
|
|
|
195
|
-
if (call->block != NULL) {
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
if (call->block != NULL && call->block->type == PM_BLOCK_NODE) {
|
|
196
|
+
pm_block_node_t* block_node = (pm_block_node_t*) call->block;
|
|
197
|
+
size_t opening_length = block_node->opening_loc.end - block_node->opening_loc.start;
|
|
198
|
+
bool has_do_opening =
|
|
199
|
+
opening_length == 2 && block_node->opening_loc.start[0] == 'd' && block_node->opening_loc.start[1] == 'o';
|
|
200
|
+
bool has_brace_opening = opening_length == 1 && block_node->opening_loc.start[0] == '{';
|
|
201
|
+
bool has_closing_location = block_node->closing_loc.start != NULL && block_node->closing_loc.end != NULL
|
|
202
|
+
&& (block_node->closing_loc.end - block_node->closing_loc.start) > 0;
|
|
203
|
+
|
|
204
|
+
if (has_do_opening || (has_brace_opening && !has_closing_location)) {
|
|
205
|
+
current_type = CONTROL_TYPE_BLOCK;
|
|
206
|
+
keyword_offset = (uint32_t) (node->location.start - context->source_start);
|
|
207
|
+
}
|
|
198
208
|
}
|
|
199
209
|
break;
|
|
200
210
|
}
|
|
@@ -298,7 +308,7 @@ static AST_NODE_T* create_control_node(
|
|
|
298
308
|
|
|
299
309
|
if (end_node) {
|
|
300
310
|
end_position = end_node->base.location.end;
|
|
301
|
-
} else if (children
|
|
311
|
+
} else if (hb_array_size(children) > 0) {
|
|
302
312
|
AST_NODE_T* last_child = hb_array_last(children);
|
|
303
313
|
end_position = last_child->location.end;
|
|
304
314
|
} else if (subsequent) {
|
|
@@ -340,7 +350,7 @@ static AST_NODE_T* create_control_node(
|
|
|
340
350
|
hb_array_T* in_conditions = hb_array_init(8);
|
|
341
351
|
hb_array_T* non_when_non_in_children = hb_array_init(8);
|
|
342
352
|
|
|
343
|
-
for (size_t i = 0; i < children
|
|
353
|
+
for (size_t i = 0; i < hb_array_size(children); i++) {
|
|
344
354
|
AST_NODE_T* child = hb_array_get(children, i);
|
|
345
355
|
|
|
346
356
|
if (child && child->type == AST_ERB_WHEN_NODE) {
|
|
@@ -354,7 +364,7 @@ static AST_NODE_T* create_control_node(
|
|
|
354
364
|
|
|
355
365
|
hb_array_free(&children);
|
|
356
366
|
|
|
357
|
-
if (in_conditions
|
|
367
|
+
if (hb_array_size(in_conditions) > 0) {
|
|
358
368
|
hb_array_free(&when_conditions);
|
|
359
369
|
|
|
360
370
|
return (AST_NODE_T*) ast_erb_case_match_node_init(
|
|
@@ -550,7 +560,7 @@ static size_t process_control_structure(
|
|
|
550
560
|
hb_array_T* in_conditions = hb_array_init(8);
|
|
551
561
|
hb_array_T* non_when_non_in_children = hb_array_init(8);
|
|
552
562
|
|
|
553
|
-
while (index < array
|
|
563
|
+
while (index < hb_array_size(array)) {
|
|
554
564
|
AST_NODE_T* next_node = hb_array_get(array, index);
|
|
555
565
|
|
|
556
566
|
if (!next_node) { break; }
|
|
@@ -566,7 +576,7 @@ static size_t process_control_structure(
|
|
|
566
576
|
index++;
|
|
567
577
|
}
|
|
568
578
|
|
|
569
|
-
while (index < array
|
|
579
|
+
while (index < hb_array_size(array)) {
|
|
570
580
|
AST_NODE_T* next_node = hb_array_get(array, index);
|
|
571
581
|
|
|
572
582
|
if (!next_node) { break; }
|
|
@@ -638,7 +648,7 @@ static size_t process_control_structure(
|
|
|
638
648
|
|
|
639
649
|
AST_ERB_ELSE_NODE_T* else_clause = NULL;
|
|
640
650
|
|
|
641
|
-
if (index < array
|
|
651
|
+
if (index < hb_array_size(array)) {
|
|
642
652
|
AST_NODE_T* next_node = hb_array_get(array, index);
|
|
643
653
|
|
|
644
654
|
if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
|
|
@@ -672,7 +682,7 @@ static size_t process_control_structure(
|
|
|
672
682
|
|
|
673
683
|
AST_ERB_END_NODE_T* end_node = NULL;
|
|
674
684
|
|
|
675
|
-
if (index < array
|
|
685
|
+
if (index < hb_array_size(array)) {
|
|
676
686
|
AST_NODE_T* potential_end = hb_array_get(array, index);
|
|
677
687
|
|
|
678
688
|
if (potential_end && potential_end->type == AST_ERB_CONTENT_NODE) {
|
|
@@ -705,15 +715,15 @@ static size_t process_control_structure(
|
|
|
705
715
|
end_position = end_node->base.location.end;
|
|
706
716
|
} else if (else_clause) {
|
|
707
717
|
end_position = else_clause->base.location.end;
|
|
708
|
-
} else if (when_conditions
|
|
718
|
+
} else if (hb_array_size(when_conditions) > 0) {
|
|
709
719
|
AST_NODE_T* last_when = hb_array_last(when_conditions);
|
|
710
720
|
end_position = last_when->location.end;
|
|
711
|
-
} else if (in_conditions
|
|
721
|
+
} else if (hb_array_size(in_conditions) > 0) {
|
|
712
722
|
AST_NODE_T* last_in = hb_array_last(in_conditions);
|
|
713
723
|
end_position = last_in->location.end;
|
|
714
724
|
}
|
|
715
725
|
|
|
716
|
-
if (in_conditions
|
|
726
|
+
if (hb_array_size(in_conditions) > 0) {
|
|
717
727
|
hb_array_T* case_match_errors = erb_node->base.errors;
|
|
718
728
|
erb_node->base.errors = NULL;
|
|
719
729
|
|
|
@@ -771,7 +781,7 @@ static size_t process_control_structure(
|
|
|
771
781
|
AST_ERB_ELSE_NODE_T* else_clause = NULL;
|
|
772
782
|
AST_ERB_ENSURE_NODE_T* ensure_clause = NULL;
|
|
773
783
|
|
|
774
|
-
if (index < array
|
|
784
|
+
if (index < hb_array_size(array)) {
|
|
775
785
|
AST_NODE_T* next_node = hb_array_get(array, index);
|
|
776
786
|
|
|
777
787
|
if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
|
|
@@ -786,7 +796,7 @@ static size_t process_control_structure(
|
|
|
786
796
|
}
|
|
787
797
|
}
|
|
788
798
|
|
|
789
|
-
if (index < array
|
|
799
|
+
if (index < hb_array_size(array)) {
|
|
790
800
|
AST_NODE_T* next_node = hb_array_get(array, index);
|
|
791
801
|
|
|
792
802
|
if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
|
|
@@ -818,7 +828,7 @@ static size_t process_control_structure(
|
|
|
818
828
|
}
|
|
819
829
|
}
|
|
820
830
|
|
|
821
|
-
if (index < array
|
|
831
|
+
if (index < hb_array_size(array)) {
|
|
822
832
|
AST_NODE_T* next_node = hb_array_get(array, index);
|
|
823
833
|
|
|
824
834
|
if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
|
|
@@ -830,7 +840,7 @@ static size_t process_control_structure(
|
|
|
830
840
|
|
|
831
841
|
index++;
|
|
832
842
|
|
|
833
|
-
while (index < array
|
|
843
|
+
while (index < hb_array_size(array)) {
|
|
834
844
|
AST_NODE_T* child = hb_array_get(array, index);
|
|
835
845
|
|
|
836
846
|
if (!child) { break; }
|
|
@@ -866,7 +876,7 @@ static size_t process_control_structure(
|
|
|
866
876
|
|
|
867
877
|
AST_ERB_END_NODE_T* end_node = NULL;
|
|
868
878
|
|
|
869
|
-
if (index < array
|
|
879
|
+
if (index < hb_array_size(array)) {
|
|
870
880
|
AST_NODE_T* potential_end = hb_array_get(array, index);
|
|
871
881
|
|
|
872
882
|
if (potential_end && potential_end->type == AST_ERB_CONTENT_NODE) {
|
|
@@ -933,7 +943,7 @@ static size_t process_control_structure(
|
|
|
933
943
|
|
|
934
944
|
AST_ERB_END_NODE_T* end_node = NULL;
|
|
935
945
|
|
|
936
|
-
if (index < array
|
|
946
|
+
if (index < hb_array_size(array)) {
|
|
937
947
|
AST_NODE_T* potential_close = hb_array_get(array, index);
|
|
938
948
|
|
|
939
949
|
if (potential_close && potential_close->type == AST_ERB_CONTENT_NODE) {
|
|
@@ -965,7 +975,7 @@ static size_t process_control_structure(
|
|
|
965
975
|
|
|
966
976
|
if (end_node) {
|
|
967
977
|
end_position = end_node->base.location.end;
|
|
968
|
-
} else if (children
|
|
978
|
+
} else if (hb_array_size(children) > 0) {
|
|
969
979
|
AST_NODE_T* last_child = hb_array_last(children);
|
|
970
980
|
end_position = last_child->location.end;
|
|
971
981
|
}
|
|
@@ -995,7 +1005,7 @@ static size_t process_control_structure(
|
|
|
995
1005
|
AST_NODE_T* subsequent = NULL;
|
|
996
1006
|
AST_ERB_END_NODE_T* end_node = NULL;
|
|
997
1007
|
|
|
998
|
-
if (index < array
|
|
1008
|
+
if (index < hb_array_size(array)) {
|
|
999
1009
|
AST_NODE_T* next_node = hb_array_get(array, index);
|
|
1000
1010
|
|
|
1001
1011
|
if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
|
|
@@ -1008,7 +1018,7 @@ static size_t process_control_structure(
|
|
|
1008
1018
|
}
|
|
1009
1019
|
}
|
|
1010
1020
|
|
|
1011
|
-
if (index < array
|
|
1021
|
+
if (index < hb_array_size(array)) {
|
|
1012
1022
|
AST_NODE_T* potential_end = hb_array_get(array, index);
|
|
1013
1023
|
|
|
1014
1024
|
if (potential_end && potential_end->type == AST_ERB_CONTENT_NODE) {
|
|
@@ -1070,7 +1080,7 @@ static size_t process_subsequent_block(
|
|
|
1070
1080
|
hb_array_free(&children);
|
|
1071
1081
|
}
|
|
1072
1082
|
|
|
1073
|
-
if (index < array
|
|
1083
|
+
if (index < hb_array_size(array)) {
|
|
1074
1084
|
AST_NODE_T* next_node = hb_array_get(array, index);
|
|
1075
1085
|
|
|
1076
1086
|
if (next_node && next_node->type == AST_ERB_CONTENT_NODE) {
|
|
@@ -1128,7 +1138,7 @@ static size_t process_block_children(
|
|
|
1128
1138
|
analyze_ruby_context_T* context,
|
|
1129
1139
|
control_type_t parent_type
|
|
1130
1140
|
) {
|
|
1131
|
-
while (index < array
|
|
1141
|
+
while (index < hb_array_size(array)) {
|
|
1132
1142
|
AST_NODE_T* child = hb_array_get(array, index);
|
|
1133
1143
|
|
|
1134
1144
|
if (!child) { break; }
|
|
@@ -1150,7 +1160,7 @@ static size_t process_block_children(
|
|
|
1150
1160
|
hb_array_T* temp_array = hb_array_init(1);
|
|
1151
1161
|
size_t new_index = process_control_structure(node, array, index, temp_array, context, child_type);
|
|
1152
1162
|
|
|
1153
|
-
if (temp_array
|
|
1163
|
+
if (hb_array_size(temp_array) > 0) { hb_array_append(children_array, hb_array_first(temp_array)); }
|
|
1154
1164
|
|
|
1155
1165
|
hb_array_free(&temp_array);
|
|
1156
1166
|
|
|
@@ -1166,10 +1176,10 @@ static size_t process_block_children(
|
|
|
1166
1176
|
}
|
|
1167
1177
|
|
|
1168
1178
|
hb_array_T* rewrite_node_array(AST_NODE_T* node, hb_array_T* array, analyze_ruby_context_T* context) {
|
|
1169
|
-
hb_array_T* new_array = hb_array_init(array
|
|
1179
|
+
hb_array_T* new_array = hb_array_init(hb_array_size(array));
|
|
1170
1180
|
size_t index = 0;
|
|
1171
1181
|
|
|
1172
|
-
while (index < array
|
|
1182
|
+
while (index < hb_array_size(array)) {
|
|
1173
1183
|
AST_NODE_T* item = hb_array_get(array, index);
|
|
1174
1184
|
|
|
1175
1185
|
if (!item) { break; }
|
|
@@ -1304,7 +1314,7 @@ static bool detect_invalid_erb_structures(const AST_NODE_T* node, void* data) {
|
|
|
1304
1314
|
if (if_node->end_node == NULL) { check_erb_node_for_missing_end(node); }
|
|
1305
1315
|
|
|
1306
1316
|
if (if_node->statements != NULL) {
|
|
1307
|
-
for (size_t i = 0; i < if_node->statements
|
|
1317
|
+
for (size_t i = 0; i < hb_array_size(if_node->statements); i++) {
|
|
1308
1318
|
AST_NODE_T* statement = (AST_NODE_T*) hb_array_get(if_node->statements, i);
|
|
1309
1319
|
|
|
1310
1320
|
if (statement != NULL) { herb_visit_node(statement, detect_invalid_erb_structures, context); }
|
|
@@ -1336,7 +1346,7 @@ static bool detect_invalid_erb_structures(const AST_NODE_T* node, void* data) {
|
|
|
1336
1346
|
const AST_ERB_IF_NODE_T* elsif_node = (const AST_ERB_IF_NODE_T*) subsequent;
|
|
1337
1347
|
|
|
1338
1348
|
if (elsif_node->statements != NULL) {
|
|
1339
|
-
for (size_t i = 0; i < elsif_node->statements
|
|
1349
|
+
for (size_t i = 0; i < hb_array_size(elsif_node->statements); i++) {
|
|
1340
1350
|
AST_NODE_T* statement = (AST_NODE_T*) hb_array_get(elsif_node->statements, i);
|
|
1341
1351
|
|
|
1342
1352
|
if (statement != NULL) { herb_visit_node(statement, detect_invalid_erb_structures, context); }
|
|
@@ -1348,7 +1358,7 @@ static bool detect_invalid_erb_structures(const AST_NODE_T* node, void* data) {
|
|
|
1348
1358
|
const AST_ERB_ELSE_NODE_T* else_node = (const AST_ERB_ELSE_NODE_T*) subsequent;
|
|
1349
1359
|
|
|
1350
1360
|
if (else_node->statements != NULL) {
|
|
1351
|
-
for (size_t i = 0; i < else_node->statements
|
|
1361
|
+
for (size_t i = 0; i < hb_array_size(else_node->statements); i++) {
|
|
1352
1362
|
AST_NODE_T* statement = (AST_NODE_T*) hb_array_get(else_node->statements, i);
|
|
1353
1363
|
|
|
1354
1364
|
if (statement != NULL) { herb_visit_node(statement, detect_invalid_erb_structures, context); }
|
data/src/ast_node.c
CHANGED